#arma3_scripting

1 messages · Page 45 of 1

hallow mortar
#

Not in a way where local vs global variables would break it

languid tundra
#

Is there a way to read profile settings in SQF?

drowsy geyser
#

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] 
    ];   
}];
little raptor
#

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

fallow vector
#

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

granite sky
#

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.

hallow mortar
#

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

wanton tundra
#

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.

kindred zephyr
#

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

wanton tundra
winter rose
kindred zephyr
opal zephyr
#

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

meager granite
#

These near* command looks through different lists

#

Try nearestObjects

opal zephyr
# meager granite Try `nearestObjects`

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...

meager granite
opal zephyr
#

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

opal zephyr
#

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

meager granite
#

What object are you creating?

opal zephyr
#

I was an object I modded in, not one from base game. The object is spawned in 3den editor

meager granite
#

How it is spawned matters the most

outer python
#

Hello

#

I need help with something that is bothering me right now.

warm hedge
#

Then ask for help

#

Not ask to ask

outer python
# warm hedge Not ask to ask

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.

torpid mica
#

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

south swan
#

afaik arrays are handled by reference. So you can use _bigArray select 2 to get sub-array and use set on that 🤔

torpid mica
#

but that wont work when the array is empty right?

south swan
#

"i want to change a sub-array that may not exist yet" sounds kinda strange tbh 🤔

torpid mica
#

yeah. only in the first iteration the subarray does not exist. i gets created and populate by more then one script

little raptor
#

So don't use it often

#

Also allObjects will support strings once v2.12 is available (you can try it on dev branch)

little raptor
torpid mica
# torpid mica yeah. only in the first iteration the subarray does not exist. i gets created an...

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;
little raptor
#

Use resize meowsweats

torpid mica
torpid mica
outer python
little raptor
torpid mica
#

thanks mate

little raptor
#

Gives you 100 empty arrays

little raptor
outer python
south swan
#

private _allBluforGroups = groups blufor; only becomes available with 2.12 meowsweats

torpid mica
south swan
#

2.10 with 2.12 being planned to release "soon"(tm)

torpid mica
#

yeah soon can mean half a year right?

little raptor
#

Oh is that what you're trying to do? meowsweats
I didn't even read your script...

#

That script has so many problems...

torpid mica
torpid mica
south swan
#

inb4 hashMap-fueled caching system meowsweats

little raptor
#

For one thing not being written properly
E.g. using foreachindex to set the opfor group thingy

#

Other being manual counter

torpid mica
little raptor
#

Another being resizing the array when you don't even know how many you want

torpid mica
little raptor
#

Don't copy paste. Use functions 😓

little raptor
torpid mica
#

no problem...

