#arma3_scripting
1 messages · Page 154 of 1
isNull objectParent <_unit> would return false if the unit is in a vehicle.
If you want to specifically check for aircraft, (typeOf objectParent <_unit>) isKindOf "Air"
Also it'd be better to check the vehicle before the waitAndExecute, that way you're not creating unnecessary waitAndExecutes, and it's not likely that someone would go into the area, leave, hop in an air vic and then fly back
Thanks!
ah I just saw this one is you'd need to add custom pathing yourself, looks incredibly amazing tho!
Looking for tips as to why AI generated on Side EAST start shooting at each other. I wondered if it could be because some units have a uniform, vest, helmet etc for which modelSides[] is set to a side that is an Enemy of EAST. Any help would be greately appreciated.
Okay, weird one here. So I need to block the 'TacticalPing' input action. I have it working by adding a display event handler on display 46, however some players are able to get around it via display 129 (diary). Anyone have ideas on other ways to block input actions that aren't linked to the display? Unfortunately, it seems like the userActionEventHandler command doesn't utilize the return value like the display handler
That EH has no way to interrupt a key input for multiple reasons and intentionally... I guess you want to disable it through Difficulties, if that satisfies the goal
Yeah I would do that if it wern't for the fact that we want to allow some players (SL's) to use it, but block a bunch of randoms from trying to recreate beethoven's first symphony
I see so some can some can't is the situation you want?
Yeah, basically I just need to get the onKeyDown event to block consitently when display 129 is open
Managed to get it. I just need to constantly wait until display 129 is opened, add the event handler, then repeat incase they close it and open it again
How do you create the units?
The units must be from the east side in config too
e.g. this is wrong createGroup east createUnit ["B_soldier_F",...] because B_soldier_F is a blufor soldier
You can change the uniform, loadout, face, etc. later but initially you must create an opfor soldier
Are you sure you need to constantly loop? Most BI displays are initialized using the BIS_fnc_initDisplay function which iirc triggers a scripted event handler
Also there's "DisplayCreated" UI event handler. If you know the parent display of display 129 (which is most likely 46 or 0) you can add that EH to it and watch for opened displays
Looks like there's no such EH. Weird I thought it was added
I ended up doing a loop with some waitUntils that works. its running in I&A apex so while I could make it event based, this is fast enough considering I can tell you about 15 other places in the mission file that are at least 100x slower to compute.
[] spawn {
while {true} do {
// Wait until display is opened
waitUntil {!isNull findDisplay 129};
// Add event handlers to block actions
(findDisplay 129) displayAddEventHandler ['KeyDown', {_this call (missionNamespace getVariable 'QS_fnc_clientEventKeyDown')}];
(findDisplay 129) displayAddEventHandler ['KeyUp', {_this call (missionNamespace getVariable 'QS_fnc_clientEventKeyUp')}];
// Wait until display is closed
waitUntil {isNull findDisplay 129};
};
};
You don't need 2 waitUntils. Because if someone opens and closes that display very fast you won't notice it
And this code is considered bad. Look into the initDisplay stuff I said
I mean, it would constantly add the event handlers then, which wouldn't be very performative
No. You can add a variable to that display
And check that variable
If a var doesn't exist it's a new display
Theres a thousand ways to slice this. I don't have CBA or anything like that to make this easier on myself and frankly I don't feel like spending an extra 3 hours to solve this when I can spend those three hours removing a couple thousand lines from one of the probably 5 or 6 10k line long step 0 loops
agreed
¯_(ツ)_/¯
They are complex but basically the tl;dr is that they are an object which stores data in key / value pairs. So instead of storing stuff in an array and needing a way to convert a string or whatever to an index, you can instead just directly look it up by the string (or whatever the key is).
ahhh thx Mjc4
now i understand
i do the instead already
thx for your clear explantion thx you so much
ArmA 3 is awsome i have 8,000 hrs now woohoo ArmA 3 yeah
Leopard20, the code is:
private _unit = _group createUnit[GMSCore_unitType, _pos, [], 5, "NONE"];
where GMSCore_unitType is set to "O_Soldier_lite_F"
and _group is created as:
_group = createGroup [_side,true];
where _side is passed as a parameter and is EAST for Exile servers
I will test if _side is being corrupted for some reason - I have not double checked that
What do you mean by you don't have CBA?
Vanilla server, presumably
I honestly forgot people hosted vanilla servers
Even just CBA for utilities I feel would be the bare minimum, but granted I've never run an arma server specifically
It's not that hard to get by without it
A fair number of people play on the official servers, too, and I'm pretty sure those don't require CBA
I know, I've just gotten so used to working with it. Easy settings/keybinds, being able to run unscheduled really easily, etc.
Custom events too
Yeah normally I'm writing mods where I have access to CBA, HEMTT, etc. Dealing with an almost pure vanilla mission file for a server (we have server mods and some extensions) with a code base originally written by someone who isn't a programmer is definitely a change.
So I am trying to overwrite a Vehicle config for a Mission(file) to add more magazines to the main gun.
My approach of doing it similarly to SOGs MF crate overwrite is essentially:
(The original only has 1 x CUP_340Rnd_TE1_Green_Tracer_30mmHEIF_2A42_M)
class CfgVehicles
{
class CUP_O_BMP2_TKA
{
class Turrets
{
class MainTurret
{
magazines[]=
{
"CUP_340Rnd_TE1_Green_Tracer_30mmHEIF_2A42_M",
"CUP_340Rnd_TE1_Green_Tracer_30mmHEIF_2A42_M",
"CUP_160Rnd_TE1_Green_Tracer_30mmAPBC_2A42_M",
"CUP_160Rnd_TE1_Green_Tracer_30mmAPBC_2A42_M",
"CUP_8Rnd_AT5_BMP2_M",
"CUP_250Rnd_TE1_Green_Tracer_762x54_PKT_M",
"CUP_250Rnd_TE1_Green_Tracer_762x54_PKT_M",
"CUP_250Rnd_TE1_Green_Tracer_762x54_PKT_M",
"CUP_250Rnd_TE1_Green_Tracer_762x54_PKT_M",
"CUP_250Rnd_TE1_Green_Tracer_762x54_PKT_M",
"CUP_250Rnd_TE1_Green_Tracer_762x54_PKT_M",
"CUP_250Rnd_TE1_Green_Tracer_762x54_PKT_M",
"CUP_250Rnd_TE1_Green_Tracer_762x54_PKT_M"
};
};
};
};
};
This does however not function. What am I missing and what should be added to my thought process? I need to learn.
Inheritance.
That you are missing.
https://community.bistudio.com/wiki/Class_Inheritance
There is a lot examples at #arma3_config ,
If you search with class turrets
Like one how to do
#arma3_config message
you also can't overwrite a vehicle config from a mission description ext
This makes me sad.
Fortunately you don't need a config change to do this. You can use addMagazineTurret, using an entityCreated EH to target the class (or a CBA class event handler if you have a CBA dependency), or just in the vehicle init/whatever script if you only care about one specific one rather than all of them
Seems simple enough. Thx alot!
EHs are either way on my list of things to learn! :)
Also giving config makers and the wiki a good read tho
Does anyone know how I could snap a player into switchCamera "GUNNER" without the animation delay? I'd want it to be near instant
seems almost instant to me
is there a way to get respawn template set in editor via SQF ?
equivalent of
"Tickets" in getMissionConfigValue ["respawnTemplates", []]
idk where to ask this but is there a table of the a3 soundtrack ive discovered the jukebox utility and i would jus like to be able to play soundtrack music as i wait for things like helis or jus during drives
nvm found
Include description.ext/mission.sqm, read the config
messy export, not sure if possible when scenario is binerized
Good point about binarization, then you'll need to get it elsewhere somehow
I don't deal much with editor to advise more
GIB sqmConfigFile
Bet its somewhere in the memory during gameplay anyway
Very unlikely, even BIS scripters use such approach.
Eden Editor scenario attribute
not sure if this includes that custom attribute
Greetings, me again:
When I provide the following function (snippet) with my in editor markers like this:
[_MarkerTop, _MarkerBottom] call TAG_fnc_markers; (assigned with _MarkerTop = "MarkerTop";)
and
["MarkerTop", "MarkerBottom"] call TAG_fnc_markers;
produces the same result.
params [
["_firstMarker", "Marker_1"],
["_secondMarker", "Marker_2"]
];
_firstMarkerLocation = markerPos "_firstMarker";
_secondMarkerLocation = getMarkerPos "_secondMarker";
hint format ["M1 is at: %1 & M2 is AT %2", _firstMarker, _secondMarkerLocation];
It seems to not realize that I am giving it markers but just strings.
"%1", _firstMarker" does display the correct string "_MarkerTop" but the position is always hinted as 0,0,0
Markers "_firstMarker" and "_secondMarker" don't exist.
How come? I´m trying to have markers as a function input
I guess i am just giving it random strings atm?
Also use https://community.bistudio.com/wiki/private in your function.
i do, just didnt copy it with.
private ["_firstMarker", "_secondMarker", "_Ydirection", "_Xdirection", "_distance", "_unitVector"];
The single private _varName for each variable is a lot faster
i.e.
private _firstMarkerLocation = markerPos "_firstMarker";
private _secondMarkerLocation = getMarkerPos "_secondMarker";
Yes, marker names are stored in variables _firstMarker and _secondMarker, but you don't pass them to commands markerPos and getMarkerPos, instead you pass new strings, "_firstMarker" and "_secondMarker".
But it's less readable.
No it's not
Do you have an article that compares? I always like reading up on this stuff
so would removing my quotes ("_firstMarker" to _firstMarker) fix my issue? What am I missing in my thought process ?
You don't need an article for it, just run some tests and see how long they take to execute.
This here is from drofresh in the ace discord:
"It's slow
Code:
private _a = 1;
private _b = 2;
private _c = 3;
private _d = 4;
private _e = 5;
private _f = 6;
private _g = 7;
Result:
0.00178426 ms
Code:
private ["_a", "_b", "_c", "_d", "_e", "_f", "_g"];
_a = 1;
_b = 2;
_c = 3;
_d = 4;
_e = 5;
_f = 6;
_g = 7;
Result:
0.00286985 ms"
Yes.
You're trying to use the variable name as a string, instead of just the variable itself
private _someNumber = 0;
private _result = "_someNumber" + 1; // Error! Can't add string and number
seems to be "twice as fast". I´ll keep that in mind for future scripts. My current pref is putting the private at the top with everything it it tho
Dedmen also commented on this when I had asked about it:
Creating an array, AND its a script command that must be executed.
the private keyword is just an attribute to =, it has basically zero cost
That and it's annoying to have to go back to the top of a file (or wherever you'd private them) whenever you add a new variable to a function
private ARRAY / private STRING is just old way of doing it, that's why there is so much of it in many scripts
What I am doing is very small, so the "going up" part isnt annoying to me atm.
Better learn good habits right away
If you guys good any "good practice" headers for me to get better / make it look better i am always glad to hear it
There are still uses for it when you need several variables in lower scope
private ["_var1", "_var2"];
if(complexHeavyFunctionCalledHere) then {
_var1 = 123;
_var2 = 321;
} else {
_var1 = 111;
_var2 = 333;
};
Personally I try to avoid structuring my scripts to lead to this
inline private assignment ❤️
So you are saying "Declare on use" is a better practice?
...
Like inline assignment yeah
Yea
To use Sa-Matra's example,
private _var1 = 111;
private _var2 = 333;
if(complexHeavyFunctionCalledHere) then {
_var1 = 123;
_var2 = 321;
};
Yeah, but what if 111 is another heavy function call
Then yeah you'd use a different setup
The one you gave was just numbers
if(complexHeavyFunctionCalledHere) then {
private _var1 = 123;
private _var2 = 321;
call secondPartOfTheFunction;
} else {
private _var1 = 111;
private _var2 = 333;
call secondPartOfTheFunction;
};
```One of ways to get out of this
if(complexHeavyFunctionCalledHere) then {
[123, 321]
} else {
[111, 333]
} params ["_var1", "_var2"];
```
(Only do this if you're weird and performance doesn't matter)
are these timings for each time the function / script is run or does the preprocessor in a mission save some performance?
Or a "compile command" / putting it into CfgFunctions ? (since that at least tells you about some script errors)
This one scares me
private _condition = complexHeavyFunctionCalledHere;
private _var1 = if(_condition) then {123} else {111};
private _var2 = if(_condition) then {321} else {333};
```How I usually end up solving it
Not the best performance wise but that column of privates pleases me
I like that way. Always looks neat
[[123, 321], [111, 222]] select complexHeavyFunctionCalledHere params ["_var1", "_var2"]

now that's just silly
I feel like I started a battle of funny coding paradigms
if(complexHeavyFunctionCalledHere) then {[
123
,321
]} else {[
111
,333
]} params [
"_var1"
,"_var2"
];
```*this post was made by leading comma gang*
{[123, 321]} else {[111, 222]} select complexHeavyFunctionCalledHere params ["_var1", "_var2"]
Okay that one just hurts my soul (leading comma)
Those are the times for a single execution (at least I was getting similar times when I just tested).
As for the performance, I looked into it a long while ago but I don't remember many specifics
you might need () for this actually due to else having weird precedence rules
Just wrap everything in parenthesis to make it more readable 
Ty anyways, been helpful already. Would just be good to know so my projects don´t end up having a 1 second execution time xD
I remembered slightly wrong, this will only work if you need an array of Code types. Oh well
I didn't know else simply returns an array
Thought it would be some kind of else type similar to if
I assume i can do
private _result = diag_codePerformance [MyFunctionOfDeath, MyArgumentOfDeath, 1000];
and then I just hint the reult? xD
Yeah
[
diag_codePerformance [{
if(false) then {1} else {2};
}]
,diag_codePerformance [{
if(false) then [{1}, {2}];
}]
,diag_codePerformance [{
[2, 1] select false;
}]
]
``` => `[[0.000582414,100000],[0.000559752,100000],[0.000411131,100000]]`
supposedly (#community_wiki message)
I'll grant you I've never had a reason to actually test it myself
Interesting, so ARRAY select BOOL is better than if-else in some cases 🤔
If you use the Advanced Developer Tools mod, it also just has a button you can push
is it on the workshop? ima get that one asap then lol
There is such a button in the vanilla console too, though I do recommend ADT
The config viewer alone is amazing compared to the vanilla one
You don't have a loading screen just from switching between root classes
Forgot it had one
complexHeavyFunctionCalledHere = true;
[
diag_codePerformance [{
private _condition = complexHeavyFunctionCalledHere;
private _var1 = if(_condition) then {123} else {111};
private _var2 = if(_condition) then {321} else {333};
}]
,diag_codePerformance [{
private _condition = complexHeavyFunctionCalledHere;
private _var1 = [123, 111] select _condition;
private _var2 = [333, 321] select _condition;
}]
]
``` => `[[0.00134022,100000],[0.00100242,100000]]`
oh wait, nil
Useful if you have a static value for if and else
bad idea if you're calling something or using a function
You don't necessarily need to save the result and hint it; the debug console displays the last return from any executed code in the line below the input field.
complexHeavyFunctionCalledHere = true;
[
diag_codePerformance [{
private _condition = complexHeavyFunctionCalledHere;
private _var1 = if(_condition) then {123} else {111};
private _var2 = if(_condition) then {321} else {333};
}]
,diag_codePerformance [{
private _condition = complexHeavyFunctionCalledHere;
private _var1 = call([{123}, {111}] select _condition);
private _var2 = call([{333}, {321}] select _condition);
}]
]
``` => `[[0.00134632,100000],[0.00125972,100000]]`

still better than if-else
yeah that one wasn't a joke suggestion.
Caveat is that it evaluates the whole array, so if the possible values are complex then if/then/else is better.
Although that makes the call method interesting :P
probably too much horror for a minor optimisation.
my last test shows that its still better even with code inside
What about alt syntax of if else
Looks atrocious though
Clearly the ideal solution is to use the nice looking syntax in source, and then use regex to replace it with the more performant version on build
I'm trying to make a script that automatically ace heals a player that gets inside of a vehicle. I found this script online but when put into the init field of the vehicle it only displays the hint but doesn't heal the player
[
"GetIn",
{
params ["_vehicle", "_role", "_unit", "_turret"];
[_vehicle, _unit] call ace_medical_fnc_treatmentAdvanced_fullHealLocal;
hint "You were healed!";
}
];```
That's old ace medical
[_unit] call ace_medical_treatment_fnc_fullHealLocal
both ace_medical_fnc_treatmentAdvanced_fullHealLocal and ace_medical_treatment_fnc_fullHealLocal work when called directly on the unit in zeus but not when the script is used, so I think it's something with the script itself
Add a systemChat format ["%1 (%2)", _unit, typeOf _unit] to your code
Just to see if maybe _unit isn't what you're expecting it to be
adding that seemed to cause it to list some medical details, but also showed an error relating to "cardiac output"
Hi all! I feel like I'm missing a small thing but I can not figure out what
playSound3D [getMissionPath "pdr_dnb.ogg", partySpeaker]; // This works
playSound3D ["pdrdnb", partySpeaker]; // This does not work
My Description.ext:
class CfgSounds
{
sounds[] = {}; // OFP required it filled, now it can be empty or absent depending on the game's version
class pdrdnb
{
name = "PDR DNB"; // display name
sound[] = { "pdr_dnb.ogg", 1, 1, 100 }; // file, volume, pitch, maxDistance
titles[] = { 0, "" }; // subtitles
};
};
What am I doing wrong?
good question, honestly I have this notion from somewhere that having sounds described in Description.ext is the "right" way to do things, but idk maybe I'm wrong
playSound etc
I'm having some trouble with deleteVehicle. It doesn't seems to delete UAVs correctly, even if I've emptied the UAV of crew, if I'm still connected to the UAV.
Added actions remain, and if I have the "awareness marker" on in difficulty settings, I can still see it where it was last.
Actions you added yourself or what?
its not
Also with ASC (I think, I hope, atleast its possible) the array creation can be completely optimized into a constant
Yeah I added some action to the vehicle.
But it seems like deleteVehicle doesn't work reliably for the UAV.
And by UAV, I meant an autonomous centurion, my bad.
When I call the "remove vehicle" action a second time, this is what it's turned into:
2add32c2040# 1814732: sam_system_02_f.p3d
is there a way to get the group object from its name? or some identifier that can be stored to then retrieve the object without looping them all?
@formal grail If it's UAVs then it's probably an Arma bug, but maybe kick the player out of it before you run the deleteVehicle?
well, in script you'd just store the group...
Yeah. Unfortunately im in a context where its evaluating script from string to do group work
thought there'd be an engine function to fetch by id/name, all good though, i'll work around it!
Okay, so after some testing, I think it has to do with having been in the gunner seat. I imagine it might be some locality thing.
More context please
@warm hedge I have a webpage connected to an Arma 3 server via websocket and im evaluating sqf code sent from the site, result is sent back to the site for processing
I think I'll just do what john mentioned and create a variable of a hashmap that is just updated with groups by name every 2 seconds
And reference that
That's not what I wanted to ask. How it will be run in Arma side? Why you can be sure you have no access to the group but Identifier?
The call is being initiated from a component that only has the group's name as an identifier
It will be run as call compile "sqf code" Arma side
External to arma
Okay so, you have literally zero arguments to refer in the code?
That's right. Following John's suggestion I realised I could access a variable in the way I mentioned above
Also by "Id" mean... setGroupId?
Either group id or the group name / string (str _groupObject)
Why you can't put Identifier into that script?
I am passing the group identifier into the script, I was hoping there was a function that returned the group object from the identifier
But it doesn't seem there is
So to avoid running a loop on allGroups every request I'll store allGroups into a hashmap variable that the script that's being evaluated can access
I think
Okay what it does mean group object
...I'm confused
A group is not an object. Also in your situation, do you have an identifier that points the group or not?
The group type instance then if not object
Do you just mean the group itself
Yeah
What about my second question
Then why you just don't use
_yourGroup = thatIdentifier;```
Because the identifier is just a string, and any group functions fail to evaluate because it expects 'object' not a string
missionNamespace getVariable ["YourString",grpNull];```
Yeah, that's what I thought about trying following John's advice
After thinking about it more
Groups are saved to mission namespace?
Group and Object are two separate types
Because any variable can be stored into Identifier?
Oh were you telling them to just save it themselves?
yourIdentifier = 0;```is identical with```sqf
missionNamespace setVariable ["yourIdentifier",0];```also same with```sqf
with missionNamespace do {
yourIdentifier = 0;
};```which means `getVariable` is also a thing
I'm aware, I just didn't get that you were just telling them to save the str to mission namespace. With just seeing:
missionNamespace getVariable ["YourString",grpNull];
Made it seem like all groups were just saved to mission namespace
Hi All, I am trying to setup a trigger that in the activation does something to the player and only that player that activates the trigger. I can't find anything for this though, any clues?
{[_x] joinSilent(createGroup blufor)} forEach (thisList);
This script above keeps setting my civ to opfor, I have tried to set it to independet and as you can see west and blufor. Any thoughts on why?
I cannot really understand both questions.
What is the actual question about the first question, a trigger?
What is it does mean by setting my civ to opfor?
Sorry, lets go the second one. That script above does not set the group side to west or blufor. It always setes it to east or opfor. Even though the script states for west
think thats a bit clearier
Then you are running a wrong script/trigger I guess
This is my trigger for it
Are you 100% sure that trigger is the only trigger that is running
in SP it will work, in MP not so much as addAction only adds it locally
How to get vehicle camo name for new class in CfgVehicles which will override standart camo?
Look at the vehicle in the config viewer. The textureList property will be a list of class names in TextureSources and how often they appear.
@zealous solstice "everything run in one Thread guys" not exactly true with sqf
of cause
map object == objnull
lol
Nothing said it's a null?
Yes, an object is the same type as the null value for objects
it big house isEqualType objnull... oh it obj == obj...
My error in logic is due to null
isEqualType only checks the type of two things.
objNull isEqualType objNull; // true
objNull isEqualType 0; // false
If you want to check if something is null, you can use isNull, like you have there.
I know. Look bottom code #arma3_scripting message
isNull clearly says it's not null?
Did you mean isEqualTo?
Hi guys. I have a custom post processing settings.
_hndl = ppEffectCreate ["colorCorrections", 1501];
_hndl ppEffectEnable true;
_hndl ppEffectAdjust [ 0.6 , 0.6, 0, [1.01, -2.46, -1.23, 0],[2.11, 1.6, 0.71, 0.8],[1.43, 0.56, 3.69, 0.31]];
_hndl ppEffectCommit 1;
Im having issues disabling it. Tried with "ppeffectDestroy _hndl"; and "_hndl ppEffectEnable false; Both didnt work. Any ideas?
the _isPlayerMessage variable means AI "sent" the message to the player in HandleChatMessage? 🤔
Filtering out server msgs I'd assume
what kind of server msgs?
🤷
i have some ppeffect code that looks slightly different (and works)
"filmGrain" ppEffectAdjust [0.3, 2, 4, 0.5, 0.5, true];
"filmGrain" ppEffectCommit 0;
"filmGrain" ppEffectEnable TRUE;
then
"filmGrain" ppEffectEnable FALSE;
dunno if it has anything to do with your private variable
where can I find 2.18 release date ?
There is no release date yet but I think in 3-4 weeks
If a release date is announced you can find it in #dev_rc_branch
Once an RC build is released you can normally expect a release within a couple of weeks
Perfect. Got it working. Adjusted to your script. Now it looks like that
"colorCorrections" ppEffectAdjust [ 0.6 , 0.6, 0, [1.01, -2.46, -1.23, 0],[2.11, 1.6, 0.71, 0.8],[1.43, 0.56, 3.69, 0.31]];
"colorCorrections" ppEffectCommit 0;
"colorCorrections" ppEffectEnable true;
Im working on a small addon and some custom PP effects is something i'd like to include in it.
Does the target unit actually have a squad selected?
maybe it works better in initPlayerServer.sqf , since its too early for onUserSelectedPlayer
2.18 should fix it, by postpone event triggering after player is assigned.
I suspect, that depending on server connection, I need to wait until unit is transferred to player
Try geting the Info before removing EH myb it will work that way as well ?
Removing the EH just prevents it from firing again in the future. It doesn't have any influence on the current instance.
Is it possible to add buttons to diary record?
What is this. Example MP mission that has 4 working configurable clickable buttons in the briefing. Purely VANILLA, no addons These buttons can be configured to Open an external web page in your default browser Start and connect a client to your Teamspeak server ( If they have Teamspeak installed...
you can add links (at least that's what I know of). The link Schatten gave has bit hacky solution as it creates new controls
it would be cool to be able to create clickable images as buttons to the vanilla diary system but i havent got that working
youre actually a blessing...
This should of been way easier for me to find.
-# Hopefully this works out for me
Someone should make a ubiquitous go-to http extension 😄
Many have tried over the years
Buttons that will call functions, not link
Remove URLs and add event handlers.
which EventHandler would I use for a vehicle having blown up? Such as a Helicopter?
Ah So killed goes for that aswell, thx!
Are there any good animations for a cheering civilian?
is there a script i can put in the debug console to enter zeus bc the mission im playing doesnt have zeus set rn and i need to get ai into a ghost hawk
its multiplayer scenario but im playing alone
or did they remove that
thx
btw server global or local exec
if you're playing alone and are a host too then it doesn't matter I think
huh then i might be doing smth wrong it doesnt do much exept freeze the game for a second
For some reason a number of vanilla models don't include .p3d at the end of their model string in the config, which isnt a problem for loading the model, however it means that the command fileExists returns false on them because it expects the file extension.... oof
Just check if the string ends with .p3d. If it doesn't, then add it and then check
I am doing that, but its annoying lol
is there any part of what u sent that i need to change
They do the same thing with sounds, except those are worse because they could be one of several file extensions ¯_(ツ)_/¯
replace unit with player or the variable name of unit you're playing perhaps
they should- but now that I have this... and it seems to be battleye approved already....
Im spending a toxic amount of time learning sqf in order to bring Sonoran Cad to Arma 3 and the roleplaying community
Is it possible to make a trigger reference units that are synced to it?
For example, say I have a trigger that makes someone salute. The way I would do it right now is dude_1 playActionNow "Salute"; dude_2 playActionNow "Salute"; dude_3 playActionNow "Salute"; (...) and that's insanity. Now I could also do a for loop but that's still tedious and annoying and you see I'm an idiot and will inevitably miss somebody or misspell their var and ruin it.
What I wanna know is if I can do something like this and have everyone synced to the trigger get the same command that the trigger wants to do. This will make my life way easier for future things.
synchronizedObjects or similar name AFAIK
am i jus supposed to be able to acess it like regular zeus
yes, CheatCurator is an existing zeus module by default
if it doesnt work then idk, ask the mission maker if they removed the module or blocked you from using zeus in any way
If I use allowFunctionsRecompile = 1;, am I able to override bis functions?
Im trying to modify bis_fnc_getRespawnPositions...
Yes
Speaking of which, wish you could selectively overwrite functions just for your mission
allowFunctionsRecompile[] = {"BIS_fnc_getRespawnPositions", "BIS_fnc_somethingElse"};
// In description.ext
class CfgFunctions {
class BIS {
class Respawn {
class getRespawnPositions { file = "mission\path\to\function.sqf"; };
};
};
};
This should work, right?
Doesnt seem to work.
What other way would you override it?
Only way I see so far is to set the variable to my custom function after startup... which works, but not "clean"
// in postinit function
bis_fnc_getRespawnPositions = { /* custom function */ };
🤷♂️
#arma3_scripting message
Found this from Lou, so guess not through missionConfig....
Well yeah, missionConfig and configFile (mod config) are different
You can't overwrite a class in mod config from mission config, and vice versa
I was expecting maybe CfgFunctions compiling script checks if there is overwriting function inside the mission config
So.... I have an example of someone overriding ace_gunbag_fnc_hasGunbag from missionConfig..... And I know it works..... IDK? Maybe I have to double check....
@little raptor would you consider adding lint support to ADT for _self when using hashmapObjects?
if (_tagName == "BIS" && _pathAccess == 0) then {
//--- Disable rewriting of global BIS functions from outside (ToDo: Make it dynamic, so anyone can protect their functions)
```BIS functions are specifically excluded from being overwritten 
Why though?
Weird choice
Ace functions use CBA's function compiling, not CfgFunctions
So functions library is just an configed way of compile final a list of scripts... yeah? Doesnt CBA use compileFinal?
Yeah, but there's still other differences
Actually looking more at the script I'm not sure if this really disabled overwrite from mission/campaign config, could be only from addon configs
a3/functions_f/initFunctions.sqf
Can someone give me a hand? I'm trying to use find to locate an array(position) within an array, however it keeps returning -1, if I type out the array in plain text though then it can find it no problem... am I doing something wrong?
Ex:
this works
["configFile / ""CfgWeapons"" / ""ACE_Banana""",[[0,0.208496,1.30957],[0,1,0],[0,0,1]],"Spine2",[1,0.595],[-0.00115322,0.209215,0.0536224],[[0,1,0],[0,0,1]]] find [-0.00115322,0.209215,0.0536224];
this doesnt
((player getVariable ["Barbie_activeOutfit", []]) select 0) find [-0.00115322,0.209215,0.0536224];
Share your code, as always
Just added it to the msg
The working code was pasted from console when printing the selected variable (so im sure theyre the same)
Probably a floating point
In console select 0 on that variable gives exactly it
["configFile / ""CfgWeapons"" / ""ACE_Banana""",[[0,0.208496,1.30957],[0,1,0],[0,0,1]],"Spine2",[1,0.595],[-0.00115322,0.209215,0.0536224],[[0,1,0],[0,0,1]]]
Oh, so you copied the number from console and then decided to find it
This then. Your console output doesn't reflect the values exactly
I need to get an index from values within it
hm ok, ill try doing it without hardcoding it then
Doing it without hardcoding seems to work, silly console
Thankyou for your assistance everyone :)
GIB isAlmostEqualTo 
The real question is, why you need this execution anyways? It does seem to be unreasonable enough to me. You have that seriously exact position then why you need to find something out of it?
POSITION isCloseEnough POSITION
distance 
is dum-dum
My script is searching an array for positions close to it using BI's neareastPosition function, and then I need to go back and grab the index of the array the position was in so that I can get other data within it
Is there a much better way to do this? Since im already finding this convoluted haha
If that still is the way, use distance to compare. I still can't figure out why it is the way
Why use BI function when you can just use sort and find index instead
This is an example array:
[["configFile / ""CfgWeapons"" / ""ACE_Banana""",[[0,0.208496,1.30957],[0,1,0],[0,0,1]],"Spine2",[1,0.595],[-0.00115322,0.209215,0.0536224],[[0,1,0],[0,0,1]]],["configFile / ""CfgMagazines"" / ""acex_intelitems_notepad""",[[0,0.209473,1.30957],[0,1,0],[0,0,1]],"Spine2",[1,0.595],[-0.00115322,0.210192,0.0536224],[[0,1,0],[0,0,1]]],["configFile / ""CfgWeapons"" / ""ACE_Banana""",[[0,0.208496,1.30957],[0,1,0],[0,0,1]],"Spine2",[1,0.595],[-0.00115322,0.209215,0.0536224],[[0,1,0],[0,0,1]]]]
I am taking a location from it (index 4 in the sub) and then seeing if any of the other locations are super close. But then I need to go back and get more info from the one thats close and the original, so I need to be able to get their index's within the master array from just their positions
private _lotsa_stuff = [...];
private _sort = _lotsa_stuff apply {[_x select 4 distance player, _x]};
_sort sort true;
private _closest_stuff = _sort select 0 select 1;
Theyre checking distance to eachother, not a single object
Reading it a bit in depth, essentialy any functions that does not come from a path that starts with \a3, it sets filepath to nothing...
And then the compile function _fncCompile which is passed to the script may somehow decide whether or not to compile it base don the _itemMeta which includes the path....
_itemMeta = [_itemPath,_itemExt,_itemHeader,_itemPreInit > 0,_itemPostInit > 0,_itemRecompile> 0,_tag,_categoryName,_itemName];
_itemCompile = if (_itemCheatsEnabled == 0 || (_itemCheatsEnabled > 0 && cheatsEnabled)) then {
[_itemVar,_itemMeta,_itemHeader,_compileFinal] call _fncCompile;
} else {
compilefinal "false" //--- Function not available in retail version
};
But based on the condition and the comment that you shared, setting _itemPath = "" disables recompile.....
It also checks for _pathAccess which is 0 only for configFile, not other configs
If I read that right (and I didn't read it thouroughly enough)
Whare you trying to do? Find two closest?
Im trying to find ANY within a certain range of one another, could be 2, could be twenty
Yes. I couldnt figure out what that represented, but it also sets _itemPath = ""
Thanks for the insight!
Do you want any two items that closer than X meters with each other?
I want any number of items that are closer than x meters to eachother
The array I used as an example had 3 items that were all close, so all 3 should be returned. There might be many more though
What is considered "close"? Having at least 1 nearby?
private _close_stuff = _lotsa_stuff select {
private _stuff_pos = _x select 4;
_lotsa_stuff findIf {_x select 4 distance _stuff_pos < 1} >= 0;
};
Actually no, checks itself
Where is my _selectIndex magic variable 😡
And _findIfIndex too
_handle is a local variable, are you sure it still exists where you terminate it?
_applyIndex
^ That too
Close in terms of distance, like if object 1 is close to object 2 then I want them both returned, if object 2 is also close to 3 then return 3 as well. I don't want duplicates returned though, if 1 was also close to 3 as well then I dont need 1 and 3 returned again
You're not doing this very often, I hope.
No
private _close_stuff = [];
{
private _stuff_index = _forEachIndex;
private _stuff_pos = _x select 4;
private _stuff = _x;
{
if(_forEachIndex != _stuff_index && {_x select 4 distance _stuff_pos < 1}) exitWith {
_close_stuff pushBack _stuff;
};
} forEach _lotsa_stuff;
} forEach _lotsa_stuff;
```Like this then?
fixed ^
Yes pretty much that, I need to be able to go back now with the locations and get the index that they came from. That was my original issue
Well you have entire array as result instead of just position now
No need to find anything
hmm good point
I have a couple other search parameters needed, ill try adding them on as well
Thanks for the in depth help by the way sa-matra
inb4 inArrayOfAreasArray 
there is actually a semi-cute way of doing this with inAreaArrayIndexes
but it's let down by bad methods of inserting a batch of dataless keys into a hashmap.
otherwise you can do it with a single loop.
Hmm, using inArea* command could speed this up quite a bit indeed
I just ran this code for 718 items and it froze the game for few seconds 😬
inb4 "do it by part in scheduled, fire a custom event on done"
nah, you write it in a fancy-ass way that gets it somewhere near nlogn :P
yaay, now it hangs for 1.5 seconds instead of 4!
but yeah, don't do that stuff in unscheduled.
Its in scheduled and is likely to only happen a couple times or so a minute, but I will definitely be looking for ways to improve it
Antistasi had an approx n-cubed routine that looked for possible convoy routes. It was ok on Altis and then blew up on CamLaoNam
forEachReversed + deleteAt/resize? 🤔
still roughly quadratic, though
Thought about it more and it wont work how I wanted it
would work for "find the stuff that's not near marked positions"
private _lotsa_stuff = nearestTerrainObjects [player, ["Tree", "Bush"], 200] apply {[_x, 1, 2, 3, getPosATL _x]};
private _close_stuff = [];
{
private _stuff_index = _forEachIndex;
private _stuff_pos = _x select 4;
private _stuff = _x;
{
if(_forEachIndex != _stuff_index && {_x select 4 distance _stuff_pos < 5}) exitWith {
_close_stuff pushBack _stuff;
};
} forEach _lotsa_stuff;
} forEach _lotsa_stuff;
{deleteMarkerLocal _x} forEach marks; marks = [];
{
private _mark = createMarkerLocal [str random 1e6, _x select 4];
_mark setMarkerTypeLocal "mil_dot";
_mark setMarkerColorLocal "ColorRed";
marks pushBack _mark;
} forEach _close_stuff;
why no select/findIf, though? sqf _positionsToCheck select { private _currentPosition = _x#4; (_markedPositions findIf {_x distance _currentPosition < 1}) > -1 };
Checks itself so distance will be 0
with inAreaArrayIndexes you can just check if the output count is >1
Yeah, or also iterate through it if you want other conditions
still less iterations than the whole array
or filter out the element with isEqualRef in findIf's condition. Should be decently fast, i think
Basically halves the speed of the code :P
which may or may not be comparable to count inAreaArray > 1 not exiting early 
nah, amortized, the findIf is gonna check about half of them. inAreaArray over the whole thing will be much faster, especially on stable.
yaaay, microbenchmarks
But in a lot of cases that's still nowhere near good enough and you'd need to subdivide.
Depends on size of cloud vs distance check.
private _lotsa_stuff = nearestTerrainObjects [player, ["Tree", "Bush"], 200] apply {[_x, 1, 2, 3, getPosATL _x]};
private _positions = _lotsa_stuff apply {_x select 4};
private _close_stuff = _lotsa_stuff select {count(_positions inAreaArrayIndexes [_x select 4, 5, 5]) > 1};
{deleteMarkerLocal _x} forEach marks; marks = [];
{
private _mark = createMarkerLocal [str random 1e6, _x select 4];
_mark setMarkerTypeLocal "mil_dot";
_mark setMarkerColorLocal "ColorRed";
marks pushBack _mark;
} forEach _close_stuff;
```Much faster
For your case that's probably better than avoiding the double-checks.
That is essentially checking everything twice, A vs B and B vs A
Depends on cloud size vs distance check again.
If distance is relatively small you're better off just double-checking.
i'd argue that at all conditions checking twice in C++ would be faster than any SQF to avoid double checking
Yeah, the less scripting commands the better
Not universally. Sometimes the bar is high enough.
Having no indexes in other iterator commands makes its all so complicated
As a kinda-relevant example, if you're trying to find the nearest point to something in SQF, it's often best to run through a bunch of appropriate-chosen inAreaArrays first in the hope of narrowing down the list of precision checks.
Because for some reason there is no nearestPoint command
Yeah, inArea* commands are a game changer, so many uses
I updated my map icon drawing code to do inAreaArrayIndexes before drawing units and players, this improved the FPS quite a lot when you have GPS open as it usually only displays a bunch of units
Before that, running any kinds of border checks was more expensive than just feeding the game drawIcon regardless
Did you ever see my scam for doing inAreaArrayIndexes before it existed :P
Setting index to Z?
yeah
I did that by your example before it was added
I later found a way to do that check quickly by setting a location in size of map control and doing POSITION in LOCATION check but bulk inAreaArray* made it even faster
There is, oddly enough, a nearestLocation
but I don't think there's a sensible way to use it without heavy pre-prep.
Hmm, maxDistance is recent addition there, I bet it simply checks against location center and not its shape borders
Maybe. Almost the entire lint needs a rewrite because of some fundamental issues tho 
For example, I have to preprocess first then do the linting but I do them at the same time and that causes many issues with macros and stuff
Took a lot of fuckery but i got a script that makes NPCs use tickets on death unless they are controlled by a player.```
this addEventHandler ["Killed", {
params ["_unit"];
if !(isPlayer _unit) then {
[east, -1] call BIS_fnc_respawnTickets;
};
}];
And for vehicles```
this addEventHandler ["Killed", {
[east, -15] call BIS_fnc_respawnTickets;
}];
Added
Anyone know the event i could check on sectors to see if they have been captured? I thought something like "ownerChanged" would work but it says foreign.
Nevermind i kind of got what i was trying to do.
On a sector if you put the following code into the expression then whoever captures the sector will be awarded 60 tickets.```
params ["_module", "_ownerSide", "_previousOwnerSide"]; [_ownerSide, 60] call BIS_fnc_respawnTickets;
is there anyway to hide code in function viewer tool?
Can selectionPosition somehow return NaN? 🤔
Or NaN as one of coordinates
private _used_offset = if(client_revive_bodyCameraTargetIsMan) then {_target selectionPosition "pelvis"} else {[0,0,0]};
private _body_pos = AGLtoASL(_target modelToWorldVisual _used_offset);
20:27:54 Error position: <AGLtoASL(_target modelToWorldVisual _used_offset>
20:27:54 Error Type Not a Number, expected Number
```happened on live server for some player
Or modelToWorldVisual
AGLtoASL errored out, so its modelToWorldVisual 
once the scope is destroyed it goes with it, unless privatized and the scope isn't the script / function itself.
I guess it has to do with visual? I know that entities that were just created return funky values in render scope commands
like they zoom from [0,0,0] to sim scope position for few frames
Visual position interpolation fucked up?
It kept erroring out for 16 seconds though
Also f16 Overflow right after errors stopped
This error each 10 seconds in RPT actually
Added logging to see what's going on
I am so confused. For some reason this trigger is only working once then never again no matter what i do.
isnil { nil selectionPosition "pelvis" } returns true
The error is for NaN though, so one of the position numbers was messed
Actually i think all my triggers are only functioning a single time like repeatable isnt working.
BRUH
hmm dunno , cant repro that
I can't either, but here it is, happening on live
I doubt it
Yeah, looks like modelToWorldVisual is at fault
Hi guys. a quick question pls
I want to doArtilleryFire on specific marker and I want Ai to fire a round every 10s for example I could get that "gun_1G doArtilleryFire [getmarkerpos"marker_0", "8Rnd_82mm_Mo_shells", 2]; " but I could combine that with do sleep 10.
See spawn .
i.e. a script executed by execVM or spawn.
https://community.bistudio.com/wiki/sleep
https://community.bistudio.com/wiki/spawn
And if you want x times use for loop , if you want loop use while loop.
Depends how long and where and when you want execute your event.
thx
still wondering whats the story behind the _isPlayerMessage variable in HandleChatMessage. when is it true?
Do you know why AIs refuse to follow waypoints when they enter a vehicle assigned to them (CUP vehicles)?
Like if the driver werent sitting in the driver's seat.
I am really clueless since there is not much I can do about it apart from separating the crew.
are all the AIs in same group?
Yes.
humm
you actually assigned some one as the driver and not just moved them all in? that might be required for the AI
I just assigned the vehicle to the group, and gave them a waypoint, they got in on their own, but refused to move.
ic
(driver TheVehicle) assignAsDriver TheVehicle;
``` you could try that, just guessing here
I have to add that it happens if I manually place them inside via Eden; or if I let them get in on their own when they have two vehicles. If they have only one vehicle, they get in and move correctly.
try single veh? 🤔
With a single it works.
the moving?
Yes.
oh
when a player sends a chat message, I would say?
so not script commands that post messages into chat
hmm when I send chat message it's false
but thats editor-MP maybe it only works in dedi environment
how to create backpacks with special actions when droppen in the ground (e.g. mounted weapons)? event handlers for when the player drops a backpack or is there any special command for this?
Greetings, ya boi, me again.
I was wondering if this:
_id1 = addMissionEventHandler ["EntityKilled",{
params ["_unit", "_killer", "_instigator", "_useEffects"];
if (_this#0 isKindOf "B_Heli_Light_01_dynamicLoadout_F") then{
[_this#0] spawn {sleep 360; deleteVehicle _this;};
};
}];
_id2 = addMissionEventHandler ["EntityKilled",{
params ["_unit", "_killer", "_instigator", "_useEffects"];
if (_this#0 isKindOf "B_Heli_Attack_01_dynamicLoadout_F") then{
[_this#0] spawn {sleep 360; deleteVehicle _this;};
};
}];
would work?
the goal is to delete a Vehicle of a specific class some time after it was destroyed
Better have it inside one event handler
also you need deleteVehicle (_this#0); since you send array into spawn
But technically you can have several EHs
(kind of || other kind of) is guess
so the Event should work? I´ll get to testing then
_id = addMissionEventHandler ["EntityKilled",{
params ["_unit", "_killer", "_instigator", "_useEffects"];
if ((_this#0 isKindOf "B_Heli_Light_01_dynamicLoadout_F")||(_this#0 isKindOf "B_Heli_Attack_01_dynamicLoadout_F")) then{
[_this#0] spawn {sleep 360; deleteVehicle (_this#0);};
};
}];
What if i were to use an array of like 12 classnames btw? How would I go about adding all those into 1 MEH?
My mind can´t wrap a {_x ...}forEach _Array anywhere it would fit.
Never seen findIf before, gotta read
I am not sure how to use the findIf. Since it does not return true/false but "first match in array".
You can compare the returned index with 0, as shown in the examples.
...
_array findIf {isKindOf _this#0} == 0;
...
Or something like that?
i think i need to remove the iskindof
(_array findIf _predicate) >= 0 // found
or
(_array findIf _predicate) < 0 // not found
so:
(_array findIf {isKindOf _this#0}) >= 0; // "someClassInArray" at index isKindOf "what just died"
or:
(_array findIf {_x isKindOf _this#0}) >= 0; // "someClassInArray" at index isKindOf "what just died"
?
Trying to use Sytax 2
hello chat anyone know how to turn surface texture into something edible by set object texture?
Are you saying I can´t use it cuz it return boolean ?
_vehicle = _this # 0;
(_classNames findIf { _vehicle isKindOf _x }) >= 0
ahhh I see!
But couldn´t I:
(_classNames findIf {_this#0 isKindOf _x}) >= 0;
Or is _this#0 not available like that anymore ?
It's available, but why do this few times (choosing array element using #) if it's better to do this once?
Moreover, you already have such a variable, _unit.
Don´t both our approaches do it once?
MEH(Entity dead) -> Check if(one of these classes) -> do or don´t
----------------both times just one Entity to check against array--------
Or am I missing a piece of the puzzle here?
Also:
(_classNames findIf {_unit isKindOf _x}) >= 0;
Kinda just like using the # with EHs, always done so and it tickles my brain.
_id = addMissionEventHandler ["EntityKilled",{
params ["_unit", "_killer", "_instigator", "_useEffects"];
if ((_classNames findIf {_unit isKindOf _x}) >= 0) then{
[_unit] spawn {sleep 360; deleteVehicle (_unit);};
};
}];
Is what i´d have then. I guess not using "this select first element" but straight to _unit is faster
My approach:
_vehicle = _this # 0;
(_classNames findIf { _vehicle isKindOf _x }) >= 0
The first element reference in _this is obtained and assigned to _vehicle, once.
Your approach:
(_classNames findIf {_this#0 isKindOf _x}) >= 0;
The reference is obtained at least once, in worst case it is obtained as many times as there are elements in _classNames.
Ah because it isn´t "stored" somewhere. Got it, thx!
And,
_unit spawn {
sleep 360;
deleteVehicle _this;
};
_unit is undefined inside spawned code.
I would have missed that and be confused, thx again xD
You really shouldn't use spawn for this, that's going to clog the scheduler. Just use a CBA waitAndExecute.
[{ deleteVehicle _this }, _unit, 360] call CBA_fnc_waitAndExecute;
You should always avoid the scheduler when possible. All scheduled scripts have to share scheduler time with each other, so your code is not guaranteed to run when you think it will.
I'm pretty sure I saw and used this many years ago, but is there a script/set of functions that can be used to check if a player takes a specific item from a specific dead enemy?
For example (my use case) when an enemy squad leader's body is searched, he'll have a map in his map slot. When the player takes that map, the script would trigger a taskCreate (or similar)
If it matters, my actual plan is to have it call Drongo's MP task generator, but the idea is the same.
Might have found the answer to my own question. I should be able to use a "take" event.
Yea
Is there a way without a CBA dependency?
No, CBA's functions don't exist unless it's loaded
How about having a call to a custom function of my own instead?
You could technically re-upload CBA's functions, but it's not worth it. Especially if you don't understand how they work internally
_unit call My_fnc_deleteStuff;
deleteStuff = sleep 360....
?
That would either
- Do the exact same thing as what you have currently if it's being run from a scheduled environment
- Fail because you can't use sleep in an unscheduled environment
I´m using this in a mission I want to keep vanilla. So noone has to dl any mods.
I guess CBA can be made as an optional mod and people wouldn´t have to load it?
CBA is 4 megabytes, it's not going to strain people's download speed.
True, but I don´t want anyone to DL any mods for this atm
You'd have to a lot of extra work for that
For example,
if (isClass configFile >> "CfgPatches" >> "cba_main") then {
// ... call cba function`
} else {
// use vanilla
};
Then you just have to use vanilla
Can CBA be there as a Server Mod and my mission use its functions ?
event cba for (in this case) one MEH?
No fancy DB like setup that patches in a function?
What?
like instead of loading a variable from something like extDB, loading a function in? Or use file patching or something?
Why would you need to do that
You can check if a mod is loaded, and do different behavior based on whether it is or isn't
CBA isn't really the kind of mod you write optional support for. CBA has 2.8 million subscribers, your players will likely already have it downloaded anyway.
CBA allows you to write much better code and do things you simply can't do in vanilla.
Because that way I can get the better performance, without clogged scheduler, and noone would have to load mods.
True, just want to avoid all mods for the sqm tho.
CBA is required to be loaded on all machines to work properly. You can't just half load it
hm sad
If getting people to dl CBA is an issue, like your playing with your geat uncle who isn't tech savvy enough to deal with the steam workshop or w/e, you can create and export a launcher preset to load just CBA and have them use the preset.
You can send a screenshot or two to show then how to load the preset in the launcher.
No issue, just want it 100% vanilla for now
interesting moment
I just remembered that "if" is the type. And "then" "exitwith" takes the "if" type, which means "if" can be saved to a variable.
JavaScript web developers have received a flashback
This pains me to look at honestly
This didn't work out.
If you wanted to replicate CBA's behaviour for some reason, you'd add an EachFrame mission event handler and then check whether your 360 count was reached, and if so, execute the code.
This is of course much more expensive than the spawn method :P
I´ve seen this before. but I would classify this as horror beyond human imagination
I´ll keep the spawn for now, but thx
Dedmen even optimised the scheduler for spawn-spam recently, but one spawn per kill is negligible cost anyway.
and it should only spawn on a list of specific entities. The creation of which I control
@slim trout @bold comet HELL ... use fucking markdown ...
code blocks require 3x ` in front and end
if it annoys you that much then i'll keep doing it on purpose
#Markdown (╯°□°)╯︵ ┻━┻
does setVariable with public true JIP gets removed once the varspace (e.g. an object) is destroyed? like remoteExec with an object as JIP argument
You mean at a technical level? No-one's gonna know that as there wouldn't be any practical effects.
Could run an empty server without any AI, join with a single character and run https://community.bistudio.com/wiki/exportJIPMessages
Run before + after testing setVariable with true flags and see what happens?
Though I would assume it would work like remoteExec, you never know with legacy Arma code ¯_(ツ)_/¯
Last time I used exportJIPMessages it didn't give that sort of level of detail.
hmm, although it'll give you the count of setVariables at least, so maybe if you spammed a bunch and then compared before & after deleting the object.
My notes say that type 382 is public setVariable and type 284 is setVariable on logic objects (wat)
there were about 20 types that I failed to generate at all with SQF code so I may have been doing it wrong.
Public set var as in publicVariable or with the true flag? Kinda strange they'd be two different types unless its because one is technically a "entity" and one is an "object"? I dont know honestly
Discord doesn't even support proper markdown
publicVariable is type 10.
Ah
is it possible to have a script run the second the "mission failed" popup appears?
I got a script working that makes all bots on the map shoot eachother and i want them to do that when the mission ends lmao
Yes
Isn't it an EH to detect a mission end, not its effect
No idea. It claims to include BIS_fnc_endMission as a trigger but I'd guess that this is because it calls endMission after showing the UI.
Otherwise I guess you'd need to dismantle BIS_fnc_endMission and see whether there's any other effects to trigger off.
Also not sure how editor mission termination works.
i tried ```
addMissionEventHandler ["Ended", {
[] execVM "endMissionChaos.sqf";
}];
Unless someone's done it before you'd probably need to reverse engineer some BI code.
Or your exact situation you see
I am far too dumb to do this
That fact tells us nothing
i dont know what to do!
Could probably utilize this inside BIS_fnc_endMission
if ((!isNil {BIS_fnc_dbg_reminder_value}) && {!isNil {BIS_fnc_dbg_reminder}}) then {
[] call BIS_fnc_dbg_reminder;
};
Not sure If Im allowed to post that
Set the reminder_value to something, then set the reminder to the code you want to exec
I dont see any other potential trigges you could use for that file
Im probably just implementing it wrong but thats not working either. Everything i see online says that just having an EH should do it.
Well i got something similar working for me, but wont work in most other cases.
Since the round ends when you run out of tickets i did this```
sleep 5; // Wait 5 seconds before starting the checks to avoid reading null
while {true} do {
// Get the current tickets for BLUFOR
_westTickets = [west] call BIS_fnc_respawnTickets;
// Check if tickets are valid and less than 1
if (_westTickets >= 0 && _westTickets < 1) then {
[] execVM "endMissionChaos.sqf"; // Run the chaos script
break;
};
sleep 1; // Check every second
};
That's the "proper" way to do it if there's no event handler
_westTickets >= 0 && _westTickets < 1 ??
Greater than or equal to 0, but then you check if it's less than 1?
There is no real reason to struggle to understand ChatGPT
ya i removed that
just before you asked
Hey im trying, im editing it manually to try get the outcome im looking for. But its the quickest source i got.
Its that or dont get anything
The biggest problem is it likes to make shit up and pretend its fact
Yeah, because that's how AI works
Don't use an AI for programming, especially if you don't know whether it's correct or not.
Its trial and error, for simple things it often works. Idk why be so dead set on dont ever use it ever
probably because people here are kinda tired of "Help, CGPT gave me this code and it doesn't work the way i imagined" 
Easier to make code from scratch than fix a broken mess ChatGPT made
I dont know how to code from scratch at all. Im just asking for things that cant be solved at all.
Because it just regurgitates what it finds. Whether that be from someone who just started, or has been doing it for years.
Its better than nothing at all, which is what i would be able to do on my own.
You are in a discord for learning modding.
it's worse than nothing at all when you bring it to help channel 
Ya and its helping me learn. I need to start somehwere.
When i first started modding the game Barotrauma which has almost no documentation at all i could only make things work by stealing other people's code and modifying it. And years later now i know how to mod it fully. But here i genuinly have no base to start from. So figuring out why bad code isnt working is a better start than nothing.
So why is your solution to start with the bad habits that learning through an AI will teach you
How is it particularly a bad habit? Its creating very basic code and im learning by making it work.
In the case above i was just trying to see if there is some function or method im missing that would properly detect when the end round screen pops up.
If the code writer doesn't know how to debug, that means the writer cannot write a proper code
Well i am debuging things as i go. Probably not well. But for example i put a hint to read out the value of _westTickets and i found out it was reading it before the game had actually assigned the value, so i have to put a delay on it
If you have a more effective method for figuring things out im open. But from what ive tried so far making then fixing AI code has taught me the most so far.
This all just kind of comes off as "grr, AI evil!"
Basically yes. The only way we always prefer is, just learn by yourself
But i am
What other method would you recommend.
just learn by yourself
as in...
Thats an ok resource but it doesnt help me from scratch really. I could do like youtube tutorials for the bare basics but for A3 they are rather lacking.
I have very little proper coding experience and am just trying to make a game mode for my friends.
Way I jumped into it was finding an already created code base and just... going at it changing shit and finding things that worked
One of the more maintained code-bases
https://github.com/AsYetUntitled/Framework
Something seems F'ed here.
Comment on function is //! Sends chat message by player
content of function isPlayerMessage = false, whut?
It is set for radio messages, if the sender equals the currently focused unit.
So if you yourself, report someone going unconscious, its playerMessage == true.
Also if a player joins into a group, the message being sent from the "group" ? leader? to the player, is also a player message
Seems its only for radio messages, a bit confusing
Yes
idk if its possible to detect if chat message came from player typing it or from the globalchat command? (In the chat EH)
just diag_log _this in the eventhandler.
run a globalChat command
And manually write something into chat.
And compare what gets logged to RPT
the forceDisplay parameter miiight help.
Atleast that is set to true, in actually player sent messages.
But probably there will be other places where that's true too, so you're doomed
It seems all the radio messages set forceDisplay to false, so that might work
its the bool before the isPlayerMessage one
seems like _forcedDisplay is always true
looking for abit of advice here,
trying to get a series of turrets to mimic the actions of a player controlled turret, including aiming and firing. been messing around with it and i cant find a simple way without the animate functions. I dont want the turrets to look at the same target, just look in the same direction and azimuth (eg like a broadside)
i can return and setdir but cant do that for azimuth (based on what ive found on the wiki) and a firing eh is simple enough
There isn't really a simple way. We don't have that kind of direct control over turrets.
One way would be to do some maths to work out a relative position based on where the player is aiming, and then apply that relative position to the other turrets and use lockCameraTo to aim at it. It would have the effect you're after, because it's a translated relative position rather than the same world position, but it'd be a bit of work to get the calculations right.
in which case i may just go down the animate route
i just want them to look at the direction and azimuth not an exact pinpoint
eseentially going for like an old naval ships broadside effect
Yes, I understand, that's what I'm talking about
You can't use animation commands to control live turrets. Those animation sources are normally controlled by the engine - they can only be controlled by scripting on simple objects.
bugger
You can use various means to find out the vector of the player's turret's aim. Use that to extrapolate a point, say, 10 metres in that direction, as a relative position. Because it's a relative position, not a world position, if you transfer it to another turret you'll get exactly the effect you want: parallel aiming, not convergent.
hmmm
i was originally thinking something like animationSourcePhase or and animateSource
but as you said that wont work so https://community.bistudio.com/wiki/weaponDirection i guess it is
so what? @lone glade
excuses nothing
out of curiosity, why does something like example 2 of https://community.bistudio.com/wiki/animateSource
work but it wont work on a "live turret"
- does it in fact work?
- because the animation is controlled by the engine aiming system
i mean the example seems to
im struggling to get this to work
idk if its the turret im using as its modded and poorly made or if its me
im suprised there is no way to simply return and set what im looking for. weapon direction doesnt seem to work for this turret
so i tried getting the beginning and ending of the gun with some math and draw lines between them for my own clarity, apparently i can only fetch turret and the gun with this turret.
well, it does... if you use the unarmed UGV listed in the example 🤣
so i got it to work in the end, poorly made turret is to blame
lockCameraTo (if the turret has AI)
so:
onEachFrame {
_gunB = port_3 modelToWorld (port_3 selectionPosition "gun");
_gunE = port_3 modelToWorld (port_3 selectionPosition "gunEnd");
drawLine3D [_gunB, _gunE, [1,1,1,1]];
};
gets me a nice point to point on elevation which also functions as a direction
ig all i gotta do is extrapolate ma point now
vectorFromTo and vectorMultiply may be helpful
yeah, just gonna have to figure this out
i can make an a3 carrier fly but relativity will still make me scratch my head
I remember encountering this too
I assume you can still read the animation state correctly?
ugv = "B_UGV_01_rcws_F" createVehicle (player getRelPos [5, 0]);
ugv addAction ["Show Turret",
{
ugv animateSource ["Turret", 0];
ugv animateSource ["MainTurret", rad 0, true];
ugv animateSource ["MainGun", rad 0, true];
}];
ugv addAction ["Hide Turret", { ugv animateSource ["Turret", 1] }];
ugv addAction ["Turret Left", { ugv animateSource ["MainTurret", rad 90] }];
ugv addAction ["Turret Right", { ugv animateSource ["MainTurret", -rad 90] }];
ugv addAction ["Turret Up", { ugv animateSource ["MainGun", rad 30] }];
ugv addAction ["Turret Down", { ugv animateSource ["MainGun", -rad 20] }];
```Turret rotation doesn't work
Yes, it reads correctly
oh, you can't set rotation even if it doesn't have crew?
Yes
Sounds like a bug.
#arma3_scripting message My original message with it
I tried it a few mins ago and it still rotates the turret, just not completely as I'd expect.....
Yeah, works fine?
None of the direction actions do anything for me
Only Hide/Show work
what the hell :P
is there a way to manually respawn players through script even though the spectator option is enabled?
Keep increasing the respawn time, then drop it to respawn them manually if it's via script or Zeus module
That's how I've usually done it when I want manual respawn waves
Cursed code
Date of purchase of A3 changes function performance ahh code
Wiki: "You should use animateSource because it works properly in MP"
Reality: animateSource does completely random shit.
AnimateSource would have been an easier fix to my solution yet here I am with my goofy ahh vector math code
Tbf half the bi funcs barely work anymore, give the homing missile one a whirl and see the interesting results 💀
I know they have been broken down or rebuilt into other syntax now but it's still funny to me to think I've found a saving grace only for it to perform in the strangest manner
I can't really help because it works for me :P
"don't worry, got it working" aaah thread response from 2018
Hittin us with the "works on my machine"
If you cap to 60fps, does it still jitter?
I'll give it a go when I'm home N report back, I was running around 109fps
But that's because of my un optimised prototype scripts 🫠
Is there some kind of special case handling for when there is low framerate? For example, if I artificially lower my client's framerate to 1 frame per second, my projectiles (like from a Titan AT) travel much slower over time.
(I would expect that projectile travel speed is not dependent on my framerate, and at higher fps that seems to be true.)
This is relevant, because I'm debugging an active protection system, and I want to calculate the radius I would have to intercept a projectile at a low framerate.
Greetings, rooky question:
private _spawnLocation = selectRandom [
{[_cornerTopLeft, _cornerTopRight] call ADALIB_fnc_randLocation;},
{[_cornerTopRight, _cornerBotRight] call ADALIB_fnc_randLocation;}
];
This makes _spawnLocation hold the "code" [...]call function; but I want it to hold the return value of my function instead.
is it the "{}" ?
or is it selectRandom ?
or both 🤖
Yes
By wrapping it in braces, you're making a new code block, and storing that in the array
Also those parameters would be undefined because it'd be a new scope (with the braces)
so:
private _spawnLocation = selectRandom [
[_cornerTopLeft, _cornerTopRight] call ADALIB_fnc_randLocation;,
[_cornerTopRight, _cornerBotRight] call ADALIB_fnc_randLocation;
];
Would give expected results?
or:
private _spawnLocation = selectRandom [
([_cornerTopLeft, _cornerTopRight] call ADALIB_fnc_randLocation),
([_cornerTopRight, _cornerBotRight] call ADALIB_fnc_randLocation)
];
The parenthesis are redundant, and the semicolons after each call will end the line in your first example and cause an error
copy and thx
Also, you can just select the arguments at random, and then only call the function once
With your current setup, you're calling the function twice, and then selecting one result at random
makes sence, goot to know
Is this syntax with not before brackets OK? if not (false) then {true}; //returns true Thank you.
Should be. if actually takes a boolean so bracket itself is not required
Thx.
What
Can I trigger a respawn point (activate it) by two triggers wich would be in a logical OR relation, where one is enough to activate it? Just with modules.
yes
hi guys working on an ai guided kamikaze drone for missions i want to make, dont really have any idea what im doing lol. went through a few iterations with AI and lots of caveman thinking and have a pretty basic model that's OK, had a previous version with some -z velocity to simulate the final strike but had some bad version control and lost it lol. tried working on stepping back to previous altitudes and velocity if the target was getting away but keep running into issues and AI only gets you so far. any tips or suggestions are welcome and if youd like to repurpose any of this garbo feel free 🙂
Please stop to post and delete if you can't figure out something to post it correctly. If you want to share the code, post the file
ive never used markdown in discord and it was posting weird and people in other modding discords cry about downloading files from discord. no need to be rude it doesnt affect you 👍
the truth in the sentence is we still need to see the code. post in pastebin/github if its long.
and im working on it
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
i wanted to hide it, it really doesnt matter im working on it.
This too, also you have a edit functionality to edit your post
does it matter?
If you want to edit the markdown, yes
nevermind guys thanks
["end1"] remoteExec ["BIS_fnc_endMission"];
"end1" call BIS_fnc_endMissionServer;
oh i see what the issue is now. its because you posted without any real question. you used your post more as a showcase when that belongs more in #1056183794979328120 or #1056183665706668032, instead of the help channel.
what is with the passive aggressiveness in this discord? dear god
'discussion about anything related to scirpt creation and usage within game'
i was in the middle of trying to post it marked up but hidden so i wasnt blocking the entire channel with the code.
I'm just trying to interpret
what's passive aggressiveness
i never did it and was deleting my mistakes, what is the issue in here?
why would i showcase something someone knowledgable could do in 20 minutes i was asking for a review of my garbage code and thoughts. you people are not conducive to the hobby.
did you have a question about these two?
is passive aggressiveness like a football QB
no sir thats what i use to win end my missions
talk to me then. show me what ya got.
you can also just use the first line since that remote is also firing on the server
when you don't provide the second argument, it treats it as if you put 0 which is remoting to all machines. that includes dedi
But how do I do the OR? Usually all synced triggers behave as AND.
try including a condition that makes sure that the other one (trigger) isn't fired yet. put that in both
Nobody cares how garbage your code is as long as you wrote it and you have a will to learn. I would care if, let's say, you're here to search for the help but you really didn't shared the actual question either intentionally or unintentionally. As I said in my first post, if you don't want to walltext, you can post the file itself so you don't at least walltext it
yeah PolPox helped me alot hes good
sorry polpox ill follow your prescribed format next time i post about something i dont see on the workshop i didnt realize there was a format bossman
rude for no reason man
could probably be better explained by: https://dontasktoask.com/
so it would be something like:
// trigger 1
someCondition_1 && !triggerActivated trigger_2
// trigger 2
someCondition_2 && !triggerActivated trigger_1
which I guess is really more like XOR
but really I would suggest just making a single custom trigger that handles it all
no one is rude they r just trying to help
ok and i was in the process of doing that so what are you bitching about? i posted the video for reference and was in the process of doing the script so i could ask questions about specific parts of the guidance i dont know. why you peopel are getting butthurt over 'showcasing' when the channel and its intent is clearly stated. sorry i didnt ascribe to your invisible format
passive aggressiveness is you wearing a suit that I really don't like and instead of me saying that I don't like it, I say wow, that looks SOOOOOO good on you, in a sarcastic tone
huh i see
i didnt know really
i was thinking it was like a football QB passing aggressively
alright, time to get back on topic, post your code and a issue you are having. if you want a code review, understand that you might not get an answer as someone might not want to take the time for something general like that.
omg iv been doing this for 15 years and i still have so much to learn omg
doing what? life?
yeah that to but no i mean C++
ArmA 3 1st life 2ed he he
so i have a ?
if i have this code how would i add more chats to the line Enemy Down
addMissionEventHandler ["EntityKilled",{
params ["_killed", "_killer", "_instigator"];
if (isPlayer _instigator && side group _killed isEqualTo EAST) then
{
Player GroupChat "Eneny Down";
};}];
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
is this singleplayer or multiplayer
where are you adding this event handler?
added to the server? to a client? in the initPlayerLocal?
okay, so player on a local hosted server is that particular player, and on a dedi, its undefined
wait... are you using Player as a variable?
ok lets rewrite this then:
do you need to use groupChat then? vs just sending out a systemChat message?
you want it to say the name of the unit killed and by whom?
oh ok I see now what you want
||https://pastebin.com/r5KLJcbf
lots of ai and while loops, not sure if everything i have is even necessary might be really redundant, tried remaking it with arrays and indexing 'flight profiles' together, 400m, 20m/s, flyInHeight 7 | 200m, 16m/s, flyInHeight 5, so on and so on but had issues with it. if this is poor practice how can i step the drone down gradually/where would i begin looking into how to make it so it strikes the target without all these loops? if its no big deal to do it like this, how can i have the drone repeat the loops so if the target is outside its current 'profile' it runs through them until the distance/knows about enemy is satisfied (drone closes to within 15 meters but the target manages to escape to 50m, smoke canister, etc. i guess code review and and general tips are appreciated as ill keep trying to remake or alter this so it guides on the move better & can disengage and reacquire lost targets. feedback to any of these points or others are appreciated. its functional for the scenarios im making on ai targets but id like to integrate them into the RTS mod eventually so targeting players on the move needs massive work, thanks for the time. insert to ar-2 darter/uav unit init||
what team is your player group
@pallid palm
if (isServer) then {
addMissionEventHandler ["EntityKilled",{
params ["_unit", "_killer", "_instigator", "_useEffects"];
if (isPlayer _instigator &&
side group _instigator isEqualTo west &&
side group _unit isNotEqualTo west) then {
private _group = group _instigator;
[_instigator, "Enemy Down"] remoteExec ["groupChat", _group];
[_instigator, "My Second Message Here"] remoteExec ["groupChat", _group];
};
}];
};
Another option is to force-move the vehicle along a path with setVelocityTransformation or similar, but I don't think there's any good way to make an aircraft fly directly at a point in 3d.
this is fine for stationary stuff like set dressing a mission but a running player will notice the trajectory is pretty bad if you evade so I’ll look into this, thanks!
I kinda wonder if you could use https://community.bistudio.com/wiki/BIS_fnc_EXP_camp_guidedProjectile for this lol
To be used with CfgAmmo type of entity, but can be used with virtually any kind of object
My main gripes are final guidance is pretty bad and too slow compared to irl FPV. if I speed it up it often overflies it terribly and add in the deflection of a moving player and it looks very poor, and if it loses its target it basically removes that fpv style dive and just flys straight into slowly at like 1m high lol. Blowing in a radius would probably work but the way it works now is ok for vehicles since it smacks into them most of the time
That would be amazing I saw this mentioned while looking through the wiki just attach a drone to it if that’s possible and send it on its way lol
I tried using planes but I can’t really find anything that lets players be targeted by AI drones it’s all stuff like crocus that you fly unless I’m missing something so gonna frustrate myself on this for a while
https://youtu.be/DSV6dkdykXg?si=Z2FpnTeivZVTmHrH
Best example I’ve found in arma but it’s not public/published might just try the transformation when it’s in strike range with optional deflection for inaccuracy.
From my upcoming Fire Support mod, showing off some of the drone attacks it can perform. The drones come from FPV Drone Crocus.
A lot of the mod dev was streamed live here: https://www.twitch.tv/rimmy
AI can autonomously deploy and call these attacks in, however for this demonstration the attacks were triggered by script.
MY...
Agreed with John, I'd write a (bunch of) setVelocity etc to move quad more aggressively. Since helicopter AI does have its rule to avoid collision etc, they wanted to fly safely and there is really no way to alter without having such workaround
Is "explode" a function you wrote BTW?
No I was doing set damage on a variety of mines which would work sometimes and other times not, was trying to figure out why when copilot suggested I use the explode paired with that specific ‘explosive’ and I was having less issues with this version. I was using the regular setvelocity to give it -6 Z when it was within like 7 meters and if it had a full attack run it would typically target fine but had issues with the target moving and the velocity forcing the drone to continue on a poor trajectory, there was a version that targeted much more aggressively but I think I changed it out trying to get the velocity to be applied in the relative direction of _target for guidance but it looked unnatural at least the way I implemented it, I didn’t add anything along the Y
Sorry for typing a book! main thing is I’d like to improve final targeting/speed & it to have a behavior for no target, basically go from the ‘dive’ back to the chase if the target evades(might skip if transforming is the way forward). Will likely be back in here with specific questions but was just curious if anything in there was bad practice like all those loops and sleeps
My preference actually is running them each frame TBH. I dislike while with sleeps for, after my experience years ago, especially if you have multiple instance of spawns
Regarded to moving target, I'd make a coefficient so the quad does move to the position + (targetVelocity * distance till the target * maybe some number to tweak) yeah psuedo code but my idea is this
I saw in the wiki about each frame was just worried about performance impacts, like I said very noob not sure what’s acceptable. Cheating with AI and looking at some examples incorporating your suggestion I think I’m going to scrap the old version with these tips in mind. Thanks people anything else you’d like to share in the future I’m all ears. will likely be back with questions/progress
If you're just moving a few air vehicles around for a limited period then eachFrame is acceptable.
sounds great thank you
gonna rework this, started it for a pack of scenarios im finishing up and possibly zeus wargame if i can make my brain work on this, thx
Can anyone think of a way i could modify the "Infantry Cost" on a sector?
My goal is to have sectors unable to be captured until the previous one has been neutralised. I feel like the easiest method would be having the cost on all be 0 until the previous has been captured.
i tried ```
Sector_4 setVariable ["costInfantry", 1, true];
have you seen this https://community.bistudio.com/wiki/Arma_3:_Module:_Sector ? maybe you can use enableSimulation on it, not sure
Method i came up with was setting a value in this case Sector_4_Cost = 0; and then just have Sector_5 update it to 1 when captured. But it almost seems like after spawning in the sector doesnt check what its infantry cost is.
Ive confirmed that Sector_4_Cost is being changed to 1 but it still remains unable to be captured.
Isnt simulation an object only thing?
it mentions it in the page that I posted , where it says "disable"
Delete or disable the sector module to 'finalize' the sector. Once done, capturing will be disabled and the last owner will retain the control forever.
```Im not sure what exactly this means
me neither 😄
Hmm, i was able to do "Sector enableSimulation false;" which made it translucent and popped up "task cancelled" But then i cant re enable them. Its just permanently dead.
Sector enableSimulation false; doesn't do a toggle but disable it. To enable it, try enableSimulation true;
I did, it cant be enabled again
I tried simulationEnabled as well
Well one JANK solution i know i can do is just have all Sectos set their pos to 0,0,0 then teleport them into position when its time to cap them
or create sector modules by script
or just use EOS Awsome
is there a way to check via sqf what graphics settings the player is using?
amazing, thanks!
I feel like thats more work than just teleporting them away.
Also its extra annoying if i want to make a new map in the future.
ya it requires bit of scripting skills. easier to apply your script on new maps though
I got another question. I got the sector setting the value "Sector_5_Owner" to whatever team owns it. But for some reason i just cant get it to do anything when east is true.
I stripped it down to just these two sectors for simplicity.
[] spawn {
while {true} do {
if (Sector_5_Owner == east) then {
Sector_4 setPos Sector_4_Pos;
};
sleep 1;
};
};
```I tested *"Sector_4 setPos Sector_4_Pos"* on its own and it all works as intended.
If i could just directly check the owner of sector 5 that would be easiest but i had problems with that in the past.
having some issues projecting the point for each gun
as Jhon said, EachFrame is the way to go as long as they wont be permanent nor 20+ of them at the same time. Other mods might already be using frame loops and check and could drag the performance on the long run, but let say, if 2 or 3 vehicles/missiles/etc are active at once for small periods you should be more than fine.
did some testing and it looks like you get the "owner" like this: SecModule getVariable "sides"
_turretArray = [port_1,port_2,port_3,port_4] - [port_3];
_handler = addMissionEventHandler ["EachFrame",
{
{
_gunB = port_3 selectionPosition "gun";
_gunE = port_3 selectionPosition "gunEnd";
_gunDir = ASLToATL (_x modelToWorldWorld (_gunB vectorAdd [10,0,0]));
_x lockCameraTo [_gunDir, [0]];
private _vehicle = "VR_3DSelector_01_exit_F" createVehicle _gunDir;
systemChat format ["%1", _x];
} forEach (_thisArgs select 0);
},[_turretArray]];
having issues with the aforementioned projected point
the createvehicle is there for my own visualisation
ignore selection names, this turrets config is uhhh... something
i ended up just adding fac_ before the facion identifiers and it wokred
Is there a way to declare a particular team the winner? I can just subtract all their tickets but i would rather have that visible at the end.
How come in a sector module, Wheeled vehicles cost, tracked vehicles cost, naval cost, and aircraft cost is at 0, but infantry and players cost is at 1. Yet when I drive into a sector, it starts capturing anyway...
Even tried -1 with no effect.
Thanks, it is a volume trigger (presence), so I will probably put a deleteVehicle with the other trigger, into both of them. Cause when u delete all untriggered triggers synced with a module, then the module gets auto. activated.
_turretArray = [port_1,port_2,port_3,port_4] - [port_3];
_handler = addMissionEventHandler ["EachFrame",
{
{
_gunB = port_3 selectionPosition "gun";
_gunE = port_3 selectionPosition "gunEnd";
_gunDiff = vectorNormalized (_gunE vectorDiff _gunB);
_gunProject = _gunDiff vectorMultiply 10;
_gunDir = _gunB vectorAdd _gunProject;
_debug = AGLToASL (_x modelToWorld _gunDir);
_x lockCameraTo [_debug, [0]];
private _vehicle = "VR_3DSelector_01_exit_F" createVehicle _debug;
systemChat format ["%1", _x];
} forEach (_thisArgs select 0);
},[_turretArray]];
``` how its going.... lockcamerato doesnt work so im assuming its at a point it cant see and the createvehicle spawns the markers on the floor
rather than at the elevated point
otherwise, tracks the barrel at its projected point
just not in its elevation
any assists?
Try this:
_turretArray = [port_1,port_2,port_3,port_4] - [port_3];
// store a debug visualiser for later instead of creating a new one every frame (awful)
{
private _debug = "VR_3DSelector_01_exit_F" createVehicle [0,0,0];
_x setVariable ["debug_target",_debug];
} forEach _turretArray;
_handler = addMissionEventHandler ["EachFrame",
{
// all this will be the same every frame so only do it once per frame, not once per turret
// model space position of gun base
private _gunB = port_3 selectionPosition "gun";
private _gunE = port_3 selectionPosition "gunEnd";
// 3D direction of gun determined by direction from its base to its end, extended by ~10 metres (NOT in model space, just a relative vector)
private _gunDirection = _gunB vectorFromTo _gunE;
private _gunProject = _gunDirection vectorMultiply 10;
// add the extension vector on to the base position to get the extended position in model space
private _gunProjectModel = _gunB vectorAdd _gunProject;
// now we can transfer the model space position to all the other turrets' model space (assuming they're facing the same way anyway; if they're not then further maths needed to compensate for that....)
{
private _target = _x modelToWorldWorld _gunProjectModel;
// syntax 1 only works with position-stabilised turrets, so we use syntax 2
_x lockCameraTo [_target, [0], false];
private _debug = _x getVariable ["debug_target",objNull];
_debug setPosASL _target;
} forEach (_thisArgs select 0);
},[_turretArray]];```
that works a charm
however - elevation still isnt accounted
just rotation
could i use - deg (port_3 animationSourcePhase "gun");
@restive bay
and move the target up n down based on that?
Elevation should be accounted for; this is based on the 3D (not 2D) direction between the base of the gun and its end - 3D meaning it includes the vertical.
Try increasing the direction multiplier, that may be too close for the turret to track properly since it's so large
Also, as another debug indicator, try attaching objects to the gun base and end memory points on the original turret. It's possible those aren't actually used with its animations.
Even tried .1 to get a slowed effect, but no change in the speed...
bear with, my a3 likes to keep crashing suddenly
mission file corrupted 
increasing the private _gunProject = _gunDirection vectorMultiply 10; has strange efffects
wait.... might be the way around you put the "gun" and "gunend"
as for some reason "gun" is the actual end, and gunend is the start (i dont even know how with this turret it works)
only reason i can explain why increasing it inverts it
the lower the multiplier... the further out it goes
what
Yes, if gunEnd is actually the base of the gun then reverse them.
I'd definitely suggest doing something to visualise where these memory points actually are and how they move (e.g. attaching indicators to them) rather than just guessing
alright
just waiting on arma 3 to fix itself, keeps crashing when returning to editor
it works
ty for the help nikko ❤️ works well, just dealing with unknown a3 crashes rn
i don't know if it is the correct location to ask this, but on the server i have some problems. Whenever somebody joins the server everybody who is already on it loses their armour and helmet. Does anybody know why this is happening?
How long respawn time do you find reasonable for a 20-40 minutes long, small scale coop mission (4 players) with respawn on the leader? I am thinking about a minute.
localityyyyy
do you use gear scripts?
in the unit init fields?
or called from init(Player).sqf?
because what's happening is these are re-ran when someone JIPs in
so this is probably just some silly scope / failure to pass variables around. but it throws an error now on lockcamera to.. 0 elements provided 3 expected
heres the relevant snippets from the function
_turretArray = _turretArray - [_controlTurret];
// store a debug visualiser for later instead of creating a new one every frame (awful)
{
private _debug = "VR_3DSelector_01_exit_F" createVehicle [0,0,0];
_x setVariable ["debug_target",_debug];
} forEach _turretArray;
_handler = addMissionEventHandler ["EachFrame",
{
// all this will be the same every frame so only do it once per frame, not once per turret
// model space position of gun base
private _gunB = (_thisArgs select 1) selectionPosition "gun";
private _gunE = (_thisArgs select 1) selectionPosition "gunEnd";
// 3D direction of gun determined by direction from its base to its end, extended by ~10 metres (NOT in model space, just a relative vector)
private _gunDirection = _gunB vectorFromTo _gunE;
private _gunProject = _gunDirection vectorMultiply 30;
// add the extension vector on to the base position to get the extended position in model space
private _gunProjectModel = _gunB vectorAdd _gunProject;
// now we can transfer the model space position to all the other turrets' model space (assuming they're facing the same way anyway; if they're not then further maths needed to compensate for that....)
{
private _target = _x modelToWorldWorld _gunProjectModel;
// syntax 1 only works with position-stabilised turrets, so we use syntax 2
_x lockCameraTo [_target, [0], false];
private _debug = _x getVariable ["debug_target",objNull];
_debug setPosASL _target;
} forEach (_thisArgs select 0);
},[_turretArray,_controlTurret]];
the error being the _x lockCameraTo [_target, [0], false];
line
No respawn, if using ACE, turn up the time until death a significant amount. Turn off instant death.
ive done nothing to this version bar change the variable names around to allow it just be a function that can have setups thrown in and they work as is rather than hardcoding
so im not sure why of all things its the lockCameraTo that breaks
It looks like _x is a turret index here, not a vehicle?
ah never mind, it's probably just misnamed.
"0 elements provided, 3 expected" sounds like the position variable (_target) is empty (because it's expecting a 3D position array, [x, y, z]). I think lockCameraTo isn't what's broken, it's just the first place where the breakage causes an error.
There are no scope issues here; it's all in the same scope within the EH.
I think probably _turretArray or _controlTurret is undefined, empty, etc. before being passed into the EH.
It should be™ a turret object, like a static turret.
well im calling the function via:
[[port_1,port_2,port_3,port_4],port_3] call CBB_fnc_carrier_Guns;
and inside the func its:
params [
["_turretArray", [objNull], [[], objNull]],
["_controlTurret", objNull, [objNull]]
];
so they should be getting passed in just fine
heres the whole thing
It's only run on the server too
It looks plausible. Add a bunch more logging.
diag_log is your (only) friend in Arma.
I guess so, just stumped me is all as it all looks correct.
Not related to your problem, but you can save a tiny bit of performance in your Fired EH by not having the params line, since you don't actually use any of those variables
No gear scripts...
I'm not sure "gun" and "gunEnd" selections are guaranteed to exist, but I imagine you tested that already.
they exist, using it on a specific turret
wanted to get it to work on this setup first for an op. then was going to expand it to allow them to be entered manually so all turrets can be used
currently validating my files as ive been getting nonstop status violations, which hasnt ever happened to me before
might be a cursed file
will do
i downloaded the hell heli map and it ended up uninstalling all my mods vro (not related to my current issue)
Search your mission file for removeHeadgear, that would give you a couple possible locations to look at
Does it happen when any player JIPs, or is it a specific player?
Any
Then it definitively sounds like a dress-up script going haywire
Are you using any mods?
Is there an easy way how to reverse the order of waypoints?
Hi, tell me please.
If I enter the zone for 1 second and exit, then after 15 seconds a message will come.
I trying to do if the player is in the zone then execute my code, if he is not in the zone then do nothing
[] spawn {
while {true} do {
private _WaitTime = time + 15;
private _in = player call ExileClient_util_world_isInTraderZone;
if (_in) then {
waitUntil {time > _WaitTime};
["ErrorTitleAndText", ["text", "text"]] call ExileClient_gui_toaster_addTemplateToast;
};
sleep 1;
};
};
if I do sleep 15; then everything works, but it turns out the time increases to 30 sec
Just run your check again after the waitUntil
I tried that, everything is the same
Code?
[] spawn {
while {true} do {
private _WaitTime = time + 15;
private _in = player call ExileClient_util_world_isInTraderZone;
if (_in) then {
waitUntil {time > _WaitTime};
if (_in) then {
["ErrorTitleAndText", ["text", "text"]] call ExileClient_gui_toaster_addTemplateToast;
};
};
sleep 1;
};
};
or
[] spawn {
while {true} do {
private _WaitTime = time + 15;
private _in = player call ExileClient_util_world_isInTraderZone;
private _inz = false;
if (_in) then
{
_inz = true;
waitUntil {time > _WaitTime};
if (_inz) then {
["ErrorTitleAndText", ["text", "text"]] call ExileClient_gui_toaster_addTemplateToast;
};
};
sleep 1;
};
};
Of course it won't work -- _in has outdated info, _inz is meaningless.
You need to re-run the function
if only I knew how to do all this😞
while { true } do {
_in = player call ExileClient_util_world_isInTraderZone;
if (!_in) then {
sleep 1;
continue;
};
_WaitTime = time + 15;
waitUntil {
sleep 1;
_in = player call ExileClient_util_world_isInTraderZone;
!_in or { time >= _WaitTime }
};
if (_in) then {
["ErrorTitleAndText", ["text", "text"]] call ExileClient_gui_toaster_addTemplateToast;
};
};
[] spawn {
while {true} do {
private _WaitTime = time + 15;
private _in = player call ExileClient_util_world_isInTraderZone;
if (_in) then {
waitUntil {time > _WaitTime};
if (player call ExileClient_util_world_isInTraderZone) then {
["ErrorTitleAndText", ["text", "text"]] call ExileClient_gui_toaster_addTemplateToast;
};
};
sleep 1;
};
};
is there a function or perhaps even a script someone has made, to check if a waypoint is "valid"
e.g. If you have a boat with randomly generated waypoints, assume these waypoints are guaranteed to be in water, but it could be a lake the boat can't actually reach or a river with a bridge that's too low for the boat.
i guess what I'm asking is if there's a way to check for AI pathing correctness
same idea, but perhaps its a car on an island and the random waypoint is on a different island with no bridge connection, something that will check to see if the waypoint can actually be reached
@faint burrow@tulip ridge thank you very much friends
well there is the https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#PathCalculated that you can play with. that should trigger only on valid paths
hmm, that's a useful EH, it does mention paths are calculated in segments, i wonder how long those segments are
it is a start though, thank you!
I had some path length issues last time I worked with that https://feedback.bistudio.com/T170428 . the segments if i remember right are at least 1km in length
there's also the calculatePath function, but it returns the object used to calculate the path, not a boolean or array of waypoints/segments
nothing i could really use in a script to determine if a path is possible
yeah
The idea is that you then immediately use a pathCalculated EH on that object to get the array of points it generates
Is there a script to cause an item to blow up when it’s inventory is accessed but not when picked up by ace?
Not specifically for that purpose, but you could pretty easily make one using an inventoryOpened event handler
you can also test with that (calculatePath) if the path if possible before trying to make the AI move
Okay makes sense, just need to find the explosion then
The traditional method is to spawn a Mk 82 with createVehicle
There are other, more cowardly options available depending on how many people you want to kill
setDamage leaves no traces
yes @ace
@ALiVE
@cba_a3
@cTab
@EUROFORCE
@mcc_sandbox
@staf_misc
@task_force_radio
@xla_fixedarsenal
does it happen immediately when the player jips, or later on?
if(calculatePath ["boat","CARELESS",_boatWaypoint,_spawnPos] isEqualTo "") then {break};
this did the trick it seems, thank you both! nevermind, it did not work lmao
calculatePath returns an agent (object) not a string
yeah i know i just wasn't sure how to check if the function returned nothing when the return is an object
maybe isNil?
nah, isNil also wants a string
whats the best way to see if calculatePath returns nothing? or does it just always return the agent used to calculate the path?
if so thats sort of a useless function on its own lol
Read command description.
isNil takes a string because you'd give a variable name directly
isNil "_var"; // true
_var = 1;
isNil "_var"; // false
yeah i realize that
calculatePath always returns the agent. There's no way to return the result directly; you'd have to add the pathCalculated EH as shown in the orangebox on calculatePath's wiki page, and have the EH trigger "part 2" of whatever you needed the result for.
The command isn't useless - without it it would be difficult to get the pathCalculated EH to return what you want. It probably doesn't return a value directly because it's a retrofitted way of accessing engine-level stuff that isn't designed to be accessed like this. For example, AI pathfinding might not be fast enough (or guaranteed to be fast enough) for a direct return to work. If the path might not be generated until the next frame, it can't be returned inline.
just throwing shit at the wall right now
AI pathfinding is definitely not fast enough for the direct return :P
Think seconds rather than frames.
How am I supposed to setDir on individual units in a group? Even when I use doStop, they still turn somewhere else.
setFormDir, I think
Is there any way (like an event handler) to know when an AI squad leader is giving orders? I know they give orders to their subordinates because you can hear them speak, so I'd like to have a script that would make them play animations like pointing.
It'd be fun as a sniper to see officers pointing and otherwise obviously being officers.
I don't know if the event "CommandChanged" works with AI leaders, or just when the player issues orders to his group.
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#CommandChanged
If you really want to force them then disableAI "MOVE"
@mcc_sandbox it's the worst piece of code I've ever laid my eyes upon, wouldn't surprise me if it was involved...
I don’t mind waiting seconds lol, but I get what you mean
https://community.bistudio.com/wiki/setDetailMapBlendPars really worth adjusting?
I want to, as the idea with this particular scenario is to be acessible and extremely performant.
Check how it affects the FPS
I think my question regards the lowest common denominator as far as performance goes. I can't notice any difference between 120 and 125 fps until par is so low that it shoots up to something ridiculous like 300 or 500
which, you're right if that's desired effect = then yes.
But I don't know if it has the same drastic difference on a layman pc
I just think it's almost as subjective as simul weather layers ( if that even still applies ) but I want to make it feel eazy breezy beautiful for all