#arma3_scripting
1 messages ยท Page 678 of 1
I can get AI to revive me by selecting them as their commander and telling them I'm injured
I was hoping I could just use that bc it's easier
but I'll probably just have to script it manually
here's a scripting example of auto medics
those ones will revive nearby incapacitated
and a video example
vid of some stuff done awhile ago to design an automated medic system, robust enough to handle mass-casualties and multiple medics
I used that one years ago but the vanilla revive system has changed since then it may be out of date but worth a try
Dont let that idea overwhelm you tho, it can be done in a simple way . Juat try to prioratize what you need , like get the ai to heal/revive you when you command/run script, then move on to the ai moving to your position to heal or detecting auto if you need help etc.
@pulsar bluff awesome ๐ ๐ฏ
maybe others have easier script, but in script you can see it is not so simple
that one is meant for MP compatibility
you need to put them into "i want to revive this guy" state, but also pull them out of that state if conditions change (guy bleeds out or starts to get carried/dragged/in vehicle)
You don't really need that.
The basics of all auto medic scripts:
- Detect that a unit is wounded (loop, event handler, etc.)
- Pick a near unit as a medic (usually his own team member), preferably one that has a medkit or the most FAKs
- Tell him to move to injured
- Heal. You can just use setDamage
setHitIndex is another alternative.
If you want more detail you can make the healing part fancier
yeah that's why I was using the action
so they'd actually do the action
run the animation
You can play the animation yourself too
sure but how is this easier than just using action
The action varient is a bit annoying
The unit won't get healed if he moves away
well they're immobilized
Then u still have to use a command to un-immobilize them.
What's another playMove/playAction command?
Try using "HealSoldier" also, looks like a good place to start
In the real world unfortunately it's not that easy. The AI is super unreliable.
Showerthoughts: Is is possible to get if BattlEye is running or not via script commands?
Don't think so
you can answer that yourself if you just think about it
has anyone ever tried making the civilians into a proper faction?
I'm trying to have them friendly to themselves but hostile to everything else
can't seem to find a solution for that
what did you try so far?
nothing too incredible
I gave them a negative rating, which should assign them to what I think is called renegade faction
which sort of works but this means it will also shoot at other civilians even if they're also renegades
โฆsetFriend?
doesn't that only work between sides?
how could I use it?
oh I though you meant ait as a fix for the friendly fire
I'll try
alright it seems to be working
only two minor problems
the civilians now cooperate to fire on other factions but the other factions still don't shoot on them, luckly its not necessary for me, but there is still the other minor problem
the AI still tends to run away after a while
is that related to the courage setting?
the other factions still don't shoot on them
setFriend
yeah I've used multiple setfriend so that every faction hates everything
still refuses to fire
I've got a question. I'm stupid, and I can't figure it out so I'm asking here. I need a script that would allow me to create an ACE arsenal which only uses the items placed inside using Zeus. I hoard weapons in the arma campaigns, and I just need a storage place. I know I can just put down more crates, but thats boring. I've looked at the ARMA3 wiki and the ACE wiki, but couldn't find anything. I've done scripting before, but this is just beyond my level. Is it even possible in the first place?
with the Explosion eventhandler, is it possible to get the causing explosion?
@cosmic lichen with the new setunitbehavior command it might actually be that easy. you can force their behavior to safe/careless and make them go somewhere and they'll ignore fire
Perhaps but I doubt it.
i mean the vcom ai dev has made videos showcasing it
and it definitely does actually work like that
if you use setUnitBehaviour "CARELESS" they will drop out of combat and listen to waypoints
@smoky verge unless something has changed the ai in arma 3 has always been hard coded not to shoot at the civilian faction, you would have to use forceWeaponFire, they wont do it on thier own. But players can shoot at them so they are good for making them say an HVT that will shoot and run to "avoid capture" and your ai team mates wont kill them so you can try to take them alive (if you use ace3 or something)
you also could set the side of the civvie
True but then they arent civilians anymore, but that is a way to use their skins so yeah
["_x", 0];
["_y", 0];
["_z", false, [0]];
]; ```
Would this construct for _z work? I want _z to be a number in case it is present in _pos, but another type if its not present/ not a number
yes
Will still throw an error if it is not a number (but works)
@hushed valve looks like you can use BIS_fnc_arsenal
to create the BIS arsenal on a box and make it availabe to players, it also says that you can whitelist what classes of equipment you want to make available, so my thought was you fill another box with stuff then return the classes of gear in the box so you can put them in the whitelist for your arsenal. I know you are looking for the ace version but this is a start
This page has some info on the subject
Right, thanks. Will look into that.
the page does say how to whitelist its just further down
page mentions?
@hushed valve found it https://community.bistudio.com/wiki/BIS_fnc_addVirtualWeaponCargo
Read this page to add the weapon/item/etc. To the arsenal
@little raptor sorry i worded that wierd, the info on the page talks about/mentions the whitelist
lol no I read it wrong! ๐
Hello everyone, I have a object with variable _object1 and I am trying to get the location of that object by using
getPos _object1 ;
But for some reason it is not returning anything
No it isnt, how would I make it globaly?
also its best to be more specific on the type of position you want. getPosATL getPosASL etc
you should be minimizing global variables. is object1 what you named it in the editor?
okay, you need to read up on variable locality
do you understand what the underscore does?
No i dont, figured it was a easy way of identifying something as a variable
no, underscore makes the variable check in the scope of that particular script or scope (if using private)
globals do not have the underscore
read that link, it does pretty good at explaining it. especially the variable lifespan picture with the colored lines
Ah i see, so removing the underscore makes it go a scope higher, Im familair with scopes but not cross eden/script
and its been a long while since I did scripting
editor vehicleVar names should be without the underscore to make them global
and you reference it by using its global handle (without underscore)
Thats nice to know, i've missed the meaning of the underscore till now
pay attention to private as well. when you start getting complicated stuff, you can prevent/allow overwrites if using the same variable name in different areas.
I avoid global variables as much as possible and made it a habit to _variable without even knowing its real purpose lol
it all makes more sense now too ๐ thanks!
Trying to make a custom multiplayer respawn, but I am sure it has been done before.
Want to have "SIDE" respawn with lots of AI to spawn from, but not a long list of playable units (the command https://community.bistudio.com/wiki/addSwitchableUnit seems perfect, but only singleplayer).
And if possible, restrict certain lobby roles to respawning/switching to certain AI units.
So for starters, anyone know a multiplayer version of "addSwitchableUnit" ?
i don't think there is a mp version of that. how big of a list we talking?
there is no mention about removeSwitchableUnit being sp only, which means you can just remove unwanted units from the available list instead of add them to get the same result
Thanks for the advice. Well, the idea is that I'd like 6 lobby roles, but let's say 40 shared respawns for the players. The scenario idea is that they are playing out a two squads of a larger unit (platoon).
Of course you can place all those units and set Respawn = "Side". But of course, when you mark all those units as playable, you can a very long list of lobby roles. Would like to avoid that.
Secondary, restrict the lobby roles, so you have one group of (tanker) players that can respawn as tank crew members, and a set of rifleman roles that can only respawn/switch to riflemen.
It looks like https://community.bistudio.com/wiki/selectPlayer allows player to switch to other AI units. Still have to make it activate on respawn, with a selection menu. Interesting...
How bad for performance do you think it is to have a waitUntil {!(alive _object)} running on any explosive?
just a single one?
yeah just waiting until it's exploded.
not much
but followup question
do you know when the explosive will blow up? like can you give me an instance?
no
its possible that it's an impact grenade
so that could take a half second, could take 15
ah. okay. just for future reference, try to avoid waitUntils if you happen to know the definite time that something is going to occur. better to script directly then use a bunch of wait untils between scripts
yeah, that makes sense
I was ideally going to use an eventhandler, but I'm not sure if they work on ammo objects.
which one were you going to use?
probably Killed
i think the problem is I'm worried its possible for the EH to run after the object has been destroyed
could always experiment it by using "throw" check for _weapon on a fired event handler that stacks with a killed event handler on the object "throw" references. then use that killed event handler lol.
basically what I'm doing rn yeah
afaik it won't work
its in the config for the Grenade class that it'll run this code on Fired
what won't work?
the killed EH?
ye
just doesn't work on ammo
oh odd
I would have guessed the killed EH would just fire when the object was no longer alive
I think projectiles are created via a different mechanism in the engine
they're supposed to be more "frequent" than objects
so it kinda makes sense
yeah it does
anyway, I've always wanted at least killed or deleted EH for them too
I've asked in #arma3_feedback_tracker . let's see what happens
does commenting something out bassiclly just stop it from happening?
yeah the interpreter just passes over it.
ok so in regards to a sever my mission cycle is commented out would that be a issue if im just trying you do any mission?
/*
this is a comment block
*/
// This is a comment line
anything that is in these gets passed over
if they are outside, then you are fine
//hint "I wont run";
hint "But I will"
/*
hint "I wont run";
hint "I wont run";
hint "I wont run";
*/
hint "I will run"
ok that part makes sense
guess i dont know if it will have an issues until i try it then
none
except if they're defined in the config
oh, those are the only EHs that work on stuff in CfgAmmo?
dang
shame only the fired EH type works for those
fired doesn't work on them either
it does though, that's what I'm using right now to call my script
do you add it to the ammo?
class CfgAmmo {
class Grenade {
class EventHandlers {
class Kaboom {
fired = "_this execVM 'sg_kaboom\kaboom.sqf';";
};
};
};
};
this works
apparently this is a relatively new development
well config variant works
I thought you meant script
oh no I was talking about other config event handlers that I could use
I wonder if there's a deleted EH there
execVM
yeah yeah I'll fix it before I put it on the workshop this was just quick and dirty to make sure it works
Hi, could someone help me figure out which command i should use to remove the main rotor from a helicopter? I am currently using this command but it only damages the rotor :/ .. I found some tips on the net but I have trouble understanding them ๐ฌ
heliname setHitPointDamage ["HitHRotor", 1];
I am actually looking at that .. but I don't understand how to use it and even if it is what I am looking for https://community.bistudio.com/wiki/BIS_fnc_helicopterDamage
is there a simpler way of converting a direction and distance to a worldspace vector than just doing the math myself
Does anyone know the doorname for the BackAlley Wire Fence door in arma3? for use with Message6Exit animate ["Door_1_rot", 2];
/*
Author: Joris-Jan van 't Land
Description:
Handling EH-based helicopter damage
Parameter(s):
_this: EH arguments (Array)
Returns:
Bool
*/
//TODO: use new EH which returns actualt hitpoint names?
if ((_this select 1) == "main rotor") then
{
private ["_heli"];
_heli = _this select 0;
if (((_this select 2) > 0.999) && !(_heli getVariable ["HSim_mainRotorDestroyed", false])) then
{
private ["_handle"];
_handle = _heli execVM "hsim\air_h\data\scripts\main_rotor_destruction.sqf";
};
};
true
this is the function pull from the game.
like its just distance sin whatever but if there's a function for it i'll use that
give me the class name and ill look it up
nvm found it you can literally do this with getPos
yes
depends what you want
Land_BackAlley_01_l_gate_F
Animation Sources
"Door_1_locked_source"
"Door_1_noSound_source"
"Door_1_sound_source"
Thanks ๐ How are you able to look those up?
@little raptor the best mod made by this guy who makes it easy with his config viewer
animationNames 
oh you mean sources 
try eventually the alternative syntax of getPos
yeah i found it
Thanks guys ๐ Ill look that up for future use
@little raptor did you take your mod down from workshop?
no
Hmm, neither of the animation names seem to work
Really sorry but I don't really understand how to use it ๐ฅต
hmmm i click on the steam link from my launcher and it says it longer exists. interesting
that might not work at all since its pulling a file from hsim addon and I think thats their stand alone helicopter game
oh my god it works.
the previews are gone too! ๐
I was freaking out for a second
So there is probably no way to destroy the main rotor ? :/
standby
which heli you using?
WY-55 Czapla (I_E_Heli_light_03_dynamicLoadout_F)
vanilla arma?
Yup
AAF unarmed or armed
armed
so even setting specific parts of the heli, the rotors don't just fly off if thats what you want. even at full rotor damage, they just have holes in them. I also see no animation source for hiding the rotors or anything of that nature
even when crashing the heli the rotors don't come off.
Nop I just want to make it static crashed in a building but the blades go through the wall ...
It goes off when hitting something :/
But when using command to break it .. it only damage it at 100% but does not destroy it like a crash in a wall
Thx anyway for your answer ๐ !
SetObjectScale does work on a dedicated server, you have to run the command locally on every player.
it will be fixed in the next version
Now I can have my mini tanks on a table.
Anyone figured out a way to remove a single backpack from a container?
what class of backpack are you using
"B_AssaultPack_blk"
wait one and i'll put something together
sweet. removeItem is great but wont do backpacks
well you can always move them around! ๐
wait there's no command for that either 
I guess the best solution is to just transfer its contents
oh look workshop got fixed! ๐
testing my solution
works.
if !(isServer) exitWith {};
private _box = boxname;
private _backpackType = "InsertClassHere";
private _numToRemove = 1;
private _backpackCargo = backpackCargo _box;
clearBackpackCargoGlobal _box;
if (({_backpackType in _x} count _backpackCargo) > _numToRemove) then {
for "_i" from 1 to _numToRemove do {
_backpackCargo deleteAt (_backpackCargo find _backpackType);
};
_backpackCargo apply {
_box addBackpackCargoGlobal [_x, 1];
};
} else {
hint "Not enough backpacks for the amount you want to remove";
};
oh that is cool, and real simple too. thanks for working that out.
remember that its contents will be lost
should be a good fix for others loooking too! remove backpack, remove single backpack from player
it seems to just touch backpacks and put the rest back
SOO good, wow! thank you truly. Can i use this then?
it removes all of them and gives you empty backpacks instead
put items in them and they'll be lost
yeah why not? made it for you. I'm sure you can go deeper and keep the backpack inventories, but I'll let you figure that out after seeing this shell.
I see, for its current use the backpacks will be empty as is. good to know.
@scenic kestrel ive been using with great results [box, itemclassname] call CBA_fnc_removeWeaponCargo; if you use cba
it can remove just one item from a container, including groundWeaponHolders and such
just use the same but CBA_fnc_removeItemCargo , CBA_fnc_removeBackpackCargo, and CBA_fnc_removeMagazineCargo for the other types
leave it up to cba to have a solution. thanks for the info johnweston
"Money_roll" in (magazineCargo medBox);
Hey so yesterday I got some help to make this check to see if an item was inside a box.
How would I make it so I need 2 money rolls to make this condition true?
Use count
[]spawn {
while {true} do {
My_Box2 addMagazineCargo ["Antimalaricum",1];//example: this adds magazines every 10 seconds.
sleep 10;
};
};
```How can i remove one (1) magazine every 10 secs . lol i knw how to add but not to remove, besides i think the clearMagazineCargo will remove everything .
VanMoney = {(Money_roll) in _table} count (magazineCargo medBox);
then in the conditions of another trigger
VanMoney > 1 = VanTrigger=True;
I'll give this a try
hmm actually no don't thin that will work.
Trying to make it so all 3 items (2 money roles and a flash drive) are in a box at the same time
"Money_roll" in (magazineCargo VanBox1) &&
"FlashDisk" in (magazineCargo VanBox1);
Was doing this, I'll try this instead
>1 = {(Money_roll) in _table} count (magazineCargo medBox); &&
"FlashDisk" in (magazineCargo VanBox1);
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
@harsh vine we were just talking about that sort of thing, try this https://cbateam.github.io/CBA_A3/docs/files/common/fnc_removeMagazineCargo-sqf.html // you need cba tho
"FlashDisk" in (magazineCargo VanBox1);```
getting there error that "Generic Error in expression"
also where would be the best place to run so this effects all players since this is for a MP game mode
missionNamespace setVariable ["VanMoney",2];
@torpid quartz VanMoney has nothing to do inside the condition
_x is the tested element
how would i define _x as 2 or >2
To answer your second question. You have to make it public e.g.
setVariable ["VanMoney", 2, true];
_count = {_x isEqualTo "Money_roll"} count magazineCargo VanBox1```
there is even an example of this on the count page
Always good to read the docs
yeah was looking at them and a forum topic to figure out my first attempt
and oh hey, should have kept scrolling there are more of them lol
hmm still getting generic error messages
_count = {_x isEqualTo "Money_roll"} count magazineCargo VanBox &&
"FlashDisk" in (magazineCargo VanBox);
init:
missionNamespace setVariable ["VanMoney", 2, true];
{_x isEqualTo "Money_roll"} count magazineCargo VanBox >= 2 &&
"FlashDisk" in (magazineCargo VanBox);``` or something
oops hang on lol
Why you even need to declare VanMoney?
ok no changing VanMoney to _x didn't fix it
Yup that's ones working 100%, I'll keep that handy.
thanks so much!
you should really read some docs
this contains pretty much everything you need to know.
yeah might help when i'm running through wiki articles lol. thanks i'll take a read of it.
Hello, is possible to somehow modify CfgFunctions (which i defined in server pbo)
without restart server?
what about allowin recompile of functions? https://community.bistudio.com/wiki/Description.ext#allowFunctionsRecompile
Could someone explain Nand for me?
"Nand returns true if not both values are true at the same time"
Struggling hard to make sense of this 
and = and
Basically
if A = Green and B = Green
then do this
Nand = Not And
Also known as !&& in some languages
Not sure where you find this line tho...
Hello its out of topic but i have sqf related question. Can i ask it?
Its so simple i made a zone trigger, and if move out side selected zone it will kill. Its working great. But only problem is when i enter any vehicle in game, i start taking damage.
Which is not i want.
Here is my sqf file that i was trying run in trigger zone.
Check the pinned please
@vagrant parrot So, if A is green, and B is green, but at the time of running the code, A is red and B is red, then trigger? Because it's !&&, right?
Sorry.
I never said to delete it...
It was kinda long and i don't want to destroy the whole chat with that sqf.
It doesn't matter. Let skipper skip ๐ง
aright
correct
any ways is there any thing wrong there?
I think hold up
So uhh, how did you run it?
&& would be, if A = green && B = green, and they both are in fact green, then true.
!&& would have to be the opposite, no?
It is running i as intended. Player outside the trigger zone are taking damage like pugb or h1z1 (ish). But when a player is in vehicle its always taking damage. Inside trigger zone or outside.
How do i fix it ?
Rephrase it. How did you put it into a trigger?
So lets say we have A and it's green
we program logically
If A exists (To check ofc if I dont' call something that doesn't exist) && = Green
it's true
Now if we do the opposite
A exists and It's Red
IF A EXISTS !&& = Green
It's true
@turbid rapids
Logical operators
Always use Binary
is shorter and less performance intense
even though it's a minimal difference
I will try to fix it one more time if i fail, i will try to show you. Thank you anyways..
ยฏ_(ใ)_/ยฏ
nand is basically !(a && b), (!a && !b) makes it easier to understand maybe, in other words if both booleans are true, end result is false, if they're both false, its true, hope it makes sense ๐
What happens if one is true and the other false?
whats the point of the new "setCombatBehaviour" command if its immediately overwritten by the combat fsm? only things like "setBehaviourStrong" are useful
then it's true
And the inverse is true for &&, yeah?
If one is true, the other false, the result is false?
without the inversion, yes
i guess it allows you to set behaviour for single unit only?
๐ค
it's only useful when you disable AUTOCOMBAT
(if you want to use combat-aware-safe, stealth should be fine)
hi folks, what piece of script would make the helis rotors spin when its simulation is disabled
I think i saw one somewhere but cant find it anymore
no you didn't. it's impossible
it can have the rotating "look" (blurry blades), but a disabled simulation will stop the blades from rotating, definitely
so... REGEX support is dev branch only right now? damn...
Don't even think it's on dev branch
11-06-2020EXE rev.146461 (game) EXE rev.146461 (Launcher) Size: ~ 310 MB DATA Added: Base CfgDustEffects classes to config (CfgDustEffectsAir, CfgDustEffectsMan, CfgDustEffectsCar, CfgDustEffectsTank, CfgDustEffectsTankSmall) and implemented them on vanilla vehicles - FT-T131130 Tweaked: Appearan...
according to some of the docs it is:
https://community.bistudio.com/wiki/Category:Command_Group:_Regular_Expression_(Regex)
i.e. https://community.bistudio.com/wiki/regexMatch => "โ DEV BRANCH ONLY โ "
hmm okay
We add new commands as soon as we are know they are set in stone, although that doesn't has to mean that they are already available
already added 'where' (?), not in the live version.
i.e. "I'm a coOkIe clicker" regexMatch ".*cookie.*" does not do anything
Added to the biki*
oh well pff.... 'docs' is one thing, I thought we were talking "code on the ground", if you will
also just an observation, reading those pages, REGEX will be case insensitive? or case sensitive?
as you wish with the i modifier
ah ok I see. cool.
in terms of REGEX paradigms, seems close to PHP, in that family of regex?
thanks...
I don't do PHP, but afaik it's a bit different
dedmen said it was STL
oh he "switched"! ๐
not just a different library, but I also think that the syntax is different
both support perl syntax
any idea why this wouldn't be working as expected?
[_unit, _direction_vector, _magnitude] spawn {
params ["_unit", "_direction_vector", "_magnitude"];
_str = format ["VECTOR: %1, MAGNITUDE: %2, UNIT: %3", _direction_vector, _magnitude, _unit];
if (isPlayer _unit) then {
_str remoteExec ["hint", 0];
};
[_unit, [_direction_vector vectorMultiply _magnitude, [1, 0, 0]]] remoteExec ["addForce", 0];
sleep (ceil (_magnitude / 100));
_str remoteExec ["hint", 0];
_unit setUnconscious false;
};
addForce is working correctly, but the setUnconscious doesn't get called
_unit must local for setUnconscious
ah.
makes sense
technically addForce should also be local so I think I'll just remoteExec this spawned code
this is really odd. the magnitude value there being less than 100 should mean the spawned code isnt even run
oh, exitWith doesn't work how I think it does
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
Seems like highlighting doesn't show on my phone. Ignore above if you've done it correctly
yeah i did
Yea mobile version of discord does not show the highlighting
hey ive got some popup targets in a small shoot house ive got setup but you cant reset the swivel targets using the "terc" like with the popup targets, is there something different to put there so they reset or different method to do it entirely?
is there any best practices for what I should put in Extended_PreInit_EventHandlers versus Extended_PostInit_EventHandlers
Best practices?
You either need preinit or you need postinit
Not sure there are any practices. Use what you need
But you must make functions for them. Don't use call compile or execVM
what do you mean? you have to call compile if you're using XEH, unless you like provide the code directly in the config
call compile is fine for one-time exec
yep
and i mean it wouldn't make a lot of sense, you'd still end up having to call compile something that compiles init functions before you can call them in later init event handlers
good practice
I think I understand
I also need to quickly refresh on pre vs post since its been a while
there aren't any good practices, like Dedmen said, if you need to run something post init, do it in postinit, if you need preinit, do it in preinit etc
Yea I completely forgot that post is scheduled and pre is non scheduled. I just knew that pre ran before init eh of units/vehicles and post ran after
Wasting memory by storing something in ram that only runs once? Not really.
Also functions might not necessarily be ready at preInit
the init expression is unscheduled in both, it's your choice if you want to allow suspension via spawn
Oh I see
anyone know how to use a trigger to set a specific time? (all my google research just gave me skip time haha) i dont care about the day but i want a trigger to set my mission time to night time for a specific task in that mission, skip time wont work because its a free roam mission and only 1 of the tasks has to be at night so i have no idea at what time it might get activated
setDate
@timber bear it might be cool if you set the time multiplier and then stopped it once it reaches the desired time, that is if you want like a elderscrolls style wait effect https://community.bistudio.com/wiki/setTimeMultiplier
awesome will check that out thanx man!
ya that would be awesome! thanx man! However im using ravage and have a timemuliplier on by default but that shouldn't mess with it i dont think. But that should work i think! cause my task area is in the middle of no where with only 1 road leading in the rest is heavy forest, and once players enter this area it turns to night wolves start howling maybe throw in some other creepy noices haha
Mybe you can just use timeMultiplier to return what the current multipier is and then crank it up , waituntil desired time and set it back , the wolves sound cool btw good luck
Oh ya that would work! and thanx man! appreciate it!
what was the command to dump every sqf op again? 
EDIT: found it! https://community.bistudio.com/wiki/supportInfo
Hey, so i need a command for the console that spawns a vehicle, that's also an arsenal. I've tried with
["AmmoboxInit",[this,true]] spawn BIS_fnc_arsenal;
But that just doesn't even spawn the vehicle.
Tried that, it just spawns the vehicle without the arsenal
Also tell us more about what you mean by console?
The debug console
Oh ok
That one console that pops when you press ESC
Sorry if i'm not very detailed on this, i'm not that used to scripting
veh1 = "B_MRAP_01_hmg_F" createVehicle(position player);
["AmmoboxInit",[veh1,true]] spawn BIS_fnc_arsenal;
Ah, there it is. Appreciated a lot
@still forum how do we calculate how much force to apply with addForce, in order to move a physx object proportionally
like different force required for quad bike vs tank
but what value do we use
mass?
IIRC multiply with getMass will do
Heyo guys, hoping I could get a bit of help with setting up 2 separate camera feeds onto two diff screens. One shows up with live feed but the other is just black. Here is the script code, copied from KillZoneKid's script: https://www.sqfbin.com/nazuyexudaxaboliwufe
Any help is greatly appreciated, I've been trying at this all night, it's 9am now lol
Did you figure it out @turbid rapids
@hardy sierra Wrap it up with spawn and put sleep 0.1 before 2nd setObjectTexture.
God bless you, added sleep 0.1; where you said and it works now! https://gyazo.com/07382e5175c332677f00f049ace1b3d1
@vagrant parrot think so
๐
GetMass as POLPOX said.
But also remember to account for the moment (r x F)
Can anyone explain to me how to implement BIS Spectator to game when player dies, i know nothing and theres no good explanations i can find
https://community.bistudio.com/wiki/Arma_3:_Respawn
Play around a little with the "Spectator" Respawn Template.
https://community.bistudio.com/wiki/Arma_3:_End_Game_Spectator_Mode
This might have helpful information too.
right, thanks
If I set public variable of a global object a local script, would I be able to address the script globally?
script handle? they are local to the machine
What would it return on a different machine then?
either nil, scriptNull or you cannot broadcast it
is there any way to make an entityKilled missionEventHandler hint something locally to the killer?
you can check if the killer is the local player and hint accordingly
Could you give me an example?
because player and hint are both clientside, you can do if (_killer == player) then {hint "got kill";};
I've tried that but it doesn't work
did you declare _killer?
anyone have any idea on how to keep dead units ragdolling?
I assume this is a performance concern as to why they stop ragdolling after a few seconds or so, but I'd like to be able to dynamically re-enable it
oh. and would it be possible do you think to override vehicle explosions? Like ideally I would subclass the #explosion object type but I don't think this is possible
oh it seems I likely already am
is there a way to get the respawn location selected in the respawn position menu?
it should be. it's just a normal gui
my respawn position scripts are a mess based on the player's position after respawn it moves them to one of the nearby spawn locations, probably not the best way to make a "respawn area"
@fair drum back to the drawing board then, that could in theory be cool but you would need alot of "spawn locations" or a very controlled "play area"
You can create your own respawn template with custom script. Maybe that works?
well it works fine, but it sometimes throws people out of wack on the first mission spawn (respawnOnStart = 1). every other spawn works correctly
Has anyone experimented with the addForce command that now works on units? SQF _unit addForce [_unit vectorModelToWorld [0,-200,0], _unit selectionPosition "rightfoot"];
Don't know why the wiki uses the rightfoot selection for this?
and also does the -200 is the amount of force applied or just the direction?
just a random selection to demonstrate.
it doesn't have to be a selection. just a point in model space
and the force amount?
a value large enough to move the unit, but don't actually send him flying
I think it assumes that each person weighs 75 kg?
why not use a trebuchet instead? they can use a counterweight to launch a 90kg stone projectile over 300 meters
Will try it in game, hope the command doesn't send my xenomorphs over the air
Hello Guys and Girls,
I'm trying to put an ambient sound into my mission, that plays around a certain object and should loop itself - and a second sound that should activate once a certain Hold-Action is started.
Currently I have the sounds inside the description.ext defined as follows:
class turnon
{
name = "turnon";
sound[] = {"\Sound\turnon.ogg", db+5, 1};
titles[] = {};
};
class humming
{
name = "humming";
sound[] = {"\Sound\humming.ogg", db+5, 1};
titles[] = {};
};
(If I play the sound locally with the "playsound" command, everything is working, that feels like the sound is correctly defined to me)
The init of the object where the sound should be played from looks like this
playsound3D ["humming",xyz,false,4,1,50];
(xyz is the object variable)
I tried to omit the PosASL part of the array because I want the source object to be used as the emitter, but it doesn't work obviously. I tried entering the exact coordinates of the object before with [], but this did not work aswell. Any tips?
if you have defined your sound in the config use say3D
I tried to omit the PosASL
you can't "omit" an argument that falls between others
Great, it worked! Much easier than I thought. Thank you very much!
Follow-up question: How do I loop that sound indefinitely?
you can try while with a sleep value equal to sound duration
e.g:
_last_source = objNull;
while {true} do {
deleteVehicle _last_source;
_last_source = xyz say3D "blabla";
sleep 10; //insert sound duration here
};
I've put this now inside the objects init:
nul = [this] spawn {while {true} do {(_this select 0) say3D "humming"; sleep 45;};};
and it worked flawlessly. thank you very much!
it's better to delete the sound source
in case the game doesn't
Okay, I'll fix that, thank you!
What is the best way to assign a side color to an object in a list? Getting the side from config and using BIS_fnc_sideColor doesn't work reliably since
configfile >> "CfgVehicles" >> "Land_Target_Dueling_01_F" >> "side" //Returns 8, which is sideEmpty โ correct
but
configfile >> "CfgVehicles" >> "Land_Bench_05_F" >> "side" // Returns 3, which is sideCivilian โ incorrect
any more reliable way?
Edit: I guess I have to combine "faction" and "side" -_-
how do I find a list of radioNames from cfgRadio?
same with other configs, how can I access a list to view all my options. such as cfgSounds
read the config:
"true" configClasses (configFile >> "CfgSounds") apply {configName _x};
how do I remote execute something in side chat? like what about the other parameters?
"Message" remoteExec ["sideChat"];
I need the side and the identity
no
idk if your message you linked helps tho
because I already know how to do it for systemchat
but now im doing it for side chat and i need other parameters and idk where to put em
there are more examples! ๐
anyway:
you leftArg is [blufor, "Identity"]
rightArg is "Message"
just paste them in the template:
[leftArg, rightArg] remoteExec...
[[blufor, "Identity"], "Message"] remoteExec ...
what's on the left of the command is leftArg
what's on the right is rightArg
either (or both) can be arrays with their own args
yeah thats why I was confused
this is the script I have, but its not working
waitUntil player inArea "marker";
[[blufor, "Some Person"], "message"] remoteExec ["sideChat"];
()
โฆ { }
oh
lol
waitUntil {player inArea "marker"};
[[blufor, "BLU"], "message"] remoteExec ["sideChat"];
this still isnt working and im not getting an error message
will the first line detect when any player enters the zone?
the first line will only determine if the player that executed the script is in the area. also have a look at the sideChat BIKI page. you can only use a set of predefined indenties, so "Some Person" should not work
It is currently in the initPlayerLocal.sqf shouldnt that execute the script for every player that joins?
in that case it's fine
ok
Trying to make a trigger that kills anything that enters it, a death barrier for a PVP mode so players cant leave.
It's on any player present conditions with
condtion
this && (player in thislist)
activation
player setDamage 1;
this would only kill the players in the trigger right any not everyone on the server? just making sure since i can't get anyone to test right now.
Why though, there is already a function for that purpose.
what's the function? been googling death trigger and kill barriers for arma and this is the best thing I've found so far. Down to try alternatives.
Module list > Other > Zone restriction
oh cool didn't know about that, having a warning is pretty good. I'll give it a go
Does headless client run initPlayerLocal.sqf?
i don't believe so. try running it in init.sqf but have a if (!hasInterface && !isServer) then {}
Ok, thanks
so im still a little confused about different type of variables. global, local, private, etc.
what is the difference between _variable and variable?
@past wagon Read the Variables page https://community.bistudio.com/wiki/Category:Scripting_Topics
I already read the wiki page on variables and it just confused me more
^
https://community.bistudio.com/wiki/Variables#Local_Variables_Scope
This literally says everything
variable is available everywhere on the client/server where it was initialized
_variable is only available in the script / scope it was initialized
I'm sure it does, I just dont understand what its saying
what does "where it was initialized mean"?
variable = 1;
[] spawn {
// variable is alive here
_variable = 2;
// _variable is alive ONLY here
};
// _variable is no more
// variable is still alive```
is getUnitLoadout not supposed to save your gun?
Yes, it saves every item, including weapon
_terrainobjects = nearestTerrainObjects [[11847.1,2544.43], [], 5];
{hideObjectGlobal _x} foreach _terrainobjects;
where am I missing a ; on line 1???
Seems like you have an extra semicolon before the forEach @past wagon
getUnitLoadout this doesn't apply to vehicles does it? Is there an equivalent command which does?
You would need to use something with getBackpackCargo, getMagazineCargo, and getWeaponCargo
Afaik there isnt one command to get it all
Sounds like it's still impossible to correctly serialise vehicle inventory all these years later
I just normally smash the results of the other commands together and compare that way
It is possible, but it needs scripting. There is unfortunately no command which handles it all
Iirc attachments on weapons in backpacks in vehicles was a problem?
Potentially https://community.bistudio.com/wiki/weaponsItemsCargo ?
Might only check current weapon tho
syntax error on hideObjectGlobal. look at wiki page of that command
Whats the reason that if i spawn a building item locally ingame (custom model). That half of the object has a null cursortarget and I can just pass through it? But if i place a new object next to it, the cursortarget of the original object now fully covers the model and I cannot walk through it anymore?
is it big?
yes
Well wait, define big. Its a metalfloor from the original dayz if you remember that, but 4x in one model
Thing is if I spawn the object normally with createvehicle instead of createvehiclelocal there is no issue
thats what interests me
try it closer to origin see if it still happens
if it doesn't it's the lod issue I said
You mean move the object so its 0,0,0 to me in-game?
setPosATL [0,0,0]
ah ok
that is if it's not water! ๐
VR is the best for such tests
Hi Mates, i got some problems with params directives, maybe im to dumb to understand but maybe its another thing
I got the following definition and then call it, but it generates every time generic error
rebru_fnc_spawnCargoPlane = {
params [ "_modulePos", "_cargoPlaneData", "_cargoData"];
_modulePos params ["_modulePosX","_modulePosY","_modulePosZ"];
hint _modulePos;
};
// Calling
[ getPos player, "test", "test"] call rebru_fnc_spawnCargoPlane;
it's fine
except for the hint
that's what's giving you error
_modulePos is array
ah this is only possible with format right?
str
like systemChat format["pos is %1", getPos player];
ah ok, thx i'll give it a try
format works too but str is shorter
works, thanks a lot Leo
np
does anyone have a repro for the flying tanks/vehicles issue?
yes
can has?
see the first image here:
https://steamcommunity.com/sharedfiles/filedetails/?id=2191542091
on stratis?
yeah
I also mentioned the class name of the building in description
You can find one instance of this building about 800 m east of Stratis Airbase, next to the end of a road which you should be able to find easily (GRID: 025055). You can also place the building yourself (Land_i_Stone_Shed_V1_F)
@little raptor I fixed it, it was the classic arma rooty tooty you have to put setPos after setvectordirandup else it breaks