torpid mica
south swan
#

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;
};``` 🤷‍♂️

little raptor
#

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...

torpid mica
#

maybe you should join me in my project XD

torpid mica
#

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

little raptor
#

Use the array to simply get the groups faster

torpid mica
#

you think of setVariable?

little raptor
#

Yes

south swan
#

because ordering/count of groups can change and it would invalidate all the data that's set manually anyways

little raptor
#

If it's an array then use setVar once. Use getVar + set afterwards

torpid mica
pulsar bluff
#

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; };

south swan
#

2.12, though

pulsar bluff
#

2.12 isnt far ooff

little raptor
#

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

pulsar bluff
#

too bad we dont have a "setVariableDefault" or "setVariableDefaultCall"

south swan
#

*get

pulsar bluff
#

yea

#

my bad, drunk & high lol

little raptor
#

A simple flag for getVar can do it

pulsar bluff
#

yea "getVariableDefaultCall" i have dreamed about for a couple months now

little raptor
torpid mica
#

and how could i delete empty groups without leaving an epmty array entry?

#

is deleteGroupWhenEmpty on default true or false?

granite sky
#

Pretty sure it's false.

#

But you could check easily enough.

winter rose
#

I believe it's true by default in A3

granite sky
#
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.

hallow mortar
#

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.

granite sky
#

There may be a distinction between emptying a group with join and emptying a group by units dying or being deleted.

#

Confirmed.

winter rose
#

tbh, I have no clear idea of the entirety of the groups management system
we'll have to explore, deduce and write

granite sky
#

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.

winter rose
#

like [onlyUnit] join objNull?

granite sky
#

yeah

#

Struggling to find a case where deleteGroupWhenEmpty deletes the group :P

little raptor
#

Yeah it never works 😅

winter rose
#

I believe it is a cycle like every 1, 5 or 10 minutes something

little raptor
#

But all empty groups do get deleted after 60s thonk
At least as far as I remember when I was messing with that

winter rose
#

we could ask KK or Dedmen… 😏 I know KK worked on groups recently

granite sky
#

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.

winter rose
granite sky
#

hmm, maybe it needs a live leader to do that.

#

But then group is never going to be empty except via deletion or join.

manic sigil
#

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?

torpid mica
#

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?

manic sigil
torpid mica
#
_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

granite sky
#

@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.

winter rose
#

Google: did you mean "recursion"?

south swan
#

endless recursion at that

stable dune
#

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]
]
south swan
#

_attempt3 = [_allGroupWithPlayers, [], {str _x}, "ASCEND"] call BIS_fnc_sortBy; 🤷‍♂️

stable dune
#

Oo, cant wait solution

winter rose
#

even though "str _x" is risky as if a group has a var name it will be "varname" 😬

winter rose
#
[_allGroupWithPlayers, [], { groupId _x }, "ASCEND"] call BIS_fnc_sortBy; // final v3.docx
winter rose
#

a lot 😁

manic sigil
south swan
#

groupId may be better semantically, but it seems to be roughly equal performance-wise 🤔

manic sigil
#

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.

stable dune
torpid mica
#

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.

granite sky
#

count _array >= 3

torpid mica
#

Ah thanks 😁

winter rose
#
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
stable dune
#

And i want it to be 1st

granite sky
#

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.

torpid mica
#
_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

lucid monolith
proven charm
#

break; can exit the while loop

torpid mica
torpid mica
proven charm
torpid mica
lucid monolith
#

Take away the break and see if it still exits the loop. If it doesn't, then the issue is the if statement

torpid mica
#

still only executed once. I already tried that

lucid monolith
#

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

proven charm
#

what does this line do: "deletevehicle _x;" ? I cant see _x being defined

torpid mica
#

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

torpid mica
proven charm
torpid mica
#

ok thanks

torpid mica
lucid monolith
#

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.

meager granite
#

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

copper raven
frank mango
#

The VLS?

meager granite
frank mango
#

No.. it definitely works.

meager granite
#

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

frank mango
#

I think it needs a laser (or etc) to lock onto. if doing it UAV

meager granite
#

(setMissileTarget on the missile after it is fired)

meager granite
meager granite
#

Close and visible, kilometers away, no difference

copper raven
#

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)

meager granite
#

Vehicle was turned on (engineOn), I also did it reportRemoteTarget on it

meager granite
#

What it does

frank mango
#

idk if that helps you or not. I was (and am) hoping it does

meager granite
#

Works now, confirmSensorTarget is not even needed

#

What the hell is going on thronking

#

Did exactly the same thing

copper raven
#

yea

#

btw setMissileTargetPos is not supported for that ammo type, so you can't use that, but the non pos one works fine

lucid monolith
#

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.

lucid monolith
#

Thanks!

velvet merlin
#

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)

copper raven
tiny loom
#

is there anyway to convert an old arma 2 mod to work with cba?

hallow mortar
#

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.

tiny loom
#

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

velvet merlin
#

sounds like this was all solved years ago

#

is there a way to filter from allControls/controls without getting the reference with (findDisplay x) displayCtrl y ?

tiny loom
#

what does map update interval mean

#

also what do these mean

still forum
#

there is not enough context to give you any answer

torpid mica
#

can i delete Waypoints with deleteVehicle?

still forum
#

no

torpid mica
#

how can i delete Them?

still forum
#

isn't there a deleteWaypoint command?

proven charm
torpid mica
#

oh my god... i didn´t found it i must have misstyped at least 2 times... Thank you

tiny loom
#

does anyone know where this file pathway is

#

i cant find it

south swan
#

it's not file path. It's config path 🤷‍♂️

torpid mica
#

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

south swan
#

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 🤷‍♂️

torpid mica
#

but i delcared it again with _this select... 😦

south swan
#

it doesn't exist at your last line yet. It's only declared and assigned after the action is created.

hallow mortar
#

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.
south swan
#

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 ];

torpid mica
#

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?

tacit swift
#

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

modern meteor
#

How can I delete the current waypoint of a unit?

outer python
#

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

hallow mortar
next kraken
#

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

hallow mortar
little raptor
outer python
outer python
little raptor
#

when activation? what?

outer python
little raptor
#

just put that in the init field

hallow mortar
little raptor
#

also use tags when naming your global vars meowsweats

outer python
little raptor
#

e.g. MR74_myVar

little raptor
#

just copy paste it

outer python
#

okayOk, but how do I make this code only for the unit for example chosen of my choice in game

little raptor
#

meowsweats
just put it in its init field

#

do you know what init field is?

outer python
outer python
#

I have

little raptor
#

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

outer python
#

Ok I will try and let you know if everything is good 🙂

little raptor
#

btw the unit won't reload when you use that code. it will have infinite ammo

outer python
#

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?

little raptor
#

setVehicleAmmo sets the unit loadout based on his config defined loadout

little raptor
#

or even when not aiming meowsweats

outer python
#

Ohh, Okay

#

thnk's you

outer python
little raptor
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```

