#arma3_scripting
1 messages · Page 638 of 1
who said that?!
yes it works
then that part is right but i still get the error missing " ; "with only that line in "on activation"
uhm i just removed the ; behind it and it works
it was ["acdc"] remoteExec ["playMusic"];
now ["acdc"] remoteExec ["playMusic"]
and im confused as F*** again :-I
cant check that now but i still dont hear the music
and if you try that in debug console, do you hear it?
so your music is not defined
it is! it works fine if use it it with say3d
this ;[radio, ["acdc", 100, 1, false, 0]] remoteExec ["say3d"];
↑
got that working on a radio as u spawn in
they do. their velocity is capped
They don't -descend-
what do you mean?
if you spawn the flare in the air with the mentioned code, and don't apply setVelocity to it, it will just sit there in the air until it self destructs.
if you spawn the flare in the air with the mentioned code, and don't apply setVelocity to it, it will just sit there in the air until it self destructs.
no it doesnt
I beg you to try.
ok, they don't descend
that part is correct
ok, they don't descend
but their velocity is capped
Maybe next time try it before you come off so... condescending
And you are also incorrect on their velocity being capped, if you setVelocity [0,0,-20], it will faceplant into the ground
its velocity is CAPPED
only when the flair hasn't gone off yet
once it goes off the velocity becomes capped
Yes. Which is what the OP was observing.
I made fun of what?
Leopard20, to put a cap on this, I have tried to solve this guy's problem, and am in DM with him to do so, rather than just making assumptions about what he's trying to do.
is there a way to add the unit emblem to a vehicle without having it as a squad.xml?
No, you can use insignia's though
damn, wanted to have my clans logo appear on a prowler
in that case, you know where to find an olive green prowler texture i can edit?
yea ik my bad
can someone point me in the direction of how i can look up all the ammo for a weapon so i can fill a crate with it.
currentMagazine? or all the different mags available for the weapon
all mags available would be great
so if i need to fill a crate will all ammo from a titan for example. with out having to specify manually so that i can use it on any weapon.
magazines[] is a bit more immediately useful
yes obsolete now no?
getArray (configfile >> "CfgWeapons" > typeOf currentWeapon player >> magazines) will give you an array of magazines compatible with your current weapon
SWEETT!!!!
there's also magazineWells
shrug, works immediately with vehicleName addMagazineCargoGlobal [magazineName, count]
I'm not familiar with how magazineWells gets interpreted to produce accurate magazine names
configFile >> "CfgMagazineWells"
Though a googlin' later and it appears
[currentWeapon player] call BIS_fnc_compatibleMagazines will produce what you need
sweetttt
I have a code that allows for the AI to rearm at various things, but i cant seem get it so that the AI are able to rearm at a deceased soldier? how do i get it so the AI can just run to the nearest dead AI?
Not sure I like this approach though as it will return things like the 100-round mags for a regular MX, where as magazines[] I think was intended to be more conservative in what's typically used in the weapon
nearSupplies perhaps?
That works for dead AI? Huh
maybe, not sure
I found this intel on the topic 🙂
https://community.bistudio.com/wiki/Arma_3_Weapon_Config_Guidelines#Magazine_compatibility_groups
is createVehicle also used to spawn ordnace for explosions directly on a location? ( for example letting a obj/crate explode on !alive=true
I am not sure I got the entire question, but yes you can createVehicle live ammunition
can i convert an existing unit into an agent or do i need to create a new one with createAgent
recreate
@winter rose
my idea is to set up a crate that looks very unsuspicious but as soon as the player destroys it (C4,enough dmg etc.) triggers a massive explosion at that location like from a GBU/jdam or there like
ah sure, well yes doable
crate needs to have damage tho
yes, you would use create vehicle for that, spawn the bomb, then set damage to 1 to destroy
well it would me most associated with ammo crates etc. but i just want a bigger bang then the normal cook off from ace
infraction incoming, take cover 😄
uhm agains what?
who are you calling a bot 🤖 👀
its not automated?
doubt it
aw yaw saw it :-II
normal cock off
cook* off, it's a joke on the typo @sharp skiff
sry english is not my native language
my bet is on automated detection, mod decides if punish or not
they got me multiple times for dumb stuff hours later
that, or we use the top-right search field, too 😄
you can always use particle effects
like fake explosion
and make it however you like it
yeah but the collateral damage coming with the ordenance would also be nice!
and well with the particle effect i would have to fiddle around more then just to spawn a jdam etc.
If you use it rarely, use real bombs
waitUntil { sleep 1; not alive crate };
createVehicle ["Bo_GBU12_LGB", getPosATL crate];
*boom*
I didn't expect this from you Lou
Just dont do it on a loop to create background ambience. Lost of bombs is bad for performance
stop with your EH heresy!
waitUntil will rule the world!
@spark turret 3 times over a whole airbase or so , so its not to much
@winter rose i didnt even ask for it an u delivery THANK YOUR VERY MUCH!
{
_x addEventHandler ["Killed", {
params ["_crate"];
createVehicle ["Bo_GBU12_LGB", getPosATL _crate];
}];
} forEach [crate1, crate2, crate3];
❤️
better ↑ ^^ previous was only a proof of concept as @little raptor pointed 👀 😄
I WIN!
blah blah blah 😛
.sqf then let it run once with a init?
you can set it in initServer.sqf
ok
are you CRAZY?!
I just dropped that bomb on top of someone.
found his body 500 m away from where he was
be glad you found the body 😄
I had to use Zeus
I only saw him for a fraction of a second
flying at the speed of light
are you CRAZY?!
and I thought that question was sorted already
lol what size is a gbu 12
i can recommend the Mk84 for really nice effects 🤔
eh 500 lbs. thats toys
@winter rose @little raptor yeah well i found out u can make nice suiciders with that also, excuse me i need to find new pants and a way to scrap the civi of the runway :-I
LOL a suicider carrying a 500 pounds bomb
yep
i was to lazy to search for a crate i just placed a civi named him crate1, shot his head, ????, Profit!
is there any command for me to remove a weapon that was put into a backpack and not in the active slot ?
yes
try removeItemFromBackpack
https://community.bistudio.com/wiki/removeItemFromBackpack
i bet there is no sorted version of the cfgMagazine wiki site?
you mean, clicking on the table headers? ^^
my bad :-I
you are condemned to write sqf in notepad (not ++) for 2 weeks! 👨⚖️
uff
Id do it with graph paper and colored pencils
pls i dont want to die!
Crayons only!
hmm… grayons
leave them for the mariens
no the crayons are for when i get hungry
might be Contact only :3
yeah never ever saw that ingame XD
oh and u guys brought me to use Visual studio code wit the sqf addon 🙂
or @spark turret did with his mention it to someone else
more colours yay
is there a way to loop through all tasks on the map?I need to get their locations. Im not seeing any functions to do that.
@winter rose Thanks alot mate!
Arma2OA: Is there any way to return a list of rocks or boulders near a position?
that's A3 only
doesn't exist in A2
nearObjects is the closest thing, which only returns objects which are also configured in the game (so some rocks/boulders might, but most won't)
I can use nearestObjects to get a list of objects which includes names like rocks and boulders. However, I cannot seem to use those values in any way. If I try to convert the value for a rock into a string, it just says "Null-Object"
If I can get those values as strings, I could do a string compare to find rocks
If I try to convert the value for a rock into a string
?!
If I can get those values as strings, I could do a string compare to find rocks
I'd say you'd have a better luck getting their model
if it works in A2 - it doesn't
Thanks god i'm on Arma 3 and have the new functions
When i execute this from the server nothing happens. Nor does it do anything when executed on local or global. What do i need to do to make this work?
[west, "HQ"] commandChat "Light Armor is Online.";
you're supposed to execute it on the client where you want the message to show. that being said, i have also had issues with some of the chat commands simply not working, so you may not be doing anything wrong.
How can I stop the script and "exitWith" while inside a loop within that script?
you can set a variable in the loop when you exit, and then check for it outside the loop. or you can use a combo of scopeName and breakTo/breakOut.
private _exit = false;
{
if (_x == 1) exitWith {_exit = true};
} forEach [0,1,2];
if _exit exitWith {};
scopeName "root";
{
if (_x == 1) exitWith {breakOut "root"};
} forEach [0,1,2];
// Exits before this line
sqf
I didn't know Discord supported that... TIL
there's also a wiki with all the commands/functions from Arma which explain how they work and with examples on how to use them ;)
https://community.bistudio.com/wiki/exitWith
someone here having arma up and running?
and is in editor?
if yes, please provide me the result of the following:
private _arr = [];
[] call {
_arr push_back 1;
[] call {
_arr push_back 2;
[] call {
_arr push_back 3;
breakOut "foo";
_arr push_back 3;
};
_arr push_back 2;
};
_arr push_back 1;
};
systemChat str _arr;```
@queen cargo your pushbacks have a underscore in them so they won't work. Also generic expression for your breakout
argh ... thanks for the headsup (doing c++ right now and push_back and pushBack mixup)
the generic expression error i guess is with those fixes applied?
https://community.bistudio.com/wiki/breakOut but then this note would be wrong 🤔
tho ... no
only wrong if he actually did have show script errors set and othewise missleading
|#| breakOut "foo";
Generic Error
maybe something changed 
hmm... even when fixing pushBack and adding a scopeName I have no results or errors
he added a scopeName to the breakout i think
nope, errors are enabled and RPT logging enabled
and it doesn't matter where I place scopeName "foo";, doesn't do anything
also checked with breakTo, also nothing
i got something in system chat with this
private _arr = [];
[] call {
_arr pushback 1;
[] call {
_arr pushback 2;
[] call {
scopeName "foo";
_arr pushback 3;
breakOut "foo";
_arr pushback 3;
};
_arr pushback 2;
};
_arr pushback 1;
};
systemChat str _arr;
returns [1,2,3,2,1] in systemchat
... I hate systemChat in the editor... need to exit the debug console to be able to see stuff...
scopeName "foo";
private _arr = [];
[] call {
_arr pushBack 1;
[] call {
_arr pushBack 2;
[] call {
_arr pushBack 3;
breakOut "foo";
_arr pushBack 3;
};
_arr pushBack 2;
};
_arr pushBack 1;
};
systemChat str _arr;
``` returns nothing
ye
wat
think you got something wrong there grez
anyways
note is incorrect, that much is a given
You talk about the note by alef?
Seems to be incorrect:
nil works and returns [1,2,3,3,2,1]
"" works and returns [1,2,3,2,1]
Incorrect:
"dskfhdsklfh" gives Generic error in expression
"" works and returns [1,2,3,2,1]
is that with the last snippet you posted?
private _arr = [];
[] call {
_arr pushBack 1;
[] call {
_arr pushBack 2;
[] call {
_arr pushBack 3;
breakOut "";
_arr pushBack 3;
};
_arr pushBack 2;
};
_arr pushBack 1;
};
systemChat str _arr;
ahh
so nil ignores it, and "" takes any scope...
I wonder what happens when there are multiple scopes
"" just drops out of current scope
its not a surprise that nil ignores it. all commands are ignored if nil is given as an argument
i recommend asking it 
_passengers = [];
_crew = crew introplane;
_dir = direction introplane;
//Get everyone except the crew.
{
_isCrew = assignedVehicleRole _x;
if(count _isCrew > 0) then
{
if((_isCrew select 0) == "Cargo") then
{
_passengers pushback _x
};
};
} foreach _crew;
//Now moveout only passengers leaving the crew inside.
{
_x disableCollisionWith introplane;
_x allowdamage false;
unassignvehicle _x;
moveout _x;
_x setDir (_dir + 90);// Passengers exit _yourvehicle at right angles.
sleep 0.6;//space the Passengers out a bit so they're not all bunched up.
_x allowdamage true;
} forEach _passengers;
sleep 120;
{introplane deleteVehicleCrew _x} forEach crew introplane;
deleteVehicle introplane;
i am using this
to eject players
out of a plane
then delete it after 2 min
what ends up happening tho is
like
the plane
after it ejects players tries to go rescue them?
like it plunges down towards the ground and then lifting and hovering around
how do i make it...not do that xd
is it just forcing another move waypoint after the eject
@ember path is the planes crew part of the players group? Maybe the pilots just try to stay in formation with their squadleader, who was just ejected, and therefore they dive down and loiter near the players.
no
they are in their own groups
hm
interesting
so
when i switched to a position that has the lil like..gun icon
not the seat icon
it doesnt eject us
on a sidenote, im not sure you can do allowdamage as that needs to be executed where player is local
i really dont know i copy paste the script.. seemed to work the first time
then your idea with the new waypoint might work best. Combine it with flyInHeight and setWaypointCombatMode to ensure that the planes stays up high.
ok..so different issue
now
UHm...so i have it setup so that when a player crosses a trigger that script executes
That's because the scripts checks wether the role the player is assigned to is "Cargo", excluding pilot and gunner seats.
for some reason....the script doesnt execute if the player is not in one of those...seat icon positions....how do i include those too.. OR even better, how do i make it so only a group ejects
i see
the problem rn is i just copy pasted the script i dont really understand it, so idk which parts i need to modify
Heh
if you have the group's reference, use units saidGroup
if not, maybe use fullCrew
listen.....new mission makers make do
Sorry, I couldn't resist.
You've been around here for a while now though, and that's not very complex code, even commented 🙂
i have i have, and im very thankful that yall are very patient with me, im sorry
hi sorry, I'm dad!
heck
ok
ill try
just replacing crew...with playerside right.. that should work
oh no
cuz its.. selecting cargo
{
_isCrew = assignedVehicleRole _x;
if(count _isCrew > 0) then
{
ditch this whole disaster and usefullCrew
or maybe you should listen
i could do that
Don't know why the script is so complex, I'd just define an array of either all crewmembers or all people that need ejection and then do my thing based on that.
@winter rose also, the role can be empty "", which will return all roles
ok ok.. sorry ill try to figure it out
please update the wiki
stated in the last note
if anything but given values, will return everything
even "potato" will return all units 😄
ok
(was thinking of adding that info in the type argument description yes… maybe today)
Would it be possible to make a script that would make there be a 1 in 4 chance that when you loot a weapon from someone, the weapon's iron sights are set to the highest setting? I don't think it is, because the AI doesn't seem to adjust weapon ranging and the default zero is a config from the weapon itself.
you can only get zeroing by command, not set it
Darn. Ah well, it would've been for a joke anyways.
sorry, and one knows I like a good joke 😄
yall i think i goofed up
_dir = direction introplane;
//Now moveout only passengers leaving the crew inside.
{
_x disableCollisionWith introplane;
_x allowdamage false;
unassignvehicle _x;
moveout _x;
_x setDir (_dir + 90);// Passengers exit _yourvehicle at right angles.
sleep 0.6;//space the Passengers out a bit so they're not all bunched up.
_x allowdamage true;
} forEach fullCrew [vehicle player ""];
sleep 120;
{introplane deleteVehicleCrew _x} forEach crew introplane;
deleteVehicle introplane;
i was like
i dont need the crew script.. i just want the players to eject so
and....at one point i did something... that made again just the cargo ppl eject.. not gunners..but
hm
my two brain cells cant figure it out...lemme try using group player..
no..
even using forEach player doesnt work.. i thought it would
like just do this script for each player...idk hm
oh wait could i..
mh
fullCrew [vehicle player ""];
fullCrew [vehicle player, ""];
did you even read the biki about fullCrew params?
yea
then why is your code wrong?!
Return Value:
Array - format [[<Object>unit,<String>role,<Number>cargoIndex (see note in description),<Array>turretPath,<Boolean>personTurret], ...]
long story short, the unit is the first element in the array
in other words
I'm not sure if that's what you want
that'll only eject the turret (aka FFV) units
yeah but im saying....the unit is not....the first element
right, in that example
? or am.. reading it wrong
or is vehicle player a unit
the first element in each array of seats
not the return array
also your code ejects everyone
so you won't have a pilot anymore
I mean if it worked
_dir = direction introplane;
//Now moveout only passengers leaving the crew inside.
{
_x params ["_unit", "_seat"];
if (_seat in ["turret", "cargo"]) then {
_unit disableCollisionWith introplane;
_unit allowdamage false;
unassignvehicle _unit;
moveout _unit;
_unit setDir (_dir + 90);// Passengers exit _yourvehicle at right angles.
sleep 0.6;//space the Passengers out a bit so they're not all bunched up.
_unit allowdamage true;
};
} forEach fullCrew [vehicle player, ""];
sleep 120;
{introplane deleteVehicleCrew _x} forEach crew introplane;
deleteVehicle introplane;
this is a sample of what _x looks like:
[<NULL-object>,"cargo",2,[],false]
one thing I'm not sure is whether the game returns "turret" or "gunner" for gunner seats
so the "gunner" part in my script might be unused
or you know, you can simply use:
if !(_unit in _crew)
no that won't work
apparently cargo units are also part of the crew
Oh...
forEach allPlayers might be what you want?
if all players are in that vehicle
therefore, maybe not
otherwise isPlayer _unit
forEach allPlayers was it, its the intro so all of them are in the same plane, cool
i...feel like i wanna never look at arma ever again, i just still dont get how or what or.. like what this script is doing, so ig ill have to just....READ
because you skipped your lessons
good start is to get Visual studio code + the sqf extenstions, run your code, look into rpt, find the error and then read the documentation for the methods called around the error
see if you passed a wrong parameter or syntax or sth
you can always ask your questions here
like what does this part do and stuff
i....i am going to die, i...its not working now....wh...it worked like.. a test ago and its not working now....hhh ok, i need to take a break from this
and your new code is?
I mean like the full code
_dir = direction introplane;
//Now moveout only passengers leaving the crew inside.
{
_x disableCollisionWith introplane;
_x allowdamage false;
unassignvehicle _x;
moveout _x;
_x setDir (_dir + 90);// Passengers exit _yourvehicle at right angles.
sleep 0.6;//space the Passengers out a bit so they're not all bunched up.
_x allowdamage true;
} forEach allPlayers;
sleep 120;
{introplane deleteVehicleCrew _x} forEach crew introplane;
deleteVehicle introplane;
anyhow thanks yall for suffering with me, but ill take a break from this now, gotta clear me head
it looks fine
is that normal for forced unboarding planes? making the units invulnerable?
the unit might hit a wing or something
or maybe even collide with each other (not sure if that's simulated too)
but locality
yeah most of them take local arguments
_x disableCollisionWith introplane;
_x allowdamage false;
unassignvehicle _x;
_x setDir (_dir + 90);
I'd expected that at least moveOut would work
shouldnt allowdamage be executed on the players pc, this looks like server code
because unit is remote on server
yeah
ye just confirming my logic here lol
as nobody said something about the allowdamage in that function
it's not just allowDamage but all of these that need to be remoteExeced:
#arma3_scripting message
oh yeah
yeah im just executing the script after a certain triggers conditions have been met, which is probably wrong, but i did also just copy paste the script soo
also i dont know what that _x means
ive seen it in multiple scripts tho
magic variable in foreach, apply, count and findif loops which represents the current element of the array.
`Is your idea necessary?
Will players even notice or use what you want to script? Just because you can doesn’t mean you should. Sometimes less is more!`
this line from the wiki
mean
ofc i needed a script that makes the bar gate whatever its called open when an enemy vic comes near it
its very important to me xd
{ systemChat _x; } forEach ["apple", "banana", "carrot"];
// apple
// banana
// carrot
pefer ["beer", chocolate", "steak"]
😛
@ember path i recommend you spam diag_log or systemchats everywhere and see what is actually happening
for your own sake
question is there a way to make is so that AI do not show up on thermals, I have seen scripts that have made it so that you can only see ai with thermales but cant find anythign the other way around.
I doubt it. You got a link to one of those scripts?
so you need to mod it (i.e it can't be scripted)
probably one of those scripts that hides the unit
if that's what you want, just reverse the script
for vehicles you can use setVehicleTIPars in a loop to remove the signature, but I don't think you can do that with units
you can use the same script, by inverting the hideObject values true \↔ false
roger i will try it once i get the chance, I was trying it last night but maybe I was putting it in wrong somewhere.
that's wha—
what is persisten global execution?
// 0 for server only execution, 1 for global execution, 2 for persistent global execution
isGlobal = 1;
like JIP?
looking for a way to execute my modules function on JIP too, as it edits map objects which are local to each player (lights)
is a house object the same across all clients? like, can i select a housereference, call [_myHouseOnServer] remoteExec setDamage 1 on it and it will die on all clients?
not if each client spawns it local
so how do i get the map objects between all hosts? like i select a streetlight on the server, and want to kill it on all machines.
And this is probably JIP, yes
https://community.bistudio.com/wiki/Multiplayer_Scripting#General_information_about_locality
terrain objects (buildings, vegetation, roads etc.) are local everywhere (
local nearestBuilding playerreturns true on every client)
isnt it the case that if you destroy a map object with a gun or something that it breaks for everyone
i forgot
I assume this should work fine because setDamage takes global arguments and has global effect.
i was just wondering if maybe the house reference doesnt work bc map objects are wierd
One can never be sure until one has tried 
do or do not. there is no try. 🐸
yeah you re right. i just hoped maybe theres a clear answer before i have to repack my pbo 🙂
is there a way to find out what class of mapobject im looking at in the editor/zeus?
my script misses a certain lamp type on tanoa and i wanna find its classname
systemChat (typeOf cursorObject);
can anyone point me to the wiki entrance about Zeus module especialy about integrating units (Player AI) on map load? i cant seam to find it!
https://community.bistudio.com/wiki/Arma_3_Curator has all the info about the Curator Module and commands/functions with it.
And you probably want addCuratorEditableObjects, although I have no idea what you exactly want
just that the zeus sees all units on start of the round (u have to add them manuly or they miss the marker/contolablility)
in that case you need to go over all objects you want to add and use addCuratorEditableObjects to add them to the curator(s)
when writing a script that creates waypoints for a group is there any way to make a waypoint be skipped if its condition has not been met by a certain elapsed time?
yes, you can delete it
well, waitUntil time > x ?
thank you
Is it possible to lock corpses and remove the pickup actions somehow?
lockInventory doesn't seem to work on corpses
corpses don't have an inventory, it's a ground holder which contains the items (normally placed under the corpse)
Doesn't appear to work however I twist and turn it
Any idea about making an immortal area like how they have it in KOTH ? I'm still wondering if there is any ingame module doing that or I would have to script it from scratch ?
try "detecting" that ground holder with a nearSupplies mayhaps?
That is what I did
but lockInventory only works for vehicles and backpacks, not ground holders (afaik)
no idea how to lock ground holders though...
probably by blocking it through the OpenInventory EH or something
how can I round numbers from specific digits? like 1832 to 1800 or 135345 to 135000
wow, clever.
when would I want to do call compile preprocess vs execVM excluding the need for scheduled environment
when you only need to compile/execute a file once. if you need to more than once, you compile preprocessfile into a variable and call that instead
another use case is when developing a mission in editor/mod with filepatching enabled. for example, in what im working on right now, the main build uses fnc = compileFinal preprocessFileLineNumbers "filepath.sqf" but the dev build uses fnc = {call compile preprocessFileLineNumbers "filepath.sqf"} so that it recompiles the file on every execution to make testing changes that little bit quicker.
"excluding the need for scheduled environment"
That means there is no difference, because execVM is
spawn compile preprocessFile
so without the scheduled environment that is
call compile preprocessFile
which makes these both lines be exactly the same if you ignore the scheduled 
ok so..i think i figured out why the script doesnt work.. its not the script thats the problem
its the trigger
and idk why
its a really long trigger, that activates when any player comes in contact with it
which is weird cuz it did work
and now it just doenst
doesnt
and that plane of yours was piloted by AI?
mhm
maybe it's gone off course
remember that triggers are only checked every 0.5 seconds
the minimum width of your trigger depends on how fast the plane is
I recommend you use waypoints instead
they also have "triggers" (waypoint completion code)
ok thats
wait
(making the trigger thicker helped)
oh you mean the scripted gear icon
so would that mean that:
variable = [] execVM "script.sqf" is equivalent to variable = spawn compile preprocessFile "script.sqf" ?
no I mean the "On Activation" code
you can use a "MOVE" waypoint
variable = [] execVM "script.sqf"
variable = [] spawn compile preprocessFile "script.sqf"
kk
but i want the script to execute at a specific point on the map... i was thinking maybe using sleep
but idk
yes, but spawn will return a script handle
when the waypoint completes, the code executes
which is exactly what you want
and execVM does too
Is it somehow possible to turn off the casing particles coming out of weapons when fired?
Would it be possible somehow to define a variable on pbo level?
use case as follows:
In a mission init I define an array for the Arsenal items. But I want that array available in all missions
so I want to put it in a pbo, for the mission to ready that array and not having to update the array on a whole series of mission.
What do you mean with "on pbo level"?
As in a mod, an addon, or within a mission pbo?
because if you create a global variable (properly tagged) you can use it from anywhere
use the uiNamespace to store the variable
it will stay in memory until the game closes
to define a variable on pbo level?
the only way to "store a variable on a pbo level" is using the config itself. (altho it's not technically a "variable", because it's constant)
but that's not what you want anyway
I also have arsenal content in a mod which is used in all missions we run, which is a simple array dumped in a file.
Question is; what do you do with that data? In our case the mod also handles setting the arsenal, so no need to be global (which can cause massive problems) or unnecessary stuff in namespaces where it has nothing to do...
I think he just means a preInit inside a pbo.
Using CfgFunctions with preInit.
just set the variable, it will be available in every mission
Anyone have any idea how I can make my car "float" via trigger?
so far I've tried "surfaceiswater getpos mycar;
and onAct mycar setPos (getPos mycar vectorAdd [0,0,0.1]);
mycar setMass (0.1); (this decreases the mass but makes the car sink nevertheless, I've also tried using disablesim but that just freezes the car mid-air so no)
Edit: Detach & reattach worked, If anyone has a similar idea, i can help you out.
you need to modify the config of a car so it can float, nothing you can do with only a script
welp, :(
disable simulation
and it won't sink and just stay stati......
read slower than type
no no, disable sim freezes it, i want it to have simulation and I think i actually nailed it by detaching my pre-attached but hidden boat and re-attaching my car to it
That would kind of work but you couldnt do much with the car itself
it's soo simple
https://community.bistudio.com/wiki/CfgVehicles_Config_Reference#canFloat
Just a small config change 😉
yeah, but I'm not making a new mod, I'm making a custom composition.
I would like to get the position of the machinegun weapon of e.g. a Karatel. Opened the editor, created the karatel, then
_wpnPos = cursorObject selectionPosition "zasleh_mg";
diag_log formatText ["%1%2%3", time, "s _wpnPos: ", _wpnPos];
but result is always [0,0,0]
same goes for other selectionNames I tried. What am I doing wrong?
a karatel… is that vanilla?
Yes, I think so
oh, the Ifrit
have you tested that cursorObject returns what you think it should?
Yes, the ifrit
_wpnPos = cursorObject selectionPosition "zasleh_mg";
diag_log formatText ["%1%2%3%4%5", time, "s _wpnPos: ", _wpnPos, ", cursorObject: ", cursorObject];
result
12:49:36 331.513s _wpnPos: [0,0,0], cursorObject: 15e1b154080# 5: mrap_02_hmg_f.p3d
I got the list of the selection names with
{
diag_log formatText ["%1%2", " _x: ", _x];
} forEach selectionNames cursorObject;
not answering, but a formatting tip:```sqf
format ["_wpnPos: %1, cursorObject: %2, time: %3", _wpnPos, typeOf cursorObject, round time];
Thanks for advice, will do. But why is this formatting better?
format is better than formatText for plain text
and you only set the values in %x, not your text - it is more readable
I understand. Will do that method in future then.
So, as I understand, there is no way of somehow get the model position of a turret or muzzle of a vehicle, right?
As far as I know:
the turret position, yes
muzzle position, I don't think so
Turret would be ok. How would the command look like?
the same selectionPosition command you were using.
for the ifrit, for example it is:
"otochlaven" and "otocvez"
This is something I can work with. Many thanks Leopard!!
When using selectionNames with and without LOD given, some of the return values are shared, some aren't(shared: glass9, lod exclusive: hit_main_turret_point, no lod exclusive: zasleh_mg). Is there any logic behind it? I assumed there are only the LODs "Memory", "Geometry", "FireGeometry", "LandContact", "HitPoints". If there are more, that might explain it.
Great so now my eject script works fine, i do have to figure out why the plane dips
And ive also noticed its going down...not maintaining height i put it at, i even moved the waypoint on the same height thinking maybe that was the issue
Only other thing that i can think of is..maybe its too high
And i tried doMove after the players eject
Doesn't work
@ember path Try using flyInHeight to set the planes altitude.
https://community.bistudio.com/wiki/flyInHeight
I did see that.. I'll try that thanks
Oh ill try setting its behaviour to careless maybe that wont make it maintain formation idk
Im Going to do some googling, but i assume there's a way to make hints show up only for the admin, cuz id like to know while playing the mission if certain things triggered or not
Is there a way to dynamically change the engine power for vehicles (for high load imitation, i.e.)?
there are no commands for that except for AFM helicopters
Using setMass might be what you are looking for: https://community.bistudio.com/wiki/setMass
No, the mass doesn't affect the dynamics in the most of cases.
I already has it in my engine script, and even setting it to 30+ tons doesn't change speed on a horizontal surface.
Reducing the weight on helicopter make them LESS agile, while adding more mass to them makes them MORE agile.
I'm speaking about the land vehicles mostly. Helicopter engine script should be MUCH more complex.
Ain't propably the best way but you could propably make a script to reduce the speed with setVelocityModelSpace
What was the problem with it?
Non-stable motion, performance hit.
Okay
As I understand, there is no way in A3 to add a constant force, not a single impulse?
repeat it 🤷♂️ there is no "always apply that force" afaik
Luke Skywalker begs to differ 🙂
it's gonna cost you an arm, maybe not a leg though
hehe
yes, that^^^
changing the behaviour to careless, and setting them to be forced to hold fire and not keep formation...did not change anything, plane just really wants to go down
"Plays back input movement data on input unit. " what does that....even mean
You can use unitCapture to record the movement of a unit, then save this data (e.g. as part of your script) and then play back said movements data on a unit by using unitPlay.
Hey guys if I have a sqf with multiple scripts but
Like 8 lines inbetween each script/array could that slow anything down? The reason I do this as its easier to read
Wasn't sure if the engine tries to read every line or not
Ah thanks
Just trying to optimise some code as I'm sensing a little script lag as hints are taking longer to appear sometimes
Unless you're writing SQS (Which i sure hope you don't) it doesn't matter
Yep it spawns in units/props/waypoints/markers the lot
yeah, probably that
you can optimise marker spawns, you know about making them local until the last marker command?
I'm not really that advanced but would you be okay if I showed you my aicreate.sqf?
too big? wow lol
> 2000 chars 👀
then i have a library which i use this grab code in the debug console on the editor
https://pastebin.com/sUUFB28W
i wouldnt worry about that script causes lag / warp
its doping a lot of network / cpu heavy stuff
then it copies this array which i put into another sqf and then another code on a sign lets say addaction to spawn what i placed down on the editor bla bla
its quite clever
although there is sometimes script lag it works nicely 🙂 just was worried about the hints sometimes taking its time
some here are calling in assassins because you haven't used camel case consistently, but not me
over my head there haha
this addAction ["Start: Athanos Officer MEDIUM",
{
[
[],
{
if (isNil "athanos1") then
{
athanos1 = [SAS_ATHANOS1] call SAS_fnc_AICreate;
athanosradius spawn
{
waituntil
{
private _Player = [PlayableUnits,_this,true] call BIS_fnc_nearestPosition;
(_Player distance2D _this > 3500)
};
[athanos1] call SAS_fnc_AIDelete;
athanos1 = nil;
};
comment "ADD CUSTOM CODE AFTER THIS";
["Event Started - Athanos Officer MEDIUM"] remoteExec ["hint", 0];
sleep 5;
["[Athanos Officer] You must remain 3,500m radius of this event. Enjoy."] remoteExec ["hint", 0];
sleep 10;
waituntil
{
sleep 5;
!(alive officer22)
};
["HVT has been killed. RTB // Or you have stopped the mission."] remoteExec ["hint", 0];
comment "ADD CUSTOM CODE BEFORE THIS";
};
}
] remoteExec ['bis_fnc_Spawn',2];
}, nil, 1.5, true, true, "", "true", 4];```
whats what i have to initiate the spawn per say of what i captured in the editor
i know someone said why am i using fnc spawn - is there a better way?
ps sorry for the indentation thing
how did y…
there's nothing in that script that jumps out as horrible
ive never used fnc spawn, so can't say
remoteExec spawn, no?
is remoteExec more efficient than bis_fnc_spawn?
ohhh
derpp
so the bit where it says ``bis_fnc_spawn'` what would i replace that with?
spawn
mmm anyone? as i say, I've never used it
don't trust the other channels 👀
here's how I would do something different to you, may or may not get aggreement from the guys
the big switch statements, I'd try to do them differently
for example, line 422...
something along the lines of _creategroup setformation select ["WEDGE","VEE", "LINE" etc etc]
switch has it's place, but IMO, not there
oh so instead of sqf switch (_GroupFormation) do { case 0: {_CreateGroup setformation "WEDGE";}; case 1: {_CreateGroup setformation "VEE";}; case 2: {_CreateGroup setformation "LINE";}; case 3: {_CreateGroup setformation "COLUMN";}; case 4: {_CreateGroup setformation "ECH LEFT";}; case 5: {_CreateGroup setformation "STAG COLUMN";}; case 6: {_CreateGroup setformation "ECH LEFT";}; case 7: {_CreateGroup setformation "ECH RIGHT";}; case 8: {_CreateGroup setformation "DIAMOND";}; };
it would more or less (sorry in advance lol) look like
_createGroup setformation select ["WEDGE","VEE","LINE","COLUMN","ECH LEFT","ECH RIGHT","ETC ETC"];```
this one yeah
_createGroup setformation (["WEDGE","VEE","LINE","COLUMN","ECH LEFT","ECH RIGHT","ETC ETC"] select _GroupFormation);
_GroupWideSettings params ["_GroupCombatMode","_GroupBehavior","_GroupSpeed","_GroupFormation"];``` would i need to remove this index then?
ignore me
revo referenced it
you lot are awesome lol
you should see us when we're sober
hahahaha
well, not dwarden, obv 🙂
setviewdistance in initserver goes for all player right? or should i better place that in initplayerlocal.sqf /server.sqf?
@sharp skiff What does the biki page say about locality?
"Client-side max view distance is limited by the server's view distance." On setviewdistance so run it initserver?
@cosmic lichen
What does this tell you? 😉
Oh never realised that they have a sort of hint popup! so it Must be initplayerlocal?
Thx!
init.sqf
The effect is local. That means it needs to be set on server (otherwise server limits it for clients) and it needs to be set for the clients
not sure if you're already aware, @sharp skiff , players in multiplayer changing their video settings is ignored
the idea is to force the view to max 3km
ok cool
there are a number of oven ready scripts you can use if you don't want to do it yourself
I use one called
er
CHVD
See above
I think the answer is it's JIP safe if you run your code from initplayerlocal
i will do an ac-130 supported mission but that thing has thermal vision which basically can look over half the map! Since it is a small mission i dont want the Infantry to walk/drive the next 10-15km and let the inf know whats goin on in 30km or so cause of that the max view distance is 3km (which is basicly 2times the fire range/distance of the ac-130 in this case)
^^^^^^ hasnt read the entire convo, as usual, so might be talking poo
na its fine i would says both are better initplayerlocal and init
it's also jip if you run it in init.sqf
if you put in init.sqf you don't have to put it in initPlayer and initServer.sqf
Good to know thx for telling me will do that!
Anyone know a way to stop any buildings or structures getting damaged in a session?
yes, allowDamage
be sure to execute it on every computer, otherwise there might be some hovering 😄
for normal terrain objects?
like houses and stuff on altis
_houses = nearestObjects [player, ["house"], 200];
{
_x allowDamage false;
} foreach _houses;``` would that work
yes
This is a tpq/idea question. Is there some form of eventhandler within arma for error/scripterrors that can be utilized or monitored in some way? I know its an engine level things ofc and I know the handler doesn't exists technically. Im mostly just wondering about how errors are handled withing the engine and if there is any possibility of making use of it.
Can anyone spot my screw up? I'm not getting any errors, and it passes everything till it goes to add the items.
if (isServer) then {
private _medical = [
["ACE_fieldDressing",5],
["ACE_elasticBandage",5],
["ACE_packingBandage",5],
["ACE_quikclot",5],
["ACE_splint",2],
["ACE_tourniquet",2],
["ACE_morphine",1],
["ACE_epinephrine",1]
];
private _units = [];
{
if (!(isPlayer _x) && (side _x != civilian)) then {
_units pushBackUnique _x;
};
} forEach allUnits;
{
private _unit = _x;
{
_x params ["_item","_count"];
for "_i" from 1 to _count do {
_unit addItem _item;
};
} forEach _medical;
} forEach _units;
};
not sure about this usage _x params ["_item","_count"];
but I see that the wiki says it's a thing, so
I've used it before in a similar manner but only had to apply it to one unit vs a bunch
so your problem is that the medical items are not being added?
yes, the error has to be somewhere in the stacked foreach
nah, I've done that similarly to how you've done it, worked for me
you could avoid having to declare a _units variable by just doing
forEach (allUnits select {!(isPlayer _x) && (side _x != civilian)});
maybe pop some systemChat's or diag_log's in there to see what's being processed?
well with systemchats, its pulling all the needed units into _units, it also recognizes the item and the count from the code block so far
addItem has global effect and scope, so shouldn't be a problem there; if their inventory is full, it won't add though
Inventory must have enough space to accomodate new item or command will fail.
perhaps add this before your _unit addItem _item statement;
systemChat format ['%1 addItem %2', _unit, _item]
just to see that the command's being parsed correctly?
I mean, looks good to me but I'm running out of ideas.
yup using your system chat, it pulls the correct unit and item through all units
and if you just straight up run that command through debug, it adds the item correctly? But doesn't, using this code?
it doesn't add the item still. let me pull a full diag_log and see whats going on
tbh I'm a bit more specific about where I put stuff, I use commands like addItemToUniform and addItemToVest
but the other commands didn't work? strange!
and now addItem is working and I didnt change anything! I wonder if there is something to do with playableUnits that are controlled by ai that are not being added to the _units array.
may have to add another stipulation
if these are eden-placed units that aren't playable, not side=civilian and not currently a player, should be picked up
hmmm actually this is interesting. when i enter a units arsenal, it shows its been added, but when I kill them, its not on their body
so you want the items to be there for player scavenging?
I might have a conflict with another function I think. gonna eat and think about it after a break
cos you could just add the items with a Killed eventHandler
oh I'm just stupid... its like I forgot how to play arma. I was looking at my inventory. guess thats what I get for not playing in a few months
Hey all. I'm trying to script a way for a play to change their class. I'm using createUnit to make a new unit of a given class, and selectPlayer to turn the unit over to that player, but this leave behind their old... what I'm going to call body, for lack of a better term. The unit they left behind. I want to delete it, but I'm not sure how to get a reference to it for deleteVehicle to put them out of their misery.
_unit = group player createUnit ["GGG_Soldier", position player, [], 0, "FORM"];
selectPlayer _unit;```
every time this runs, the player shifts into the newly created "GGG_Soldier", and leaves behind their old unit. If I run the above a bunch of time, then there will be their original body, and a horde of GGG_Soldiers running around. How can I stop this mad cloning machine?
And as a followup, I read somewhere on the wiki that it's best to wait a moment after calling on createUnit before selecting into it, at least, for MP reasons. I'm guessing I should just do the above coe in a spawn block with a sleep 1; in between?
tried _oldUnit = player; before changing unit and then deleteVehicle _oldUnit; after?
Yup, no dice. I'm guessing _oldUnit just stays as a reference to the player no matter what happens in the selectPlayer function.
yea. it is what player returns at that moment.
...
Welp tried it again and it worked this time? I probably screwed up saving the change or something 
Im having some issues with sliderSetSpeed on CT_XSLIDER, I've set it to
sliderSetSpeed [18002,10,10];
The "line" works just fine but when I try to move the slider without the arrows it doesn't do it in increments of 10. What am I missing? 🙂
im not sure that page (the last element in the array) actually works.
Ah that explains a lot, cheers
Anyone know how I can force-eject and my player into another vehicle? doGetOut and moveInDriver doesn't work...
moveOut + moveInxxx
It worked, thanks but I'm fascinated how doGetOut messed my entire script...
doXXX commands are for orders
they don't have immediate effect
oh, that explains it
Does startLoadingScreen / endLoadingScreen work mid game to execute a long code
yes
Amazing thank you
Is there a way to force duration of it as I think I read you cannot use waituntil or sleep
Actually you put that comment in haha
Oh thanks bud
Sorry for the late reply.
Do you want to share that? Sounds like this is exactly what I'm looking for.
how would you make a usable sign in a server for example like a garage sign to pull cars out
addAction / holdAction @fallen talon
cheers
I need some help i want to set a task state to completed after downloading UAV Data i use eden enhanced for the holdaction function
In the "Code Complete" field put ["YOURTASK_ID","SUCCEEDED"] call BIS_fnc_taskSetState; @random bramble
replace YOURTASK_ID with the name of your task
@spark dew I have been dealing with this exact situation lately (changing player classes dynamically). There are some considerations;
a) the vehicleVarName doesn't transfer. So if you are moving from an eden-placed unit (which you must be) which has a designated variable name, that variable will stay behind on the previous unit after you use selectPlayer
b) all actions are also left behind on the previous unit.
c) tasked are not sync'd to the unit you just used selectPlayer on.
d) using Vanilla revive system? That's also not sync'd.
... so, just be aware that if you're going this way, you'll want to transfer/rebuild all of a/b/c/d to the new unit you just used selectPlayer on.
as for deleting the old unit, just use
[_oldPlayer] spawn {
params ["_oldPlayer"];
waitUntil {!(isPlayer _oldPlayer)};
deleteVehicle _oldPlayer;
};
... because for a time, both units will share the variable name. I suspect this timeframe is variable in a multiplayer context on a dedicated server, making the waitUntil even more useful.
it doesn't works lmao :/
i get an error
wot error?
i typed this like he said ["task1,"SUCCEEDED"] call BIS_fnc_taskSetState] ;
no you didn't
okay i've corrected the error, but the task state doesn't change when the download is complete
post your holdAction code
["TASK_1","SUCCEEDED"] call BIS_fnc_taskSetState;
this is the code when the action is completed
yes the task is created hold i'm uploading the screenshot
please read fully what I'm asking if you are looking for help.
how are you creating the task
have you named your task "TASK_1" in the module?
👍
if im moving an ai from 1 group to another, do i need to move him to grpNull before moving him to the new group?
I think you asked this before! 😄
lolo did I?
thanks
if im moving an ai from 1 group to another, do i need to move him to grpNull before moving him to the new group?
lol
maybe it was someone else, but I'm 99% sure it was you!
it is the sort of thing I'd do
@finite sail #arma3_scripting message
yeah, well.... I'm old. It's only going to happen more often
Hello guys, I do have a question regarding setUnitLoadout.
So I have created an action on a object that changes uniform + vest + helmet
However I want to keep the old items in the vest and the uniform.
Action works, However I do loose all gear in vest + uniform.
Any ideas to save the loadouts in the uniform + vest and then add them in again once the new uniform is on?
player setVariable["KilletsSaved_Loadout",getUnitLoadout player];
player forceAddUniform "LOP_U_TKA_Fatigue_01";
player addVest "LOP_V_6Sh92_WDL";
player addHeadgear "LOP_H_SSh68Helmet_TAN";
player setUnitLoadout(player getVariable["KilletsSaved_Loadout",[]]); //but remove the uniform + vest
im a bit rusty with loadout stuff, but there might be a function that gets the items inside a wearable container
if not, i suggest a loop that gets all items, sorts out anything thats a vest/uniform or helmet and readds to the player
now would you look at that!
https://community.bistudio.com/wiki/vestItems
Thanks. I was just looking at it.
But how would it be possible to add all items in an array and att to forexample the uniform?
private _stuff = uniformItems player;
{player addItemToUniform _x} foreach _stuff;
maybe?
yeah the general structure is how i would do it
but you need to change the uniform inbetween, otherwise you just double the items 😛
now that i look at your code, it might be easier to just take the saved loadout and replace the uniform, vest and heargear classnames in it
so this is what I put together. Reading your latest now =)
private _uniformStuff = uniformItems player;
private _vestStuff = vestItems player;
player forceAddUniform "LOP_U_TKA_Fatigue_01";
player addVest "LOP_V_6Sh92_WDL";
player addHeadgear "LOP_H_SSh68Helmet_TAN";
Uniformtaken = Uniformtaken + 1;
publicvariable "Uniformtaken";
{player addItemToUniform _x} foreach _uniformstuff;
{player addItemToVest _x} foreach _VestStuff;
Oh sorry. that is for something else 😉 (unrelated to this)
The condition for the action
(_this distance _target < 3) && (Uniformtaken < 5)
Uniformtaken = Uniformtaken + 1;
publicvariable "Uniformtaken";
why do you public this var?
So that it sets for all players on the server even JIP so that only the gear can be changed 5 times on the server
HEEY It worked!
THANK YOU ❤️
5 gearchanges in total for all players?
Yes
a more performant code is probably to replace the vest, uniform and helmet classnames in the stored loadout array
long story and unrelated to this really.
Players infiltrate an supply depot. they can change 5 sets of uniforms. so they need to choose 5 players.
Then those players will infiltrate a base blah blah blah. main point is that its working 😄
so getloadout, replace names in it, setLoadout.
use array set [index,value]
Ahright!
Yeah that may be better! Thanks
I take a look into it
Oh man, thanks for all your notes! I just started testing MP stuff and noticed some issues with vanilla revive. Tasks, actions, vehicleVarName (that's a thing? I didn't even know ><) aren't too big of a concern at the moment, but that revive...
How would you go about getting the vanilla revive rebuilt/transferred? I always set up revives and whatnot through the mission attributes or description.ext, I've not looked into doing it win scripting yet.
That's actually pretty easy, there is an init function you can run, look in the functions for revive
I'm still having trouble getting AI not to show up on thermals
as I mentioned before, it depends on the unit's uniform. and it needs modding. it can't be done by scripting.
you can hide the unit when the thermals are on, but it's not a good solution.
Well no that would work for what im doing
whats gone wrong here then? while {position player #!= _endPos} do {blah} - _endPos is a valid xyz.
ah right that explains it, thank you
You should also consider using a distance-check, instead of comparing the position.
@brave jungle
I return a week later regarding my issue. I found the source of my crashes: the .ogg files. Mental note: make sure to set the quality of .ogg files to 0 before export.
called it 😉 #arma3_scripting message
then you can use:
https://community.bistudio.com/wiki/hideObject
https://community.bistudio.com/wiki/currentVisionMode
https://community.bistudio.com/wiki/allUnits (after filtering out vehicles)
in a loop.
Thank you,
It also crashes if you input a misspelled file name.
playSound3D? it shouldn't, if so please confirm and make a ticket 👀
In the old man campaign, if we were close to the character speaking we would hear his normal voice, but if we get far from him we would hear from the radio, what command is that that also adds the radio quality effect?
Copy last
no crash nor error for any of the below lines:```sqf
playSound3D ["test"]; // should error, no pos given
playSound3D ["test", player];
playSound3D [getMissionPath "test.ogg", player];
Dedmeeen, add error to the first case! ↑
unlinkItem
removes the green suit and the rubies from it
This crashes me on a "dirty" perf. of arma. I'll test in vanilla to double check.
I am on perf rn
vanilla perf then.
what do you call "dirty"?
modded to all heck
ah, well.
and can i test for a gps in use with searching for the class in the loadout?
we don't cover those here 😄
yes, yes you can
Yep, it strangely crashes even on a vanilla virtual reality test
where should I send the ticket?
feedback tracker, see #arma3_feedback_tracker pinned messages (and use search to avoid duplicates)
no crash on my side, on a complete vanilla perf though 🤷♂️
check your game files first?
sure I can do that. i do have to mention that Im on the JEMalloc which is the only difference from "pure" vanilla.
looks like its sideRadio and need to config CfgRadio.
It does adds the radio effect, but how can I reduce even more the quality of the radio?
you could apply a radio effect in Audacity
the game uses kbTell, but if you want a different quality between radio and direct, you will need two different declarations and say/sideRadio
Yes, but im going to do a huge work with many sounds, so I would like to known if the game already does that
it does the thing by itself (see the Conversations wiki article, lovely brought to you by Me\®) but if you want more radio effect, it means you will need a file for direct and a file for radio, and manually use the adequate command
The effect I want is to reduce even more the quality of the radio, like a bad transmission or interference, my audio file still too clean to hear
therefore, two files (unless you are certain it has absolutely no chances to be said directly)
is there a way to make a hint dissapear?
like i display the hint "noob" for one second and then kill it?
Ah lol Okay thanks
Hi there
I am kinda stuck with a task here
I want to check if within a specific side (for example east) as group with a specific groupId is existent.
I looked for a CBA function but couldn't find one. Anyone got an idea how to script this?
allGroups findIf {side _x == east && groupID _x == "myGroupID"} != -1
But isn't findIf extremely load heavy?
depends on the condition you use in it
well I guess this one isn't too bad
it can be faster than other loop options as it exits on the first group to return true
oh thats useful if you only search one group
so in some cases it might exit on the first group, others the last.
thanks Connor 🙂
@robust hollow Would this also work? https://community.bistudio.com/wiki/groupFromNetId = "nil"
!isNull groupFromNetID "net:id" only if you already know the netid
hm... well I basically only want to start a creation of a specific group, if the group is not already existent
So no, I do not know the NetId
Guess that seals that then
if you make a variable at the start of the mission myGroup = grpNull and then assign the group to myGroup when you create it, you could use isNull myGroup checks wherever necessary and that would work before the group is created and after it is deleted (if it does get deleted)
Yeah but I want to use the BIS default of Letter groups...
Alpha, Bravo and so on
oh wait
if (isServer) then {Alpha = createGroup [east, false];};```
@robust hollow
hmmm?
nevermind... I thought I could extract the NetId for east group "Alpha", but NetId only gives the var name to check on
if there is resistance and blufor group with Alpha I get a problem
netid should give the netid of the group... "owner:id"
so on the server something like 2:Alpha 2 for server and ID for Alpha? Or is owner to understand as the groups side i.e. east?
2 is the server, because that is where the group was created
i think its the server, thats how it is for objects iirc
okay so a check for !isNull groupFromNetID "2:Alpha" would return true if there is a group with that name on any side right?
argh... I don't get it... whatever xD I will use what you posted first allGroups findIf {side _x == east && groupID _x == "myGroupID"} != -1
But thank you @robust hollow
@robust hollow You still here?
If finished it and if possible could check for syntax and thought failures?```sqf
params [
"_unit",
"_side",
"_grpName"
];
private _grp = "";
if (allGroups findIf {side _x == _side && groupId _x == _grpName} != -1) then {
_grp = [allGroups, {_this in [side _x == _side && groupId _x == _grpName]}] call CBA_fnc_select;
_unit joinAsSilent [_grp];
} else {
_grp = createGroup [_side, false];
_unit joinAsSilent _grp;
}```
please, use ```sqf
the != -1 on the end of my snippet needs to be in the condition
oh
That params is wrong.
cba_fnc_select looks obselete
private _grpIndex = allGroups findIf {side _x == _side && groupId _x == _grpName};
if (_grpIndex != -1) then {
_grp = allGroups#_grpIndex;
_unit joinAsSilent [_grp];
} else {
_grp = createGroup [_side, false];
_unit joinAsSilent _grp;
};
is what i'd do
So I basically did everything wrong... cool 🤣
because select condition could return more than one group
You should post this in the Biki article for groups or what not. there is basically nothing as a function that would let you do above, w/o reinventing the wheel every time some tries to do this
you need to add sqf after the first three `
weird
it doesnt directly apply to groups though. you could use findIf/select/any multipurpose command for any number of things. just gotta know what commands to use together to do it
Then maybe post it in joinSilent and joinAsSilent?
I fucking bet people search for this all the damn time
still not directly related to groups in any way so it would be a little out of scope for a specific command's page.
Hello again. I'm trying to kick all the AI units out of a vehicle when it enters a trigger and keep them out. I've got this while {true} do{ {moveout _x} foreach units REIN_1; {moveout _x} foreach units REIN_2; sleep 0.1; };
in the activation field of a trigger but when the vehicle enters the trigger there's a lag spike and then it says "Generic Error" can anyone advise me on what to do please?
well, you won't need to loop something which only happens once
and since the while loop never stops it returns an error
unassignVehicle
{unassignvehicle _x} foreach units REIN_1;
{unassignvehicle _x} foreach units REIN_2;
``` Just that?
This should work: ```sqf
{
unassignVehicle _x;
moveOut _x;
} forEach (units REIN_1) + (units REIN_2);
although moveOut is not required when all units are AI (since the group leader will order the group to go out with unassignVehicle)
They still climbed back in after they got kicked out.
{
_x leaveVehicle REINH_1;
moveOut _x;
} forEach (units REIN_1) + (units REIN_2);
``` That worked in the end. Thanks for the help. @exotic flax
Script to set R-750 Rhea elevation to 90 degrees?
anyone knows if there is some tool that allows to attach objects directly in 3den without try and error?
i remember having seen something like that ages ago, but i'm not really sure anymore
might have just dreamed it
found it. [obj1, obj2] call BIS_fnc_attachToRelative nice
Oooo am I right in saying executing multiple separate remoteExec, 0 inside a remoteExec, 2 is bad 😅 i just spotted it in my code thats not the efficient way is it lol i am a TOOL
How to make AI keep position and watching direction at mission start? I tried with delayed spawn doStop followed by lookAt and while they keep position, they look at random direction.
Use doWatch instead. LookAt doesn't make them change direction (they only move their heads)
Sorry, I am already using doWatch, I've rechecked my code now.
params ["_group"];
if (!isServer) exitWith {};
[_group] spawn {
params ["_group"];
waitUntil { time > 0 };
{
doStop _x;
_x doWatch (_x getRelPos [100, 0]);
} forEach units _group;
_group setBehaviour "AWARE";
_group setCombatMode "YELLOW";
_group setSpeedMode "LIMITED";
sleep .5;
}
This is a function called on group in group init field.
you're using getRelPos from each unit
How do you expect them to not watch random directions?!
and what's the point of sleep 0.5 at the end?
getRelPos means look where your mission maker told you in 3den, "Returns position, which is given distance and relative direction away from original object."
0.5 is a mistake, it was from some loop and got left behind
in SP it works
on hosted server it works
on dedicated it doesn't
I know what it means. You didn't specify where you wanted them to look
so that means locality issues
requires local argument
this is executed on server in groups init field, it should be local to the server
afaik AI units are local to the server unless moved to headless client or created by zeus
editor-placed objects and empty vehicles are local to the server
@fossil yew have you made sure the code executes correctly?
if you pass a wrong argument into [spawn] it will not always throw an error
also getRelPos [100,0] will get a pos 100m in direction north from each individual unit.
Lies
ah whoops. to its relative north
12 o clock on units watch
so you tell all units to "look straight ahead" lol not sure thats what you wanted
hey hey ho, so I have a quick question...
using a looping execVM, I've been able to make a blackfish follow a player around by basically repositioning a loiter waypoint onto the player's position every few seconds. All well and good.
My main question now is if its possible to map the weapons on the blackbird to function as support weapons, like mortars/artillery? Be able to call it in to attack a marked position with a requested weapon?
How to make AI keep position and watching direction at mission start?
I think it is...
hm a disableAI "move" might be easier ?
I think so, yes.
not sure how long a "doWatch" command lasts. maybe leader will give new orders
That would be cool- I'm just not sure how to go about doing it. Mind, I am very much new to the world of ARMA scripting. I only really know enough to be able to format shiz and work off of and learn from example pieces
you can use "doTarget" to make the heli target (and attack if it can) a crtain enemy
Perhaps easiest with the CAS module, if the Blackfish works with that.
actually tried that, but no joy- it only ends up acting like a CAS helo instead
which is... funny to watch
...maybe if I try the artillery module
one moment
hm if you dont want cas, how is it supposed to behave?
no no, I mean
i mean, a helo cant be a mortar 😛
like it swoops around like a CAS helicopter
but the blackfish should be working more like- orbiting from a far off distance, sending ordinance from up above
@spark turret Sometimes...
first lemme see if I can get it to work with the arty module
if not, I'll look into working with a doTarget
The orbiting can be achieved using a loiter waypoint.
yeah I've already achieved that part
the main thing I'm trying to get is to have it attack on a player's request
ahhh no good- while the blackfish will get added into the support list, it's greyed out
you can use a scrollwheel action to control the helos behaviour
set it to hold fire maybe
I think there might be something getting confused here- I'm having the Blackfish behave similarly to an AC-130
or rather, that's my goal
aha
have it orbit from a distance, and use its three weapons, a cannon, a minigun, and a howitzer, fire down upon the ground
a blackfish has a howitzer? 0.o
and the orbiting already works with the "loiter" wp?
It gets added to the support list? That surprises me. I thought assets that don't work don't even show up on the list when added... But it's been a while since I've tried it.
105 mm cannon, yeah