when I call a code, does it inherit the this from the scope it was in?
Do you mean _this or this?
this, yes
_this, depends
@little raptor Is there a limitation of waitUntil in a function? Because i want to transfer my execVM Scripts into functions, but got generic error. My suggest is, that there is something different from call vs execVM?
no
you probably called it?
or didn't define the function properly
rebru_fnc_spawnCargoPlane = {
params [ "_modulePos", "_cargoVehicle", "_cargoItems"];
_modulePos params ["_modulePosX","_modulePosY","_modulePosZ"];
_cargoVehicle params ["_faction","_cargoPlane", "_range" ,"_direction", "_height", "_speed"];
_cargoItems params ["_cargoItem", "_cargoAmount", "_useChute", "_delay"];
private _spawnPosition = [0,0,0];
private _despawnPosition = [0,0,0];
private _dropPos = [ _modulePos select 0, _modulePos select 1 ];
// Spawn Cargo Plane
private _veh = [_spawnPosition, _direction, _cargoPlane, _faction] call BIS_fnc_spawnVehicle;
private _vehicle = _veh select 0;
_vehicle flyInHeight 200;
//_vehicle setVelocity _velocity;
// Move to Position
_vehicle doMove (_dropPos);
// Warten bis da
hint str _dropPos;
// GENERIC ERROR (but getPos _vehicle and _dropPos are defined and correct (3D Position))
waitUntil { getPos _vehicle inArea [_dropPos, 100, 100, 45, false]; };
// Move CargoPlane back to Spawn
//_vehicle doMove (_despawnPosition);
// Warten bis da
//waitUntil { getPos _vehicle inArea [_despawnPosition, 200, 200, 45, false]; };
// Delete Vehicle
//{ deleteVehicle _x } forEach (crew _vehicle); deleteVehicle _vehicle;
};
the waitUntil directive works in execVM, but since i moved it into a function a generic error is thrown.
The important question is: How do you execute this code?
[getPos player, [east,"RHS_TU95MS_vvs_old", 500 ,"N", 200, 200], ["CUP_B_Mastiff_HMG_GB_W", 1, true, 0.30]] call rebru_fnc_spawnCargoPlane;
call
call waitUntil?
where do you exec it from?
Console in MP
You mean, i should spawn my own function instead of calling it?
yes
i'll try
Thx a lot, now i can go further ๐
prints: [west,"testers"]
so im trying to use the alive command to check if a helicopter is still "alive". but im having a hard time getting the alive command to see the variable i gave the helicopter
the code im using looks like this
(alive airframe1[select 2]);
keep in mind i spawned the helicopter using BIS_fnc_spawnVehicle
does anyone know how i can get the alive command to see the helicopter?
get the variable returned by BIS_fnc_spawnVehicle and use that for alive check
right
wouldnt the variable returned by BIS_fnc_spawnVehicle be the variable i gave the helicopter in the first place?
airframe1 = [getMarkerPos "mrk1", 140, "B_Heli_Attack_01_dynamicLoadout_F", _crew1] call BIS_fnc_spawnVehicle;
dude i was so close, thank you
np
worked like an absolute charm again thank you
Is there a way to find out if someone has been shot with scripts?
shot with scripts
wat?
Shot *Using scripts, my bad
event handlers
Im using ace medical, not sure if there is a way to detect if a player is damaged
thank you ๐
If I am running the setobjectscale command in PreInit from server exec does this stop it from working with 2.04? It seems to be for me. Does just running it normally from server work for all clients? Thanks.
Is it possible to add a highlight around objects and units? Like a green border or something?
can I check to see how many people are inside a marker area?
I don't think so. But I'm not sure either
Use a trigger,: {alive _x && side _x == WEST && vehicle _x in thislist} count allunits == {alive _x && side _x == WEST} count allunits
ok
ZonePopulation = allPlayers inAreaArray "Marker";
would that work?
what if I want to know how many blufor and how many opfor players are in the zone separately? kind of like KOTH
Question: if you call a function will the script that called it wait until that called function finishes and then the calling script resumes?
If I want to fire off a function into the dark and let it do it's own stuff while my caller script continues regardless, what do I use? Is it spawn?
Ah I see now.
you can use units east/west with inAreaArray, or count that ZonePopulation array for each side
so something like this?
ZonePopulationBlufor = Units west inAreaArray "Marker";
units
Hello
i'm trying to override default K key action (Compass), but not working anyone know why?
(findDisplay 46) displayAddEventHandler ["KeyDown", "if (_this select 1 == 37) exitWith {true}"];
override it using actions
it is
use mouseButtonClick event handler (or some other mouse EH)
Im trying to set up a training scenario for a unit im in. One team of 5 people will defend an objective, one team of 5 will attack. Obviously, i dont want them killing each other, so i have an idea for a script which will check for if a player has been made unconscious, in which it will then:
Find the player that is unconscious,
Fully heal and revive the player,
Remove their weapons to simulate being dead.
UsingUnit1 getVariable ["ACE_isUnconscious", false];tells me if a unit is unconscious, but it doesnt check continuously. I dont want to use 10 different scripts for 10 different players, so my plan is to put that in a loop, like this:
Unit1 getVariable ["ACE_isUnconscious", false];
if Unit1 ACE_isUnconscious = true
_Conscious = false```
would this work?
they might've implemented an event handler for it that you can use
ZonePopulationBlufor = Units west inAreaArray "Marker";
Ive had a brief look online, ive only found this so far, but its possible. Ill check again ๐
how do I get a number of units from that?
count
search for isUnconscious in ACE repository (or unpack the medical pbos and search using Notepad++)
How do i search the ACE repository sorry ๐
Like the github page or something ingame?
I don't know if github has a file content search
if not you can clone it
Now that's a very overcomplicated version of ...
waitUntil {MyUnit getVariable ["ACE_isUnconscious", false]};
```... if I've ever seen one 
Go to the repository and type into the search bar, it will give you a couple search options.
btw that
is because your code won't work! ๐
( ) indeed ^^
can I do this to test what it returns?
ZonePopulationBlufor = Units west inAreaArray "Marker";
systemChat ZonePopulationBlufor;
str
how can I make systemChat say a variable?
systemChat format ["%1", _variable];
or simple, yet not accurate with strings
systemChat str _variable
so would this work?
ZonePopulationBlufor = Units west inAreaArray "Marker";
systemChat str ZonePopulationBlufor
yes
as lou said before
why don't you just test it? It's not gonna kill your pc or something
oh yeah
good idea
ok so I got what it returns
now how can I get a number from it?
i just need a number of how many units there are in the area
while Unit1 = {Conscious1} do {
Unit1 getVariable ["ACE_isUnconscious", false];
if Unit1 ACE_isUnconscious = true;
Conscious1 = false;
};``` apparently im missing a semicolon here, it may be a formatting issue, or i could be an idiot ๐
or all of them! ๐
why don't you use what ansin11 wrote for you?
I believe Lou said it wouldnt work? ๐ค
I did. but he fixed the error
Ahhh sorry, let me try it ๐
sleep 1;
[Unit1] call ace_medical_treatment_fnc_fullHeal;
removeAllWeapons Unit1;``` this is the full thing at the moment, hopefully ive got everything else right
it sorta works
but:
- why do you use
unit1? is this supposed to run for 1 unit only? - is it supposed to run once?
Well im testing it with a single unit to see if the idea works or if i have to scrap it
Yes, its supposed to be available to trigger by interacting with a laptop, after its run for all players, theyll be allowed to enter this Dead state once and it should reset them to normal after
also default for ACE_isUnconscious is false
they can't "die" anymore?
but its waiting until they are unconscious, so shouldnt it be true? or have i got that wrong
its just until they "die" once. then it should hopefully not run the script anymore and theyre able to take damage again
I believe there may be an issue with the fullheal script, ill try FullHealLocal
if the variable doesn't exist, it defaults to true and exits the loop
Ahhh so its a separate variable, nothing to do with weather it is conscious or not
no
also I'm not fully familiar with CBA, but I believe this is what you can use:
Alright, thanks for explaining it :)
you might be able to capture the ace_unconscious state with that "event handler"
and then you don't need loops
Im relatively new to scripting you see, and arma's language isnt like anything ive worked with before, so its quite a learning curve :D
With that said, you've been really helpful, thank you :)
["ace_unconscious", {
params ["_unit", "_isUnconscious"];
if (_isUnconscious) then {
// do what you want
}
}] call CBA_fnc_addEventHandler;
you can put a systemChat in it for testing
if it triggers, then you're in luck
that'd be a lot faster than a loop
@true frigate try this:
["ace_unconscious", {systemChat str _this}] call CBA_fnc_addEventHandler;
run it in debug console
then make yourself unconscious
see if you see a message
It returned 12 by itself lol
ok then, you can use it
see if this works:
["ace_unconscious", {
params ["_unit", "_isUnconscious"];
if (_isUnconscious) then {
[_unit] call ace_medical_treatment_fnc_fullHeal;
}
}] call CBA_fnc_addEventHandler;
make yourself unconscious again
this time you should be fully healed
Fully healed, but not awake ๐ค
Nvm, just bled out
๐
I know why
Remember i said FullHeal doesn't work
I need to change it to FullHealLocal :P
Hmm, still not working
add a bit of delay:
["ace_unconscious", {
params ["_unit", "_isUnconscious"];
if (_isUnconscious) then {
[_unit] spawn {sleep 1; _this call ace_medical_treatment_fnc_fullHealLocal};
}
}] call CBA_fnc_addEventHandler;
Is there a benefit to doing it this way? Because the way ive done it works, but im not sure on how to do it this way
faster
alright
ZonePopulationBlufor = Units west inAreaArray "Marker";
how can I get a number of units in the area from this?
Lou already told you
he did?
yes
:|
Eyyy the script works :)
when
you literally asked the same question :/
ik but no one responded
Under this message
wait what
He replied "count"
No worries
I think it's a global event so you should only add it on the server
but test it, cuz I'm not familiar with CBA
["ace_unconscious", {
params ["Unit1", "_isUnconscious"];
if (_isUnconscious) then {
[Unit1] spawn {sleep 1; Unit1 globalChat "Unit1 has been killed"; removeAllWeapons Unit1; _this call ace_medical_treatment_fnc_fullHealLocal};
}
}] call CBA_fnc_addEventHandler;
would this still work?
it has to be _unit
it works for everyone
Is there a way i can display whoever has been killed? say, in that example, its unit1
would i put _unit there or?
wdym "display"?
in chat?
[format ["%1 has been killed", name _unit]] remoteExec ["systemChat", 0];
https://cbateam.github.io/CBA_A3/docs/files/common/fnc_waitAndExecute-sqf.html instead of spawn :3
["ace_unconscious", {
params ["_unit", "_isUnconscious"];
if (_isUnconscious) then {
[_unit] spawn {
sleep 1;
_this remoteExec ["ace_medical_treatment_fnc_fullHealLocal", _this#0];
_this remoteExec ["removeAllWeapons", _this#0];
[format ["%1 has been killed", name _unit]] remoteExec ["systemChat", 0];
};
}
}] call CBA_fnc_addEventHandler;
should work
pretty sure that eh is fired globally
I thought remoteExec didnt work well on servers?
nvm
is it because its in a script?
what does that even mean
even if added on one client?
Someone told me, when i was first learning to script, to always use Tags and functions in the Description.ext instead of remoteExec
Nevermind
Im an idiot
I was thinking of ExecVM ๐
i mean, it's your choice really, either you add it to the client owning the unit(then remoteExec), or all clients
i guess maybe first one is better
or not 
Listen its past midnight for me Leopard, im allowed to be a little slow :P
ye
if it only triggers on the system that added the EH, then yeah
no, it calls an eventhandler lookup on all machines im pretty sure, then if they have it added, it runs the code
@true frigate try this first:
["ace_unconscious", {
params ["_unit", "_isUnconscious"];
if (_isUnconscious) then {
systemChat format ["%1 has been killed", name _unit];
if (local _unit) then {
removeAllWeapons _unit;
[_unit] spawn {
sleep 1;
_this call ace_medical_treatment_fnc_fullHealLocal;
};
};
};
}] call CBA_fnc_addEventHandler;
add it in initPlayerLocal.sqf
if it doesn't work, use this:
#arma3_scripting message
in initServer
init means it loads on server start yes?
how do I navigate to the conifg file?
or when someone connects
yeah
Ah you see i want it to be a one time thing that activates when someone interacts with a laptop
so i think ill stick with it being in an action
then add it with addAction
Yep, already done :)
Well everything in our training server is fully setup like that, you want a BRDM spawned for AT practise? Interact with a laptop. units spawned in a compound for CQB drills? Laptop ๐
You get the idea :P
what's wrong with them being revived at any time during the training?
We may need to do medical training, if that occurs, having everyone autoheal might be a problem :D
can i throw in a cheeky little _this setCaptive true;
["ace_unconscious", {
params ["_unit", "_isUnconscious"];
if (_isUnconscious) then {
systemChat format ["%1 has been killed", name _unit];
if (local _unit) then {
removeAllWeapons _unit;
[_unit] spawn {
sleep 1;
_this setCaptive true;
_this call ace_medical_treatment_fnc_fullHealLocal;
};
};
};
}] call CBA_fnc_addEventHandler;
no
put it before spawn
sooo
i need to learn those cba macros
["ace_unconscious", {
params ["_unit", "_isUnconscious"];
if (_isUnconscious) then {
systemChat format ["%1 has been killed", name _unit];
if (local _unit) then {
removeAllWeapons _unit;
_unit setCaptive true;
[_unit] spawn {
sleep 1;
_this call ace_medical_treatment_fnc_fullHealLocal;
};
};
};
}] call CBA_fnc_addEventHandler;
those ones are mostly internal
plus I'm sure not even CBA members know them all! ๐
yeah
Alright ๐
i was reading through a bunch of them the other day trying to understand things happening in other mods from the members. pages of gibberish lol
most of them are unused, only there for backwards compatibility
setCaptive isnt working ๐ค
even tried it in debug menu with Unit1 setCaptive true;
i just want to read the files so i have the strings to use. where can i find the config files in my file folders?
I had the wrong syntax, ignore me
what do you mean read the files ?
use loadFile then
do you have leo's advanced developer tools? grab it if you don't. then go to the debug, and hit config viewer
easy to navigate and search
I just need to find the file in my file folder
not in a script or anything
where are those files located
i just wanna know where to find the config files
@copper raven
I got everything working how i want it, now im gonna go to sleep, its 1:30am ๐
what if I do a while loop inside a while loop?
ZonePopulationBlufor = Units west inAreaArray "ObjectiveMarker";
BPX = count ZonePopulationBlufor;
ZonePopulationOpfor = Units east inAreaArray "ObjectiveMarker";
OPX = count ZonePopulationOpfor;
ObjectiveScore = 0;
while { true } do {
while { OPX >= BPX * 2 && ObjectiveScore < 300 } do {
sleep 1;
ObjectiveScore = ObjectiveScore + 1;
};
while { BPX >= OPX * 2 && ObjectiveScore > 0 } do {
sleep 1;
ObjectiveScore = ObjectiveScore - 1;
};
};
those won't loop at the same time
its going to wait for the first inside loop to finish, then go onto the second inside loop, then loop the outside
yeah but when it goes to the loop outside, the whole process starts over, right?
yes, it would go back to the first inside loop
and you'll want to add a brief sleep to the outside loop too
outside the while { true } loop or outside the smaller loops?
OPX => BPX
wat?
>=
reads just like you say it. you don't read... is equal to or greater than
it is unfortunate that the arma subreddit has devolved into an image posting board over the years...
how can I use a variable array with setMarkerAlpha?
this is what im trying to do:
_objective = "Objective1";
_objective setMarkerAlpha 1;
will this work?
"Objective1" is a marker
Hey, I'm trying to put a language check into a script, I was just wondering if I should compare using the "classname" or "in-game name" strings, eg;
List of languages (Each has a classname and ingame name) https://community.bistudio.com/wiki/Stringtable.xml#Supported_languages
The command to test language only has an example using English which has the same classname as ingame name which makes it kinda confusing :P https://community.bistudio.com/wiki/language
AKA Should I put (language == "Polish") or (language == "Polski")?
is going to assume classname.
className is the always goto when you're about to script something
Just the same thing that you won't put "Hunter" into createVehicle but "B_MRAP_01_F", classNames are always unique
Does anyone know what might be the problem with my script?
//VARIABLES
ZonePopulationBlufor = Units west inAreaArray "ObjectiveMarker";
BPX = count ZonePopulationBlufor;
ZonePopulationOpfor = Units east inAreaArray "ObjectiveMarker";
OPX = count ZonePopulationOpfor;
ObjectiveScore = 0;
Objective = 1;
//OBJECTIVE SCORE
while { Objective <= 7 } do {
_currentObjective = call {
if ( Objective == 1 ) exitWith { "Objective1" };
if ( Objective == 2 ) exitWith { "Objective2" };
if ( Objective == 3 ) exitWith { "Objective3" };
if ( Objective == 4 ) exitWith { "Objective4" };
if ( Objective == 5 ) exitWith { "Objective5" };
if ( Objective == 6 ) exitWith { "Objective6" };
if ( Objective == 7 ) exitWith { "Objective7" };
while { OPX >= BPX * 2 && ObjectiveScore < 300 } do {
sleep 1;
ObjectiveScore = ObjectiveScore + 1;
_currentObjective setMarkerColor "colorRed";
};
while { BPX >= OPX * 2 && ObjectiveScore > 0 } do {
sleep 1;
ObjectiveScore = ObjectiveScore - 1;
_currentObjective setMarkerColor "colorBlue";
};
if ( ObjectiveScore >= 300 ) then {
Objective = Objective + 1;
ObjectiveScore = 0;
_objectivesChanged = call {
if ( Objective == 2 ) exitWith { ["Objective1", "Objective2"] };
if ( Objective == 3 ) exitWith { ["Objective2", "Objective3"] };
if ( Objective == 4 ) exitWith { ["Objective3", "Objective4"] };
if ( Objective == 5 ) exitWith { ["Objective4", "Objective5"] };
if ( Objective == 6 ) exitWith { ["Objective5", "Objective6"] };
if ( Objective == 7 ) exitWith { ["Objective6", "Objective7"] };
};
_previousObjective = _objectivesChanged select 0;
_newObjective = _objectivesChanged select 1;
_previousObjective setMarkerAlpha 0.5;
_newObjective setMarkerAlpha 1;
_previousObjective setMarkerColor "colorBlack";
"ObjectiveMarker" setMarkerPos [getMarkerPos _newObjective];
"ObjectiveMarker" setMarkerColor "colorBlue";
}
else {};
_currentObjective setMarkerColor "colorGrey";
};
opfor addScoreSide 100;
sleep 5;
"SideScore" call BIS_fnc_endMissionServer;
What is the problem? I roughly read it and Objective = 1 is illegal
why is that illegal?
= is to declare, not compare
ohh yeah
So, what is the problem you're facing? Any errors? Without it we won't spend our effort to read it...
yeah the thing is im not getting any errors
i havent been getting errors for some reason
Then you probably didn't even run it?
lemme test again one sec
the script should definitely be running.
its in initServer.sqf and im testing on MP
use https://community.bistudio.com/wiki/format instead of those comparisons 
hey guys, in MP, is it possible to send people to spectator when they die, and after a certain trigger is activated spawn them again in a certain place?
example:
- player dies
- player spectates alive friend
- alive friend secures objective
- player is respawned at objective
https://community.bistudio.com/wiki/Arma_3:_End_Game_Spectator_Mode#Spectate_when_dead
This might inspire you ๐
_currentObjective = call {
if ( Objective == 1 ) exitWith { "Objective1" };
if ( Objective == 2 ) exitWith { "Objective2" };
if ( Objective == 3 ) exitWith { "Objective3" };
if ( Objective == 4 ) exitWith { "Objective4" };
if ( Objective == 5 ) exitWith { "Objective5" };
if ( Objective == 6 ) exitWith { "Objective6" };
if ( Objective == 7 ) exitWith { "Objective7" };
}
Well thats certainly a new and creative way of just to not wanting to use an array...
its not running. You have a syntax error you're missing a };
Also that's nonsense: else {};
Also please just use an array oof..
either that or format
thanks, but how do i prevent players from respawning until a trigger is activated?
as "BASE" respawn behaviour is like this:
If no markers at all are found, respawn unit where it died.
so even though i remove all respawn points they will still respawn after the timeout
is it possible to change respawn type mid mission? i dont know how to as respawn is defined in the description.ext
Good day. How do you get correct comparison for UAV drones and static weapons? I tried this, took names from A2 CFG, thought it didn't change, but it's not seems to be working
_isDrone = _object isKindOf "UAV";
_isStaticWeapon = _object isKindOf "StaticWeapon";
private _isDrone = getNumber (configOf _object >> "isUav") == 1
StaticWeapon should work for statics
Aha, let me try.
and correction - static weapon check is working
Works like a charm, thank you
actually, https://community.bistudio.com/wiki/unitIsUAV use this
if you didn't have object reference(only classname), then it would be correct to use the config lookup,
Yeah, that looks even better, thanks a lot ๐
I've never done what you're trying to do, so I don't have a solution, I'm just sharing some ideas.
You could use setPlayerRespawnTime or use a large value for the description.ext attribute.
I believe onPlayerKilled.sqf even works without respawn enabled, so you might not have to use the respawn system at all.
i see, so i set default respawn time to like 9999 and then after trigger activated do setPlayerRespawnTime 0 to force player to spawn, the reset it back to 9999 right?
i guess it can be a workaround, but will have to test
also found this function, from what i understand the description says that you can change respawn types, however it also said "Internal use." not sure what it means
https://community.bistudio.com/wiki/BIS_fnc_selectRespawnTemplate
Hello there,
Have a quick question : Is there a way to open the UAV terminal without having one in its inventory or gps slot?
For technical reasons I would have to be able to use the UAV terminal but keeping the GPS in the GPS slot.
I only found this command:
player action ["UAVTerminalOpen", player];
But according to the documentation and my tests, it requires the UAV terminal in the GPS slot.
that command just simulates pressing "open uav terminal" in action menu
so if you don't have the uav terminal, you normally wouldn't get the action
means, it won't do anything
and as far as i'm aware, no, maybe you can try doing some UI hacking, and creating the UI manually
(complete wild guess)
What are you getting at here?
loading sqf bytecode which has optimizations, i.e [0,1,2,3] literal normally is 5 sqf instructions, while optimized is just a single push instruction
Is it possible to add https://community.bistudio.com/wiki/Arma_3:_Sensors_config_reference to a player?
So his equal tos, you'd convert the number to a string for faster speed?
no, it has nothing to do with that
Can you do a quick example? Maybe I'll understand from that.
sqf array is created by pushing all elements onto stack(push instruction per element), then popping them and pushing an array onto stack, if all elements in the array are constant, you can optimize it down to just directly pushing the array onto stack with its elements(because you know them at compile time)
hopefully this makes it easier to understand
[0,1,2,3] select 0;
//somewhere in init TAG_numbers = [0,1,2,3];
TAG_numbers select 0; // will be faster than above select
it's still not perfect because in the init, it'd still be 5 instructions, but atleast you save some runtime later
Oh so it's something I already do. I never just list an array before a modification. It's always stored before hand.
[0,1,2,3] select 0;
//is
push 0
push 1
push 2
push 3
makeArray 4
push 0
callbinary select
TAG_numbers select 0;
//is
gvar TAG_numbers
push 0
callbinary select
[0,1,2,3] select 0; could be just
push [0,1,2,3]
push 0
callbinary select
Is there a way to alter Class of object without making a custom PBO? For example, adding a sensor to a vehicle
nope
Can someone help me with some basic remoteExec stuff? I have my regular hintSilent working, but I don't understand how to use it in remoteExec. Assuming I placed everything where it's supposed to go, the quotations marking the params interact weirdly with the hintSilent stuff.
//remoteexec, doesnt work
"format ["Time Left: \n %1", [((_time)/60)+.01,"HH:MM"] call BIS_fnc_timetostring];" remoteExec [hintSilent];
//old version, works (but only locally)
hintSilent format ["Time Left: \n %1", [((_time)/60)+.01,"HH:MM"] call BIS_fnc_timetostring];
thx I'll take a look at that
@winter rose can you pin this plz?
#arma3_scripting message
if not good let me know how to improve it
i will say, remote exec, the concepts of setvariable/getvariable, variable locality, and MP locality are the top 4 things that mess up newer scripters.
seems like those are the things we answer the most often
when youre paid by the hour, not per project.
another issue that you have is putting " in "
in that case you must double them (""):
hint "he said ""hello""." //shows: he said "hello".
Is it possible to have the intro text you set up from the Attributes tab pop up via a trigger?
Or smth else which would give me the same/similar result
yes by using this function in the trigger: https://community.bistudio.com/wiki/BIS_fnc_infoText
is else {}; invalid?
if used as a unary like that yes, but in your case it's not invalid, it just doesn't make sense because you don't do anything in the code
is attachTo clientside?
no
wait so I dont need an else statement at all?
you don't do anything with it
x = 5 is assignment, not comparison
oh yeah
that was just an example but
yea
i didnt even realize that you could have an if then statement without an else
why would that be a thing
idk
didnt occur to me
can I use != to mean 'not equal to'?
for example:
if ( x != 5 ) then {
x = x + 1
};
yes
Is it possible to use a script within a config to temporarily change the value of a variable in that config?
Specifically, I'm trying to add an ACE interaction to a mine to 'bury' it (move it -0.25m on the Z axis), and change it's mineInconspicuousness value - it's that second step I'm trying to parse.
Is it as simple as _this setVariable ["mineInconspicuousness", ("mineInconspicuousness"+50)]? I wasn't sure if setVariable is applicable to this case.
(I realize I also might need to define a local variable to store mineInconspicuousness if I'm changing it to a relative value)
no
As in "not possible"? OK. Thank you!
just create two mines
delete the other and replace it with the "inconspicuous" one
Hello everyone. I have been asked an very interesting question and i would like to ask you guys if you might have an awnser to that:
Is it possible to enable 3rd Person view (in vehicles or in general) for an individual player via Debug Console as an admin?
Background:
<22:45:38> "###": I have a question for you that I would rather ask with not having everyone else know regarding because it would cause a whole thing if people start thinking about it being possible. I have a friend who used to play Arma 3 with me on his servers, but gets motion sick from being in first person when in vehicles. Is there anyway that it could be done so he could have third person in vehicles when on the server and still go back to first person while walking?
If this is not the right channel, please accept my apologies and point me in the right direction. I'm already checking the wiki but havent found anything so far.
Also feel free to @ping me when you have an awnser for me, i would appreciate it!
It exists as a difficulty setting, as well as a scripted solution
I am aware of the difficulty setting, but ahvent found the scripted thingy yet
switchCamera iirc
thank you!
I see what i can figure out, i not really deep into code but i'll see how ican make this work
If in doubt, the channel is here to help
โค๏ธ
@little raptor Hey ive got a problem, when i try the script in SP, it works fine, in multiplayer on my hosted server, it only works for me, no one else has the healing effect
if you're using this version:
#arma3_scripting message
it should be put in initPlayerLocal
Did I do the BIS_fnc_AAN correctly? Does it need to be remotely executed or will it execute globally for all players? did I do the structured text correctly? and did I do str player; correctly?
initServer.sqf:
penisSurgeon addAction ["Inquire about Penis Surgery", "penisSurgery.sqf", nil, 1.5, true, true, "", "true", 5, false, "", ""];
init.sqf:
largerOrSmaller = 69420;
waitUntil { largerOrSmaller != 69420 };
if ( largerOrSmaller == true ) then {
str player;
[parseText "<t size='2'>player has Recieved Penis Surgery!</t>",
parseText "player chose to make his penis larger because it was too small!"] spawn BIS_fnc_AAN;
};
if ( largerOrSmaller == false ) then {
str player;
[parseText "<t size='2'>player has Recieved Penis Surgery!</t>",
parseText "player chose to make his penis larger because it was too small!"] spawn BIS_fnc_AAN;
};
penisSurgery.sqf:
largerOrSmaller = ["You can get penis surgery to adjust the size of your penis! Would you like to make your penis smaller or larger?", "Penis Surgery", "Larger!", "Smaller!", displayNull, false, false] call BIS_fnc_guiMessage;
removeAllActions penisSurgeon;
this is a very important script that is crucial to the mission so I need to get it right
AFAIK addAction has a local effect so it probably needs to be remoteExec'd if you want all players to have it, not sure about BIS_fnc_AAN and it looks like the wiki is outdated for it
ok
I get an error in penisSurgery.sqf that says "unable to create message box" with BIS_fnc_guiMessage
waitUntil { largerOrSmaller == true };
why would this statement return nil?
can a variable be a number and then be changed to true/false?
you can define 1 to mean true with #define, but that probably not what you want
im sorry wut? penis surgery?
dont worry about it
and no thats not how you do a waituntil
what did i do wrong?
waitUntil { largerOrSmaller };
ohhhhhh
if larger or smaller is true, you just call the variable
im retard
thnaks
@fair drum would the waitUntil statement work in this case:
waitUntil { largerOrSmaller != 69};
if largerOrSmaller is a number, yes
ok
one sec let me show you the whole script
init.sqf:
largerOrSmaller = 69;
penisSurgeon addAction ["Inquire about Penis Surgery", "penisSurgery.sqf", nil, 1.5, true, true, "", "true", 5, false, "", ""];
waitUntil { largerOrSmaller != 69};
if ( largerOrSmaller == true ) then {
str player;
[parseText "<t size='2'>player has Recieved Penis Surgery!</t>",
parseText "player chose to make his penis larger because it was too small!"] spawn BIS_fnc_AAN;
};
if ( largerOrSmaller == false ) then {
str player;
[parseText "<t size='2'>player has Recieved Penis Surgery!</t>",
parseText "player chose to make his penis larger because it was too small!"] spawn BIS_fnc_AAN;
};
penisSurgery.sqf:
largerOrSmaller = ["You can get penis surgery to adjust the size of your penis! Would you like to make your penis smaller or larger?", "Penis Surgery", "Larger!", "Smaller!", displayNull, false, false] call BIS_fnc_guiMessage;
removeAllActions penisSurgeon;
can a variable change from a number to true/false?
i basically want the waitUntil statement to wait until the variable equals either true or false
so I set the variable to a number at the beginning and said "wait until this variable isnt a number anymore"
