#arma3_scripting
1 messages Β· Page 7 of 1
Anyway i can make it so that only players of a set role (pilot) or set variable can use the map click waypoint system?
what do you mean, like "shift-click"?
I need some help please, Ive been trying to remmeber how to allow ai to say quotes from movies ect
I remmeber being able to set a trigger and once I walk over it they say a quote from the movie
ive been trying to find a video on youtube, but they all pre-record them selves saying it, but I dont want myself to say the quote except I want quotes from movies like blackhawk down etc
ask them nicely
Anyone know of a script to add to missions to make the AI dynamically surrender or retreat?
retreat - the AI does that already (on certain conditions)
dynamically surrender - is there a surrender module in A3?
you can also play with waypoints, that's more of a mission design thing
ace3 at least has a surrender function
otherwise if there isn't a BIS function I believe there's an animation you can use
hi im new to mission file and scripting im really confused on what i actually doing with eden and was hoping someone could catch me up on what im missing and whats done wrong
do you have something specific to ask?
sadly not artisan as i only understand how to place syn group up and how to disable ai movement
no, I made it years ago as a proof of concept. But.. eh
Not happy enough with it, and I think its not worth my time to make it properly
hello guys,
I'd like to let players spawn unconscious at mission start with the ACE Unconsciousness feature. Anyone know how to do that? I found this on google, but it didnt work.
In the init of the player unit I put:
[player, true] call ace_medical_fnc_setUnconscious;
Any ideas?
You could try putting "_this" or "this" to replace "player" and see if it works
_clothing = selectRandom _array;
this forceAddUniform _clothing;
_HatArray = ["H_Bandanna_gry", "H_Watchcap_blk", "H_Bandanna_blu", "H_StrawHat_dark", "H_Hat_blue", "H_Hat_tan", "H_Cap_Orange_IDAP_F", "H_Booniehat_khk", "H_Cap_red", "H_Cap_blu", "H_Cap_oli", "H_Cap_blk_ION", "H_Cap_khaki_specops_UK", "H_Cap_blk", "H_Cap_tan", "H_Hat_Safari_sand_F"];
_Hat = selectRandom _HatArray;
if (random 1 < 0.5) then {
this addHeadgear selectRandom _HatArray
_BackpackArray = ["B_CivilianBackpack_01_Sport_Blue_F", "B_CivilianBackpack_01_Everyday_Black_F", "B_CivilianBackpack_01_Everyday_IDAP_F", "B_CivilianBackpack_01_Everyday_Astra_F", "B_CivilianBackpack_01_Sport_Red_F"];
_Backpack = selectRandom _BackpackArray;
if (random 1 < 0.75) then {
this addBackpack selectRandom _BackpackArray
};```
when i try to put this in an init of a unit a warning box appears with just "init:" as the error message
an identical script minus the last two paragraphs relating to backpacks works perfectly fine so im not sure why it wont accept it now
nevermind, just realised im missing a closed bracket, bit of a scripting noob, ill delete this wall of text
Not that. You should be able to see the black error message and it should suggest why it doesn't work
No need to delete
yeah normally it tells me whats wrong
but when i tried to enter it it just says "init:" and nothing else in the error box
but yeah ive figured out whats missing, still getting used to the syntax n stuff
I am somewhat sure there is a player waypoint thing that works when you click a point of the map.
I dont know the name of it. which is kinda my problem.
75%
Let's simplify the thing: the random 1 is, let's say 0.0,0.1, 0.2, 0.3... 1.0
And the sentence will be true if the random is 0.0 through 0.7
It can be referenced with "customWaypointPosition"
I don't think you can lock out who can use it though, perhaps through one of the eden base game menu's
yeah that makes sense now i was confused because i mixed up the < > things but my thing was occuring more often than not
ill just switch it to 0.25
The opened side is bigger
yeah, the alligator opens his mouth to get the bigger food
smaller < bigger, bigger > smaller
or something along those lines
i've found this piece of code which works for a few seconds but the player keeps waking up after maybe 10-15 seconds.
nul = [this, true] execVM "\z\ace\addons\medical\functions\fnc_setUnconscious.sqf";
[player, true] call ace_medical_fnc_setUnconscious;
If I try either one of those lines, it does not work at all, together they work for 10 seconds. Any more ideas?
ya you can set a minimum time for them to be unconscious
add a 3rd parameter into the call, like this [player, true, 10]
the 10 is the time in seconds
yeah i know that. Is there a way to keep them unconscious until someone "revives" them via zeus? I'd like them to stay uncon compared to let them wake up after a certain amount of time
You could put a very large number in that field
please do tell what is it you want to disable π
Literally want it to be active for pilots only.
It should be if you're putting it on the actual unit that they are joining as
want what to be pilots only?
"somewhat sure there is a player waypoint" seems somewhat inaccurate π
I think they want only pilots to be able to place the waypoint
which waypoint
alright i guess. just one more question: do you know why calling the function in itself does not work but after execVMing the function, it does?
The one that appears when you shift click the map Lou
i thought calling fncs is global already
I asked about that, he didn't seem sure
oh lol ok
Im not sure, sorry. Someone more experienced here can probably answer that
Not even related to the current topic but can anyone confirm that you can run or not Debug Console's execution even if you're not a host?
Context: I'm using a Mod that unlocks the console for everyone, but can't execute anything. So I looked into BIS_fnc_debugConsoleExec but the code says the executor needs to be isServer. So looks I can't run Debug Console in this context unless I'm missing something. Is this intentional?
["Arma 3","Arma3",211,149760,"Diag",true,"Windows","x64"]
(Oh don't mind me I'm just launching Diag at this time, but I've tested the MP environment in Dev, I know)
It does? I dont think Ive ever seen AI retreat in my 1000 hours on A3 - What are the conditions?
low morale, when leaders get shot, etc etc
you can influence that with allowFleeing
Does anyone know if there is an event for when the local player kills another player?
I dont think there is one specifically for that, but there are ones for when units die, and a number of filters could be applied to check for that
ok
is there a way to disable a unit being treated as hostile by everyone after killing like 2-3 civilians?
Maybe in the difficulty settings or something in the mission editor
It is handled by engine, but you can overwrite it using addRating. You can probably use the command with some kill EH(s) to attempt it
that should be fine, all i need is the rating to be acceptable once they reach a certain area
so im assuming i can use a trigger to reset their rating once they get near that area
does anyone else have an idea why its not working?
because the player wakes up after 15 seconds if his vitals are stable in ace medical
so the timer is the way to go then?
I am using the killed event but it only works if a unit kills me and not when I kill a unit. Any ideas on why this is happening?
not sure - if theres a script that lets you change the blood levels of the player then you could make him have a low blood pressure and reset it when you want him to wake up
i know next to nothing about scripting but he shouldnt wake up in ace if his blood pressure is low
or try re-running the unconscious script after like 9 seconds? i dont know if that resets the timer that checks if their vitals are stable
Can you show the code?
this is the documentation on the uncon fnc.
* Arguments:
* 0: The unit that will be put in an unconscious state <OBJECT>
* 1: Set unconsciouns <BOOL> (default: true)
* 2: Minimum unconscious time (set to 0 to ignore) <NUMBER><OPTIONAL> (default: 0)
* 3: Force wakeup at given time if vitals are stable <BOOL><OPTIONAL> (default: false)
so i guess the minimum uncon time should fix the problem
player addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
removeAllWeapons _killer;
}];
``` In initPlayerLocal
yeah, exactly. should just be able to set minimum uncon time to however long you want him to stay under for.
where is that documentation btw?
cheers
I don't exactly know what im talking about, hence why I am unsure.
Just been told the vanilla shift + click on map waypoint
Huh, thats interesting - like I said I dont think Ive ever seen that happen.
i put the timer on 900 but the player still keeps waking up on random intervals between 10-60 seconds :/ goddamn
When I select an item from an array, how can I remove the quotes?
Context?
I am doing this ```sqf
_randomWeapon = selectRandom ["arifle_SDAR_F", "arifle_SDAR_F"];
Why you need to get rid of?
nevermind.
does anyone know how much "rating" a unit starts with and how much they lose for killing someone they shouldnt?
nevermind
id assume its the same as this? anyone know if its different in A3?
IIRC it's at least roughly the same.
Honestly it's really busted and you should just override the EH.
Especially if you're using any vehicles off-faction.
but crashing your own vehicles (even forced) can get you into sideEnemy.
How can I add ammo to a player's inventory?
is it possible to change a units side upon firing their gun?
i want a civilian to switch to opfor when he first fires a gun in the scenario
You can use join to move the unit into a group belonging to the other side. Units inherit their group's side.
Can I get the magazine of the current weapon?
currentMagazine or bis_fnc_compatibleMagazines (compatibleMagazines in 2.10)
Caveat: The side switch only works after creation. If you create a civvie in a redfor group, he's still side civvie. If you join him to a redfor group afterwards, he's side redfor.
thanks
that achieves my aim though right?
A fired event handler would do it
you can override with some event handler, and assign it only to non-pilots
or, you can make it an opfor unit, and use setCaptive true/false to hide/reveal him
onMapSingleClick is the command. (onMapSingleClick {_shift}; to override the 3D waypoint)
Unfortunately the EH version doesn't allow overriding.
isn't there a Mission EH for it?
It says No Entry '.model'
That's a shame. Unfortunately, I can't really troubleshoot without knowing what you actually did.
I did this
_magazineClass = currentMagazine _killer;
_killer addMagazine [_magazineClass, 30];
That appears to be valid in principle, but it could be broken if _killer didn't have a weapon, or switched to a weapon with no magazine, or something like that.
Note that if you just want to add a full mag of whichever type, you can just do _unit addMagazine _magazineClass and not have to specify the bullet count. Specifying the bullet count could result in getting a 200rd belt with only 30 bullets in it if they were using an LMG!
Oh, if this is for multiplayer, you should remoteExec the addMagazine command because it has to be run where the target unit is local. This isn't the cause of the error you had, but it will be an issue later.
This is my current code:
_magazineClass = currentMagazine _killer;
_killer addWeapon _randomWeapon;
_killer addMagazine [_magazineClass, 30];
The new weapon doesn't have a magazine.
currentMagazine returns the current magazine at the time the command is run. If you run it before giving the unit a weapon, while they don't have a weapon, then it won't return anything useful, because......they don't have a current magazine.
If they do already have a weapon and you're intending to replace it with a new one, then running currentMagazine on the previous weapon is also not very useful, because the magazine it returns is unlikely to be compatible with the new weapon.
Perhaps it would be helpful to know what you're trying to achieve overall.
I am trying to make it so when you kill a unit it switches your primary weapon to a new random weapon.
Everything works other than the ammo.
Well, when you use currentMagazine you're getting the magazine of the previous weapon (or of no weapon, if you removed the old one first), so this isn't right.
There are a couple of ways you can do this. You can store a selected magazine type in an array with the random weapon, and select it when you come to add it. Or you can use bis_fnc_compatibleMagazines to pick a random magazine that's compatible with the selected weapon. Give me a moment and I'll demonstrate.
addMagazine adds magazines to the unit's inventory, not the weapon anyway
addPrimaryWeaponItem can be used.
addMagazine does load the magazine instantly if you do it before adding the weapon
The caveat there is that I can't really assume it's going to be a primary weapon. This feels like a Gun Game thing so it could be a pistol or something
Method 1:
// Remove old shit
_unit removeMagazines (currentMagazine _unit);
_unit removeWeapon (currentWeapon _unit);
// Store a list of guns and magazines
_randomWeapons = [["gun_rifle_1","ammo_rifle_1"],["gun_rifle_2","ammo_rifle_2"]];
// Select a random pair
_randomWeapon = selectRandom _randomWeapons;
// Select the magazine from the pair and add it. Mag first so it gets instantly loaded.
_unit addMagazine (_randomWeapon select 1);
// Select the weapon from the pair and add it
_unit addWeapon (_randomWeapon select 0);```
Bis_fnc_addweapon will automatically give ammo
Just don't give them a Javelin because then it won't, unless they have a huge backpack :P
That would be convenient. That being said, I think it would be better to specify the magazine type to use per weapon, in case the weapon has some wild things that work with it that could be accidentally auto-picked (e.g. rifle grenade magazines for the GM G3)
(having just realised this I'm not going to bother with the other method I mentioned, since it would also be vulnerable to that)
3CB Factions has a lot of broken default magazines, like it lists all the BAF grenades before the ones that actually exist.
So yeah, getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines") # 0 is not reliable.
Works fine for vanilla, RHS and CUP though IIRC.
A weapon with magazineWells set up properly shouldn't have any problems* because magazines that aren't installed won't be picked up. Unfortunately, you can't rely on weapons having magazineWells - older mod stuff could have defined lists of mags that include things from other mods for cross-compatibility.
- problems with broken stuff specifically. Problems with functional but unwanted magazines like rifle grenades might still pop up.
Thank you. Everything seems to work now.
Hi! Is there a chance that I could randomize my ALIVE unit? I want the roles to have random variations of the vest, helmets and hats they already have.
has anyone tried sorting for something like```sqf
_rifle = "getText (_X >> 'author') isEqualTo 'Bohemia Interactive'" configClasses (configFile >> "CFGweapons");
then using ```sqf
_Holder addWeaponCargo [_rifle, 1]; ```
because for me regardless of what i try it doesnt give error nor working and it seems to just not work
dont see anything about it
(ive tried addweaponcargoglobal and additemcargoglobal etc
i have a question of performance:
i had lets say 100 sector of 100x100 meters that i check a few things to be captured and display it changing the color of a global marker.
what its the best way to handle it?
having 100 whiles runing on each sector, or having only 1 while that checks for each of them ?
At the end its like giving 100 triggers ...
That's something that you should have smarter optimisations on.
it has, but in the end is an foreach or 100 whiles running
What's the check?
In general 1 while with a loop is much safer, because it's self-limiting.
its a function i made, that check the amount of players on each side, and if the ammount is bigger that a desired value like 1.5, you can capture the sector
atm i have 1 while that has an 1 minute sleep, and check all at once
ill prefer more "resolution" on this, checking each second and having a capture phase
Are these sectors in a rectangular block?
yea but use the marker as input an inarea to define what players are in the sector
use https://community.bistudio.com/wiki/inAreaArray instead
Another way you could further optimize it with square/rectangular grid is by doing inAreaArray with columns and rows rather than individual grid squares
Then just use row/column intersection for specific cells
Why would you want all BI assets?
for testing
im trying to sort cup i was thinking an issue with cup config
so i went to something that should be replying
is this when you tell me that there is limits ingame?
i think i can link a video so its easyer to understand what happening:
https://cdn.discordapp.com/attachments/1002291807914303558/1002380809333915809/rab.mp4
its a little more complex than that just counting the players actually π
( this video i made it for show that new feature)
1 thread is always better than 100 threads
to be able to capture a square, you need to be more than 1.5 times enemies and having a non diagonal neighbor of same side, after a sector is captured, that new check is made
configClasses returns an array of configs, but addWeaponCargo requires a string.
@open hollow That has even better optimisation opportunities, because a sector can only flip (in the first pass) if it's non-diagonally adjacent to a sector of a different side.
So after each loop, you can adjust a candidate list cheaply.
And the candidate list is ~10-20% of the total sectors.
yea ill leave it in that way, ill try in the future to make it work better and be hable to have a middle point, but event if i lower that check to every second. it will be less harmfull that having 100 threads running
yeah, it just won't necessarily complete in a second, which is preferable to murdering the perf of every other script :P
plz dont leave me on read too any idea about the issue?
i made another script for other gamemode, that check if that condition is met, and the capture is visible, but its made to be 5-10 sectors at the most, so having 5-10 threads its not a big deal, but having 100... its another level lol.
@tough abyss configClasses returns an array of config classes, addWeaponCargo takes a string. So it's very wrong.
how would i add them in an array of config classes? would i need to convert them?
also, doing that its dead slow
Probably this for the second part:
{ _Holder addWeaponCargo [configName _x, 1] } forEach _rifle;
_rifle = "getText (_X >> 'author') isEqualTo 'Bohemia Interactive'" configClasses (configFile >> "CFGweapons");//this give you an array of configs
//so you can whant jhon say:
{ _Holder addWeaponCargo [configName _x, 1] } forEach _rifle;
//you ended up with a holder with all bis weapons
I haven't checked whether the first part is valid.
yea it is, but it returns a whoping 3286 configs lol
well yeah...
ok might need to filter that a bit lol
God I hate writing code on mobile
Why do I even bother
a friend once added 10k binoculars in a box and it somehow mess up the server lol
so having 3286 different items, i think it will be much worse
should check for scope == 2 aswell
otherwise you will end up with all the baseclasses
!code
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
ansin11 answered you - and I am not "always-on" :p
yeah just didnt get till later sorry
I have a... math error I do not understand.
vehicle distance (plane1 getRelPos [247.909, 0]) returns 789.629
but
vehicle distance plane1 returns 1742.79
how does adding 247.909 meters to 1742.79 (or in the most relateable scenario, subtracting it from it) result in a difference of over 1000?
try with (plane1 getRelPos [247.909, 0]) distance plane1
if its more than 250, something weird happend lol
1500.22

I'm so lost.
...wait it... it's... altitude. GetRelPos does not account for altitude its getting the position on the GROUND
thats... so dumb but... it makes sense now.
yea it return the Z = 0 isn't it?
is there any way to detect when a script has failed
i have a meme idea to punish myself for making errors in scripting
any script in general nothing hardcoded or anything
diag_log
Not entirelt what I'm looking for though its 0232 so I should probably wait till morning so im not tired
If you spawned it then you can check the handle for completion, but it won't tell you failure vs normal completion.
Would this work as a function to play a custom sfx sound: ```sqf
SOGAmbientSoundLoop = {
params ["_source", "_sfx"];
private _dummy = "#particleSource" createVehicle ASLToAGL getPosWorld _source;
_dummy say3D _sfx;
waitUntil {(!alive _dummy)};
deleteVehicle _dummy;
};
```sqf
[object, "NameOfSFXSound"] call SOGAmbientSoundLoop;
createVehicleLocal*
and idk, try it
I would say that "no" because why would the _dummy "die"
It's for an object that would be creating an ambient sound
and it would die?
also, it would not be a loop.
I recommend you using CfgSFX if you try to do what I think you try to do
I was using createSoundSource and I just now saw that the command becomes greatly attenuated when in a vehicle or first person view. So I'm trying to figure out an alternative to play an ambient engine sound for a custom composition I created.
I believe this bug has been solved recently, can you please try and let me know?
Will do, I'll test it out and let you know, thanks
then a wiki edit is in order if it has been fixed π
I have a simple add action script
_this addAction ["<t color='#01AC01'>Open Door",
{
params ["_target", "_caller", "_actionId", "_arguments"];
_target animateDoor ['Door_1_source', 1];
},
[], 7, true, true, "", "_this == driver _target"];
_this addAction ["<t color='#AC0101'>Close Door",
{
params ["_target", "_caller", "_actionId", "_arguments"];
_target animateDoor ['Door_1_source', 0];
},
[], 7, true, true, "", "_this == driver _target"];
but instead of executing it in vehicle init, I want to execute it from sqf, how does one go around executing it that way?
I was thinking
[_this select 0,βyesβ] execVM "\MF_Plane_Configs\MF_Y_32X\scripts\door.sqf";
doesnt seem to work
!code
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
instead of executing it in vehicle init
that code can't be in init anyway
because of _this
also β is an invalid character
_this can only happen in scripts, not in Init field of a vehicle, you want this instead. Yes, I think this is an Arma moment
Anyone that played the campaign anyone remember the first checkpoint that you get stopped at, I have a good SQF file for it but i would like to add the dialogue with text and voice, anyone know how to do that?
Also anyone know if its possible to edit a arma 3 singleplayer mission in Eden Editor?
Existed e.g. official missions you mean?
Yes, Like the official Arma 3 campaign
Do you know how to unpack pbos?
In that case, I found a variation of that
params ["_units", "_pos", "_alt", "_shift"];
if !(["pilot", typeOf player, false] call BIS_fnc_inString) then {
onMapSingleClick {_shift};
};
}];```
But doesnt actually seem to do anything. I presume the fact that it doesnt allow overriding is why.
That's....not really a good way of doing it
the event handler you're adding is completely unnecessary.
Just put this part in initPlayerLocal.sqf:
if !(["pilot", typeOf player, false] call BIS_fnc_inString) then {
onMapSingleClick {_shift};
};```
onMapSingleClick is, itself, like adding an event handler. The effect persists once the command has been run. The benefit of the actual EH version is that it can be stacked with other EHs of the same type, removed with removeMissionEventHandler etc. Trying to apply onMapSingleClick through an event handler doesn't confer any of those benefits on it - it just means that it only takes effect once the EH has fired at least once, and the command is repeated every time the EH fires, which is not necessary.
The structure of your event handler means you're only applying onMapSingleClick once the EH has fired, which means it's probably too late to intercept that initial map click. I bet if you continued testing after the first one, you'd find it worked for those, since the onMapSingleClick pseudo-EH has now been created.
"pilot", typeOf player
How do I ensure this? Is it just as simple as placing the Helicopter Pilot AI/setting to playable?
it's a reasonable way of checking whether the player is a pilot. Since the point of this was to restrict the waypoint except for pilots, that's necessary
That's contingent on the pilots's classname falling under that naming convention
strings are slow but it shouldn't matter too much at this scale
if Eagle strictly uses "pilot" classes for playable pilots it should be fine, but if it's part of a template/framework it's probably best to avoid relying on classnames
I don't believe there is anything like isPilot in the config
maybe grabbing all planes in the config and their pilot's classname would be a framework-acceptable solution
Slightly
Quick question, am I able to make a weapon respawn after 20 minutes? If so how, I'm trying to find how. Thanks
I would say "yes"
But what do you call "make a weapon respawn"?
So I'm looking to place a M107 on the ground and make it respawn after picked up.
it would involve the ContainerClosed event handler, as well as creating a scripted weapon holder in which you would addWeaponCargoGlobal
Thanks that what I needed to know.
this addEventHandler ["FiredMan", {this setCaptive false;
}];```
I'm trying to have this unit turn captive false upon firing a shot so that my police units will start engaging him
but it doesn't seem to work - I'm not sure what the issue is. they don't fire at me, and I have no idea if captive is even turning false at all
you can't use this in an event handler expression
so i should name the unit and replace this with the name?
not necessary one second
see the code block?
just copy that into your script
this addEventHandler ["FiredMan", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"];
}];
then use _unit to get the unit the event handler is attached to
and do not forget to remove the EH from there too π
(for the sake and beauty of cleanliness!)
what if he wants his setcaptive to be set to false for every bullet in the magazine ever thought of that, Lou?
no? I only think of MYSELF
but yes see example 2 https://community.bistudio.com/wiki/removeEventHandler
im still kinda confused
where do i put this setCaptive false;
you don't
_unit setCaptive false;
and then remove the event handler as it shows in the link
this is a magic variable mostly used for init boxes and such in mission making
which while the event handler is being added in the init box the code you're providing in the event handler expression is being executed elsewhere
//use `this` here :)
this addEventHandler ["FiredMan", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"];
//don't use `this` here >:(
}];
//use `this` here :)
@tough abyss
setTowParent disables stationary brakes, right? will wheels actually rotate upwards/backwards (not steering) while towing in that case?
I'm experimenting with Advanced Towing script from 2016 adding this new command, it seems to work for me with at least steering, but wheels are not rotating/turning over (fully rotating upwards/backwards just like normal wheeled vehicle movement).
try?
I meant I tried this and this is what i've observed
I will upload on a video of what's happening, brb
what do you mean, "upwards/backwards" - like, "rotating", or something else?
so you tried setTowParent and could not see how it behaved?
I mean rotating not left-right (when you use steering wheel on real car, for example) but upwards-backwards, making full turn (just)
||jesus, my english is in dire need of improvement||
It seems to working, but it looks like that stationary brake is still working - wheel's protector/tread is not moving at all
still no idea what you mean but okay π
i just wanted to say that the wheels on towable vehicle are static
they're only moving left-right angles, not, idk, tilting
have you tried https://community.bistudio.com/wiki/disableBrakes ?
yeah (I believe that setTowParent applies it too though)
Advanced Towing uses proxy object to attach rope instead of attaching directly to vehicle, maybe it's causing this
yeah, it's the case
https://streamable.com/fnpsy1
yeah, it's working
thanks for listening my and trying to understand my cryptic messages π
last question - do towing parent needs to be set to nothing after removing rope? something like _towableVehicle setTowParent objNull?
That would be sensible.
The towed vehicle's steering will continue to follow its parent even if it's not connected by a rope.
Yeah.
Also, function description has information that only Car-kind vehicles should be towed that way (I guess it's cars, trucks and wheeled APCs as isKindOf returns true for all these types). So, I should avoid towing tracked vehicles with setTowParent or it will be mostly fine?
Hello guys,
I saw a video somewhere where an artwork creator used a couple of animations so set a scene on video. I went and read a few things about how animations work ingame in Arma 3 and found a few animations I'd like to use.
Now the question: I know how I can put an animation onto a soldier and keep that playing, but I'd like to play (read: queue) a few anmiations one after another to make a coherent scene and record that. Does anyone know how I would go about that? For reference, I use some of the mods POLPOX released (the animations viewer for example), but only know how to put on a single animation for example. This doesnt need to be MP friendly aswell, just for recording purposes in SP.
I'm already doing that.
if (_towable isKindOf "Car" && {(_towing isKindOf "Car" || {_towing isKindOf "Tank"})}) then {
_towable setTowParent _towing;
_towable disableBrakes true;
{
if (isPlayer _x) then {
["Towing", "This vehicle is about to be towed."] remoteExecCall ["A3A_fnc_customHint", _x];
};
moveOut _x;
} forEach crew _towable;
the question is that new way of towing applies only on wheeled vehicles, so only wheeled vehicles will receive new good way of towing, while others will use the old janky one, so I want to know if setTowParent really can't apply on tracked vehs (I guess I just need to test it).
also, do I need to use exactly CarX and TankX? Are they legit classes?
Simulation, not classes
getText(configFile >> "CfgVehicles" >> typeOf _towable >> "simulation") == "carx"
oh, didn't know that
thanks for code snippet!
toLower getText(configFile >> "CfgVehicles" >> typeOf _towable >> "simulation") in ["carx", "tankx"]
Didn't use the command myself by apparently you need both vehicles to be local. If that's the case and command itself doesn't do anything with locality, you might have to first kick driver out, lock the driver seat, then have server setOwner to towing vehicle locality and then use the command
POLPOX Artwork Supporter is not made for ambient anims but for screenshots/videos π
function already has a way to jump around locality issue (though not efficient one) - it simply checks locality of vehicle and remoteExecs it to vehicle's owner machine in case if the vehicle does not belong to origin executor
Up to you to implement all that
lockDriver can be useful to keep players out of driver seat (and locality change)
They will still be able to remain in the vehicle on other seats during towing if needed
Wish there was something like lockOwner so we can keep driver in with controls disabled and no locality change
hmmm
So, only driver should be locked?
driver is the only seat that changes vehicle locality
That is true, but it is easier to check out how the animations play out. I use it for that. But I am still trying to find out how to queue animations together besides that :)
Co-Pilot that can "Take controls" does too, but thats not for carx/tankx, I don't think you should care about it
lockDriver has to be executed where vehicle is local, it will broadcast to other clients after a bit
Not sure how well it does when locality changes, I guess it should be fine
Best bet would be add plenty of logging and test edge cases
toLowerANSI getText(configOf _towable >> "simulation") in ["carx", "tankx"] 
is there anything on modifying the speed of arma 3 characters?
playMove queues animations
There used to be a way to send txt in the center of the screen anyone know the command for that?
e.g cutText?
yes thank you bro
hey guys
i got problem
editted a mission in pbo manager
but when i replace the existing pbo it just reverts
I need to get an array of every unit in a vehicle, without selecting any players.
I've been tinkering with this whole thing all day, and I'm finally hitting brain frying limit t_t
what do you mean by "selecting"
... May have come to a workaround.
you want an array of every ai unit in the vehicle?
Yeah
crew _vehicle - allPlayers
``` if i'm thinking straight
allUnits - allPlayers select { !isNull objectParent _x }
Aw cripes
I was wrapping my head around FindIf, or going to just build an array as they climb in T_T
Of fn course, there's a command for every player on the server.
Might want to use
private _allPlayers = BIS_fnc_listPlayers;
instead of
allPlayers
to exclude headless clients
Good call. This is a project I intend to actually release, inshallah
Worked like a charm, thank you!
For reference regarding findIf, it works fairly simply, it's just
private _index = array findIf {condition};
where _index is the array index of the first element for which condition returns true
and condition can use _x to represent the current element being checked
Yeah, I've got the gist of it, but I was hung up on 'okay so I have to find the element in the array that is a player, then remove THAT element, then search for the next player...'
It's been a day.
Ah yeah. If you want to filter arrays like that you can just use array select {condition}
which will return an array of things in the array that meet the condition
so e.g. you can do allUnits select {isPlayer _x} to get only players/headless-clients from allUnits
Aw hell that's even easier T_T
Alright, one last braintickler, why can't my trigger Call.
AirborneTrg setTriggerStatements ["this","
list AirborneTrg call SRD_FNC_TROOPTRANSPORT;
",""];
Trigger is activated, and if I take the snippet of code and execute it manually, it works fine.
But it doesn't run when the trigger activates.
try this
AirborneTrg setTriggerStatements ["this","
thisList call SRD_FNC_TROOPTRANSPORT;
",""];
No dice on trigger activation :/
Right now, injected via the debug box, on the server level.
You're doing server execute?
Yeah
mm, that'd be why
setTriggerStatements has local effect, you'll need to execute it globally
try global execute
Global exec, deactivated and reactivated trigger, no effect.

Executing the code by itself still works at least... yay?
Aight, but fair warning, this is all still in testing and needs a lot of cleaning up.
SRD_FNC_TROOPTRANSPORT = {
params ["_Helicopter"];
if !((list AirborneTrg select 0) isKindOf "helicopter") exitWith {};
Helicopter = NearestObjects [AirbornePad, ["Helicopter"], 7] select 0;
Helicopter setVariable ["SRD_canDeploy",true,true];
Helicopter addAction
["Rifleman",
{
params ["_target", "_caller", "_actionId", "_arguments"];
["vn_b_men_army_16",_Caller,"AB"] call SRD_FNC_SPAWNINFANTRY
},nil,4.1,true,false,"","Helicopter distance AirbornePad < 7 && isTouchingGround Helicopter",5];
Helicopter addAction
["Deploy Troops",
{
_Patrol = createGroup West;
crew helicopter select {!isPlayer _x} joinSilent _Patrol;
_Patrol leaveVehicle Helicopter;
[_Patrol,getpos leader _Patrol, 200] call bis_fnc_taskPatrol;
RemoveAllActions Helicopter;
Helicopter setVariable ["SRD_canDeploy",false,true];
},nil,6,true,false,"","Helicopter distance AirbornePad > 10 && isTouchingGround Helicopter",5]
}
so when you say you're executing the code by itself, what are you running?
The trigger just detects when a player vehicle is near the helipad, then the function sorts out helicopters from other vehicles.
[list AirborneTrg] call SRD_FNC_TROOPTRANSPORT;
I see
AirborneTrg setTriggerStatements ["this","
[thisList] call SRD_FNC_TROOPTRANSPORT;
",""];
^ try that
Executed on server, global, and local levels, de-reactivated trigger... no effect.
perplexing
Tested with dummy effect (hint ""good"") and that worked, so the trigger is firing and running the onAct section.
Just... refusing to call.
Not at the same time, no, I'll try that now.
Just as diagnostic - hell, Ive got the RPT open and it's telling me nothing T_T
print the list aswell, and the function
hint format ["fn=%1, list=%2", srd_fnc_trooptransport, thisList]
on phone 
Ooh, good call. I did systemChat with before and after messages, both fired but no effect on the call.
Still not sure what's causing the issue but I've cleaned up the function code for you, could help
SRD_FNC_TROOPTRANSPORT = {
params ["_detectList"];
if !((_detectList#0) isKindOf "helicopter") exitWith {};
private _helicopter = nearestObjects [AirbornePad, ["Helicopter"], 7] select 0;
_helicopter setVariable ["SRD_canDeploy", true, true];
_helicopter addAction [
"Rifleman",
{
params ["_target", "_caller", "_actionId", "_arguments"];
["vn_b_men_army_16", _caller, "AB"] call SRD_FNC_SPAWNINFANTRY;
}, nil, 4.1, true, false, "", "Helicopter distance AirbornePad < 7 && isTouchingGround Helicopter", 5
];
_helicopter addAction [
"Deploy Troops",
{
private _helicopter = _this#3;
private _patrol = createGroup West;
(crew _helicopter select {!isPlayer _x}) joinSilent _patrol;
_patrol leaveVehicle _helicopter;
[_patrol, getpos leader _patrol, 200] call bis_fnc_taskPatrol;
removeAllActions _helicopter;
_helicopter setVariable ["SRD_canDeploy", false, true];
}, _helicopter, 6, true, false, "", "Helicopter distance AirbornePad > 10 && isTouchingGround Helicopter", 5
];
};
maybe the function itself is undefined on the machine, do the hint i wrote, see what is the output
Wish I could post images, but the hintbox looked like my code, plus my player name - everything's recorded properly.
Aww, thanks! π
well then, the first object in the list is not a helicopter
Had a small error, fixed now
^ I suspect that may be the issue as well
seeing as you're just killing the entire function if the first detected object is not a helicopter
But only when run by the trigger, not manually?
I'll remove the gatekeeper to test it, but I was having the same issue before.
just don't use triggers, afaik they have some funky stuff with the thisList or list _trg not returning correct stuff sometimes
The gatekeeper is a bit pointless anyways, yeah? Your nearestObjects in the function is already filtering out non-helicopters anyways.
but why are you calling nearestObjects, or is the trigger in different position?
I would replace the gatekeeper with
if (_detectList findIf {_x isKindOf "Helicopter"} == -1) exitWith {};
then it'll only fail if no helicopters are detected
Partly so I could filter, partly just slapdash coding to push a version 0.1 out the door as fast as I could.
run findIf on _detectList, if it's -1, exit, else pick an element from the list at that index, and don't use the nearestObjects
^
private _heliIndex = _detectList findIf {_x isKindOf "Helicopter"};
if (_heliIndex == -1) exitWith {};
private _helicopter = _detectList#_heliIndex;
that'll replace the gatekeeper and the nearestObjects
Hrm... That didn't seem to work out, but its not telling why in the rpt.
What's the current function code
Ah, wait.
I'm still working in full, front of god and everyone public variables T_T
Of course throwing a few privates in there would cause an issue
lol yeah this is all assuming you're using the cleaned-up code
That did it, yeah, just had to nationalize the helicopter.
... I'm sticking with that one.
At least, until I get it working, THEN I'll break it by making everything private.
private helicopter service > global helicopter service
ah I see why it breaks with the helicopter private
one moment...
My headache with privatizing variables and objects is that I don't fully grasp how far it goes; if I private here, will I still be able to act on it there.
SRD_FNC_TROOPTRANSPORT = {
params ["_detectList"];
private _heliIndex = _detectList findIf {_x isKindOf "Helicopter"};
if (_heliIndex == -1) exitWith {};
private _helicopter = _detectList#_heliIndex;
_helicopter setVariable ["SRD_canDeploy", true, true];
_helicopter addAction [
"Rifleman",
{
params ["_target", "_caller", "_actionId", "_arguments"];
["vn_b_men_army_16", _caller, "AB"] call SRD_FNC_SPAWNINFANTRY;
}, nil, 4.1, true, false, "", "_target distance AirbornePad < 7 && isTouchingGround _target", 5
];
_helicopter addAction [
"Deploy Troops",
{
private _helicopter = _this#3;
private _patrol = createGroup West;
(crew _helicopter select {!isPlayer _x}) joinSilent _patrol;
_patrol leaveVehicle _helicopter;
[_patrol, getpos leader _patrol, 200] call bis_fnc_taskPatrol;
removeAllActions _helicopter;
_helicopter setVariable ["SRD_canDeploy", false, true];
}, _helicopter, 6, true, false, "", "_target distance AirbornePad > 10 && isTouchingGround _target", 5
];
};
this should allow you to not have everything break
and the idea of private is that you're limiting the variable's existence to the scope it's declared in
the thing with addAction is that the code within runs in a separate scope at a different time, so you need to pass any private variables to it via the arguments param
which is what I'm doing in the above code
yes and you can see I have _helicopter after the code block
as that's addAction's parameters argument
which I access via _this#3 from within the action code
also I changed the above code to properly use the new gatekeeping code
Tested, no effect - and it's well past time I went to bed, but I am really grateful for your input ^_^
I'm sure I'll be tinkering with this for the foreseeable future, but I just need a working model to start.
Strange, perhaps I've missed something. Have a good night.
_detectList is undefined
Works, but neither spawning rifleman nor deploying troop actions functioned.
ughhh that'd be because I undid one of my changes
Ah, yeah, I see it
fixed
And the troop function partially worked, but since I called on plain 'Helicopter' in the spawning script... that ones on me :p
Ah yeah, that'll need to take the helicopter as a parameter
I know working with privates seems like an unnecessary hassle at first but believe me when I say it's worth the added code cleanliness
Oh, I'm sure. Just need to bash my head into it until I get it X_X
{
// _a doesn't exist here, it hasn't been defined yet
private _a = 5;
// _a exists here, this is the scope it was defined in
while {true} do {
// _a exists here, the scope it was defined in encloses the "while" scope
}
// _a still exists here, still in the scope it was defined in
}
// _a doesn't exist here, we've left the scope that it was defined in
^ might help with the whole understanding scopes thing
Got it ^_^ I was already passing _caller, so just vehicle _caller instead of, yknow, a concrete object.
I would send _target rather than vehicle _caller
True, the action is on the helicopter...
in fact the bottom addaction could even be replaced with
_helicopter addAction [
"Deploy Troops",
{
private _helicopter = _this#0;
private _patrol = createGroup West;
(crew _helicopter select {!isPlayer _x}) joinSilent _patrol;
_patrol leaveVehicle _helicopter;
[_patrol, getpos leader _patrol, 200] call bis_fnc_taskPatrol;
removeAllActions _helicopter;
_helicopter setVariable ["SRD_canDeploy", false, true];
}, nil, 6, true, false, "", "_target distance AirbornePad > 10 && isTouchingGround _target", 5
];
but the functionality would be the same
just using _target (_this#0) instead of passing _helicopter in _arguments
Alright, got a working build with _target being passed.
Any suggestions to how I'd get the minimum range of an artillery class?
you can read it directly from config afaik
or not 
Friend says it's usually defined in the artillery firemodes and/or ammo class but can also be dependent on the time-to-live and etc.
I would guess there's a list of modes used in the artillery computer somewhere but I haven't found it yet.
Could be inherited, probably going to need to do some digging
yeah looks like it's not
I'm not certain how artillery computers get their modes, just going off of what I've been told
but if it's config-level it could be inherited from something else
there are min and max ranges in the config:
Yeah but those are nonsense for artillery.
well if you don't find anything you can calculate it yourself 
Like the RHS BM-21 actually has a minimum range of 5000m but the config minRange values are stuff like 800m.
pretty sure according to cfgWeapons docs the minRange/maxRange/etc. settings are for AI not the actual weapon ranges
then calculate it yourself 
I'm not even sure it'd come out at the same numbers.
Like that 5000m is too clean to be calculated.
Might just cut my losses and use the worst case as a global minimum.
from what I see in the config it is possible
I guess min range is:
_minArtilleryCharge * _initV^2 / 10
e.g. projectile velocity of Mk6 mortar is 200
so max range is 4000
min range is 1400 
yeah that's wrong...
Minimum range would be mostly dependent on elevation.
yeah
let's say max elevation is 80
_minArtilleryCharge * _initV^2 * sin 160 / 10
478 m
What's this _minArtilleryCharge?
0.35 for Mk6
Units? :P
oh wait
And where is it from?
so this value is now 490
I can't see that in CfgVehicles, CfgWeapons, CfgAmmo or CfgMagazines reference
it's defined in weapon modes
e.g. Burst1, Burst2
yeah this is correct
oh right, mode_N fire modes seem to be the artillery computer ones.
Oddly enough there are other modes with a smaller charge than lowest artillery computer mode...
they might be inherited from a baseclass and unused, check if they're in the modes[] array
ah right, only six of them exist in modes[]
ok, maybe this is straightforward.
minRange seems to be valid for the modes that are actually in modes[].
it was 88
yeah, the mortars can fire close :P
if you substitute that you get a correct value
also you should put g=9.807 (or 9.81)
I put 10 because I was lazy 
with those you get the exact values as artillery computer
Interestingly the min/max range in config for the mortar I'm inspecting don't match the ranges allowed by the ballistics computer, but it seems the ballistics computer does its own range calcs based on the ammo config properties and actual ballistic calcs
from what i've seen the AI can sometimes struggle with firing solutions that can be done easily with the artillery computer
like when setting up my own assets I can say, fire a mortar at a minimum range of idk, 432 m
but if I set minrange to that, and tell the AI to fire, they won't. so I end up having to set the minrange to something higher like 450
this isnt always the case its just something about the AIs own firing solution system vs. the artillery computer
If you account for air resistance the min should be a bit lower. Not sure if that's a factor there.
airfriction is disabled for artillery
no
artilleries have no drag
its why using 'real' values for artillery you end up with mortars that can fly 8km wehn they struggle to 2km in reality
Wonder if ballistics computers just generate the min/max range using the min/max angle and artillery speed then 
suppose they must if not defined in config
In that case it's kinda curious that the AI firing solution & ballistic computer are different at all. Maybe one's just using the wrong source point or something.
but whatever, I can just add 100m here :P
thx everyone
I didn't find any value for min and max angle so it probably just passes 45 and 88 π
I saw min/max angle under the turret properties so could be that 
hmm. BM-21 clearly isn't using 88 for the max though.
Well wouldn't be surprised if it's just hardcoded, seems ArmA-y
sure but if you calculate it what is the angle?
idk what BM-21 is, so... 
It's one of those russian rocket launcher trucks.
Elevation limit is quite low.
(for artillery)
Surely the elevation range of the turret comes into play, no?
maybe not always but I'd think with something like that it would
it does
but not sure if artillery computer actually uses it
it seems scripted 
and I didn't find anything to get the elev by script
or maybe not
I didn't find any event handler or anything for the display
the artillery computer displays are all in engine
like the calculations I mean
the turret values are correct but for like a mortar its already pointing up so a maxElev of 13 or something is nowhere near correct
and its more like 85-89
oh, these things have thrust + thrustTime rather than muzzle velocity
they might but it's unlikely they're used, all 'rocket' artillery is generally using shotshell as its the only one the artillery computer cna handle
hmm. In that case the numbers are 65 degree max elevation (on the turret, can't find anyone on the weapon), initSpeed 690 (on the sodding magazine) and 0.365 for the minimum artillery charge.
Comes out at 4954m.
oh hey, actually works with (0.365 * 690)^2 * sin (2*65) / 9.807 :P
what is "it just reverts"
(also not exactly scripting)
Also pboManager is not to edit a mission
Good morning! Do you know how I could know when a vehicle passes a speed? I couldn't find a matching event handler
No, an EH doesn't do that. You can check the speed each frame
@warm hedge to get the variation of the gearbox ?
What?
... are you trying to create a racing sim framework?
The translator distorts what I mean, sorry π. In fact, I would like to know when does the gearbox retrograde or raise a speed, as neutral, first...
To make flames appear via an animation on the vehicle's exhaust...
Tight π₯
π
I think it's not even possible to recover the revolutions per minute of the engine :/
Not directly, but there are a couple of ways you might be able to estimate it indirectly
Many vehicles have RPM animation sources, for use with dashboard meters etc., which you might be able to check the phase of.
You could also try looking at the RPM soundController. This is used to determine the engine sound for gear shifts, so in theory it should know the RPM. I'm not completely sure how it works, though.
Ah, this has exactly the right example! https://community.bistudio.com/wiki/getSoundController
https://community.bistudio.com/wiki/BIS_fnc_ambientAnim
Is this function with an agent affect performance much?
[
{
AirbornePad =createVehicle ["Land_HelipadCircle_F", [16166,7059,0]]
}
] remoteExec ["call",0];
Am I right in this syntax? Just had a terrifying moment of realizing I was letting a global effect run wild on whats supposed to be a multiplayer code t_t
with target number 0 you are running the code in all machines (clients/server)
(which you really don't want or need to do here)
I'm not sure exactly what you're trying to do, but this should be fine when executed on any single machine:
AirbornePad = createVehicle ["Land_HelipadCircle_F", [16166,7059,0]];
publicVariable "AirbornePad";
Note that code in init fields and waypoint statements runs everywhere anyway, so watch out for those.
Aw cripes t_t its 2 for server only, isnt it...
yep
Bluh. This has become a passion project, which is a problem when its my weekend on work and all I have is some friends who can run my code and report the results at their own pace
Trouble is, I also have a truck that spawns, and a block of code for creating AI units... and while the helipad stacking isnt a problem, trucks and troops are :p
Well, not a problem in the exploding chaos sense.
Whats wrong with my code?
private _flagsObj = [];
{
private _flag = missionNamespace getVariable [_x, objNull];
_flagsObj pushBack _flag;
} forEach _flags;
while {uiSleep 5; true} do {
for "_i" from 0 to count _flagsObj do {
private _flagPosition = position (_flagsObj select _i);
private _allNearEntities = _flagPosition nearEntities ["CAManBase", _distance];
if (count (allPlayers select {(_x distance _flagPosition) <= _distance}) == 0) then {
(_flagsObj select _i) setVariable ["flag_captureTimer", _captureTimer, true];
};
line 21
17:13:07 Error in expression < select _i);
private _allNearEntities = _flagPosition nearEntities ["CAManBase",>
17:13:07 Error position: <_flagPosition nearEntities ["CAManBase",>
17:13:07 Error Undefined variable in expression: _flagposition
This is part of code ofc
Distance is int = 200
flags = array, which getting from cfg
capture timer int too
for does one iteration given from 0 to 0
step 1?
no, it's just inclusive. correct version here is either from 1 to count _flagsObj or from 0 to (count _flagsObj - 1)
ye, got it
Let me test
Why you have nothing in _flagsObj is maybe another problem.
just use forEach 
^^
i have little trouble in syntax understanding when using forEach in forEach π
just store the external _x/_forEachIndex and you're good to go:
{
private _var = _x;
{
if (_var blabla _x) then {
}
} forEach _B;
} forEach _A
position
you might want to stop usingposition/getPosfor your own good
getPosATL then?
in your code you don't need any position as far as I see
Im add position cs thinks, what script can't calc distance between flag and player
But actually im delete it
idk what you mean 
nvm, thats my own script tests
private _flagObj = _x;
private _allNearEntities = _flagObj nearEntities ["CAManBase", _distance];
if (allPlayers findIf {(_x distance _flagObj ) <= _distance} < 0) then {
_flagObj setVariable ["flag_captureTimer", _captureTimer, true];
};
also I replaced your count-select with findIf
{
private _flag = _x;
private _allNearEntities = _flag nearEntities ["CAManBase", _distance];
if (count (allPlayers select {(_x distance _flag) <= _distance}) == 0) then {
_flag setVariable ["flag_captureTimer", _captureTimer, true];
};
....
} forEach _flagsObj;
Does anyone know, why doesn't "[this, 0, 0.3] call PLP_fnc_fireWeapon
" work on static turrets
Good operator, didn't know about it, thanks
Because it doesn't
y
Is it yes or why?
Why*
Because it doesn't. Because it is only for humans
Ok, ty
you can try BIS_fnc_fire. maybe it works for that
Tell me pls, why u using < 0 in if condition instead of != 0?
as i understand, findIf always return -1 or 0
Always?
findIf terminates as soon as it finds an element that fulfills the condition
ohh, ok
you could do == -1 if you wanted to
as POLPOX said, no
If I have 15 elements and the 14th matches the condition, then I get 4?
*14
13
...Or, 13 if 0 is not 1st you mean
ok, ty
Aight, Im going to post the sqfbin of my current project.
https://sqfbin.com/azifuhegimiteharezim
Im attempting to create a very basic unit-spawning system for people who want to play SOGPFs Mike Force singleplayer or with a small group, and not bother Zeus to give them supporting elements or man defenses for them.
This is my first prototype meant to be injected by the debug console, and its just not coming together right; each element, ran separately, registers and will work afaik. But trying to run the entire block as a whole produces no results, but also no errors in the report or any of the diagnostic systemChat messages.
@manic sigil What editor are you writing this in?
The indentation is... inconsistent at best.
You're missing a couple of brackets at least anyway.
SRD_FNC_AirborneTrigger is missing a close which kills everything after.
And that spawn at the end is also missing one.
Nominally, Notepad++, but sqfbin and android note app makes a mockery of organization.
The bit that sysroot rewrote for you is fine though :P
Naturally, need to add a shoutout for their excellent work.
It looks kinda like you wrote it in the debug console and pasted it back into an editor?
A lot of back and forth, yeah, though usually rewrites and edits were done on Notepad++
Clean it up anyway. It's a lot easier to spot missing brackets when your indentation is sound.
Fair, its just odd that I stopped getting error reports, normally a missing bracket would pop one up right?
how can I reference a UI control by its ID? I'm trying to run this command
https://community.bistudio.com/wiki/lbSetPictureRightColor
but the first syntax doesn't seem to work, so I need to use the second. I need the reference to the Control object
by its id, it is the first syntax.
@manic sigil There's a bug (fixed on dev, IIRC) that causes it not to throw errors on missing trailing brackets. The code just silently fails to execute.
hmm doesn't work for me. It always says "Missing ';'" between lbSetPictureRightColor and the params, even when using the example on the wiki
that's code error then? can you show?
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
lbSetData [FACTIONLIST, _index, _tmpSide + '|' + (configName _x)];
lbSetColor [FACTIONLIST, _index, _tmpSideColor];
lbSetPictureRight [FACTIONLIST, _index, (_icon select 0)];
lbSetPictureRightColor [FACTIONLIST, _index, [0, 1, 0, 0.5]];
It fails with the following error
lbSetPictureRightColor |#|[FACTIONLIST, 0, [0, 1, 0, 0.5]];
Error Missing ;
What's FACTIONLIST?
the idc of the control
given the error's location, it looks like this syntax doesn't exist here
Dedmeeen? π
the second syntax works, but I need a reference to the Control π€
then it's not an idc reference π
Naturally t_t alright, here I go indenting on a phone keyboard.
that worked yay. Thanks
I guess the first syntax is broken
plz check #arma3_feedback_tracker website and report if it doesn't exist already
Does anyone know of script that will spawn and garrison AI evenly within a given area?
hey I would have liked to modify the altis base position save script to change it, I would like to know if it was possible that the position of the player is only saved for 20 minutes basically I would like that if he disconnects and that if he reconnects within 10 minutes he stays at his old saved break, but if he reconnects after 30 minutes he can spawn where he wants? I tried to setVariable with time when the player is disconnected but I think I'm doing it wrong
there is no vanilla "Altis base position save script", this is most likely coming from a framework; it is then recommended to ask that script's author
if you mean populate buildings, I believe there is a module for that
I mean both, I'd like to find a script that spawns AI on the fly (without Zeus) and have them garrison
within specific areas
the altis life 5.0 by tonic
seek towards their Discord then - (perhaps) listed in #channel_invites_list
thanks
indeed, only the binary overload exists, according to supportInfo
you shouldn't use the idc syntax at any point anyway π
Oh, neat, Sqfbin highlights syntax when you dont have screwy code.
ta-daaa!
sighs
Anyone know a way to determine from config which turret on a vehicle is the one usable by AI for artillery fire?
Ideally not a hack :P
Hey I know that execVM will execute a script, but is there a way to execute a script with call? I've heard that its better on performance.
maybe something with compile, I cant seem to figure it out
The best way for performance is to make the script a function (https://community.bistudio.com/wiki/Arma_3:_Functions_Library) and then you can use call on it.
Q: re: units, sides, waypoints...
It has been a little while since I last pursued this issue. Scenario: couple of downed pilots (side: BLUFOR) in a zone patrolled by some enemy squad (OPFOR).
The enemy squads start off with some nominal waypoints patrolling the zone, and start off well enough.
However, after awhile pilot discovery occurs, and the squads tend to locate, approach, and train weapons on the pilots.
At the time not sure there was a workaround for this, all things being equal.
However, it would not be that offensive, potentially, if we created the same pilot unit objects, same object class, but aligned to side OPFOR. Would that make any difference, i.e. the squads continue patrolling.
Clarifying...
No thread here I suppose.
Pilots are set to a SURRENDERED state, animation; when ACE is available, literally using its CAPTIVES module for behavior.
The only concern I would have then, are the enemy squads smart enough to see a surrendered unit, and to 'free' them.
Player objective would be to identify the downed aircraft, pilots, neutralize the enemy squads, and CAPTURE and RTB for questioning.
So obviously freed pilot units would be a problem.
β¦what is the question
So the core question there is, would aligning the pilot unit side to OPFOR make any difference in waypoint behavior.
The last time I checked BLUFOR pilots interacting with OPFOR patrols, the OPFOR patrols break their waypoints cycle.
if we are talking about vanilla, and ACE not being a concern at all:
enemies don't "break" waypoints - they would fight around, move etc etc, then once everything is back to normal "AWARE" behaviour, they follow again "MOVE" waypoints.
if you want OPFOR not to "notice" some BLUFOR as enemy, use setCaptive
So, in response to the last statement, yes, they are setCaptive, AFAIK. Which I understand migrates units to CIVILIAN, IIRC (?).
A bit fuzzy there, at which point was finding OPFOR waypoint cycle stopping and training weapons on the units.
then some other mod is interfering, otherwise they should just walk past them
I can only tell you about vanilla.
AFAIK there is no other mod influencing the OPFOR units, waypoints, etc.
At the time the postulate was a bug mixing AI sides and so forth.
From the docs,
_soldier1 setCaptive true; side _soldier1; // returns civilian
side group _soldier1; // returns e.g blufor
Which makes sense.
Leaving ACE aside, setCaptive is setCaptive regardless.
The OPFOR units notice them after awhile and train weapons on them.
Literally our internal captives module is doing just this to surrender a unit:
if (!captive _unit) then {
_unit setCaptive true;
};
don't forget about locality
https://community.bistudio.com/wiki/User_Interface_Event_Handlers
is there an eventhandler that can make RscPicture clickable (like a button)
make a button with a picture in it?
how would I do that?
Locality? Not sure what you mean...
a style button + rscpicture iirc, text = image path
did we shift gears to another topic? I'm not following. what does that have to do with setCaptive effects on mixed sides?
if you use setCaptive on the wrong machine, the unit won't be set captive
this is what aG/aL eG/eL are all about on command pages
I see. yes, AFAIK it is server side. not client side at any rate.
anyway
try vanilla
"vanilla" sans ACE; there is nothing else in the loop AFAIK that is influencing the behavior.
I'm not sure what you meant by a style button
the mods I run are typically this. nothing in there influences captive interactions AFAIK. could be wrong, but I do not think so: https://pasteboard.co/m3Fi2cHzo5KA.png
I do not even care π honestly, and without any intent in being mean
make the simplest repro in vanilla
yes, and I am saying that is the simplest I can tell you.
requires that I run these for my environment.
you don't require mods to run vanilla π
1/ place weaponless unit
2/ this setCaptive true in its init
3/ opfor walking towards them
4/ ????
5/ profit, the captive is not even considered and opfor is not pointing guns anywhere.
CT_STYLE iirc, something like this
#arma3_gui may help you more if needed π
Are the squads actually blocked from shooting in any other way?
hi, when i put a function in an event handler, i.e _aircraft addEventHandler ["HandleDamage", {call hob_fnc_handleDamage}];
what is the locality of the function when run? for example i'm trying to set the vehicles fuel to 0 when its hit.
setFuel says it must be executed local to the owner of the vehicle, how can i ensure that?
locality is still a topic that confuses me
Event handlers always run where they're installed. The question is whether they run at all.
HandleDamage only runs if the target object is local at the time that it's damaged.
For example, if you create a vehicle & AI crew and then add a HandleDamage on the same machine, that'll work fine. However, if a (non-local) player then kills the crew and boards the vehicle, it'll switch locality and the HandleDamage won't fire anymore.
what if i added the event handler via a cba Extended_InitPost_EventHandlers?
i guess the event is placed on the machine of the person who spawned the asset?
I don't know if you scrambled that function name but I don't know it.
Should probably correct that to event handlers usually run where they're installed. There's exceptions with things like the MP event handlers which run on all clients regardless of where they're installed and some other ones I can't remember off the top of my head.
Generally though, unless the BIKI specifies otherwise, they run where they're installed.
oh right, not a function.
I would guess those run everywhere, like the editor init field.
GOT IT. God bless T_T
Only took like ten minutes after slapping it in an .sqf and executing it normally, so I actually get error messages.
yeah you can do that, it would add the eh on every machine, which is ok to do, HandleDamage runs where vehicle is local anyway, so in case the object changes locality, doing this would handle that aswell
is there any way to directly reference the vehicle spawned by calling BIS_fnc_moduleCAS from scripts? trying to attach something to it.
look at it's source it might give you some hints
This is probably the wrong space to ask this, im currently working with EXTDB3 w/ prepared statements, although I have quite a bit of experience with mysql/extdb, I took quite a long break and im just at a total loss for how to do this. Im currently trying to pull multiple lines out of a user database that have the same steamid.
What I'm trying to do is create a multiple-character sort of system.
I would like to have all of the lines dump from the database as their own array, within an array.
Like so:
[['steamid','characterid','name','bankacc'], ['steamid', 'secondcharid', 'secondname', 'secondbankacc']]```
I have this prepared statement, and I know I seem dumb, but if someone could help me out here to adjust this to what I need, id appreciate it.
```sql
[getPlayerChars]
SQL1_1 = SELECT citizenid FROM users WHERE steamid=?;
SQL1_INPUTS = 1
OUTPUT = 1
I basically need to push that data to the client so that I can draw out the character selection screen... If this isn't the correct space, if someone could push me in the right direction that would be amazing.
_fetchstr = format ["getPlayerChars:%1", _uid];
_fetch = [_fetchstr, 2] call ExternalS_fnc_ExtDBasync;
_returned = str _fetch;
_playersArray = _fetch;
This is how I'm retrieving the array if thats needed. Not pretty but should do the trick and I can clean it up after.
well select the columns you want, not only the citizenid?
[getPlayerChars]
SQL1_1 = SELECT steamid, citizenid, cash, bank, name FROM users WHERE steamid=?;
SQL1_INPUTS = 1
OUTPUT = 5
Already changed that
Im just not 100% sure if it will pull all of the lines
OUTPUT = 1,2-STRING,3,4,5-STRING some example output found on internet, i think you're supposed to do the same thing, so for 1, 3 and 4 it returns the unmodified value, while 2 and 5 are stringified i guess
Okay
Thank you
My main question though, will this return all the lines that it can find in the table, or just the first line?
it will return all lines where steamid is whatever you pass (just like in your query)
Okay, perfect. Thank you, this might seem stupid, but my GPU is in the mail so I'm currently coding without the game sadly.
So I really appreciate your help
private _groups = units _side inAreaArray thisTrigger;
_groups = _groups apply {group _x};
_groups arrayIntersect _groups;
``` is there a quicker way to get all the groups in a trigger area?
Depends on a lot of factors. That method is probably going to be near-optimal if the number of units within the trigger is relatively low.
keys (_groups createHashMapFromArray []) is quicker than arrayIntersect once the count gets larger.
And if the groups are mostly large and mostly on the target side then you may be better off starting from allGroups.
i see
oh, groups can't be used directly as hashmap keys, so that's not an option here anyway.
the best way is checking the ammo of the magazine of the weapon
and seeing if it has artilleryLock = 1 
Continuing on my project; while at present its a workable script that can be activated by the debug console, my future plan is to implement it as a subscribable mod in it's own right.
In the interim to getting there, and seeing how the debug console can sometimes be restrictive for feedback, I need an easier way to call it; is there a method to execute a file on a player-hosted server, running a downloaded scenario? To clarify, for a small group playing Mike Force.
make a local mod
Ah. Fair enough, didnt even see that option - or rather, overlooked it all this time.
Wouldnt happen to have a guide handy for the process of setting up the folder, would you? All Im digging up is some second hand steam forum information; naming the folder @ modname/Addons/ and the files needed as a PBO.
Ah, got a more thorough explanation dug up, just need to learn how to publish a mod anyways xD
I suppose the next question would be, since im on the topic; how would I go about automating the execution of the script? I cant exactly add it to the scenario's init files, and relying on the server host to execute it every time would be tedious at best. Or am I thinking too hard, and the process of loading it as a mod automatically runs it whenever a mission starts? Maybe ill zip it and read the articles first :)
You don't need to publish your addon just to work with it...
merely pack it to pbo
then you can use filepatching
Yeah, took me a bit to find that article, didnt think to search for 'Addon' xD
Any way to properly force open the escape menu? When I create RscDisplayInterrupt in multiplayer, it shows the load option instead of respawn like it should.
yeah no, don't create the display from scratch as it does not attach everything properly
no idea if there is a way to do what you want though
While you can open the menu using createDialog or createDisplay, it won't work correctly. I'm afraid there's currently no way how to force open functional pause menu.
https://forums.bohemia.net/forums/topic/177542-displaying-the-escapepause-menu/ from 2015
Seen that, but was hoping it had changed since. Maybe I just have to create my controls on top of the mission display instead of creating my own display.
sure, why not
depending on your goals ofc
Everything does seem to work with RscDisplayInterrupt though... So maybe I'm bold enough to just replace the save button. Hold my beer.
zomgzomgzomg - what a daring person! π π
I found RscDisplayMPInterrupt in config. Tried and see no indication of missing functionality.
you may have found the Graal π
I'm gonna assume so until the bug reports start dropping in.
Is there a way through init to get the ammo like the gbu is "Bo_GBU12_LGB "
I want to do it so I can use a nuke from a mod. I want to make it so if the players destroy a vehicle marked with nuclear materials that nuke spawns . The only thing I'm missing is the ammo for my script
this spawn {
sleep 1;
hintC str magazines _this;
};
```for _magazines_
for *ammo*, browse through mag configs
basically CfgMagazines >> magazineType >> "ammo" array
then CfgAmmo >> ammoType
ok thanks cause I was doing it the caveman way of goin to mod->pbo and searching in a cpp file
works too, but it's tougher π
yea
private _mags = magazines this;
private _allAmmo = [];
{
{ _allAmmo pushbackUnique _x } forEach getArray (configFile >> "CfgMagazines" >> _x >> "ammo");
} forEach _mags;
copyToClipboard str _allAmmo;
```@polar belfry
you should get ONE VEHICLE's data copied into the clipboard π
yes
works?
magazines should return turrets' mags, from the wiki though?
(from Dr_Eyeball's note)
This command does not include non-turret weapon magazines, such as smoke, flare or chaff magazines which are usually declared in the root of the vehicle's class, rather than in the Turrets hierarchy.
do you try it on the vehicle that has weapons (and that has that nuke you want)?
well, otherwise it's allTurrets + magazinesTurret π¬
The nuke is on a pylon
as a bomb
I'll test the thing on a ground vehicle
no luck
ammo is not an array Lou π¨
iz nawt?
@polar belfry try:
private _mags = magazines this;
private _allAmmo = [];
{
_allAmmo pushbackUnique getText (configFile >> "CfgMagazines" >> _x >> "ammo");
} forEach _mags;
copyToClipboard str _allAmmo;
@polar belfry, @little raptor is your new personal interlocutor
*runs away*
here, the code reads CfgAmmo names from vehicle's magazines
I'll save the thing
let me test my code for calling the missile
wait something messed up
[]
where are you trying it now?
the exact same code?
yea
actually before I continue, why do you even want the ammo?
let me run it again
I have a small ied code that spawns the dropped ammo (eg gbu, napalm) when a diesel silo gets destroyed to make a chain reaction
I thought about simulating a nuke when a "device assembled" gets destroyed
so doesn't it mean you just wanted the ammo class name?
Fired event handler? π
this addEventHandler ["Fired", { copyToClipboard str _this; hint str _this; }];
you typed your "nuke" ammo here a little while back
fly, fire, you should have it
why delete it? 
was ["gm_rocket_luna_nuc_3r10"]
well, use this ammo and that should be enough π
and copyToClipboard is singleplayer / server only
weird, but noice!
bomb="vn_bomb_750_blu1b_fb_ammo" createVehicle(position s1);
that is the script for anyone interested
for napalm
I don't know if bomb is universal tho
vn_ = SOGPF
so how would you write this. I found this line of script in the community page. It is an arma 2 script someone made
"vn_bomb_750_blu1b_fb_ammo createVehicle(position s1); " ?
s1 is a silo I put on the map
"vn_bomb_750_blu1b_fb_ammo" createVehicle getPosATL s1;
or even```sqf
createVehicle ["vn_bomb_750_blu1b_fb_ammo", s1];
might want to use can_collide
is there an event handler for a unit getting any kind of kill in any form? i want the unit to lose captive status if they run someone over
Hello everyone I have a question regarding ACE Cookoff,
We are using RHS Strykers and even after ACE Cookoff they seem invincible and don't want to explode. I am currently looking for a script that makes it so that after the 2nd or 3rd Cookoff the vehicle automatically explodes no questions asked, anyone have any ideas on how/where to start?
define explode as in blow up and show a damaged texture and not be usable or blow up and dissapear
Catastrophic destruction, just a big boom, non usable
i have a feeling this is to do with rhs damage model
usually things become disabled instead of destroyed
Afaik ACE will lock a vehicle at .8 dammage while its cooking off, so you could set up a trigger to detect vehicles at .8 and put them on borrowed time.
I currently have 4 loops checking for things but they are all in one script and require the 1st one to be completed before the next works, but I am looking for all 4 to run at once all checking for the condition. I think putting all loops into their own file and calling all 4 would work, but its messy and excessive, is there a way to call them all at once? maybe with spawn/call?
you can't call a loop that's more than a fixed number of iterations
use spawn
if it's the same loop run multiple times then you can run the same function with different inputs
execVM will load a file and run the code scheduled like spawn
so if you're only initiating each loop once that should be sufficient
just put an execVM line where the previous loop ends
Isn't this ACE advanced vehicle damage rather than ACE cookoff?
The thing where they flare and all components go red instead of destroying the vehicle.
If you're using RHS I'd just turn it off.
It mostly exists to make vanilla/CUP vehicle damage more "realistic".
The big fire flame is cookoff
is there any way to reduce just how blue everything looks when setting a small aperture
i.e bring back the colour to it
There's a color correction post processing effect
How would I make an addAction only available to an AI under their own Action menu [6 key]?
Bah, nevermind
Thought I had to declare Params in the condition line, didn't realize it pushed its own X_X
That's called commanding menu, not action menu
And you can't modify it
You can create a new one
Oddly enough it does seem to add addActions to the 6 menu. IIRC only one of them though.
Any idea where I could get more info about https://community.bistudio.com/wiki/BIS_fnc_moduleHideTerrainObjects
Trying to hide a building mid game
Idk what you mean 
You can add addAction to the 6 menu via addAction?
Also wdym by one of them? 
Read the function contents
I mean if you use addAction, sometimes they show up in the 6 menu. I don't know what the rule is exactly.
Feels like some vestigial functionality they forgot about :P
Never seen that 
In function viewer? If only I could get to PC with Arma. I am providing "long range consultantation" for a friend
wiki was the source I relied on. Will do, good idea, thanks!
Is it possible to store variables on Server's profile namespace?
I'd need to store variables that stay persistent over a few missions
@leaden ibex you should be able to use nearestBuilding with the building's position to get a pointer that you can use with hideObjectGlobal later
or at the same time
Just figuring that out from looking in how the module works
regardless you can grab the object
So I am gonna do it "manually"
Which will work perfectly
But thanks for the idea! Appreciated
@ashen hawk You mean from the client?
In general, yes, that's what profileNamespace is for.
I'll give some context:
I was able to write a script that stores weapons/magazines in a box in player's namespace and it works perfectly, it transfers over missions, maps etc.
Unfortunately, I am affraid I am unable to save it on the server's profile namespace
I wanted to make sure everybody has the same weapons in the box no matter if they joined sooner/later/ attended previous missions, that's why I want to save it on the server
It's the same thing. You just run the code on the server.
and if I run the function that lists all magazines/weapons using getWeaponCargo it returns [[],[]] on the server
That probably means you added the mags/weapons with local functions.
hence addItemCargoGlobal etc.
if (isServer) then {_guns = getWeaponCargo crate1;
profileNamespace setVariable ["TAG_SaguWeapons", _guns];
_mags = getMagazineCargo crate1;
profileNamespace setVariable ["TAG_SaguMags", _mags];
_items = getItemCargo crate1;
profileNamespace setVariable ["TAG_SaguItems", _items];
saveProfileNamespace;
};```
this is the script I use for saving
sagu_select_weapon = {
_weapon = _this select 0;
_index = _this select 1;
if (count _weapon > 0) then {
crate2 addWeaponCargoGlobal [_weapon select 0, _index select 0];
_weapon deleteAt 0;
_index deleteAt 0;
};
};
sagu_select_magazine = {
_magazine = _this select 0;
_indexM = _this select 1;
if (count _magazine > 0) then {
crate2 addMagazineCargoGlobal [_magazine select 0, _indexM select 0];
_magazine deleteAt 0;
_indexM deleteat 0;
};
};
sagu_select_item = {
_item = _this select 0;
_indexI = _this select 1;
if (count _item > 0) then {
crate2 addItemCargoGlobal [_item select 0, _indexI select 0];
_item deleteAt 0;
_indexI deleteat 0;
};
};
if (isServer) then {
_contentG = profileNamespace getVariable "TAG_SaguWeapons";
while {count (_contentG select 0) > 0} do {
_contentG call sagu_select_weapon;
};
_contentM = profileNamespace getVariable "TAG_SaguMags";
while {count (_contentM select 0) > 0} do {
_contentM call sagu_select_magazine;
};
_contentI = profileNamespace getVariable "TAG_SaguItems";
while {count (_contentI select 0) > 0} do {
_contentI call sagu_select_item;
};
};```
this is the one I use to load it
The loading code is pretty nasty (while + deleteAt? forEach plz)
this code is executed with "Close Container" Event Handler
but the save code looks ok.
yeah, i'm aware of that π
Where is the EH installed, and do you know if it's triggering?
EH is on the crate where I store the items, it uses execVM to run the save script
I would guess that ContainerClosed only runs if the triggering player is local, although it doesn't say so.
So you'd need to install the EH on the clients, and then remoteExec the save function on the server.
Triggers when player finished accessing cargo container. This event handler is similar to InventoryClosed EH, but needs to be assigned to the container rather than the player. Note: will trigger only for the unit opening container.
oh let me guess, it's only saving the stuff for the client using the box?
never mind the saving, that's an extra step.
I would recommend adding diag_logs at the start of each EH or function until you're sure about what's executing where.
alright
no specific rules� just addAction
Only one though? I mean, there were dozens within range when I spotted it, and only one in the 6 menu.
And in that case, how does it pick which one?
how would i go about the diag_log?
Whatever you like, it's just printf debugging.
ah, maybe something like priority / distance
but I thought one could add (and see) multiple ones without issue
Alright, got a chance to test my working script... and of course, MP scripting bites me in the ass.
Spawn_Airborne =
{
If (!isServer) exitWith {};
AirbornePad = createVehicle ["Land_HelipadCircle_F", [16166,7059,0]];
AirbornePad setdir 0;
}; systemChat "Helipad Creation Defined!";
...
Call Spawn_Airborne;
Executed on the server level, spawned several copies of the helipad, as expected by a global effect. But I thought the !isServer would have corrected for that :/
Thankfully that was just the helipad... but the script also creates a truck (which, predictably, blew the hell up) and a trigger, which was unnecessary server useage.
Executed on the server level, spawned several copies of the helipad, as expected by a global effect. But I thought the !isServer would have corrected for that :/
wat where is that code? π
This current build is being injected by the debug menu, future versions are as I was talking about this morning, putting into a local mod