// your code here
hint "good!";
little raptor
#

what is the error?

torpid mica
little raptor
#

use isNull not isNil

outer python
#

@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

opal zephyr
#

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?

torpid mica
opal zephyr
#

Are you using BIS_fnc_countdown?

outer python
#

I have a problem with enemy AI in my mortar scenario, it won't fire, it won't activate. How to do ?

hallow mortar
wanton tundra
#

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?

hallow mortar
granite sky
#

I think it's 1. yes, 2. yes, 3. temporary (per launch), but yeah. Config makers would know better.

wanton tundra
#

thank you both. i hop to config_makers

true frigate
#

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 🙂
meager granite
true frigate
#

Hmm, it's not a bad idea and it would help. I'll look more into it. Thanks anyway 🙂

next kraken
#

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?

meager granite
#

0 spawn {sleep 1; /*Goats move code*/};

next kraken
#

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

meager granite
#

Try from other places like init.sqf?

#

Just guessing here, not much of an AI guy

next kraken
#

did not work also. maybe calling it other then [] execVM "animals.sqf"

#

?

meager granite
#

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];
next kraken
#

thats beyond my scripting knowledge lol 😭

meager granite
#

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?

manic sigil
#

What's the next scale up if you zoom out? Could be '<.1' or something

meager granite
#

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

manic sigil
#

Ah, I getcha. Yeah, that's a weird cutoff.

pliant stream
#

wait FSM code blocks are atomic?

next kraken
#

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.

fair drum
#

I see no reason why the goats wouldn't move if the agents are created on the server. can you post your code?

next kraken
#

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

meager granite
#

You're creating and moving them to same position

next kraken
#

but that should not be a problem, works fine if i call it over initplayerlocal

meager granite
#

Oh nevermind, there is random radius of 5

#

Where do you create them from right now and it doesn't work?

next kraken
#

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

meager granite
#

And you run it on dedicated server?

next kraken
#

yep

meager granite
#

Why isDedicated instead of isServer?

next kraken
#

i allready tried that, same bad result

meager granite
#

What is goatpos1?

stable dune
# next kraken i allready tried that, same bad result

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;
    };
};
meager granite
#

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

fair drum
#

instead of moveTo use setDestination. I've seen it work better for agents sometimes

next kraken
#

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

opal zephyr
#

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?

next kraken
#

is there no way to tell a trigger "execute that on local only

#

or is there no createunitlocal command, thought there was

stable dune
opal zephyr
#

Thats the first line of the script

next kraken
#

mhh, sorry didnt unsterstand that. is there no way to execute a script only locally on the machine of the clients?

opal zephyr
#

try remoteExec

fair drum
#

