#arma3_scripting
1 messages · Page 45 of 1
Is there a way to read profile settings in SQF?
I'm trying to attach a reflector light to the player and have it move according to the player's head movement doing it like this:
flashlight = "Reflector_Cone_01_narrow_white_F" createVehicle [0,0,0];
flashlight attachTo [player, [0,0,0], "head" , true];
but it is not accurate because the light is not centered when the player is crouch or prone so i want to do it like this but i cant get it work properly:
flashlight = "Reflector_Cone_01_narrow_white_F" createVehicle [0,0,0];
flashlight attachTo [player, [0,0,0], "head"];
addMissionEventHandler ["EachFrame",
{
flashlight setVectorDirAndUp
[
(player selectionPosition "head") vectorFromTo
(player selectionPosition "head" vectorAdd (getCameraViewDirection player)), [0,0,1]
];
}];
selectionPosition is in local coords
getCameraViewDirection is in world coords
attached object directions must also be local
it is not accurate because the light is not centered when the player is crouch or prone
your each frame one is not any better anyway. you're still attaching it
you need to move the light every frame too, using the position of the head bone in res LODs
imo first try your original code but try other bones instead
see if you can find one that better matches the head movement
such as neck or neck1
Hi guys, just wanted to quickly ask a simple question
ELI5 moment, but why do arma 3 linux servers not support uppercase letters? Sounds extremely silly to me, but surely there's a reason why
Ok, consider what happens if a mod miscases a path. On Windows it works anyway. On Linux it doesn't. By forcing all file references to lower case on Linux you can at least make it work by lowercasing the filenames.
To expand, that's because on Linux, file paths are case-sensitive and on Windows they are not, at an OS level
Also it's not a total ban on uppercase letters, you can use uppercase in scripting and other stuff, it's just file paths that are affected
Hi!
Is there a way to get rid of all the terrain airport waypoints?
I am talking about the ilsPositon, ilsTaxIn, ilsTaxiOff
I was thinking about deleting classes like secondary airport class in my own mod config.cpp (not terrain config.cpp itself)
However there is no class defined for the main airport (ID=0). At least as far as i could understand/research.
Reason for that is i am trying to place dynamic airports on the existing airports. This would for example allow me to dynamically change the taxiOff paths.
can anyone confirm if
_agent setVelocityModelSpace [x, y, 3];
does NOT add to the Z velocity of an agent?
Do they perhaps have different physics compared to a normal unit?
Edit: animals cannot use this command, it works with human agents without issue
I could achieve my planes landing from different approaching vector as it is hardcoded in the terrain but as soon as the plane is landed it will not follow the dynamicairport anymore and prioritise the hardcoded taxiOff path.
did you try with the agent being off the ground?
no, but the behavior is consistent with anything else beside animal classnames. Animals just doesn't seem to like jumping right now.
Could anyone help me with an object i've made, the engine doesnt consider it an entity as it does not appear when using "nearEntities" I have no idea why
It appears using this, but I need to get a bunch of the objects all across the map. I was intending to search for them using entities and the class name as the type
nearestObjects isnt very efficient compared to that...
That uses object type as a defined number though does it not?
ya it wont take a string
Is there a way I could make "entities" work @meager granite ?
weird, the alternative syntax on the wiki talks about a string, but it errors in engine
You want all the objects on the map of one classname?
I'll give that a try, thanks! Right now I managed to get the effect with nearestObjects and using the worldsize
I still dont get why "entities" wouldnt work though
What object are you creating?
I was an object I modded in, not one from base game. The object is spawned in 3den editor
How it is spawned matters the most
I'm looking to make a system for an AI on my scenario but I can't do it at all. Or even understand or know how to do it.
Example, I have an AI that shoots MG, a GunnerCrew. I want this one once more ammo at all. Automatically receive ammunition so that he is not lost and can continue to fire. Until he dies.
I checked on a command with the "SetVehicleammo" but I did not understand everything, as well as whether to use an init.sqf or other.
is there a way to use double set in one command to set a subarray entry? e.g. I have an array with subarrays and i want to set a subarrayentry that is not at the first position. Would it work someting like: array set [2, set [3, "test"]]; Would that set the fourth subarrayentry in the third arrayentry to test?
the problem is that the script is called over and over again. at the Start the array is empty but it get populated more and more over time and the script should ony set some specific values and don´t touch the other entries
i can post my original code if that would help sole the problem
afaik arrays are handled by reference. So you can use _bigArray select 2 to get sub-array and use set on that 🤔
but that wont work when the array is empty right?
"i want to change a sub-array that may not exist yet" sounds kinda strange tbh 🤔
yeah. only in the first iteration the subarray does not exist. i gets created and populate by more then one script
Note that it's very slow
So don't use it often
Also allObjects will support strings once v2.12 is available (you can try it on dev branch)
You need to use a FiredMan event handler, then use setAmmo in it to set the ammo back to full
here is the code i use:
bluGroup = [[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]];
opfGroup = [];
_blueCounter = 0;
_opfcounter = 0;
while {true} do
{
{
if (side _x == WEST) then
{
_subarray = blugroup select _blueCounter;
_grouptype = _x call getGroupType;
//bluGroup append [_x,_grouptype,"", count _x,"",""]];
//bluGroup deleteAt (find "null");
_subarray set [0,_x];
_subarray set [1,_grouptype];
_blueCounter = _blueCounter +1;
};
if (side _x == EAST) then
{
_grouptype = _x call getGroupType;
opfGroup set [_forEachIndex, [_x,_grouptype,"", count units _x,"",""]];
};
} forEach allGroups;
hint format ["%1", bluGroup];
sleep 10;
_blueCounter = 0;
Use resize 
the problem is to make it work i need to set many empty subarrays (as seen above). But if i don´t do that the script wont work...
how do i have to do that?
And how do you make a firedman? Where can I find information about learning to do this for example? Because Youtube there is nothing. Bohemia on their site, there is what it takes but you have to know where to look.
_arr = [];
_arr resize [100, []]
thanks mate
Gives you 100 empty arrays
Simply google arma firedman event handler...
thnk's 😉
private _allBluforGroups = groups blufor; only becomes available with 2.12 
which versio ar ewe in right now?
2.10 with 2.12 being planned to release "soon"(tm)
yeah soon can mean half a year right?
Oh is that what you're trying to do? 
I didn't even read your script...
That script has so many problems...
i want to have an array which shows me all blufor groups and some attributs: ["name", "groupetype", "status", "transport", "traget"]; and i dont want empty entries in the main array. but the set thing should only set name and grouptype
but works... what are the problems? im just a hobby coder with not much expereience
inb4 hashMap-fueled caching system 
For one thing not being written properly
E.g. using foreachindex to set the opfor group thingy
Other being manual counter
if you want and had time we could go in a voice channel but im not native english
Another being resizing the array when you don't even know how many you want
yeah im just working on the blufor site now opfor is just copy an paste then
Don't copy paste. Use functions 😓
I'm on mobile and I'm not even home...
no problem...
the problem with resizing is that the array can grow if groups are spawned mid game and it still will work so i would need to resize to howmany groups there are on each cycle
why even keep the array if it gets overwritten every cycle?
something like ```sqf
_fnc_grpStats = {
params ["_grp"];
[_grp call getGroupType, "", count units _grp, "", ""]
};
blueGroups = [];
redGroups = [];
while {true} do {
blueGroups = allGroups select {side _x == WEST} apply {[_x, _x call _fnc_grpStats]};
redGroups = allGroups select {side _x == EAST} apply {[_x, _x call _fnc_grpStats]};
sleep 10;
};``` 🤷♂️
Here's a cleaner way of doing what you want
eastGroups = []; // same for west
_sideAttr = [eastGroups, westGroups];
{
_sideid = [east, west] find side _x;
_sideAttr#_sidrid pushBack [
_x, _x call getType, blabla
]
} forEach allGroups
Forgive the type. I did it on mobile...
maybe you should join me in my project XD
this is a pretty decent way i have to admit and it seems like its working pretty good 🙂
but now every other entry in the subarray gets overwritten with the parameters in the function so i cant set any of them manually whilest with my code i can overwrite them at any time
Set the parameters on the groups themselves
Use the array to simply get the groups faster
you think of setVariable?
Yes
because ordering/count of groups can change and it would invalidate all the data that's set manually anyways
If it's an array then use setVar once. Use getVar + set afterwards
i think i´m just to dumb. Would that change the subarray entry as well? how would i have to change the code to be able to do that?
we should not be using allGroups if we know the side sqf while {true} do { blueGroups = (groups west) apply {[_x, _x call _fnc_grpStats]}; redGroups = (groups east) apply {[_x, _x call _fnc_grpStats]}; sleep 10; };
2.12, though
2.12 isnt far ooff
It's hard to type it
Simply do
_attr = _unit getVar ["mr_attr", [0,"other attr"]]; _attr set [1, "new attr"]; _unit setVar ["mr_attr", _attr]
If you init the attributes when the group is created you won't need the setVar anymore
too bad we dont have a "setVariableDefault" or "setVariableDefaultCall"
*get
A simple flag for getVar can do it
yea "getVariableDefaultCall" i have dreamed about for a couple months now
If you don't manage to figure this out just ping me this afternoon and I'll explain it better
and how could i delete empty groups without leaving an epmty array entry?
is deleteGroupWhenEmpty on default true or false?
I believe it's true by default in A3
testGroup = createGroup west;
isGroupDeletedWhenEmpty testGroup
=> false
If you have a group in an array and something deletes it then you will have a grpNull in the array. If this is a possibility then you should account for it.
This is undocumented but I think there's a flag set on created groups which prevents their automatic deletion until a unit has been added to them.
The wiki page for createGroup says this:
When the last unit leaves its group, the group usually gets immediately auto-deleted, regardless of its auto-deletion setting.
If that's true, I'm very curious about what the point of deleteGroupWhenEmpty even is - there are so many notes saying different variations of "it doesn't actually make any difference to what the game does" that it seems there are no circumstances where the command has any effect at all.
There may be a distinction between emptying a group with join and emptying a group by units dying or being deleted.
Confirmed.
tbh, I have no clear idea of the entirety of the groups management system
we'll have to explore, deduce and write
deleteGroupWhenEmpty is quite resistant to testing. I'm not sure if it's very slow or very weird.
The delete on empty via join is instant though.
like [onlyUnit] join objNull?
Yeah it never works 😅
I believe it is a cycle like every 1, 5 or 10 minutes something
But all empty groups do get deleted after 60s 
At least as far as I remember when I was messing with that
we could ask KK or Dedmen… 😏 I know KK worked on groups recently
I do remember a 60s case but I can't replicate now.
There is also a timer where dead units get moved out of the group.
this is when the leader report they're dead, also clearing identity (name, etc)
hmm, maybe it needs a live leader to do that.
But then group is never going to be empty except via deletion or join.
Getting myself into the weeds here, probably came up with a dumb solution that unfortunately works well enough that I need to question it.
I couldnt get a while-do loop to function smoothly for what I wanted, and instead resorted to packing everything I wanted into a function that gets Spawned (requires a couple waitUntils and Sleeps), and then ends by Calling itself to keep looping.
While it works in the short term, am I just setting up a resource timebomb?
why is a task that is created via createSimpleTask not assigned to the unit it is created for?
and how i can assign the task with code to a unit?
Post the script you wrote regarding this command
_task = leader _grp createSimpleTask [_taskname];
_task setSimpleTaskDescription [_taskdescription, _taskdescription,""];
_task setSimpleTaskDestination _taskpos;
the Task is displayed on the map but no hints and non assigned
@manic sigil I don't know the specifics for SQF, but a function indefinitely calling itself is going to run out of something in pretty much any language.
Google: did you mean "recursion"?
endless recursion at that
Hi, is it possible to get groups inside an array sort by alphabetically?
private _allGroupsWithPlayers = [];
{
_allGroupsWithPlayers pushBackUnique group _x;
} forEach units blufor;
_allGroupsWithPlayersAlphabetical = _allGroupsWithPlayers call BIS_fnc_sortAlphabetically;
_allGroupsWithPlayersAlphabetical_2 = _allGroupsWithPlayers;
_allGroupsWithPlayersAlphabetical_2 sort true;
_data = [_allGroupsWithPlayers,_allGroupsWithPlayersAlphabetical,_allGroupsWithPlayersAlphabetical_2];
copyToClipboard str _data;
return
[
[B Alpha 1-2,B Alpha 1-3,B Charlie 1-4,B Bravo 1-5,B Alpha 1-1],
[B Alpha 1-2,B Alpha 1-3,B Charlie 1-4,B Bravo 1-5,B Alpha 1-1],
[B Alpha 1-2,B Alpha 1-3,B Charlie 1-4,B Bravo 1-5,B Alpha 1-1]
]
yes, it is.
_attempt3 = [_allGroupWithPlayers, [], {str _x}, "ASCEND"] call BIS_fnc_sortBy; 🤷♂️
Oo, cant wait solution
even though "str _x" is risky as if a group has a var name it will be "varname" 😬
groupId?
awesome, it works
https://community.bistudio.com/wiki/BIS_fnc_sortAlphabetically
arrayOfStrings call (...)
👀
[_allGroupWithPlayers, [], { groupId _x }, "ASCEND"] call BIS_fnc_sortBy; // final v3.docx
Nice , thanks a lot
a lot 😁
S'why I asked, Im not certain myself - I know enough that that was my concern, but not if the script would terminate each run through. Logically, though, I suppose not. Sigh.
groupId may be better semantically, but it seems to be roughly equal performance-wise 🤔
I think the issue I was having was my while-do wasnt accepting the private variables I was trying to use. Back to the drawing board.
Aa, yeh true. GroupID return is true, but it´s not in array in string. that's why that didn't work. Works if append str(group _x)
is there a way to test if an array entry is there ? so if i use select 2 and there is a third entry everything is fin but if not then i get an error.
count _array >= 3
Ah thanks 😁
depending on your case, you might be interested in params
private _array = ["element1", "element2"];
if (random 1 > 0.5) then { _array pushBack "element3" };
_array params ["_el1", "_el2", ["_el3", "novalue"]];
hint _el1; // element1
hint _el2; // element2
hint _el3; // element3 or novalue
Can you use another cond to check?
I mean when i add groups and i have alpha-10 , which goes between Alpha-1 and Alpha-2?
And i want it to be 1st
you can replace the { groupID _x } with some processing that results in something that would be sorted to your satisfaction.
In the end it's calling sort, so it'll only take strings, numbers or arrays containing strings and numbers.
_taskttrigger setTriggerStatements ["this", tostring {
_subarray = thisTrigger getVariable "_subarray";
_taskname = thisTrigger getVariable "_taskname";
_grp = thisTrigger getVariable "_grp";
while {true} do
{
_unitcount = {alive _x && _x inArea thistrigger} count units WEST;
//sleep 5;
hint format ["%1, %2", _unitcount, count units _grp];
if (_unitcount > count units _grp ) then
{
[_taskname,"Succeeded", true] call BIS_fnc_taskSetState;
_subarray set [2,"idle"];
hint "task succeeded";
break;
deletevehicle _x;
};};}, tostring {}];
the while{true} loop is ist executed once and i don´t get why. The condition for the if is not meet but the while loop is stops after the first iteration. No error at all
Are you sure it's not being met? Try using "greater than" instead, and ensuring it's the right way around: https://community.bistudio.com/wiki/Operators
break; can exit the while loop
i´m 100% sure that the condition is not meet. Since when its meet i get the hint but therefor i have to be in the area before the trigger is activated
but only if the condition is meet right?
the if (_unitcount > count units _grp ) then -- yes
but the condition is not meet 😦
Take away the break and see if it still exits the loop. If it doesn't, then the issue is the if statement
still only executed once. I already tried that
If its in a trigger then it might be related to their behaviour, I'm not sure if loops can be used in trigger fields
what does this line do: "deletevehicle _x;" ? I cant see _x being defined
If i´m in the thirggerArea before the trigger activates then i have a big lagg and the if condition is also executet. If im not in the area at the moment the trigger is activated then the while tue should wait as long as i need to get there but when i do nothing happens
it should delete the trigger after successfull execution since it´s not longer needed
oh I guess you need to use thisTrigger instead of _x then
ok thanks
theoretically i should get the hint format all the time since it should be displayed over and over agian, but it is only shown for a second until it get´s overwritten by another hint.
Try something like that so that the sleep, deactivation code and loop condition are all moved to the trigger instead of a script inside the activation field
thisList already only counts units that fulfill the activation requirement so no need to count the side units separately
Though you could also flip it the other way and have the trigger only activate when there's too few units, instead of looping constantly until there's few enough.
Are cruise missiles fired from UAV cruise missile launcher just for show?
Can't get them to fire at target no matter what it seems
setMissileTarget(Pos) don't work
ammo_Missile_Cruise_01
alive takes an object, not an array, also BOOL >= SCALAR doesn't exist
The VLS?
Yes
No.. it definitely works.
Tried connecting terminal and ordering attack on an enemy vehicle - nothing
Tried doing setMissileTarget on the enemy vehicle, laser target, position (with pos command) - nothing
I think it needs a laser (or etc) to lock onto. if doing it UAV
(setMissileTarget on the missile after it is fired)
Tried both, direct target vehicle, laser target, no luck
Close and visible, kilometers away, no difference
setMissileTarget takes all the constraints into account, if you can't make it target normally, then the command will also fail
you must ensure that the laser is datalinked/vehicle is hot etcetc
(depending on the munition)
Vehicle was turned on (engineOn), I also did it reportRemoteTarget on it
onActivation="call{west reportRemoteTarget [t1, 3000]; t1 confirmSensorTarget [west, true]; g1 fireAtTarget [t1, ""weapon_vls_01""];}";
What it does
idk if that helps you or not. I was (and am) hoping it does
Works now, confirmSensorTarget is not even needed
What the hell is going on 
Did exactly the same thing
yea
btw setMissileTargetPos is not supported for that ammo type, so you can't use that, but the non pos one works fine
Is it possible to retrieve custom lobby slot names in mission? Say if I wanted to list out what slot a specific player is in, and it's been given a custom name in the editor.
Thanks!
is the a way to easily delete all (smoke/fire) FX sources?
or you need to build a list of emitting sources (destroyed vehicles, game logic to spawn FX, etc)
i don't think there is any straight forward getter for it, so my guess is the latter
is there anyway to convert an old arma 2 mod to work with cba?
It's likely to be possible, as A3 has typically expanded on what can be done rather than removing stuff. However...it's highly dependent on the specific mod. Some mods might need to be completely rewritten; some mods will probably work out of the box without a single change. And "work with CBA" is...well, what does it mean? I can't think of any mods that outright refuse to work with CBA. You can probably rewrite a mod to take advantage of CBA functions, but if it doesn't need CBA, it doesn't need CBA, and adding CBA stuff is an optional bonus.
In short, yes, but there's no one-size-fits-all process and you'll need to know what you're doing.
ok so here's kinda what im doing. there is this mod called gcam right its basically a camera mod for recording cinematics and everything. it works fine when its on its own but as soon as you add cba it gets stuttery and jittery
it appears do drop the fps whilest using the script like its being limited
keep in mind when im not using the script i get 75 frames plus on ultra while just playing arma
i can send you the pbo but it would mean the world if someone could help me fix this mod
im not good at coding but ill do whatever it takes
sounds like this was all solved years ago
possible alternative based on your needs: https://forums.bohemia.net/forums/topic/216403-indicam-independent-camera-mod/
is there a way to filter from allControls/controls without getting the reference with (findDisplay x) displayCtrl y ?
there is not enough context to give you any answer
can i delete Waypoints with deleteVehicle?
no
how can i delete Them?
isn't there a deleteWaypoint command?
oh my god... i didn´t found it i must have misstyped at least 2 times... Thank you
it's not file path. It's config path 🤷♂️
can someone tell me why this wont work?
_deleteactionId = leader _grp addAction ["PCA: Cancel Order", tostring {
[_taskname,"Canceled", true] call BIS_fnc_taskSetState;
deleteWaypoint [_this select 3 select 0,1];
_grp = _this select 3 select 0;
_deleteactionId = _this select 3 select 1;
hint str _deleteactionId;
leader _grp removeAction _deleteactionId;
}, [_grp, _deleteactionId], 99, false];
i get the error that _deleteactionID is not delcared but i did as the description told, i even passed them as params and got them with _this select 3 select 0
because it's not declared at the point it's used at 🤷♂️
you first try to create the action that uses it and then you actually store action's ID into that variable 🤷♂️
but i delcared it again with _this select... 😦
it doesn't exist at your last line yet. It's only declared and assigned after the action is created.
https://community.bistudio.com/wiki/addAction action can access its own ID as _this select 2 from its code
Everything inside the addAction right argument:
leader _grp addAction [ **HERE** ];```
...happens before the action ID is generated. Including the part where you try to pass arguments to the action script.
also, _taskname isn't define anywhere at all in the action's code
also, the action can take straight code as its second argument, no need to use toString
also, please consider not writing all the code outside the right boundary of the screen 😛 sqf leader _grp addAction [ "PCA: Cancel Order", //title { private _deleteactionId = _this select 2; private _grp = _this select 3 select 0; private _taskname = _this select 3 select 1; deleteWaypoint [_grp, 1]; [_taskname,"Canceled", true] call BIS_fnc_taskSetState; hint str _deleteactionId; leader _grp removeAction _deleteactionId; }, // script [_grp, _taskname], // arguments 99, // priority false // showWindow ];
thank you very much
and i have another problem. I want to know if my variable is empty or not
so i made an if statement if (transportgroup != "") then that works if the transportgroup is empty, but if it is filled then it holds an array but if can not compare an array to empty it gives out an error. how can i fix that?
Has anyone got a script I can run in an ongoing mission to reduce the revive time? For some reason it’s significantly longer than normal
How can I delete the current waypoint of a unit?
Yo, Hi, I need help with this, what it is and how to do this for my own scenario. Because I want Units not to run out of ammo and have magazines of the type of weapon they have that spawn in their inventory once they run out. Could you help me to know how to do this? Is there a specific video for that?
Exemple : Call{"IAexemple" setVehicleAmmo 2; .... Etc
I believe medical settings (for vanilla, no idea about ACE) are a config thing and can't be changed mid-mission.
quick question. if i use tasks on a dedicated server, what would be the best idea to syncronize the tasks with JIP players. so far i use the initplayerlocal for adding a task and a trigger ingame to make it succeeded. the problem is, if people do JIP the task is not succeded anymore
Thank you
"" is not an empty variable, it's an empty string. This is not a great way of checking this.
There are some options you can try:
isNull transportGroup - detects if the variable contains a grpNull, which would happen if it used to exist but has been deleted
isNil "transportGroup" - detects whether the group never existed at all and the variable is undefined
plz don't type in bold
put this in the unit's init field
this addEventHandler ["FiredMan", {
params ["_unit", "_weapon"];
_unit setAmmo [_weapon, 1000];
}];
Ok sorry, so I have to put this in the "When Activation of the unit I choose? Can I put as much ammunition as I want??
I don't have an external .sqf or .ext type file to touch?
when activation? what?
no
Okay thnk's you very much 🙂
just put that in the init field
You can also use getVariable's default value system:
_group = missionNamespace getVariable ["transportGroup",grpNull]; // Returns the content of the variable. If the variable is undefined, return grpNull.
isNull _group; // Now returns true if the group was undefined OR if it was deleted```
also use tags when naming your global vars 
so I simply copy paste and replace "Unit" and "Ammo" with what you gave me, in the init, right?
e.g. MR74_myVar
don't touch anything
just copy paste it
okayOk, but how do I make this code only for the unit for example chosen of my choice in game
Ah Ah sorry, I'm learning, it's very complicated, I do my best to understand, especially since I'm not really English or savvy in all this
well just double click on the unit
there's a text box that says "Init"
put the code in there
click ok
done
run the mission and test
Ok I will try and let you know if everything is good 🙂
btw the unit won't reload when you use that code. it will have infinite ammo
Just to explain why I find it hard, because I came across an example of this type but I didn't understand everything and on the character in it there was "SetVehicleAmmo" etc...
this
Could you quickly explain to me what it is?
setVehicleAmmo sets the unit loadout based on his config defined loadout
WoW Okay ... 😂
it forces the unit to fire its weapon while aiming at the target
or even when not aiming 
I will try the code snippet you gave me.
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
still puts out an Error 😦
what is the error?
use isNull not isNil
@little raptor Does this work for mortars? I would like the same command for the mortar should I put it on the "Dit" Driver or in the mortar? Because I don't know how to attach an "Ammo Crate" to an AI unit. And also I have another problem, I don't know why, but the mortar AIs don't fire at all as I see them turning and raising their "Cannon" mortar muzzles. I have no idea what caused it
Hi, I'm looking for a way to check if a prop is hit. I know "HitPart" event handler will work, but its locality limitations make it tricky to work with for me. The prop is custom, Is there a way to make the engine think its an actual vehicle or something and has "health" so that I could use the standard "hit" event handler?
returns Null-Group everytime even when the Varaible is filled with my array 😦
Are you using BIS_fnc_countdown?
I have a problem with enemy AI in my mortar scenario, it won't fire, it won't activate. How to do ?
It can't, that's not how it works. It's likely the variable you're checking is not actually being filled - you may be checking or setting the wrong variable
Hello!
Does anyone had experience with delete classname?
The wiki says: Within configs the delete classname keyword is available. It can be used to delete already existing classes. However, classes from which other classes derive cannot be deleted unless the child classes are deleted first.
question1: would a config be able to delete classnames of other configs?
question2: more specific: would a config be able to delete classnames inside the terrain config.cpp? Like Secondary_Airports class?
question3: would this permanently delete them or only as long as my mod containing this config.cpp (with the delte commands) is loaded in the Arma 3 launcher?
That's probably more of an #arma3_config question
I think it's 1. yes, 2. yes, 3. temporary (per launch), but yeah. Config makers would know better.
thank you both. i hop to config_makers
make it a drone/uav
Hey! Is there a way of making a moveable object bring the player (or any objects near the moving one) with it? We don't use the walkable moving objects mod but I wanted to make something similar.
I've tried doing something like this
_NearEntities = V1 nearObjects 100;
{
[_x, V1] call Bis_fnc_attachToRelative;
} forEach _NearEntities;```
And whilst it works for objects, for players, they're locked and can't freelook or move around.
If anyone knows of something that might be what I'm looking for, please let me know 🙂
You can let players free look if you replace attachTo with setPos* each frame, but it won't let them move around
Hmm, it's not a bad idea and it would help. I'll look more into it. Thanks anyway 🙂
im trying to create some grouped goats, now i have the issue, i i call my script from the debug bar ingame (execute local) the goats do move, - if i call the script from initserver or from initplayerlocal the goats are frozen
any idea?
Try calling with a delay?
0 spawn {sleep 1; /*Goats move code*/};
goat is frozen if i call it via script. just standing there, i can shot it then its dead, but its frozen
what does execute locally do exactly that it works with that but not with a script call
delay did not work thx for the hint
Try from other places like init.sqf?
Just guessing here, not much of an AI guy
Make sure you even have your goats in your script, diag_log them and see if they're entites and not null or nil
diag_log ["mygoatvariable", mygoatvariable];
thats beyond my scripting knowledge lol 😭
Never late to learn and improve
From my testing I found out that map icons (rocks, churches, wrecks, etc.) show up if map scale is 0.08681 or less (ctrlMapScale return). I can't figure out where this number comes from. No matches for 0868 in the entire config, the number seem to stay the same with different UI sizes, not sure about resolution.
Talking about these map details
Any idea how this number is calculated or where it is defined?
What's the next scale up if you zoom out? Could be '<.1' or something
They don't show at >= 0.08682
Didn't bother to find more digits, but I still wonder where the engine gets this number from
Ah, I getcha. Yeah, that's a weird cutoff.
wait FSM code blocks are atomic?
so, i got my animals working with createagent command. now i have a new problem. if i call the script from initServer or Init the goats dont move like i said, the only way to get them to work is over the initplayerlocal file. now the issue is. the script creates 7 goats, now for each player who joins there are 7 goats more.
I see no reason why the goats wouldn't move if the agents are created on the server. can you post your code?
yea, thats the problem, they are frozen if i create them on the server, heres the code
sleep 10;
if (isDedicated) then
{
_goat1 = createAgent ["Goat_random_F", getPosATL goatpos1, [], 5, "NONE"];
_goat2 = createAgent ["Goat_random_F", getPosATL goatpos1, [], 5, "NONE"];
_goat3 = createAgent ["Goat_random_F", getPosATL goatpos1, [], 5, "NONE"];
_goat4 = createAgent ["Goat_random_F", getPosATL goatpos1, [], 5, "NONE"];
_goat5 = createAgent ["Goat_random_F", getPosATL goatpos1, [], 5, "NONE"];
_goat6 = createAgent ["Goat_random_F", getPosATL goatpos1, [], 5, "NONE"];
_goat7 = createAgent ["Goat_random_F", getPosATL goatpos1, [], 5, "NONE"];
while {true} do
{
_goat1 moveTo getPosATL goatpos1;
_goat2 moveTo getPosATL goatpos1;
_goat3 moveTo getPosATL goatpos1;
_goat4 moveTo getPosATL goatpos1;
_goat5 moveTo getPosATL goatpos1;
_goat6 moveTo getPosATL goatpos1;
_goat7 moveTo getPosATL goatpos1;
sleep 7;
};
};
the modules do not work correctly on the server, thats why i script it. they cant stay in position with the modules
You're creating and moving them to same position
but that should not be a problem, works fine if i call it over initplayerlocal
Oh nevermind, there is random radius of 5
Where do you create them from right now and it doesn't work?
i just call the script via [] execVM "animals.sqf"
if i do that via the init or initserver they are frozen
initplayerlocal works but then i get 7 more which each player
And you run it on dedicated server?
yep
Why isDedicated instead of isServer?
i allready tried that, same bad result
What is goatpos1?
Have you tried disable behavior?
Script
Simple example for a dog to follow the player:
// Spawn dog
_dog = createAgent ["Fin_random_F", getPosATL player, [], 5, "NONE"];
// Disable animal behaviour
_dog setVariable ["BIS_fnc_animalBehaviour_disable", true];
// Following loop
[_dog] spawn {
params ["_dog"];
// Force dog to sprint
_dog playMove "Dog_Sprint";
while { sleep 1; alive _dog } do
{
_dog moveTo getPosATL player;
};
};
Maybe it gets deleted on dedicated server or something
@next kraken Add some logging in different places to see what's going on:
diag_log ["goatpos1", goatpos1, getPosATL goatpos1];
when you do your moveTo commands then see what RPT says
Add some logging milestones like diag_log 1; and diag_log 2; to see which part of the code is reached correctly
Maybe it is indeed an issue of default animal behaviour, didn't deal much with it
instead of moveTo use setDestination. I've seen it work better for agents sometimes
yea ... they have the modules and all the stuff for animals but when it comes to server compatibility BIS really sucks. they dont care. i really hope Arma 4 provides better functionality for modules specially the atmosperhic ones
another try
i call the script via trigger, there you have the option to call it only on server, but instead of that id need it the other way around-because now it created 1 instance of 7 goats on the server who are stuck and another one of 7 goats who work
I've run into a problem that im hoping yall might be able to help with,
I'm running a script from a module using "function" inside of the modules config. Inside of that script that it runs I was using _logic = param [0,objNull,[objNull]]; to get that module object, but thats suddenly stopped working.... Anyone have an idea why?
is there no way to tell a trigger "execute that on local only
or is there no createunitlocal command, thought there was
You can check if triggering entity is local: https://community.bistudio.com/wiki/Magic_Variables#thisList
You should share the current script, without content it's hard to see where the problem is
Thats the first line of the script
mhh, sorry didnt unsterstand that. is there no way to execute a script only locally on the machine of the clients?
try remoteExec
you can remoteExec to clients using -2, or to a specific client as well using any client number
And where it doesn't work, does it give error for that or later some point. Where you can see it doesn't get module object
It doesnt work on the second line lol, gives an empty. Went back to an old almost identical script and it seems to work now. zero clue why it broke, thanks for the help though
oh ok, but is it possible to use remoteExec to call a script ?
I believe so
More like remoteExec is a way to execute a script
how would i call a script, for example, my animalscript, via remoteexec to make it execute only on client machines not server ?
i read the wiki but cant find an example for scripts
could look something like remoteExec [call animalScript, -2, true];
I'm not sure if the "call" will override the locality of it though
There is how to do correct way .
Make function of your script and remoteexec that for clients (-2 , which means not executed on the server)
thanks prisoner but this does nothing for some reason
remoteExec ["animals.sqf", 0, true]
does not create the animal agents
what do i do wrong=)
oh sorry
i did not read right
is there no way to remoteexec the script
i cant write functions=)
You need make function,
So it should be something like
remoteExec ["SKF_fnc_animals,-2,true];
Structure to your function
description.ext
class CfgFunctions {
class SKF { //Tag
class animals { //category
class animals{};
};
};
};
And your file in
MissionPAth\functions\animals\fn_animals.sqf
thanks !
tyvm
Functions can be done much easier than CfgFunctions.
myFunctionMadeFromFile = compile preprocessFileLineNumbers "my_script_that_will_be_a_function.sqf"
myFunctionDefinedRightHere = {
// Stuff my function should be doing by only returns 123;
123;
};
thisVariableWillBe123 = call myFunctionDefinedRightHere;
You need to make sure function is defined before you call it though, CfgFunctions gets read and initialized very early so it will be accessible from init.sqf for sure
i wouldn't call that easier
CfgFunctions has many nice features, its also less stuff to type in the long run
can you make structured text contain clickable text that executes code?
similar to execute for diary
yes
<a href='https://addresshere.com'> click link </a>
i think you need to pass the string through parseText
URLs and executing code aren't the same
oh my bad I misread :/
Maybe someone with experience in FSM could clarify me a couple of things?
I have developed an AI for a type of unit im creating that works in the innermost part as an aggressive Agent.
The code behave as expected when run from within functions, however I've been told by a couple of persons that I would be better on making it an FSM to actually reduce performance cost while making it be much more responsive.
There is a couple of things that I do not have fully clear in FSM that are easily done in code, for example, suspension/waitUntil.
To be more specific, this are my doubts:
1- Conditional Links can be stopped undetermined time until the condition has been completed?
2- What does a pre-condition of a state/conditional link actually does?
3- What does a true conditional link does and how does it translate to code?
4- Conditional links that have an action defined default to that action and progress to the next state or the proggression is independant on the condition being true/false?
Any info would be greatly appreciated.
I'm making a small mod and I'm wondering if I'm doing something wrong.
I need to delay a script from starting until it can be suspended but none of the following have worked, all lead to errors about suspending not being allowed
waitUntil { getClientStateNumber >= 9 };
waitUntil { time > 0 };
waitUntil { hasInterface };
waitUntil { canSuspend };
The script is also ran via execVM so it shouldn't be an issue of it not being in a scheduled environment.
is this being done with the post-init attribute for auto start? Im guessing its not since you are using execVM probably for a file
you cant use waitUntil or sleep in unscheduled environment
he is doing execVM though
It is, I had a feeling it might not be working properly but as this is my first mod, I don't really know other ways to launch scripts.
Except maybe through eventhandlers, but the script doesn't really work that way since it's meant to be refreshing stuff from the start. Unless there's an eventhandler for like when the mission starts or something.
I've done scripts with missions plenty before, but this is my first actual mod
thats the issue. Post init happens asap after mission starts. This is one of those situations in where the context for suspending is not allowed
Okay, so if this was just for a mission I'd just launch it from initPlayerLocal, but how would I do it here then
It's an automatically refreshing list of player groups in a briefing tab, so nothing really
if canSuspend == false ... then you cannot use sleep or waituntil
maybe try doing a module.
Im sure there must be ways to make it happen after mission has started. Perhaps a mission event handler.
One "hacky" solution that comes to mind is to make it be a init class eventhandler for any man class entity that would fire the function once globally and then setting a variable globally to know that initialization had been done and prevent any other unit from doing it, since your function is indended to have a player list this does makes sense.
I was just looking at the mission eventhandlers, PreloadFinished looks promising
Now I'm wondering if it's impossible to add eventhandlers in postInit, since trying this leads to yet another error:
player addEventHandler ["PreloadFinished", { null = [] execVM "\x\ag\addons\SlottingSheet\AG_Slotting_handler.sqf"; }];
player addEventHandler ["PreloadFinished", { nu>
16:35:58 Error position: <addEventHandler ["PreloadFinished", { nu>
16:35:58 Error Foreign error: Unknown enum value: "PreloadFinished"
16:35:58 File x\ag\addons\SlottingSheet\XEH_postInit.sqf..., line 8```
You looked at mission eventhandlers, and then tried to add it to the player as a entity eventhandler, that indeed won't work
What do you actually want to wait for?
Its not "till scripts can suspend" because that doesn't make sense
And I'm pretty confident you don't want PreloadFinished either
Yes, I'm unfamiliar
post briefing screen? initPlayerLocal
Ah inside mod.
preInit? maybe? 🤔 not sure if thats in briefing, otherwise just postInit then
Mods can use initPlayerLocal?
nope
I guess what I'm actually wanting to wait for is until playableUnits and createDiaryRecord work, the suspension I can probably get around with UnitJoined and UnitLeft eventhandlers if need be. Those I probably even know how to use, since they aren't mission eventhandlers.
waitUntil playableUnits is not empty ?
Mission EHs are very easy to use, you just have to use the right command, addMissionEventHandler rather than addEventHandler [and don't specify a unit to add it to since it's added to the mission, not a specific unit]
Well I can try that. But seeing how nothing else has worked with waitUntil, I'm not expecting much
how are you running your script? via postInit?
Yes
postInit should run after all entities are initialised.
So you shouldn't need to wait at all
Thing is, the script runs enough times to print out 20k "suspending not allowed" errors into the rpt in something like 15 seconds, and then just stops dead when the postinit is finalized. And with all that, it doesn't actually launch the one function it needs to in order to create diary entries.
I confirmed with systemchat messages that it goes through the whole script and doesn't reset at the uiSleep that's failing to suspend. But if I start the script manually after the briefing screen, it launches the function as intended.
That means its unscheduled
in unscheduled, you cannot suspend/pause
But postInit scripts are scheduled? If you use CfgFunctions.
So that shouldn't happen
Wrap your script in [] spawn {....}
there's limit on how much and how fast the scheduled code can run, so that's the thing
it's a matter of compromise
more schd = more delay
more unschd = more FPS drop
From a performance perspective the best option is less code :P
I speak very broadly.
Scheduled code can't use more than some percentage of frame time (ignoring corner cases).
unscheduled code freezes the game while it runs.
scheduled code also does that, but it has a maximum 3ms per frame limit
All scripts have influence on server perf
what degrades server perf over time is having too many remoteExecs and unnecessary remoteExecs in my experience (which pile up over time as new players join, etc.)
If you have lots of scheduled scripts (hundreds) then you get more impact there because the engine has to sort the scripts before it runs them
Does that apply even the script is in a long sleep?
yes
game sorts scripts to have the one that didn't execute for the longest time, come first
Does it grind through every script handle from scratch each time it picks one to run though? Or is there some persistent ordering?
Let's consider a practical example. You have a dynamic mission where you want to clean up corpses after they've been there for an hour. If you fire up a spawn with a sleep 3600 on each one, is that going to add a substantial engine overhead each time it has to run a script?
^ bump
And therefore should you write some complex and unreliable chunk of SQF to check less often but more smartly :P
I've found the hard way that doing smaller simpler checks in order to jumpstart complexer functions works best, taking this as an example
what do you call, humm, conditional links? yellow diamonds?
1- yes, looped with e.g private _wantedTime = time + 10; and condition time > _wantedTime
2- don't worry about it, iirc
3- goes straight to it - it is usually the code with the smaller priority
4- what
it orders them all, once a frame
Not multiple times per frame at least?
scheduled scripts are only executed once per frame
and before they are executed, it sorts once
ah right, sleep 0.001 won't execute until next frame
On a related note, FSMs do appear to execute multiple times per frame...
At least it seems that way given how they spam errors when you screw up :P
4- Conditions that have an action defined inside themselves will progress independently of the condition being true/false executing the action according to result or would they wait for the condition to be fullfilled in order to progress if there is no other branch available?
iirc they wait for the condition to then process that code
but by design, don't put anything in there unless absolutely required
read BI FSMs (e.g \modules_f\supports\fsms) for good examples
thanks
so for 3- its just basically a passthrough conditional block?
Is there a way to get SQF scripts to write data to a file?
you need an extension
Such as?
Thanks
it's an "if true"
e.g here in cas_heli.fsm
"yes" is isPlayer _this with a priority of 1
"no" is true with a priority of 0
given the higher priority, "yes" condition is evaluated first; if not true, evaluate the rest - "no" - which will go through
ah ok. The info in the wiki page for the fsm editor is a bit... ehem... scarce(?) and the only valid videos are 2 hour long 360p invisible texts. Sorry if this comes as annoying haha
there is this one too
https://community.bistudio.com/wiki/FSM
FSM Tutorial by Rune @ Editors Depot
yes, that's why we always say to put sleep in loops, so you don't exhaust entire 3ms limit with a single script
how can i check if every alive unit of an squad is in (the same) vehicle? and would it be possible to put this code right into the condition of an trigger?
i created following function which does some funny things and also spawns a trigger and i want to set the Triggercondition to the if everyone is in the car...
["taskgroup","task postion", "Description", "Name", "condition", "Site", "Status", "Status when finished"] call taskcreate;
count (units mygroup) == ({ _x in myVehicle } count (units mygroup)) something like that 😬
thank you. So i need the pass the vehicle as well... it´s going to be a long function XD
private _veh = vehicle leader _grp;
-1 < ((units _grp) findIf {(vehicle _x) != _veh})``` 🤷♂️
i tried entering this page multiple times yesterday when home and for the love of god almighty it never loaded, now trying it again @ work im able to open it hahaha. thanks tough, im gonna get the file and have it ready. The only thing i fear is that the file published is rather old (2007) the fsm editor has stayed the same during this 16 years?
the link was wrong, I fixed it in the meantime 🙂
and the FSM editor most likely didn't evolve lots
i would do it like that then?
["taskgroup","task postion", "Description", "Name", count (units _grp) == ({ _x in _vehicle } count (units _grp)), "Site", "Status", "Status when finished"] call taskcreate;
but the Trigger says that _condition is not delcared 😦
params ["_grp","_taskpos","_taskdescription","_taskname", "_condition", "_taskside", "_status", "_statusfinished"];
_taskttrigger setTriggerStatements [_condition, tostring { ...}, tostring {}];
i can show the whole fine if needed
what is taskcreate?
my own function
_condition is a boolean, as you did it
your code needs to be inside the bracelets { ....... }
like that?
["taskgroup","task postion", "Description", "Name", {count (units _grp) == ({ _x in _vehicle } count (units _grp))}, "Site", "Status", "Status when finished"] call taskcreate;
yep
i put a tostring infront, now it doesnt outputs an error but also wont work 😦
but if the tostring is missing then it says Error type code, expected string
where?
for the condition
well idk then
toString _condition
is sqfbin still alive? cant find a working link
seems to be down for a bit now
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
sorry if it is badly written but i can't do it any better
maybe the trigger itself isn't working
you could put there some debug lines via hintSilent or whatever
it is if i just pass "this" then it works
im a bit confused... i have the one if condition if (str _transportGroup != "") then this also return true if the hint above says that transportgroup is ""
u have to do in the condition what u did in the activation _grp = thisTrigger getVariable "_grp";
but can i put more then one command in the condition?
still not working but no error at all 😦 i should just quit XD
Why even use triggers if you script the whole thing?
how would I else do it?
spawn, waitUntil, while @torpid mica
sleep is not precise
https://community.bistudio.com/wiki/time and server time might also be interesting
Are there any wiki pages for the upcoming 2.12? I cant find anything on use of the actual functions
U can debug it: https://pastebin.com/hwqSyGrC (and do define _grp and _vehicle there , I forgot)
Returns the time since last server restart, synced to all clients in MP. Th
It should not
Im missing a way to actually be able compare 2 direction vectors within a threshold, would this be the correct way to do it?
1- obtain the normalized vector using vectorFromTo and start aligning my object with it.
2- obtain the direction vector of an object that i want to align.
3- obtain the magnitude of the normalized vector.
4- obtain the magnitude of the vectorDiff between my direction vector and my normalized vector.
5- compare the magnitude of the vectorDiff to the magnitude of the normalized vector.
6- repeat steps 4-5 until threshold is close to 0 by substracting magnitudes.
Is this correct?
Im under the impresion that in this example, vectorDiff is just extra and that i can compare magnitudes as is?
Perhaps this is the incorrect approach, basically i want to apply a direction to object A to face towards object B. I know that relative directions should be enough but im already using velocity transformations and wanted to use the vectors already obtained :x.
now it works 🙂 thank you ver much but i still had to add the tostring to make it work 😉
obtain the magnitude of the normalized vector.
normalized vectors have a magnitude of 1
Is this correct?
no
compare 2 direction vectors
idk what you said has anything to do with "comparing vectors within a threshold"
Im under the impresion that in this example, vectorDiff is just extra and that i can compare magnitudes as is?
no. magnitude alone is meaningless
if what you mean is you want the two vectors to be kinda pointing in the same direction, as in within a cone, use vectorCos
and here i was about to replicate vectorCos manually with (vectorNormalized _vecA) vectorDotProduct (vectorNormalized _vecB) 
not sure how to debug this without digging through someone's files, but I noticed that sometimes during cutscenes in Intro phase, when I'm in unit not a camera, I see the command crosshair like on screenshot - is there any way to get rid of it if I can't control the unit?
it bothers me a bit as I'm using a mod that slows down time when using the command menu, so cutscenes made that way are played in slow-mo.
if it happens when you open the commanding menu try showCommandingMenu ""
yes, so the result of vectorCos returns the angle between vectors, but how do i retranslate that and apply it to the vector that needs to be rotated said angle?
[
["Speaker 1","Subtitle1",0],
["Speaker 2","Subtitle2",5],
["Speaker 3","Subtitle3",10],
["Speaker 4","Subtitle4",15]
] spawn BIS_fnc_EXP_camp_playSubtitles;
Is there anyway to get that centered on the screen?
if, according to what you said earlier, both vectors are normalized, then rotating the vector by that angle becomes the target vector. or am I misunderstanding you?
that is indeed correct.
According to wiki the vector direction is determined by the X plane taking as reference the north as "A unit facing North would return [0,1,0]"
so taking the degrees resulting from the vectorCos would mean that in order to rotate the object to its target vector i would do:
_vectorCos = _vector1 vectorCos _vector2; //Vector 1 is target, Vector 2 is object to rotate
_obtainedAngle = (_object getDir) - _vectorCos;
_object setVectorDir
[
sin _obtainedAngle,
cos _obtainedAngle,
1
];
?
it doesn't seem to have an option for that
but iirc Apex subtitles were already centered 
yaaa your back
yeah 😅
they show up in the bottom middle of the screen
abit hard to read em when ya have a squad members
hmm caan the colour be changed on em?
if they support structured text yes

an example of a command that supports structured text:
https://community.bistudio.com/wiki/BIS_fnc_textTiles
no. why don't you just do _object setVectorUp [0,0,1]; _object setVectorDir _vector2?
oh _vector1 was target. so change it to _vector1...
anyway if that's not what you want, can you explain in detail what you're trying to do?
"rotate vector A towards vector B" still sounds like a https://community.bistudio.com/wiki/BIS_fnc_slerp job
im making an object rotate toward a target.
I already have the targeted vector and can make the vector rotate to the target.
However, i want to wait until for example, the angle between the 2 vectors is less than 10 degrees with reference of the targeted vector.
but i realized something, vectorCos is enough for what im trying to do
as you said earlier
it's not
vectorCos gives the "absolute" angle
to face an object gradually you also need the "shortest angle"
if you're simply trying to rotate horizontally, getDir is enough to get the angle. the minimum angle is either _object getDir _target or 360 - _thatAngle in the opposite direction (getDir angle is always between 0 and 360)
another approach is combinations of vectorCos for angle and vectorCrossProduct for rotation dir (which is nonsense but in SQF I guess that would be fastest)
ah, so its the second syntax
once you have the rotation angle you can just do _object setVectorDir (_object vectorModelToWorld [sin _angle, cos _angle, 0])
tho it would only be correct if the object is already horizontal
which in Arma would only correspond to infantry units (+ animals)
_dir = vectorDir _obj; _dir set [2, 0]; [_dir, _angle] call BIS_fnc_rotateVector2D; _obj setVectorDir _dir would also work but I'm gonna guess it's slower, but at least works if obj is not horizontal (rotation will be horizontal nonetheless)
so in the end the result goes as
_object setVectorDir _vector;
[] spawn
{
waitUntil {sleep 0.5; (_object getDir _target) < 10 && (_object getDir _target) > 350;};
//Do something
};
no
and yes, object is horizontal in this case
getDir returns an angle between 0 and 360 as I said earlier
what you wrote means the object is less than 10 degrees to the right
it won't cover left
yeah
so getDir second syntax acts as getRelDir?
I guess it does
but not sure. test it
I will, thanks for your time.
how can i return a value from my function?
findGroup = {
params ["_grp", "_tgrp"];
{
_temp = blugroup select _forEachIndex;
if (_temp find _grp == 0) then
{
if (_tgrp != "") then
{
if (_tgrp != _temp) then
{
_subarray = _temp;
_subarray;
break;
};
}
else
{
_subarray = _temp;
_subarray;
break;
};
};
} foreach bluGroup;
};
``` I want to return the _subarray
breakWith _subArray
^
_temp = blugroup select _forEachIndex;
That is weird.
You already have the value in _x no need to use select to get it again
yeah youre right
Also there is no reason to have _subarray either.
just
breakWith _x
you could also do it with a findIf (returns the index) and a select
i have a problem with this code... _bluGroup is an array with many subarrays. first subarrayentry is the group. I want to find the corresponding subarray to a give group. How would i do that?
findGroup = { // B Alpha 1-1
params ["_grp", "_tgrp"];
{
_variable = _x find _grp;
hint str _variable;
if (_x find _grp == 1) then
{
if (str _tgrp != "") then
{
_tgrparray = [];
{
if (_x find _tgrp == 0) then
{
_trgparray = _x;
};
}forEach bluGroup;
if (_tgrparray select 0 != _x select 0) then
{
breakWith _x;
};
}
else
{
breakWith _x;
};
};
} foreach bluGroup;
};
Does the "Respawn" event handler trigger only for players respawning, or does it work with vehicle respawns as well. (Through vehicle respawn module)
and if the secon parameter is not empty then i want to find the corresponding subarray to the second param in dependence to the first param
no
I don't understand your subarray specification. Can you list example of the array contents and what the input parameters are?
provide example inputs and desired outputs
why didn't you just use getVariable like I suggested before?
this is the bluArray. my first param would be 'B Alpha 1-2' and the function shoud get my the whole subarray with the first entry 'B Alpha 1-2'
cause i wasnt able to 😭 😬
_index = bluGroup findIf {_x select 0 == _tgrp};
//if (_index == -1) handle not found
_foundGroup = bluGroup select _index:
it would've been faster and easier to use than constantly maintaining an array of parameters
plus it makes more sense too
😢 i´m not good with programming and i just did it this way once and now i just do it that way everytime and it was way easier for me to show the array everytime and then look at the changes
_group setVariable ["someParameter", "infantry"];
_group setVariable ["otherParameter", "idl"];
and you can just fetch it:
_parameter = _group getVariable ["someParameter", "infantry"]; // attempt to get the someParameter variable. if it doesn't exist it automatically uses the default value "infantry"
_otherParameter = _group getVariable ["otherParameter", "idle"];
i think now i´m going to completely rewrite the whole script
so it triggers for vics as well?
no
vehicles don't respawn like units
they get deleted and a new one is created instead, all done by the script that the module uses (respawn EH is triggered by the engine, not scripts)
it might have scripted event handlers for that though
thanks, maybe there's an EH for when an object gets deleted. Thanks!
found it. thanks
I was feeling weird so I made a simple script to filter log messages and to view them as color coded in Baretails by using keyword highlighting (https://www.baremetalsoft.com/baretail/)
if every group now has a variable groupType and i want to find a group with groupType transport how would i do that the best way?
Does anyone have experience with executing ace functions, like addaction globally? Like on all clients
^remoteExec not working
Anybody wanna help me with a scripting riddle that i just cant figure out
Basically what i am trying to do is this,
an addAction that when the player interacts with;
- fades out to black
- teleports you to a place
- plays a short sound
- fades in
- removes map and gps
all this is basically done to simulate rappelling into an underground facility via a manhole cover that you interact with
and so far i have the teleport bit figured out
Looking those steps up individually on google should net results
Thats what ive been trying but combining them into one solid addAction has just not been working out
Create a function that will do all these steps one by one, which should not be hard to do.
Then just call this function from the action
@still forum What is the condition for showing/hiding map icons (rocks, churches, wrecks, gas stations, etc.) in the engine? From my testing I found the number 0.08681 of ctrlMapScale, if scale is <= 0.08681 then all icons show up, otherwise they don't.
class RscMapControl {
...
class Rock {
color[] = {0.1,0.1,0.1,0.8};
icon = "\A3\ui_f\data\map\mapcontrol\rock_ca.paa";
size = 12;
importance = "0.5 * 12 * 0.05";
coefMin = 0.25;
coefMax = 4;
};
```There is "importance" number in config that I thought was related, but other icons that show up at the same time with say rocks have different importance:
class Shipwreck
{
icon = "\A3\ui_f\data\map\mapcontrol\Shipwreck_CA.paa";
size = 24;
importance = 1;
coefMin = 0.85;
coefMax = 1;
color[] = {0,0,0,1};
};
```So its probably something else. I can't seem to figure out, there are no mentions of 0.08681 or 0868 in config anywhere, its either hardcoded or calculated somehow. Can I ask for your engine insight please?
If you mean controlling AI in your group, this is the wrong channel, but this may be what you're looking for https://steamcommunity.com/sharedfiles/filedetails/?id=2661374997
If you're looking for the relevant scripting command, it's https://community.bistudio.com/wiki/setCombatMode
im looking for a command to force ai too shoot on command
Scripting command or AI control menu command?
Ah, weaponState and forceWeaponFire works well
if i wanted to force ai to shoot on a trigger how would i go about doing that?
im thinking about telling serveral ai to forceWeaponFire
but i dont want to list all of them out
forEach to loop through each unit, and either add the AIs to an array, or use trigger's thisList to get units in the trigger area
Hello , there is command getOrDefault in hashmaps, how do i set default value to hashmap?
BIKI told you to set last arg true
["_currentState", 0,true]
Like this?
So if is not set it takes 0?
i mean it set 0, and get 0 if i do not set before that anything there?
Yes
In this case, if _currentstate key exists then it will return whatever it is. If it doesn't exist and the third argument is true, then it returns 0
Thanks guys
RemoteExec is the way, so find out what you're doing wrong there and fix it
if (importance >= currentMapScaleX) DoDraw
That is for tree,smalltree,bush,rock
the others... oh.. the others also same thing, just not River, Building, RailWay, House, Fence, Wall, PowerLines
What is currentMapScaleX in relation to ctrlMapScale? Rock has importance of 0.5 * 12 * 0.05 = 0.3, Shipwreck has importance of 1, yet both show up when ctrlMapScale is <= 0.08681 🤔
oh shipwreck is separate
shipwreck, church, chapel, fuelstation, hospital, ruin, tourism, power*
are buildings AND icons. Icon is only drawn same thing, importance and scaleX.
buildings are always visible i guess
but that means it should still be scale for the icons tho
ctrlMapScale returns scaleX, exactly what is used for these checks
0.3 is nowhere close to 0.08681 🤔
Unless its some other importance and not that of RscMapControl
i searched for coefMax to find this.
And there is only one coefMax in all of engine
next to the importance
I don't know where exactly to ask this question, but is it possible to launch Arma 3 with mods from .bat file?
Alright, thanks for the explanation. I guess I'll just have to use that manually found value instead of trying to figure how engine calculates it.
"-mod=@mod1;C:\FullPathToSomething\@mod2"
I don't have time to investigate more
No worries, its not critical. Thanks for trying, thought it would be easier to figure out.
Ty
Here is my RHS mod client startup .bat file contents:
arma3_x64.exe -nopause -nosplash -world=none -skipIntro -noLauncher -useBE -ShowScriptErrors "-mod=C:\Program Files (x86)\Steam\steamapps\common\Arma 3\!Workshop\@RHSUSAF;C:\Program Files (x86)\Steam\steamapps\common\Arma 3\!Workshop\@RHSAFRF;C:\Program Files (x86)\Steam\steamapps\common\Arma 3\!Workshop\@RHSSAF;C:\Program Files (x86)\Steam\steamapps\common\Arma 3\!Workshop\@RHSGREF"
Yes, it works, thanks friend!
Hello there
Im locking for a script or a tip for forcing ai controled drone to be a suecide dron (like vanilla predator) actuly i need the part that force the drone to dive on target
Any one have any idea?
I just typed "suicide drone" in Workshop, check if this works for you, I bet you can slap code on other UAVs https://steamcommunity.com/sharedfiles/filedetails/?id=2458395981&searchtext=suicide+drone
Actuly these are vtole drones and im trying to use the other type
A Darter is a helicopter not a VTOL
Yes my bad (helicopter and vtols)
And what do you mean by trying to use other type?
The type of dronse that are same as a plane and need a runway to take of (i cant remember the name that they called)
Like rq-1 predator
Then why not just fetch the script from the Workshop Item and apply it into an RQ-1 Predator and call it a day?
Bcz the rq 1 wont dive on target
A Darter doesn't either
It seems clear enough to me that the script does something that works with the helicopter flight model or AI behaviour, but doesn't work with the plane flight model or AI behaviour. Exactly what that is, I can't say without looking at the script. I'll check it out later if no one else gets to it first.
It looks like the Workshop script achieves its dive by forcing the drone to move towards the target's position, and then deleting the driver once it's inside a certain distance. I guess because of how copter drones work, this causes the drone to fall out of the sky.
Planes have a different flight model and will continue to glide rather than dropping like a rock. They also have much less precision in their movement and may not be able to fly directly at a man-sized target when under AI control. It may be possible to script something that gets the desired effect, but it's likely to be pretty complicated and I'm not going to try it.
So its not my answer . Im locking for the diving part of the scrript
Tnx
CfgLocationTypes
These seems to be names, I wonder about rocks icon
class RockArea: Hill { name = "Rock Area"; color[] = {0,0,0,1}; size = 12; shadow = 0; importance = 2; texture = "\A3\ui_f\data\map\locationtypes\rockarea_ca.paa"; };
but might be also the engine has some hardcoded
what is the safest ways to create vehicles nowadays in the landscape to avoid PX skyrocketing?
still creating in a safe area first and then setPos/setVehiclePosition?
Looking at using the below script to replace some buildings on Altis for a scenario; once I've made my adjustments to the arrays I'll basically just be removing the demountable military buildings and replacing them with older style barracks, watchtowers etc.
Main thing I want to double check: given that it's working with createVehicle and hideObjectGlobal, both of which are global, what would be the best file to execute this in assuming it's running on a dedicated server and will need to take effect for JIP players? Would executing it once in initServer.sqf work fine?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
You can use findIf for example
An alternative approach would be to keep an array of transport groups separately
You mean initPlayerLocal.sqf or onPlayerRespawn.sqf; initClient isn't a thing I don't think
As always wait until display exists
Also don't use visiblePosition
Either use unitAimPos or ASLtoAGL getPosWorldVisual
No
It takes AGL
Just quickly throwing this one out there again re best place to execute this script
createVehicle "CAN_COLLIDE" will create it exactly where you want it, 0 azimuth though
Maybe https://community.bistudio.com/wiki/awake can help after you rotate the vehicle if it starts its physics?
i have a problem... i´m calling a function which returns a group if it found one but should return something when it doesn´t found one.
findGroup = {
params ["_variable", "_search", "_status"];
{
_temp = _x getVariable _variable;
_temp1 = _x getVariable ["groupStatus", "idle"];
if (_temp == _search) then
{
if (_status != "") then
{
if (_temp1 == _status) then
{
breakWith _x;
};
}
else
{
breakWith _x;
};
};
}forEach bluGroups;
};
// it´s called with:
_transportGroup = ["groupType","transport","idle"] call findGroup;
but if nothing is found i want to return something that my if statement can evaluate if a group was found or not. where do i have to put the return if nothing was found?
https://community.bistudio.com/wiki/grpNull can be checked with https://community.bistudio.com/wiki/isNull and shouldn't trigger any type errors
But If I run that code and it doesn't find anything _transport group is not defined...
Even if I define it before
then make your findGroup return grpNull if it hasn't found anything by just slapping grpNull as its last line 🤷♂️
thanks but i want the engine to find a safe spot. just not having too much success if you have dynamic positions
like there are some sqf command and functions, but none seem to work too reliably
i tend to rather clear the are from terrain objects to create a safe area..
I guess the most reliable would be your own function with ray tracing and bounding box checking
well that sounds a bit too expensive 🙂
but now it always returns grpNull
findGroup = {
params ["_variable", "_search", "_status"];
{
_temp = _x getVariable _variable;
_temp1 = _x getVariable ["groupStatus", "idle"];
if (_temp == _search) then
{
if (_status != "") then
{
if (_temp1 == _status) then
{
breakWith _x;
};
}
else
{
breakWith _x;
};
};
}forEach bluGroups;
grpNull
};
im sorry 😦
hi
MC_fnc_findGroup = {
params ["_variable", "_search", "_status"];
private _foundIndex = bluGroups findIf {
_xName = _x getVariable _variable;
_xStatus = _x getVariable ["groupStatus", "idle"];
_xName == _search && (_status == "" || _xStatus == _status)
};
if (_foundIndex != -1) exitWith {bluGroups select _foundIndex;};
grpNull; // Not found
};
typeOf?
yyyes, but please state your use case
myObject isKindOf "CAManBase"
as @south swan rightly got 😉
is every Man
typeOf = exact classname
isKindOf = does it inherit from this class
if i want to pass something to an if statement how would i do that? e.g.:
_condition = {_unitcount == count units _grp};
[_grp,_taskpos,_taskdescription,_taskname, _condition, _status, _statusfinished,_vehicle] spawn
{
params ["_grp","_taskpos","_taskdescription","_taskname", "_condition", "_status", "_statusfinished","_vehicle"];
while {true} do
{
_unitcount = {alive _x && _x inArea [_taskpos,10,10, 0,false, -1]} count units _grp;
hint str _condition;
sleep 5;
if (_condition) then
{
[_taskid,"Succeeded", true] call BIS_fnc_taskSetState;
_grp setVariable ["groupStatus",_statusfinished];
hint "task succeeded";
leader _grp removeAction _deleteactionId;
break;
};
sleep 10;
};
};
here, _condition is code, not a boolean
so either
private _condBool = alive player;
if (_condCode) then { /* ... */ };
private _condCode = { alive player }; // MUST return true/false
if (call _condCode) then { /* ... */ };
my ninja!
but in the condition you are using _grp, which is an internal variable - not gud to know variables from the outside
that doesn´t put out an error neither does it work 😦
aaand what's your code/function call?
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
any idea whats wrong? except that the code is poorly written XD
the indent is wrong
Dedmen I think the SQF parser should throw an exception for such code and refuse to run it
not touching that, sorry 😬
whats the indent?
i had it working before with a trigger but now that trigger had just refused to work 😦
inb4 indentation-driven SQpyFon
any idea how i could fix it?
This is the indent: https://i.imgur.com/nabPTo5.png
It is not functionally wrong but it's very upsetting. Use one tab for each level, not 50.
ok get it but whats wrong with to code? why does the if not trigger?
It's hard to say without knowing what the condition actually is
to my defence i thought it is clearer when all the code is under each other and with the corresponding statement (the tostring in this case)
https://pastebin.com/3fseKCmn clearer here I believe
I don't see a problem with condition, looks ok to me.
_actionId is undefined in L44
_taskId is undefined in L41
damn i didn´t notice that...
L36 could be optimized with inAreaArray but doesn't matter much
That sleep on line 38 doesn't make sense to me.
You want to succeed the task when all units are in area.
You count units in area, then wait 5 seconds (enough for all of them to run out again) and then succeed the task even though they aren't in the area anymore
You could add diag_log's or systemChat's to your code to have some logging to see what's going on
right. used it for a hint thats not longer there. i definetly should clean my code more
I love this toString { on addAction, I haven't seen anyone use that before
me! me! me!
all these "hint str [""hello there, """"%1"""""", name player]" got on my nerves 😄
but even with all the changes the if still isn´t triggered or i would see the hint "task succeeded"...
I miss having something like isNull createHashMap to check if hashmap is empty\brand new or having null hashmap, count createHashMap == 0 is 2 operators and it triggers me.
Not a suggestion, just crazy ramblings
Love using hashmaps as objects and sometimes I want to return\have empty\null object
When in doubt, diag_log\systemChat the hell out of it
add hint or diag_log to see what parts of your code run or don't
isEqualTo createHashMap 😄
3 commands, count, createHashMap and ==
_x isEqualTo createHashMap
is only 2 commands
nevermid... forgot its only refreshing after 10 secs
newhashmap = createHashMap; [diag_codePerformance [{count newhashmap == 0}], diag_codePerformance [{newhashmap isEqualTo createHashMap}]]
[[0.00044,100000],[0.00045,100000]]

heresy
Locations don't have C size, do they?
I guess I'll have to use triggers for area detection with inArea then 
Wonder how much performance these eat up by simply existing compared to locations 🤔
What do you need a trigger for?
Quickest way to check if entity is inside area, including height
I can do pos in location and then do additional z check, but i'd prefer using single command inArea
in area has C as height?
It does when you provide an array
I guess parsing scripted array should be slower than providing trigger for its area
Gonna do performance tests soon
https://community.bistudio.com/wiki/backpacks
Why have this when you can do it already with flatten([uniformContainer player, vestContainer player, backpackContainer player] apply {everyBackpack _x apply {typeOf _x}})? 🤔
Did somebody need to get array of all backpacks in all containers of all units on the map each frame so it required a dedicated command to save performance?
flatten([uniformContainer player, vestContainer player, backpackContainer player] apply {everyBackpack _x}) apply {typeOf _x} tiny bit quicker
Because at this point it's not an option
Speaking about questionable commands, I'd love to know the story behind need for WFSideText, almost str side _x but not for all sides and capitalized instead of all caps.
its not an option for you
running both langs. in parallel for the next few month to year will give every mod enough time to upgrade
It's not an option for BI either, how much money would they need to throw in ?
alt. a dev-build could be deployed with the new lang so that mods can upgrade
oof, that was Arma 2 time yeah - and I never understood why either - maybe a "sure way" to have the expected result and to put Warfare into the game code itself
but tbh, I wish it didn't 🙂
Too much work, better do it on a new release
Did the test
testpos = getPos player;
testa = 100;
testb = 100;
testc = 100;
testangle = 45;
// 1
loc = createLocation ["Name", testpos, testa, testb];
loc setDirection testangle;
testfnc1 = {
if!(getPosWorld player in loc) exitWith {false};
getPosWorld player select 2 < (position loc select 2) + testc;
};
// 2
testfnc2 = {
player inArea [testpos, testa, testb, testangle, false, testc];
};
// 3
trig = createTrigger ["EmptyDetector", testpos, false];
trig setTriggerArea [testa, testb, testangle, false, testc];
trig enableSimulation false;
testfnc3 = {
player inArea trig;
};
[
call testfnc1
,diag_codePerformance [{call testfnc1}]
,call testfnc2
,diag_codePerformance [{call testfnc2}]
,call testfnc3
,diag_codePerformance [{call testfnc3}]
]
```=> `[true,[0.00194,100000],true,[0.00132,100000],true,[0.00064,100000]]`
Only need to check upper limit of area, but it would've been even slower if I checked down too in `testfnc1`
Guess I'm gonna switch to using triggers for area instead of locations now
Might be something to do with localization, Arma 2 had issues with sending localized AI commands over network so you could instantly tell which language uses has because their commands were broadcasted in it.
you mean the call RE; Multiplayer Framework?
Engine-sent AI commands you see in the chat were localized to sender's language, my guess is that the command was related to localization issues
Now I wonder how it was used
wasnt there some new even OOP lang in dev for DayZ?
don't go down that road, you know how it ends!
… gimme an L gimme an O gimme an L: L O L!
It feels like something that should've been a function but someone got lazy
Namespace getVariable Array Arma 2: Operation Arrowhead v1.60
Dunno I don't follow DayZ
There is no EH for connectedToUAV, right?
"PlayerViewChanged" mission EH?
not quite. I want to slew the uav camera while looking at the customInfo panel, so view is still on player unit.
but it would make sense
thanks! then i'll just base it on inputactions that change the panels.
see https://community.bistudio.com/wiki/Code_Best_Practices for good advices 🙂
(and https://community.bistudio.com/wiki/Code_Optimisation if you want)
thanks
why does a group with the "GETOUT" Waypoint does not get out of the Vehicle if they arrive at the waypoint destiantion?
It's called enscript I think
no idea
mods?
wrong setup?
cursed computer?
but they do get in perfectly
I didn't ask if they get in perfectly 🙃
yeah i have many mods
try vanilla
if it works, you have your answer
More like C++ I believe
even in vanilla they don´t get out 😦
You mean an sqf file with all the things listed one by one right?
A sqf file, a function defined in CfgFunctions, or just a private function, all would work. But yes
alright thanks
I added this interaction to the object i interact with
this addAction ["Climb down ladder", {execVM "script.sqf"}];
and i added this as line 1 of "script.sqf"
{player setPosATL (getPosATL pad2)};
nothing happens
line 1 looked like this to begin with: [{player setPosATL (getPosATL pad2)}];
but i removed the square brackets hoping it would help
remove the {}
what kind of vehicle? and how many group members?
Vehicle is a Hemtt transport and the groupsize was 4 but even with more units it wont work. Vehicle is another group... I tried Unload, TR Unload, GETOUT
Im going from a different angle and now im trying this, adding two actions that happen when someone interacts with the addAction, what im thinking is that i am incorrectly stringing it to one addaction
this addAction ["Rappel down the rope",{player setPosATL (getPosATL pad2)}, {Trigger_Con = true; publicVariable "Trigger_Con";}];
{player setPosATL (getPosATL pad2)} this teleports the player
{Trigger_Con = true; publicVariable "Trigger_Con";} while this triggers a trigger that plays effects to go alongside it
Vehicle is another group
then use the unload transport waypoint
had no effect. already tried that
if you use getOut you should use it on the original group
yeah set the transport group to tr unload and the original group to getOut. did not work
manually unload them then 
how?
this worked btw and i added my fade in and fade out script afterwards
cutText ["", "BLACK OUT", 1]; sleep 1; player setPosATL (getPosATL pad2); cutText ["", "BLACK FADED", 3]; sleep 3; cutText ["", "BLACK IN", 3];
this is what it looks like but all it does is, it tps you to the location, flickers for a split second waits a bit and then flickers 3 seconds after
my friend who gave me the fade script has no idea why it just flickers instead of doing the full fade in and fade out
what about like this?
_layer = "Koylas_layer" call BIS_fnc_rscLayer;
_layer cutText ["", "BLACK OUT", 1];
sleep 1;
player setPosATL (getPosATL pad2);
_layer cutText ["", "BLACK FADED", 3];
sleep 3;
_layer cutText ["", "BLACK IN", 3];
what do the layers do? im trying your version out now but im just curious
prevents conflict 
I WILL KISS YOU ON THE LIPS
it works hehe
and to add a sound effect in between that would i need to do any layer stuff aswell?
you can use playSound, say3D, etc.
leaveVehicle did the job. Thank you
Hello, I found this and I am looking for a way to make it only signal a message in chat when a civi is killed.
Anyone got any advice?
init.sqf
TAG_StartingRespawnDelay = 10;
addMissionEventHandler ["EntityKilled",
{
params ["_killed", "_killer", "_instigator"];
if (isNull _instigator) then {_instigator = UAVControl vehicle _killer select 0}; // UAV/UGV player operated road kill
if (isNull _instigator) then {_instigator = _killer}; // player driven vehicle road kill
if ((side group _killed == civilian) && (isPlayer _instigator)) then {
if(isServer) then { [(side _instigator), -1] call BIS_fnc_respawnTickets; };
TAG_StartingRespawnDelay = TAG_StartingRespawnDelay + 10;
setPlayerRespawnTime TAG_StartingRespawnDelay;
systemChat format ["%1 killed a civilian. Ticket subtracted (%2), Respawn time added (%3).", name _instigator, [_instigator,nil,true] call BIS_fnc_respawnTickets, TAG_StartingRespawnDelay];
};
}];
How would I have a script do stuff on initial spawn but then stop after that?
Untested but should work.
if(isServer) then {
addMissionEventHandler ["EntityKilled",
{
params ["_killed", "_killer", "_instigator"];
if (side group _killed == civilian) then {
"A civilian was killed!" remoteExec ["systemChat"];
};
}];
};
ima give it a try thank you
seems to work fine, thank you very much
not to ask for too much, but is there any way of making this send a message only after a sustain amount of killed civies, say 3?
After like 3 are killed in a short amount of time, or so it only starts warning after 3 civilians have died in the whole mission? I can do the second one, but the first one would take a bit more thought and coding
second one would be just fine
as long as I know how to change that number easily if it turns out to be too many or few
I just dont want a bad call artillery strike to spam chat
or a poorly thrown grenade
Here's one that starts messaging after 3 civilians have already died
if(isServer) then {
private _CivKillCounter = 0;
addMissionEventHandler ["EntityKilled",
{
params ["_killed", "_killer", "_instigator"];
_CivKillCounter = _CivKillCounter + 1;
if (side group _killed == civilian && _CivKillCounter > 3) then {
"A civilian was killed!" remoteExec ["systemChat"];
};
}];
};
Here's one that should limit the messages to once every 3 seconds, the time can be adjusted with the uiSleep line
if(isServer) then {
HAM_messageCooldown = false;
addMissionEventHandler ["EntityKilled",
{
HAM_messageCooldown = true;
params ["_killed", "_killer", "_instigator"];
if ((side group _killed == civilian) && (HAM_messageCooldown = false)) then {
"A civilian was killed!" remoteExec ["systemChat"];
};
uiSleep 3;
HAM_messageCooldown = false;
}];
};
The limit works so if several are killed in the 3 seconds, it just wont send a message about the additional ones at all so it might work better for what you were thinking of
Sorry I had a mistake in the cooldown code, I fixed it
shownUAVFeed and infoPanel update quite some time after the VehicleDisplay useractionEH fires. between 2 frames to 0.1 seconds. What would be a better way to check whether the player has switched to the uav feed?
I would like to ask, if I wanted this to repeat for when the next 3 has been killed, should I just duplicate this (while changing the number to 6)?
If you add _CivKillCounter = 0; on a new line below the remoteExec line, it should reset the counter after sending the message
That's for the top one of the 2 scripts I sent
if(isServer) then {
private _CivKillCounter = 0;
addMissionEventHandler ["EntityKilled",
{
params ["_killed", "_killer", "_instigator"];
_CivKillCounter = _CivKillCounter + 1;
if (side group _killed == civilian && _CivKillCounter > 3) then {
"A civilian was killed!" remoteExec ["systemChat"];
_CivKillCounter = 0;
};
}];
};
Yes
Thank you
Honestly people should make standardized files for these kinds of things its so useful
My unit has a few of these I got with help form people here
** initPlayerLocal.sqf:**
//initPlayerLocal.sqf:
player addEventHandler ["Respawn",{
params ["_newObject","_oldObject"];
deleteVehicle _oldObject;
}];
player addEventHandler ["Respawn",{
player switchMove "UnconsciousFaceDown"; player playmove "UnconsciousOutProne";
}];
onPlayerKilled.sqf
player setVariable ["Saved_Loadout",getUnitLoadout player];
onPlayerRespawn.sqf
player setUnitLoadout (player getVariable ["Saved_Loadout",[]]);
this is wrong
_CivKillCounter is not visible to the EH
change that var to global
Oh yeah, I thought about that when writing the second one but forgot I did that for the first one
Well shit, I always forget about that. This would work then?
if(isServer) then {
HAM_civKillCounter = 0;
addMissionEventHandler ["EntityKilled",
{
params ["_killed", "_killer", "_instigator"];
[_killed] spawn {
HAM_civKillCounter = HAM_civKillCounter + 1;
if (side group _killed == civilian && HAM_civKillCounter >= 3) then {
"A civilian was killed!" remoteExec ["systemChat"];
HAM_civKillCounter = 0;
};
};
}];
};
Nevermind it was the second one that used uiSleep, not the first one
wait
which one was non-functional?
the one where every 3 civies gives a warning or the one with a time cooldown
Is this still correct?
no
what would be correct then?
if(isServer) then {
HAM_CivKillCounter = 0;
addMissionEventHandler ["EntityKilled",
{
params ["_killed", "_killer", "_instigator"];
HAM_CivKillCounter = HAM_CivKillCounter + 1;
if (side group _killed == civilian && HAM_CivKillCounter > 3) then {
"A civilian was killed!" remoteExec ["systemChat"];
HAM_CivKillCounter = 0;
};
}];
};
Alright thanks
Want it to give a warning for every 3 civies killed
instead of just doing that once
so 6 civies killed = 2 warnings
etc etc
then it should say 3 civilians were killed 
hu?
this would not do that?
I mean the message it prints
ah
I'll change it as fit, I just want a message I can edit to whatever
"Slaughtering civilians is a severe warcrime" for example
Need to remove private from the global HAM var 🙂
How can I make a turret shoot at enemies with no one using it and no npc in it on a vehicle im working on
hu?
Leopard fixed the code snippet for you 🙂
create an invisible AI (like UAV driver/gunner)
you can have an automatically-operated turret on every vehicle this way
Thank you
I had this script working awhile ago but cant seem to figure out what Im doing wrong now as it stopped working and Im not doing anything different. Its this one - https://forums.bohemia.net/forums/topic/237644-ombra-random-minefield-scriptfunction/
What does this script do? This script creates a minefield with a random number of mines and IED, positioning them in a random way inside the given area. Does not include APERSTripMine (mines with cable) Does it work in multiplayer? Yes, it works in MultiPlayer and SinglePlayer Parameters _area → ...
Heres how I have it in my init.sqf - if (isServer) then { ["mines", 10, 30] execVM "randomMinefield.sqf"; };
Can someone help me get this figured out?
I hate scripts so freaking much
learn to write your own then?
I just hate scripts in general, not just this one in particular.
I just constantly have issues with them and they drive me crazy
learn how to script, and then only have problems you cause 🙂 instead of dealing with someone elses. luckily, minefields are relatively easy to script
well as I said - I had this one working just a few weeks ago, and now its not. So Im trying to figure this particular one out.
Error missing ;
come with a line number?
line 1
in the script file or the init file?
should tell you what file as well
error missing ; on line 1 tells me you might have accidentally put a character on line 1 somewhere that isn't part of anything
Not sure how - I copied and pasted directly from the guy who made the script and changed the values to fit
if (isServer) then { ["Mines", 10, 30] execVM "randomMinefield.sqf"; };
is what I have
is that the only thing in that file?
Yeah, I typically use more but Im trying to diagnose this one so thats the only line in the init
so if there is only 1 line in the init and it contains that, its not in the init file. open up the randomMinefield.sqf and make absolutely sure there isn't an extra character on line one
Well not sure what I changed but that error stopped popping up. I am now getting no errors but no mines when loading into the mission
post more errors
There are no errors showing up
just, pm me your mission folder. might have to zip it
Messaged you - thanks for your help
How do i call a function into unscheduled environment so I can suspend?
Yes I've followed what that says on isNil{ call tag_fnc_name} but I'm still unable to suspend inside that function
I am not recruiting scripters. But how much do you guys think mod projects usually cost/are worth?
Specifically script mods, mods with a lot of scripts and scripting functionality, AI stuff, gameplay mechanics
you can't suspend in the unscheduled environment. you can change over to scheduled using spawn
[] spawn ztrac_fnc_myFunction
ah i had it backwards in my mind, righto thanks
Wo params
or if there are no parameters, one can simply do this:
isNil MY_fnc_Function
Or like hypoxic says
so i saw your reddit post... you are willing to pay 800-1000 for an arma project? either you have way too much expendable income or your priorities are in the wrong place.
in the mean time, take this conversation over to #creators_recruiting
I was just in the middle of replying to you!
I'm not recruiting any developers though at the moment, and discussion isn't allowed there...
Where should I be putting my priorities then?
alright. well this is a passion project for most of us. I guess it would depend on the scale of the project you want to do down the line. A huge thing? yeah that could be costly unless you convince the community to help out together. small scale stuff is like, beer money or something
are you intending on getting money back after getting the project that you want?
No