you can remoteExec to clients using -2, or to a specific client as well using any client number

stable dune
opal zephyr
next kraken
#

oh ok, but is it possible to use remoteExec to call a script ?

opal zephyr
#

I believe so

warm hedge
#

More like remoteExec is a way to execute a script

next kraken
#

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

opal zephyr
#

could look something like remoteExec [call animalScript, -2, true];

#

I'm not sure if the "call" will override the locality of it though

stable dune
next kraken
#

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=)

stable dune
#

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

next kraken
#

thanks !

gaunt tendon
#

is there any way to reduce throwables cooldown via scripting?

gaunt tendon
#

tyvm

meager granite
# next kraken i cant write functions=)

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

copper raven
#

CfgFunctions has many nice features, its also less stuff to type in the long run

velvet merlin
#

can you make structured text contain clickable text that executes code?
similar to execute for diary

proven charm
#

<a href='https://addresshere.com'> click link </a>

#

i think you need to pass the string through parseText

hallow mortar
#

URLs and executing code aren't the same

proven charm
#

oh my bad I misread :/

kindred zephyr
#

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.

lucid monolith
#

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.

kindred zephyr
proven charm
#

you cant use waitUntil or sleep in unscheduled environment

kindred zephyr
lucid monolith
#

I've done scripts with missions plenty before, but this is my first actual mod

kindred zephyr
lucid monolith
#

Okay, so if this was just for a mission I'd just launch it from initPlayerLocal, but how would I do it here then

kindred zephyr
#

whats this binded to?

#

a player unit?

#

any unit?

#

a car?

lucid monolith
#

It's an automatically refreshing list of player groups in a briefing tab, so nothing really

proven charm
#

if canSuspend == false ... then you cannot use sleep or waituntil

kindred zephyr
#

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.

lucid monolith
#

I was just looking at the mission eventhandlers, PreloadFinished looks promising

lucid monolith
#

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```
still forum
#

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

lucid monolith
#

Yes, I'm unfamiliar

still forum
#

post briefing screen? initPlayerLocal

#

Ah inside mod.
preInit? maybe? 🤔 not sure if thats in briefing, otherwise just postInit then

lucid monolith
#

Mods can use initPlayerLocal?

still forum
#

nope

lucid monolith
#

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.

still forum
#

waitUntil playableUnits is not empty ?

hallow mortar
#

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]

lucid monolith
#

Well I can try that. But seeing how nothing else has worked with waitUntil, I'm not expecting much

still forum
#

how are you running your script? via postInit?

lucid monolith
#

Yes

still forum
#

postInit should run after all entities are initialised.
So you shouldn't need to wait at all

lucid monolith
#

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.

still forum
#

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 {....}

proven charm
#

there's limit on how much and how fast the scheduled code can run, so that's the thing

little raptor
#

it's a matter of compromise
more schd = more delay
more unschd = more FPS drop

granite sky
#

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).

still forum
#

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

little raptor
#

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.)

still forum
#

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

granite sky
little raptor
#

yes

still forum
#

game sorts scripts to have the one that didn't execute for the longest time, come first

granite sky
#

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?

granite sky
#

And therefore should you write some complex and unreliable chunk of SQF to check less often but more smartly :P

kindred zephyr
winter rose
still forum
granite sky
#

Not multiple times per frame at least?

still forum
#

scheduled scripts are only executed once per frame

#

and before they are executed, it sorts once

granite sky
#

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

kindred zephyr
winter rose
#

read BI FSMs (e.g \modules_f\supports\fsms) for good examples

kindred zephyr
heavy dew
#

Is there a way to get SQF scripts to write data to a file?

little raptor
heavy dew
#

Such as?

little raptor
heavy dew
#

Thanks

winter rose
#

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

kindred zephyr
# winter rose it's an "if true"

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

winter rose
south swan
copper raven
torpid mica
#

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?

torpid mica
proven charm
torpid mica
#

thank you. So i need the pass the vehicle as well... it´s going to be a long function XD

south swan
#
private _veh = vehicle leader _grp; 
-1 < ((units _grp) findIf {(vehicle _x) != _veh})``` 🤷‍♂️
kindred zephyr
winter rose
#

and the FSM editor most likely didn't evolve lots

torpid mica
# proven charm ```count (units mygroup) == ({ _x in myVehicle } count (units mygroup))``` somet...

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

winter rose
#

what is taskcreate?

torpid mica
#

my own function

winter rose
#

_condition is a boolean, as you did it

proven charm
#

your code needs to be inside the bracelets { ....... }

torpid mica
#

like that?

["taskgroup","task postion", "Description", "Name", {count (units _grp) == ({ _x in _vehicle } count (units _grp))}, "Site", "Status", "Status when finished"] call taskcreate;
proven charm
#

yep

torpid mica
#

i put a tostring infront, now it doesnt outputs an error but also wont work 😦

proven charm
#

u cant really evaluate string as condition....

#

why not keep it as code?

torpid mica
#

but if the tostring is missing then it says Error type code, expected string

proven charm
#

where?

torpid mica
#

for the condition

south swan
#

takes only strings

proven charm
#

well idk then

winter rose
#

toString _condition

torpid mica
#

is sqfbin still alive? cant find a working link

winter rose
#

seems to be down for a bit now

torpid mica
#

sorry if it is badly written but i can't do it any better

proven charm
#

maybe the trigger itself isn't working

#

you could put there some debug lines via hintSilent or whatever

torpid mica
#

it is if i just pass "this" then it works

proven charm
#

oh good

#

but the "_grp" doesnt exist when the condition is checked

torpid mica
#

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 ""

proven charm
#

u have to do in the condition what u did in the activation _grp = thisTrigger getVariable "_grp";

torpid mica
#

but can i put more then one command in the condition?

proven charm
#

sure

#

but the condition part has to be the last line

#

and dont forget the _vehicle

torpid mica
cosmic lichen
#

Why even use triggers if you script the whole thing?

torpid mica
#

how would I else do it?

cosmic lichen
#

spawn, waitUntil, while @torpid mica

#

sleep is not precise

opal zephyr
#

Are there any wiki pages for the upcoming 2.12? I cant find anything on use of the actual functions

proven charm
cosmic lichen
#

Returns the time since last server restart, synced to all clients in MP. Th

#

It should not

kindred zephyr
#

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.

torpid mica
little raptor
#

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

south swan
#

and here i was about to replicate vectorCos manually with (vectorNormalized _vecA) vectorDotProduct (vectorNormalized _vecB) meowsweats

jade acorn
#

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.

little raptor
kindred zephyr
coarse dragon
#
[ 
  ["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?

little raptor
kindred zephyr
# little raptor if, according to what you said earlier, both vectors are normalized, then rotati...

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
];

?

little raptor
#

but iirc Apex subtitles were already centered think_turtle

coarse dragon
#

yaaa your back

little raptor
#

yeah 😅

coarse dragon
#

they show up in the bottom middle of the screen

#

abit hard to read em when ya have a squad members

little raptor
#

aren't they supposed to? meowsweats
they're subtitles 😅

#

you can try other text things

coarse dragon
#

hmm caan the colour be changed on em?

little raptor
#

if they support structured text yes

coarse dragon
little raptor
little raptor
#

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?

south swan
kindred zephyr
#

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

little raptor
#

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)

kindred zephyr
#

ah, so its the second syntax

little raptor
#

tho it would only be correct if the object is already horizontal

#

which in Arma would only correspond to infantry units (+ animals)

little raptor
kindred zephyr
#

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
};
little raptor
#

no

kindred zephyr
#

and yes, object is horizontal in this case

little raptor
#

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

kindred zephyr
#

hm

#

so the second check has to be > 350?

little raptor
#

yeah

kindred zephyr
#

so getDir second syntax acts as getRelDir?

little raptor
#

oh wait I meant getRelDir meowsweats

#

or did I?
I don't remember 😅

little raptor
#

but not sure. test it

kindred zephyr
#

I will, thanks for your time.

torpid mica
#

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
still forum
#

breakWith _subArray

kindred zephyr
#

^

still forum
#

_temp = blugroup select _forEachIndex;
That is weird.
You already have the value in _x no need to use select to get it again

torpid mica
#

yeah youre right

still forum
#

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

torpid mica
#

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;

};
warm swallow
#

Does the "Respawn" event handler trigger only for players respawning, or does it work with vehicle respawns as well. (Through vehicle respawn module)

torpid mica
still forum
little raptor
torpid mica
torpid mica
still forum
#
_index = bluGroup findIf {_x select 0 == _tgrp};
//if (_index == -1)  handle not found
_foundGroup = bluGroup select _index:
little raptor
#

plus it makes more sense too

torpid mica
#

😢 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

little raptor
#
_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"];
torpid mica
#

i think now i´m going to completely rewrite the whole script

warm swallow
little raptor
#

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

warm swallow
#

thanks, maybe there's an EH for when an object gets deleted. Thanks!

#

found it. thanks

tender fossil
torpid mica
opal zephyr
#

Does anyone have experience with executing ace functions, like addaction globally? Like on all clients

#

^remoteExec not working

tropic cipher
#

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;

  1. fades out to black
  2. teleports you to a place
  3. plays a short sound
  4. fades in
  5. 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

opal zephyr
#

Looking those steps up individually on google should net results

tropic cipher
#

Thats what ive been trying but combining them into one solid addAction has just not been working out

opal zephyr
#

Do you have them all separate?

#

@tropic cipher ^

leaden ibex
meager granite
#

@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?

wary needle
#

hey how would i make ai shoot all at once?

#

is there a command to do it?

digital hollow
wary needle
#

im looking for a command to force ai too shoot on command

digital hollow
#

Scripting command or AI control menu command?

wary needle
#

scripting

#

for a bit of contex its for a musket operation

digital hollow
#

Ah, weaponState and forceWeaponFire works well

wary needle
#

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

digital hollow
#

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

stable dune
#

Hello , there is command getOrDefault in hashmaps, how do i set default value to hashmap?

warm hedge
#

BIKI told you to set last arg true

stable dune
#
["_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?

warm hedge
#

Yes

manic kettle
stable dune
#

Thanks guys

still forum
still forum
meager granite
still forum
#

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

meager granite
#

0.3 is nowhere close to 0.08681 🤔

#

Unless its some other importance and not that of RscMapControl

still forum
#

i searched for coefMax to find this.
And there is only one coefMax in all of engine

#

next to the importance

tranquil jacinth
#

I don't know where exactly to ask this question, but is it possible to launch Arma 3 with mods from .bat file?

meager granite
meager granite
still forum
#

I don't have time to investigate more

meager granite
tranquil jacinth
meager granite
# tranquil jacinth 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"
tranquil jacinth
keen tusk
#

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?

keen tusk
warm hedge
#

A Darter is a helicopter not a VTOL

keen tusk
warm hedge
#

And what do you mean by trying to use other type?

keen tusk
warm hedge
#

A VTOL is a plane, and plane is a plane

#

So I ain't sure what you mean

keen tusk
#

Like rq-1 predator

warm hedge
#

Then why not just fetch the script from the Workshop Item and apply it into an RQ-1 Predator and call it a day?

keen tusk
#

Bcz the rq 1 wont dive on target

warm hedge
#

A Darter doesn't either

hallow mortar
#

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.

hallow mortar
#

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.

keen tusk
meager granite
velvet merlin
#

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?

quiet geyser
#

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?

little raptor
quiet geyser
#

You mean initPlayerLocal.sqf or onPlayerRespawn.sqf; initClient isn't a thing I don't think

little raptor
#

As always wait until display exists
Also don't use visiblePosition

#

Either use unitAimPos or ASLtoAGL getPosWorldVisual

#

No

#

It takes AGL

quiet geyser
meager granite
torpid mica
#

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?

south swan
torpid mica
#

But If I run that code and it doesn't find anything _transport group is not defined...

#

Even if I define it before

south swan
#

then make your findGroup return grpNull if it hasn't found anything by just slapping grpNull as its last line 🤷‍♂️

velvet merlin
#

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..

meager granite
#

I guess the most reliable would be your own function with ray tracing and bounding box checking

velvet merlin
#

well that sounds a bit too expensive 🙂

torpid mica
still forum
#

put it above your }forEach bluGroups; line

#

your code is a total mess notlikemeow

winter rose
#

hi

still forum
#
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
};
winter rose
#

typeOf?

south swan
#

and/or "CAManBase" (or whatever base class is)

#

typeOf returns a String

winter rose
#

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

torpid mica
#

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;
};
};
winter rose
#

here, _condition is code, not a boolean

torpid mica
#

i know but how would i pass as boolean?

#

i can not let the {} away

winter rose
#

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

torpid mica
winter rose
#

aaand what's your code/function call?

torpid mica
torpid mica
winter rose
#

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 😬

torpid mica
#

whats the indent?

#

i had it working before with a trigger but now that trigger had just refused to work 😦

south swan
#

inb4 indentation-driven SQpyFon

torpid mica
#

any idea how i could fix it?

hallow mortar
torpid mica
hallow mortar
#

It's hard to say without knowing what the condition actually is

torpid mica
winter rose
torpid mica
#

yeah you´re right notlikemeow

#

except the formatting you din´t change anything else right?

still forum
#

I don't see a problem with condition, looks ok to me.

_actionId is undefined in L44

#

_taskId is undefined in L41

torpid mica
#

damn i didn´t notice that...

still forum
#

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

torpid mica
still forum
#

I love this toString { on addAction, I haven't seen anyone use that before

winter rose
#

all these "hint str [""hello there, """"%1"""""", name player]" got on my nerves 😄

torpid mica
#

but even with all the changes the if still isn´t triggered or i would see the hint "task succeeded"...

meager granite
#

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

meager granite
still forum
still forum
torpid mica
meager granite
#
newhashmap = createHashMap; [diag_codePerformance [{count newhashmap == 0}], diag_codePerformance [{newhashmap isEqualTo createHashMap}]]

[[0.00044,100000],[0.00045,100000]]

still forum
#

heresy

meager granite
#

Locations don't have C size, do they?

#

I guess I'll have to use triggers for area detection with inArea then thronking

#

Wonder how much performance these eat up by simply existing compared to locations 🤔

cosmic lichen
meager granite
#

I can do pos in location and then do additional z check, but i'd prefer using single command inArea

cosmic lichen
#

in area has C as height?

meager granite
#

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

#

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?

queen cargo
meager granite
#

flatten([uniformContainer player, vestContainer player, backpackContainer player] apply {everyBackpack _x}) apply {typeOf _x} tiny bit quicker

lone glade
#

Because at this point it's not an option

meager granite
#

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.

queen cargo
#

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

lone glade
#

It's not an option for BI either, how much money would they need to throw in ?

queen cargo
#

alt. a dev-build could be deployed with the new lang so that mods can upgrade

winter rose
lone glade
#

Too much work, better do it on a new release

meager granite
# meager granite Gonna do performance tests soon

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

meager granite
winter rose
#

you mean the call RE; Multiplayer Framework?

meager granite
#

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

queen cargo
#

wasnt there some new even OOP lang in dev for DayZ?

winter rose
#

don't go down that road, you know how it ends!

meager granite
#

_base = Call Compile Format["%1Base",WFSideText sideJoined];

winter rose
#

… gimme an L gimme an O gimme an L: L O L!

hallow mortar
#

It feels like something that should've been a function but someone got lazy

meager granite
#

Namespace getVariable Array Arma 2: Operation Arrowhead v1.60

lone glade
#

Dunno I don't follow DayZ

digital hollow
#

There is no EH for connectedToUAV, right?

winter rose
digital hollow
#

not quite. I want to slew the uav camera while looking at the customInfo panel, so view is still on player unit.

winter rose
#

ah like "just" connected I get it

#

then I don't think so

lone glade
#

but it would make sense

digital hollow
#

thanks! then i'll just base it on inputactions that change the panels.

torpid mica
#

thanks

torpid mica
#

why does a group with the "GETOUT" Waypoint does not get out of the Vehicle if they arrive at the waypoint destiantion?

tough abyss
#

It's called enscript I think

winter rose
#

no idea
mods?
wrong setup?
cursed computer?

torpid mica
#

but they do get in perfectly

winter rose
#

I didn't ask if they get in perfectly 🙃

torpid mica
#

yeah i have many mods

winter rose
#

try vanilla
if it works, you have your answer

tough abyss
#

More like C++ I believe

torpid mica
tropic cipher
leaden ibex
tropic cipher
#

alright thanks

tropic cipher
#

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

little raptor
little raptor
torpid mica
tropic cipher
#

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

little raptor
torpid mica
#

had no effect. already tried that

little raptor
#

if you use getOut you should use it on the original group

torpid mica
little raptor
#

manually unload them then blobdoggoshruggoogly

torpid mica
#

how?

little raptor
#

use the waypoint completion statement

#

to unload use leaveVehicle and allowGetIn

tropic cipher
#

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

little raptor
tropic cipher
#

what do the layers do? im trying your version out now but im just curious

little raptor
#

prevents conflict blobdoggoshruggoogly

tropic cipher
#

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?

little raptor
#

you can use playSound, say3D, etc.

torpid mica
stray flame
#

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];
 };
}];
woeful kiln
#

How would I have a script do stuff on initial spawn but then stop after that?

lucid monolith
stray flame
#

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?

lucid monolith
stray flame
#

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

lucid monolith
#

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

digital hollow
stray flame
#

Thank you

#

this is very welcome

stray flame
lucid monolith
#

That's for the top one of the 2 scripts I sent

stray flame
#
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;
        };
    }];
};

lucid monolith
#

Yes

stray flame
#

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",[]]);
little raptor
#

_CivKillCounter is not visible to the EH

little raptor
lucid monolith
#

Oh yeah, I thought about that when writing the second one but forgot I did that for the first one

little raptor
#

your second one is wrong too

#

due to using uiSleep

#

in unschd environment

lucid monolith
#

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

stray flame
#

wait

#

which one was non-functional?

#

the one where every 3 civies gives a warning or the one with a time cooldown

little raptor
#

no

stray flame
#

what would be correct then?

little raptor
# stray flame 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;
        };
    }];
};
stray flame
#

Alright thanks

little raptor
#

idk what the reset is for tho

#

makes no sense to me

stray flame
#

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

little raptor
#

then it should say 3 civilians were killed meowsweats

stray flame
#

hu?

little raptor
#

I mean the message it prints

stray flame
#

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

cold pebble
little raptor
#

yeah 😬

#

@stray flame ^

unreal wind
#

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

cold pebble
#

Leopard fixed the code snippet for you 🙂

winter rose
unreal wind
#

Thank you

vocal valley
#

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/

#

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?

vocal valley
#

I hate scripts so freaking much

fair drum
vocal valley
#

I just hate scripts in general, not just this one in particular.

#

I just constantly have issues with them and they drive me crazy

fair drum
#

learn how to script, and then only have problems you cause 🙂 instead of dealing with someone elses. luckily, minefields are relatively easy to script

vocal valley
#

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.

fair drum
#

do you have show errors turned on?

#

do you know where its failing?

vocal valley
#

Error missing ;

fair drum
#

come with a line number?

vocal valley
#

line 1

fair drum
#

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

vocal valley
#

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

fair drum
#

is that the only thing in that file?

vocal valley
#

Yeah, I typically use more but Im trying to diagnose this one so thats the only line in the init

fair drum
#

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

vocal valley
#

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

fair drum
#

post more errors

vocal valley
#

There are no errors showing up

fair drum
#

just, pm me your mission folder. might have to zip it

vocal valley
#

Messaged you - thanks for your help

manic kettle
#

How do i call a function into unscheduled environment so I can suspend?

manic kettle
#

Yes I've followed what that says on isNil{ call tag_fnc_name} but I'm still unable to suspend inside that function

tough abyss
#

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

fair drum
#

[] spawn ztrac_fnc_myFunction

manic kettle
#

ah i had it backwards in my mind, righto thanks

stable dune
fair drum
tough abyss
tough abyss
#

Where should I be putting my priorities then?

fair drum
#

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?

tough abyss
#

No