#arma3_scripting
1 messages ยท Page 667 of 1
i need to do that without making it so that civilians are not able to access crates
when I do civilian setFriend [civilian, 0];, it makes it so that they cannot open boxes because they are on the civilian side
I've just tried using BIS_fnc_SpawnGroup in two separate instances and got the same error. Verified my game files, no mods and no betas
21:32:23 Error in expression <private ["_pos", "_side"];
_pos = _this param [0, [], [[]]];
_side = _this param>
21:32:23 Error position: <param [0, [], [[]]];
_side = _this param>
21:32:23 Error Type Object, expected Array
21:32:23 File A3\functions_f\spawning\fn_spawnGroup.sqf [BIS_fnc_spawnGroup]..., line 38
What's the end goal of what you're looking for? You could look at manually resetting the rating afterwards with the https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleRating command
@fleet stirrup i basically have a battle royale type game where gear is stashed in crates around the map and civilians are fighting each other
I want players to always be able to access crates, and I want players to be able to kill each other without it saying friendly fire
since objects such as containers are all on the civ side, making civs enemies with each other causes them to not be able to access crates
https://community.bistudio.com/wiki/BIS_fnc_addRespawnInventory
Hey does anyone know where I should be putting the number for limiting the amount of times a loadout can be picked? there isn't an example with it and I haven't been able to get it working yet.
try something like this [west,["B_Marksman",2]] call bis_fnc_addrespawninventory;
the error is right there, you're passing an object as first argument, it expects an array (https://community.bistudio.com/wiki/BIS_fnc_spawnGroup)
Will do thanks, ill post again when I do
unitcaptured a Gorgon, how do i save my player's hearing
awful tire screeching
You don't - unitCapture is for air units
i will make an in-mission note to apologize to my players
0 fadeSound 0 for the travel time ๐
doesn't that mess with the player's actual ingame settings
as in setting it to 1 might be catastrophic while they have it set to 0.5 in their settings or something
nope, their setting is the "100%" of the command
you cannot force a setting upon the client ๐
thanks bud
odd
fadesound isn't working
using fadeeffect and cinemaborder if that has to do anything with that
time to write an apology
Might be something to add to the biki, if it's not been written there already
you are a lovely [insert the species of your choice]
I am getting an error saying that Suspending not allowed in this context for the waitUntil-lines but the whole thing is spawned which should allow suspension so does anyone got any clue why it's throwing that error?
{
_null = _x spawn {
waitUntil { !isNil "WL_fnc_function" };
if !(_this in [BIS_WL_base_WEST,BIS_WL_base_EAST]) then {
waitUntil { sleep 1; _this getVariable ["BIS_WL_sectorActivated",false]; };
_nil = _this call WL_fnc_function;
};
waitUntil { sleep 1; _this getVariable ["BIS_WL_guardSpawned",false]; };
_nil = _this call WL_fnc_function;
};
} forEach BIS_WL_sectors;
Where does this code block live and when is it executed? Some kind of init field?
initServer.sqf
initServer.sqf allows for suspension
functions which are called cant always suspend
not sure if that depends on the environement or the "call" execution
But the error is caused in the waitUntil-lines.
_null =
Don't do that. That's pointless
call uses the same environment as its parent yes
I do that to avoid problems with the script-handle.
There will be no problems if you don't use them.
Yeah, but that's can't be the issue here since it could only end up scheduled
No. Call simply means put the code here. It doesn't change the environment
Call from unscheduled = unscheduled
Call from scheduled = scheduled
ive got a high command module that i want a certain group in the middle of the mission to be added to HC subordinates, possible?
I had issues with that in the past where is wasn't expecting a return but got the script-handle.
Yep, so you are fixing bad code practices with another bad one ๐
Doesn't explain the error, though.
you can just use 0 =
We need more details
pls
Have you checked the biki commands?
yes
hcSetGroup
thanks buddy
it could be a serialization issue
instead of _x spawn use [_x] spawn
and then params ["_something"]
inside the code
ah an array param thing, might be
black sqf magic again 
Only init fields complain about that, it's safe to use in proper scripting.
What kind of details to you need?
Everything worked just fine until I added the sleep 1;-part into the waitUntil-loop.
That was in the editor. Not in script files (which is where your script is)
And the bug in editor was fixed.
_nil = thats also nonsense
Need full actual error from RPT, and the full script file (initServer.sqf I guess?)
Did you try what I said?
is there a variant of the unit capture script that allows me to record fireing weapons (talking about a helicopter)
unit capture has a capture firing mode afaik
I think it should be recorded at the same time as unit capture
rec = [heli1,300,120] spawn BIS_fnc_UnitCapture; rec = [heli1,300,120] spawn BIS_fnc_unitCaptureFiring;
^so i put that into the trigger?
and this into the sqf โฌ๏ธ
[heli1, wp1] spawn BIS_fnc_Unitplay; [heli1, wp1] spawn BIS_fnc_unitCaptureFiring;
?
need group to hide from appearing on map when player is using HC interface
how do
BIS_fnc_unitPlayFiring
Nope, no dice sadly.
wait hang on
thats how the basegame endgame missions do it
Two very simple questions people ๐
- How do i make a unit crouch upon reaching waypoint?
- How do i make a unit play multiple animations upon reaching waypoint (e.g kneelin, kneelloop)?
setUnitPosplayMove
this setunitpos knl; ?
What does the wiki say?
!wiki when
'_soldier setUnitPos "UP"; - wiki answer, cheers
How do I make it so a script I made applies to all the billboards in my game? Is it with typeOf? I've tried some stuff but I guess I'm just not proficient enough to get it to work. I'd love if someone could show me how to make something apply to all objects of the same class name
First you need to gather all the billboards, so depending on what you mean with all the billboards that will probably have to be done with allMissionObjects. That already has a type parameter, but I'm not sure if that works with config classes. Either way, there are probably several classes of billboards which you want to retrieve, so in case they all share a common parent class you can possibly use that parent class with allMissionObjects (but not sure about that) or you can use it with isKindOf to filter for your desired objects.
typeOf could also be used, but not with a possible parent class; isKindOf works with both, the actual class and parent classes.
Ah, yes, you can figure out if there is a common parent class shared by all billboards in the config viewer, it shows all parent classes of the current config in the bottom.
If your script has to run multiple times, you should probably buffer the result of the process described above to avoid using allMissionObjects again.
I only want a single class name
So I guess typeOf is enough right?
I just don't know how to properly apply it
https://community.bistudio.com/wiki/typeOf ๐คทโโ๏ธ
I'm going to sound really stupid, bear with me
Is it like the example in the wiki?
typeOf vehicle == "classname";
?
the examples always work when executed in game, but most likely will need some modifications based on your usage
yes, that works
if used in an if statement
I tried that before and it throwed an error
Might be something else then
That caused it
do I have to make a for with allMissionObjects to check every classname?
{
if (typeOf _x == "classname") then {
hint "vehicle is typeOf classname";
};
} forEach allMissionObjects;
Probably.
Seems about right
Unless you find a common parent class...
Anyone Know How I Can Make Scenario Into A Mod? Thanks.
That only puts it onto steam workshop and as a scenario I want make the scenario into a mod for others to use on there servers
I got it all on steam workshop just want it turned into a mod and not set as a scenario
Ok thanks
Why won't this work on servers?
`_gen = _this select 0;
_loc = nearestObject [_gen, "Logic"];
{_x switchLight "OFF"} forEach ((getPos _loc) nearObjects ["Land_Lampadrevo",150]);`
The lights will not turn on. Trying this in singleplayer the lights turns on. If start a LAN server, only I will be able to exec the script successfully
becauseโฆ suspense
switchLight has a Local effect!
https://community.bistudio.com/wiki/switchLight
fu.. me, i didnt see.. Thank you, Lou
lol Land_Lampad@cosmic lichen
What?
"Land_Lampadrevo"
Oh the config name
Is there such a thing as a three state trigger, or would I have to write it myself? Would it be more performance efficient to write a three state detector of my own or would it be more efficient to use two triggers to reach the three states?
โฆyyyes.
(what do you need, seriously? ^^)
true false perhaps ๐ฎ
Like "East Occupied," "West Occupied," "Unoccupied."
since a trigger is an object, you could use setVariable?
set side west, east, civilian?
Oh, man! That might do it! Dang. That sounds good, but I'm not sure I know how to set the conditions for it.
I guess the conditions are another hangup, because it would have to be like:
"If East > West, then True;"
"If West > East, then Also True;"
"If Civ > East AND West, then False;"
Or something. I'm sure I'm just on the wrong track.
I know how I would do it with two triggers. Maybe I need to work through that first and it'll click later.
yep, write in e.g notepad the human logic first ๐
Haha, will do, thanks!
Hello ๐ is there an easy way to call a certain script only on the first HC that connects?
Right now I'm using this in the init.sqf
if (!isDedicated && !hasInterface && isMultiplayer && local HC1) then with the headless client slots being called HC1 and HC2.
Problem is they don't populate the slots top to bottom so if I'm running only one HC it sometimes connects to slot 2 (HC2) and not calling the script.
hey lou, you happend to know how i can make a helicopter fly and shoot off of pre recorded data?
BIS_fnc_unitPlay?
that covers the movement part, but what about the shooting part
instead of local something just execute the script locally 
to prevent the script running from for multiple clients just use a condition
if !(missionNamespace getVariable ["someVar", false]) then {
missionNamespace setVariable ["someVar", true, true]
}
https://community.bistudio.com/wiki/BIS_fnc_unitCapture is able to record movement and shooting
No idea how to use it (properly) though
just set firing to true 
noticed that ๐ , i have been trying to get this to work for 5 hours now and i want to blow up
if (_captureFiring) then
{
[_unit, _duration, _timeOffset] spawn BIS_fnc_UnitCaptureFiring; // Starts the weapon fire recording script
hint "Starting Capture, including weapon fire data...\n\nPress ESC to stop capture.";
}
else
{
hint "Starting Capture...\n\nPress ESC to stop capture.";
};
```
seems like it just spawns the other script
@radiant yacht do this:
for recording:
[heli1, 300, 120, true] spawn BIS_fnc_unitCapture;
after it's captured:
[heli1, _Data] spawn BIS_fnc_unitPlay
_data is the recording data (which is copied to clipboard)
well there are 2 recorded data things
no
movement and fire
^sorry my brain has been melted, these are the 2 things i can copy now
one with F1 and another with F2
yes
if you have a clipboard manager or something you might be able to get both data
could i not just copy them seperate, and past them after one another?
you'd have to record separately then
no thats what i mean, so you are saying that i need to put the movement and weapons data as the _Data, so doesn't that mean that i can just go _data = (movement data) (fire data)?
no
I recommend you do this:
record the movement
copy it to clipboard
play the movement data and this time record firing
copy the firing data to clipboard
wait
_moveData =; _firingData =; [heli1, _moveData] spawn BIS_fnc_unitPlay; [heli1, _firingData] spawn BIS_fnc_unitPlayFiring;
that would work, no?
the best thing to do tho is to forget those nonsense functions 
no
if you mean exactly like that then absolutely not
oh, i see, yea
I could write a far better unitCapture in 10 minutes
I don't know what they were smoking 
Holy shit. A few years ago, I'd have paid twenty bucks for a decent unit capture and playback function.
idk what they smoked, but i need some of it
a quick sitrep xD
i'm at the point where i have the BIS_fnc_unitCapture data, which is movement and weapons
the thing is those 2 are seperate data sets
and the problem is that the BIS_fnc_unitPlay only accepts one data stream
[ vehicle player, _unitCaptureData ] spawn BIS_fnc_unitPlay
^i need to combind the 2 data sets somehow
I have to go rn but when I'm back I'll write a better captureData function.
new to scripting so wasn't aware it was that easy, thanks!
I need an .sqf program to end at a specific point, following an if-statement. I've tried Terminate, but it doesn't seem to be working :/
exitWith?
Hrn... I'd mucked with exitWith before but didn't have much luck. Looking at it now, maybe I was laying it out wrong.
if you are in the main scope then exitWith, if deep in child scopes can try breakTo/breakOut
That is an interesting point, because of how I structure my scripts :/
I use an InitServer to set up variables, weather, etc, then end with execVM "Staging.sqf".
Staging.sqf execs the mission's sqfs in sequence; T1 = execVM "Task1.sqf";, etc etc
So in this case;
if (triggerActivated _AAFRain) then {TasksDone = TasksDone+1; terminate T37};
if (triggerActivated _AAFRain) exitWith {TasksDone = TasksDone+1;};
What I had before, what I'll try next.
there is no guaranteed order of execution if you use execVM or spawn, you know that, right?
I'm vaguely aware, or at least know that the scheduler is something to be concerned with, but each one is tailored around the objective; waitUntil {sleep x; player distance objective <300}, etc.
At least, in my current mission, which is less linear than my other project
try
terminate _thisScript;
inside the scheduled script you want to exit
๐ฎ didn't know that was a magic word
_thisScript contains script handle
Is setTriggerInterval broken?
Not for me at least.
Then I wonder what I'm doing wrong.
In InitServer.SQF, I've got this:
If (isServer) then
{
_Flag = createMarker ['', markerPos 'Sector'];
_Flag setMarkerType 'mil_objective';
_SectorFIA = createTrigger ["EmptyDetector", markerPos "Sector", false];
_SectorFIA setTriggerActivation ["ANY", "PRESENT", true];
_SectorFIA setTriggerArea [100, 100, getDir this, true];
_SectorAAF setTriggerInterval 5;
_SectorFIA setTriggerStatements
[
"East countSide thisList < 0.4*(West countSide thisList);",
"DeleteMarker '';
Hint 'Zone Occupied';
_Flag = createMarker ['', markerPos 'Sector'];
_Flag setMarkerType 'Flag_FIA'",
"Hint 'Zone Empty';"
];
};```
Everything is working just fine except that interval.
_SectorFIA _SectorAAF 
Hahaha, of friggin course. Okay!
Dammit, always something dumb.
It's also not registering in the syntax here or on VSC for some reason, which furthered my doubt.
initServer.sqf only runs on the server, no need for if (isServer) ๐
*I'm fairly certain this script will not be run from the server init in the final product.
Yep! You found the problem. Thanks so much!
sqf to mariadb/mysql extension/mod/whatever recommendation ?
Is there a way to determine of a player object is still "active" i.e. connected?
isPlayer _player ?
how could I make armed civilian infantry group hostile to west, east, resistance simultaneously without sideEnemy (renegade approach) ? Is it doable by scripting or modding ?
See the examples here https://community.bistudio.com/wiki/Side_relations
perhaps _player in allPlayers (?)
LINQ style selectMany
params [
["_source", [], [[]]]
, ["_resultSelector", { (_this#0); }, [{}]]
, "_collectionSelector"
];
private _retval = [];
{
private ["_z"];
private _alpha = _x;
private _alphaIndex = _forEachIndex;
{
private _a = _x;
private _i = _forEachIndex;
if (isNil "_collectionSelector") then {
_retval pushBack ([_a, _i, _alphaIndex] call _resultSelector);
} else {
private _bravo = [_a, _i, _alphaIndex] call _collectionSelector;
{
private _b = _x;
private _j = _forEachIndex;
_retval pushBack ([_a, _b, _i, _j, _alphaIndex] call _resultSelector);
} forEach _bravo;
};
} forEach _alpha;
} forEach _source;
_retval;
unless there's an easier way?
thanks for link but it does not make all 3 sides (res, east, west) hostile for civ side. Each approach forces one of affected sides as a friendly one..
renegade style looks most suitable but the problem is civs start killing each other staying in one/few group(s)
@radiant yacht this is the unitCapture function:
And this is the unitPlay functions:
it's a bit crude but it'll do
it also captures the firing data
Hello, guys. How to make the Heavy to fire continuously at any target?
and he has to make a recoil correction
in other words, he should shoot at one point and try to suppress recoil, as he does when shooting at a normal target
hey, I am having trouble with the ATM_Halo jump script. I have placed everything the proper way and even downloaded another copy of the script from ARMAHOLICS. Anyone available to help me with this problem?
seems to work great, [[[0,1],['a','b'],[true,false]]] call kplib_fnc_linq_selectmany yields [0,1,"a","b",true,false], or for those times you want to select allPlayers over a cross-cutting range.
ups!
so far, seems https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#Ended never fired, but MPEnded. is Ended intended for single player?
InterceptDB :u
will u give support on that? xD
unlikely
๐ ๐ค
is there a command to convert world-direction to model-direction?
inside entitykilled EH...shouldn't getPlayerUID _instigator work?
yes, _instigator is the object (and thus player) which killed the entity
and it's empty, cause....?
just check the example on the wiki regarding weird conditions like UAV's and vehicle kills
in which page?...getPlayerUID neither EntityKilled say anything
im definetively blind xD sorry. i had the page open and looking the example...
the upper example xD
although arma is arma, this time was a simple headshot, no vehicles related
hence it shouldn't have failed (IMHO)
anyway, i'll check tomorrow what's going on
thanks @exotic flax
although it's always a good idea to check if the instigator is actually a player
if (isPlayer _instigator) then {
private _steamUID = getPlayerUID _instigator;
//...
instigator is not null, that's what drives me crazy.
hmmm...
I use ```sqf
// Player killed/destroyed AI
if (isPlayer _instigator && !(isPlayer _unit)) then {
[getPlayerUID _instigator, "KillAI", 1] call FUNC(updateData);
};
// Killed friendly!
if (isPlayer _instigator && (isPlayer _unit)) then {
[getPlayerUID _instigator, "KillFriendly", 1] call FUNC(updateData);
};
// Player died
if ((isPlayer _unit) && !(isPlayer _instigator)) then {
[getPlayerUID _unit, "Died", 1] call FUNC(updateData);
};
...
scenario:
friend killed dummy IA by headshot, getPlayerUID _instigator was blank
can we get a command to alter the attached position of an object?
attachTo again is cancer
Infact, what i find most troubling about it is that it's so slow if run rapid succession
any ideas for how i could go about setting up a script so that you can unload ace cargo to a base and have it be converted to respawn tickets or other items like guns/ammo?
["respawn_5","respawn_6","respawn_7","respawn_8","respawn_9"] joinSilent (group player);
how do i make this work?
Never. This just won't work
IDK what is your goal
i have a group of hostages which are players, its a respawn system so when you die you respawn as a hostage and wait for friends to rescue you
but i cant just let them respawn as the same side and group because opfor will just shoot them
so im trying to figure out a way to get them back in the same squad when they get rescued
What are "respawn_5" thru "respawn_9"?
variable names of the player hostages
Are they units?
yes
Then remove quotation marks
[respawn,respawn_1,respawn_2,respawn_3,respawn_4] joinSilent (group player);
[respawn,respawn_1,respawn_2,respawn_3,respawn_4] setCaptive false;
how do i combine these two?
[respawn,respawn_1,respawn_2,respawn_3,respawn_4] joinSilent (group player);
{_x setCaptive false} forEach [respawn,respawn_1,respawn_2,respawn_3,respawn_4];```Always Wiki is your friend
man what would i do without this discord
https://community.bistudio.com/wiki/Category:Arma_3:_Scripting_Commands
I didn't learnt from Discord. Use Wiki
Q: does netId player tell me the client identifier for use with remoteExec?
I see, so netId says something like "2:12345", so I could potentially split ':' and parseNumber the first element for the clientOwner?
You want to do remoteExec on some players?
yeah... actually, can I just notify the player objects themselves?
Maybe just dosqf remoteExec ["smth",[unit_1,unit_2,unit_3]]?
beauty, that worked. thank you.
hey hey, I hope someone can help me with this one,
I'm doing an animated evac via helicopter using the unitcapture/unitplay
helicopter comes -> wait for players -> helicopter fly
the issue is that once the first animation ends, the helicopter gets some height, probably from the engine's physics turning on again
Is there a way to set the engine rpm to a low value?
or a better way to make the helicopter sit still, like a trained dog.
i've disabled the AI, but sadly it still takes off
Probably flyInHeight
well, sadly the AI ignored that (activated it again)
going to try to set the pilot unconscious
welp, land "LAND" almost nails it, the pilot shuts down the engine
the "GET IN" mode is also ignored
as funny as it is, it works perfectly with the pilot dead
alright, disabling the simulation and killing the pilot seems to break the AI enough to it act properly 
hi, why setObjectScale can be used directly in single player mode, while must be first be treated as a simple object using attachedTo in multiplayer mode?
@wind sparrow it also only works on simple objects or with attachTo in singleplayer.
There is only a exception for Eden editor to let artists do what they want.
But everything except simple objects and attachTo are not supported
@supple cove Have you tried using the doStop command?
This is what I have in one of my scripts:
doStop _helo;
_helo land "GET IN";
{_helo animateDoor [_x, 1]} forEach ["door_back_L","door_back_R","door_L","door_R"];
waitUntil {sleep 1, player in _helo};
I had the same problem where the helicopter would just fly off but using doStop solved it
that's what the ๐ was all about!
copy that, THX ๐ฏ
while{true} do {
{
if(side _x == WEST && _x distance (getMarkerPos "WESTBASE") < 100) then {_x allowDamage false} else {_x allowDamage true};
} forEach allUnits + vehicles;
sleep 1;
};
};
0 = [] spawn {
while{true} do {
{
if(side _x == EAST && _x distance (getMarkerPos "EASTBASE") < 100) then {_x allowDamage false} else {_x allowDamage true};
} forEach allUnits + vehicles;
sleep 1;
};
};```
Trying to make safe zones for a PvP thing. should this work still or?
it's in the mission Init.sqf
0 = not needed
(unless in init/trigger field)
wait went back over the thread and tried some other ones
0 = [] spawn {
while{true} do {
{
if(side _x == WEST && _x distance (getMarkerPos "WESTBASE") < 200) then {_x allowDamage false} else {_x allowDamage true};
} forEach allUnits + vehicles;
sleep 1;
{
if(side _x == EAST && _x distance (getMarkerPos "EASTBASE") < 200) then {_x allowDamage false} else {_x allowDamage true};
} forEach allUnits + vehicles;
};
};
this works fine now, not for vehicles but that's fine, when the first one didn't work I thought something code wise might have been made redundant since it's from 2017
thanks for jump in so fast though, really appreciate it.
scripts never "outdate" in Arma
it rots, that's different
you have to rewrite SQF every 18 months so the file doesn't outdate; sometimes a simple Ctrl+S to refresh the file last save's date is enough, but not always
Good day. I'm struggling with something quite simple I hope - VSCode IntelliSence for local variables is not working, and it's really annoying (= Can someone help?
Yeah, I've installed SQF Language by Armitxes and SQF Wiki, noticed that autocompletion for variables not working, tried SQFLint, SQF Debugger - seems like I'm missing something. Could you point more specifically what should I check on that page?
it doesn't seem related to those plugins
maybe related to your VSCode settings
I use Armitxes' extension too and I don't get autocompletion for custom functions and variables either. Not sure if there is a fix for it, but it doesn't bother me nearly as much as the missing keyword highlighting for new commands and such. Unfortunately the extension has not received updates in more than a year; there is activity in the GitHub repo though, not sure what's going on.
I offered mainly for alternatives; I don't have autocompletion for custom variables/functions either
which means just don't use VSCode at all
I use it, it is just not that necessary to me ๐
VSC is way too good to use something else ๐
And suggestions and autocomplete work for other languages / plain text files, so I guess it has got something to do with the extension ๐คทโโ๏ธ
Notepad++ is better (for SQF at least)
I shall write mine one day, with blackjack and hookers
Oh no, I couldn't go back to N++ and Explorer
You can update N++ yourself
and not rely on someone to update it for you
Plus all the features like linting are stupid in SQF
sqf is not statically typed
half of the linting info is garbage
VSC saves my workspace, gives me Git (Hub) integration, a beautiful darkmode and endless settings, options and extensions.
I said N++ is better for SQF
not for everything
Oh no, all those apply to SQF as well ๐
I can confirm, it IS working as intended for plain text files... now how do I enable it for sqf files too I wonder?
ah yep, N++ and dark modesโฆ
I heard Notepad is the best for any language ๐
is there a way to get an sqf function(the actual script) because the script is not listed in CfgFunctions due to the config viewer cutting out (not showing all entires)
was
The config viewer not showing all entries?
The functions viewer not showing all entries? The functions viewer has the option to filter by function category.
except for the garbage linting stuff 
That is why I don't use the SQF-VM extension (by X39) but the pure syntax highlighting extension (by Armitxes). Downside is, as mentioned, it doesn't have commands like setTriggerIntervall yet and for some reason autocompletion for variables and custom functions doesn't work.
Ignore the python stuff. But the rest is very good
and SQFLint works fine for me
What extensions regard SQF are you using?
https://marketplace.visualstudio.com/items?itemName=Armitxes.sqf
https://marketplace.visualstudio.com/items?itemName=skacekachna.sqflint
It's funny, but as soon as I enable SQF Language, variables autocompletion disappears. Welp, you helped to find a reason for me, thank you
As I said, it's related to your VSCode settings
not the extension
teach me, senpai รจ_รฉ
I don't know what it is 
@cyan dust btw, you should save the document
maybe that's why
(yet another reason why VSCode sucks - it actually needs a file, and you can't edit on the fly)
what? you can change the file type bottom-right? ๐คจ
I save and reload VSCode any time I'm messing with extensions, learned it a hard way (=
you can
but most stuff don't work without a file
oh
@winter rose
without saving the file the variable names don't appear
@cyan dust โ๏ธ
oh uh ok actually do have a problem.
0 = [] spawn {
while{true} do {
{
if(side _x == EAST && _x distance (getMarkerPos "EASTBASE") < 200) then {_x allowDamage false} else {_x allowDamage true};
} forEach allUnits + vehicles;
sleep 1;
{
if(side _x == WEST && _x distance (getMarkerPos "WESTBASE") < 200) then {_x allowDamage false} else {_x allowDamage true};
} forEach allUnits + vehicles;
};
};
only the first marker works.
if I switch the east and west lines around then the one that goes first always works and the second does not.
any ideas how I'd get the second one to be read?
you don't need two forEach:
[] spawn {
while {true} do {
{
call {
if (side _x == EAST) exitWith {
_x allowDamage (_x distance getMarkerPos "EASTBASE" > 200);
};
if (side _x == WEST) then{
_x allowDamage (_x distance getMarkerPos "WESTBASE" > 200);
};
};
} forEach allUnits;
sleep 1;
};
};
yeah I tired putting sleep 1 after both or just on the last if but yeah didn't quite work haha. putting your one in now
It's not VSCode fault but the extension.
@torpid quartz updated the code again
yeah was going to say it made the wrong side invincible lmao
What's wrong with using ||? ๐
|| ? 
you mean else?
Do you really need infinite while loop? Isn't there a way to do this with some trigger entering/exiting?
I just answered the question
yes you can do it with a trigger
_x allowDamage !((side _x == east && _x distance markerPos "EASTBASE" < 200) || (side _x == west && _x distance markerPos "WESTBASE" < 200));
but the trigger needs a loop too
so it's pointless
(a trigger only triggers once)
OK, got it
what if it's a civilian ๐
or independent
Then it becomes true or not?
yeah 
Isn't that the goal? 
maybe
but I'd say doing that is slower
you're evaluating everything
with some lazy eval it'll be better
@cyan dust if you still can't get it to work, search this in VSCode settings:
editor.wordBasedSuggestions
hello i want to ask is their a script that let soldiers roam around specific area ( camp or base ) in safe mode , and if they get attacked they go take cover and fight
So when are we going to unite and write one nice sqf extension ? ๐
I'll be happy to help when I'll finish my 1337 other projects so... 2035 I guess?
The one from X39 has the most potential but sadly it's not in "production" ready state yet imo.
Thanks for help, man (= I just found another SQF Language extension by Vladislav Sazonov and now autocompletion works fine (though I lost all the snippets lol, but that's easy to recreate them)
The option you mentioned was enabled all the time, btw
How to make the Heavy to fire continuously at any target?
and he has to make a recoil correction
in other words, he should shoot at one point and try to suppress recoil, as he does when shooting at a normal target
Any ideas?
do you actually need a unit?
but anyway, you can just use a loop + forceWeaponFire
add a FiredMan event handler and guide the bullet to where you want
you can create a bullet by script too ^^
Hey hey, yea, I've tried using doStop, but as soon as the unit capture finishes it will take off.
The dead pilot is actually better to work with tho as now I know the AI isn't paying any shenanigans
had the same problem too. sometimes the sqflinter will stop autocompletion for variables. it seems to be related to indexing the workspace and parsing certain files. What I did to solve it was to exclude all files from the indexing. then i readded the files one by one until the linting didn't work again. then i excluded that file (or files) from the indexing. ofc you can do it the other way around too but you can exclude entire folders as well. the setting for that is called sqflint.exclude
How do you dump a BIS function so you can read its script?
Open it in the functions viewer and copy-paste it from there if needed.
That'll work, but I swear there was another way that I liked. This is what I get for being away for so long.
just typing the function name and "EXEC" in debug console (and it's awful)
No help disappointed โน๏ธ
happens
extract the PBO
functions_f (I think)
and you get 90% of the functions
but finding the function in the game is always the better choice
there are also many alternative function viewers that do a better job
because we don't "know of" any such script ๐คท
you'd have to script it yourself
or just Google
I used to type the function name in debug and it would stick it in my clip board somehow. Don't remember.
it gives you the preprocessed function
it may not be as readable as the function file
Interesting.
Doubt Notepad++ can do this
How to? Can you show example?
I use arma 2
doFire doesn't work
I tried but I failed
Does a command to deploy the helicopter wheels exist?
"Gear" action
but it must be called every frame if the helicopter is piloted by AI
something like this?
_pilot action ["Gear", vehicle _pilot];
sorry it was the "landGear" action:
https://community.bistudio.com/wiki/Arma_3:_Actions#LandGear
yup! it nailed what i needed! thank you very much
Hi,
can you tell me which extensions you use for visual code?
Especially for debugging!
sqflint
Thank you very much๐
OK, thanks
PLEASE, tell me there's a better way to do this...
systemTime to YYYY/MM/DD HH:mm:SS
private _date = format ["%1/%2%3/%4%5 %6%7:%8%9:%10%11",
systemTime select 0,
["", "0"] select (systemTime select 1 < 10),
systemTime select 1,
["", "0"] select (systemTime select 2 < 10),
systemTime select 2,
["", "0"] select (systemTime select 3 < 10),
systemTime select 3,
["", "0"] select (systemTime select 4 < 10),
systemTime select 4,
["", "0"] select (systemTime select 5 < 10),
systemTime select 5
];
["", "0"] select (systemTime select 1 < 10),
why?
two-digits....if seconds=5, return "05"
you stole that script of mine right? ๐
https://community.bistudio.com/wiki/date#Notes
so you're to blame for that monstrous code?! ๐
Yes! ๐
now if you have better, I'm all ears ๐
str (_x/100) select [2]
not sure if it works
let me try
@winter rose yep, it works! (for 2 or less digit numbers only)
I'm goooood! ๐
please, working code demo xD
mind if I amend my note with your solution, naming you?
you don't have to name me!
but I don't think it works that well
want me to adjust it?
but i still dont get it...why /100 would convert 5 to "05" ?
when you want to put 0 behind a number you move it "forward"! (and vice versa)
but wheres the trim? (selecting 2 digits)?
select [2]
[_date select 5] ?
(_date select 5) // e.g 8
/100 // 0.08
select [2] // 08
so () parentheses play a role here too
(_date select 5/100) is _date select 0.05, which is wrong
(_date select 5)/100 is correct @mighty vector
@mighty vector
_time = systemTime;
_date = (_time select [0,3] apply {
if (_x < 100) then {str (_x/100) select [2]} else {str _x}
} joinString "/") + " " + (_time select [3,3] apply {str (_x/100) select [2]} joinString ":");
oh wait
:suicide:
I forgot something @winter rose
numbers like 10, 20 etc. won't work ๐คฃ
I have to use toFixed
_time = systemTime;
_date = (_time select [0,3] apply {
if (_x < 100) then {(_x/100 toFixed 2) select [2]} else {str _x}
} joinString "/") + " " + (_time select [3,3] apply {(_x/100 toFixed 2) select [2]} joinString ":");
@mighty vector here's an alternative:
_time = systemTime;
_date = format (["%1/%2/%3 %4:%5:%6"] +
(_time select [0,3] apply {if (_x < 100) then {(_x/100 toFixed 2) select [2]} else {str _x}}) +
(_time select [3,3] apply {(_x/100 toFixed 2) select [2]}))
@winter rose seems simpler
either way, make sure to store systemTime in a variable
he's cheating, he is using commands I did not have at the time!
it's semi-slow apparently not
already
but I like the /100 idea, it is elegant
private _date=systemTime;
_date = format ["%1/%2%3/%4%5 %6%7:%8%9:%10%11",
_date select 0,
["", "0"] select (_date select 1 < 10),
_date select 1,
["", "0"] select (_date select 2 < 10),
_date select 2,
["", "0"] select (_date select 3 < 10),
_date select 3,
["", "0"] select (_date select 4 < 10),
_date select 4,
["", "0"] select (_date select 5 < 10),
_date select 5
];
yes...but the resulting code its not. your's seems cleaner
i'll try a mix, will "str(_x/100) select [2]" work, or all that toFixed/apply is needed?
@little raptor```sqf
format ["%1%2", _value / 100, 0] select [2, 2];
returns either 0.080 or 0.10
not that bad
performance wise only a bit slower
_date = systemTime;
format ["%1/%2/%3 %4:%5:%6",
_date#0,
(_date#1/100 toFixed 2) select [2],
(_date#2/100 toFixed 2) select [2],
(_date#3/100 toFixed 2) select [2],
(_date#4/100 toFixed 2) select [2],
(_date#5/100 toFixed 2) select [2]
]
you can use toFixed 2; and toFixed -1; too
let me see if it's faster
_date = systemTime;
toFixed 2;
private _result = format ["%1/%2/%3 %4:%5:%6",
_date#0,
(_date#1/100) select [2],
(_date#2/100) select [2],
(_date#3/100) select [2],
(_date#4/100) select [2],
(_date#5/100) select [2]
];
toFixed -1;
_result;
_date = systemTime;
_y = str (_date#0);
toFixed 2;
format ["%1/%2/%3 %4:%5:%6",
_y,
str(_date#1/100) select [2],
str(_date#2/100) select [2],
str(_date#3/100) select [2],
str(_date#4/100) select [2],
str(_date#5/100) select [2]
]

it makes almost 0 difference in terms of performance
but this was "cleaner"
#arma3_scripting message
_date select 0
cool
toFixed to "fix" the number of characters after the period: 0.10 instead of 0.1
ok
that last one seems great. im sorry @winter rose , seems u lost the competition xD
It also changes the accuracy of the engine commands.
str getPos player; "[3231.05,171.802,0.00143862]"
toFixed 8;
str getPos player; "[3231.04882813,171.80192566,0.00143862]"
hmm... would be interesting to see if mapGridPosition also works with that to get 8 or even 10 grid references instead of the standard 6 ๐ค
that's different
it's string by default
plus it doesn't return 6 digits because of "inaccuracy"
that's just how it's designed internally
so you can neither increase nor decrease the number of digits
Well, in our unit we use 8 grid for a lot of stuff because of accuracy, so it would make sense to have this increased as well.
And since toFixed is handling numbers in the back it doesn't matter what the output type is
Anyone know how to force a AI to turn on Helicopter searchlights?
welcome to one of the oldest annoying things in arma.
you can change their combat stance and sometimes it will work
enableGunLights is hit or miss
setCollisionLight sometimes works
setPilotLight?
I find its easier to just create a lightpoint on the helicopter instead
depending on the mod set, that sometimes works or doesn't too. I think its when the searchlight is a gunner posiiton
I put this in the init correct?
Yes
CUP searchlights won't work with all of the above as well
lightOn should also work, but depends on AI behavior (combat or stealth will force it off)
This is a bit of an unusual application but does anyone know in ArmA 2 how to disable player movement BUT allow aiming within the Floating Zone? Any script lines that would help me wit this?
I am building an M4 controller that I want to use a gyro for mouse inputs to aim the M4 around the screen to move the players point of aim.
Is there a better way to do this? checkVisibility is very slow, I need to check if there in nothing blocking the view from the AI to the target
//remove targets that are not in the radar but highly know for the AI and remove non air targets
private _AcurateTargets = [];
///get targets that the unit got in the radar
private _UnitTargets = (allunits select {[(side group _x), (side group ConnectedAWACS)] call BIS_fnc_sideIsEnemy});
private _RadarRange = getNumber ((configOf ConnectedAWACS) >> "Components" >> "SensorsManagerComponent" >> "Components" >> "ActiveRadarSensorComponent" >> "AirTarget" >> "maxRange");
{
if (
(_x distance ConnectedAWACS) < _RadarRange and
([(vehicle ConnectedAWACS), "FIRE",(vehicle _x)] checkVisibility [(getPosASL _x), (getPosASL ConnectedAWACS)]) > 0
) then {_AcurateTargets append [_x]};
} forEach _UnitTargets;
lineIntersect* commands?
harcoded to 1000m
you can do multiple ones, divide the distance in multiple 1km segments
doesn't that defeats the purposed if the target is really far?
if you take your distance of e.g 3km
divide it in 1km segments
check segment 1 line is clear - OK
check segment 2 line is clear - OK
check segment 3 line is clear - ah, NOK, therefore the whole line is not clear
You can also use units <side> which is quite a bit faster
just a minor overall improvement though
the vehicle side can change
so?
hard code it to only find one side breaks it.
(it is checking w/ BIS_fnc_sideIsEnemy)
Pro tip: you can Edit your post
Hello! I am trying to make a radiation script for my chernobyl op, but when i paste it in to a trigger i get following error message: On activation:
Report only an error message does nothing with troubleshoot, please post what you've done
you cannot use sleep or waitUntil in a trigger field, wrap the whole thing with a [] spawn { }
im kinda new to scripting, what do i need to wrap in?
your whole code if the issue is a sleep or a waitUntil
I have both of those so that makes sense
POLPOX underestimating Lou's abilities
ยฏ_(ใ)_/ยฏ
yet still a valid advice ^^
Hi guys. Can i get control on group with remoteControl on squad leader?
@winter rose im still not getting it to work, can i send you the script in dms if you can look over it?
negative, the channel or sqfbin.com is fine ๐
(!alive HVT or !alive HVT_SCARED) && units FOXHOUND findIf { not (_x inArea theTrigger) } == -1
whats wrong with this? (the right side doesnt work and i dont fully understand it) lol
you wrapped all this in [ ]
just remove first and last characters and it's good
(or it should be)
first and last character? sorry for being really dumb but yeah which ones?
[
(...)
]
๐
well thats what i started off with, still got that error message saying: On activation
after removing []
try putting 0 = before everything thenโฆ?
well yes, the first _x is not defined
Is there a way to make a large group of units play animations and have random loadouts without having to orderly name each single unit?
the code is a bit of a mess and indent most surely is
anyway, try having this code in a sqf file instead of a trigger
yes, forEach
Morning Sir, so as long as the units are in the triggers zone, it will work?
What's the (right side) condition supposed to be? Right now it's "all Foxhound group members have to be in theTrigger".
This is my first attempt at having 90 random csat and aaf soldiers have;
- play between these animations at random
- Have randomised loadouts (*mainly headwear and facewear will suffice) (will do it manually if need be)
foreach;
[
'Acts_AidlPercMstpSloWWrflDnon_warmup_1_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_2_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_3_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_4_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_5_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_6_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_7_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_8_loop',
'Acts_AidlPercMstpSlowWrflDnon_warmup01',
'Acts_AidlPercMstpSlowWrflDnon_warmup02',
'Acts_AidlPercMstpSlowWrflDnon_warmup03',
'Acts_AidlPercMstpSlowWrflDnon_warmup04',
'Acts_AidlPercMstpSlowWrflDnon_warmup05'];
this addEventHandler ["AnimStateChanged", {
params ["_unit", "_anim"];
}];
hint "BRUH am i close? lol
";
again and again and again, ```sqf
this addEventHandler ["AnimStateChanged", {
params ["_unit", "_anim"];
}];
@opal sand
forget it then, will just do it all manually, will probably do it quicker, coding knowledge is non-existant
*its not that i cant be arsed to not learn coding, but prioritising the workload, and right now, learning code even part time is counter productive and more time and results are lost than found
will probably just hire a scripter dude very soon instead, my only motive is to know enough coding to be able to record video cinematics
Selecting 90 random CSAT and AAF units to run some code on them is definitely more satisfying, productive and adaptable (imagine you want to change something later!) when done via a single code block than when done by hand.
Paste it into one of the Debug Console watch fields and run the mission for a bit. Observe if / how / when the result of the expression changes.
the what now?
90 random
Are you paying attention to the performance too?!
90 AI in SP = crappy performance
also, negative reinforcement after a first attempt without a solution offered in the same moment/message t 'again and again and again does nothing' is not productive, counter productive, and frankly, annoying, so id rather just not ask again and either seek help elsewhere or do it myself.
@little raptor yeah, scenes are isolated to only whats close/local, and whats required for that one shot
https://community.bistudio.com/wiki/Arma_3:_Debug_Console#Features
The lines at the bottom of the Debug Console are the watch fields, useful for watching variables / expressions over the course of time.
negative reinforcement after a first attempt without a solution offered in the same moment/message t 'again and again and again does nothing' is not productive, counter productive, and frankly, annoying
I am sorry, but I think it is not a "first attempt" on this one, unless I am mixing up with another user ๐คจ we have been through this at least three times
this channel is for scripting assistance, if you need a scripter then #creators_recruiting (paid or free) is a thing that no one will blame you for using
the conversation is still technically scripting related, and my 'probably just hire a scripter dude', isnt an active recruitment message for the scripting channel.............
can someone with 5 more iq points than me fix my script real quick
I am not throwing you a stone for mentioning that ๐ I say that if you don't really want to learn SQF, you better hire someone, it's more direct this way ๐
(I really don't mean to sound/be rude, even though I might)
thankyou sir, text comms can be misinterpreted and misleading, appreciate that, my POV is if im not competent in scripting field, i must be careful not to flood the scripting channel with too much comms, and feel like a nuisance when i do, so when u react like that, i naturally back off
so, forEach:```sqf
{ } forEach _list;
// we need a list
private _list = list theTrigger;
{ } forEach _list;
// we need an animation list
private _animations = [
'Acts_AidlPercMstpSloWWrflDnon_warmup_1_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_2_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_3_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_4_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_5_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_6_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_7_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_8_loop',
'Acts_AidlPercMstpSlowWrflDnon_warmup01',
'Acts_AidlPercMstpSlowWrflDnon_warmup02',
'Acts_AidlPercMstpSlowWrflDnon_warmup03',
'Acts_AidlPercMstpSlowWrflDnon_warmup04',
'Acts_AidlPercMstpSlowWrflDnon_warmup05'
];
private _list = list theTrigger;
{ } forEach _list;
// what do we do with that
private _animations = [
'Acts_AidlPercMstpSloWWrflDnon_warmup_1_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_2_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_3_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_4_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_5_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_6_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_7_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_8_loop',
'Acts_AidlPercMstpSlowWrflDnon_warmup01',
'Acts_AidlPercMstpSlowWrflDnon_warmup02',
'Acts_AidlPercMstpSlowWrflDnon_warmup03',
'Acts_AidlPercMstpSlowWrflDnon_warmup04',
'Acts_AidlPercMstpSlowWrflDnon_warmup05'
];
private _list = list theTrigger;
{
// random for every item of the list
private _randomAnimation = selectRandom _animations;
_x playMove _randomAnimation;
} forEach _list;
@opal sand โ
(!alive HVT or !alive HVT_SCARED) && units FOXHOUND findIf { not (_x inArea theTrigger) } == -1
```Well your conditions are linked through `&&`.
Essentially what you have is `result = (a || b) && c;`, so for `result` to become `true`, there are two conditions, and both have to be fulfilled:
1) Either `a` or `b` or both must be `true`
2) `c` must be `true`
As such, `HVT` or `HVT_SCARED` must be dead and all Foxhound group members must be in `theTrigger` to make the whole expression `true`.
Are you familiar with the truth tables of logical NOT, AND and OR? Aka do you know when their result is true and when it is false?
Error on Act: Local Variable in Global Space (https://imgur.com/hQIXLMD)
{ } forEach _list;
private _list = list theTrigger;
{ } forEach _list;
private _animations = [
'Acts_AidlPercMstpSloWWrflDnon_warmup_1_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_2_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_3_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_4_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_5_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_6_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_7_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_8_loop',
'Acts_AidlPercMstpSlowWrflDnon_warmup01',
'Acts_AidlPercMstpSlowWrflDnon_warmup02',
'Acts_AidlPercMstpSlowWrflDnon_warmup03',
'Acts_AidlPercMstpSlowWrflDnon_warmup04',
'Acts_AidlPercMstpSlowWrflDnon_warmup05'
];
private _list = list theTrigger;
{ } forEach _list;
private _animations = [
'Acts_AidlPercMstpSloWWrflDnon_warmup_1_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_2_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_3_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_4_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_5_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_6_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_7_loop',
'Acts_AidlPercMstpSloWWrflDnon_warmup_8_loop',
'Acts_AidlPercMstpSlowWrflDnon_warmup01',
'Acts_AidlPercMstpSlowWrflDnon_warmup02',
'Acts_AidlPercMstpSlowWrflDnon_warmup03',
'Acts_AidlPercMstpSlowWrflDnon_warmup04',
'Acts_AidlPercMstpSlowWrflDnon_warmup05'
];
private _list = list theTrigger;
{
private _randomAnimation = selectRandom _animations;
_x playMove _randomAnimation;
} forEach _list;
hint "good!";
Error on Act: Local Variable in Global Space
you've probably named something_blabla
Lou's code contained a step-by-step explanation of the code building process (combining different commands), half of the code has to be omitted for it to run. Leopard is right, _animations and _list can't be used in the On Activation of a trigger.
_animations and _list can't be used in the On Activation of a trigger
They can (afaik). I meant he probably named the object_blabla(variable name)
did you literally copy that above script into there? with the duplicate, useless, not doing anything code in there too?
someone said on a comment in https://community.bistudio.com/wiki/htmlLoad is blocking...does that also applies to [] spawn { _h=htmlLoad "...";}; ?
is there a bbeter alternative, including extensions, to invoke HTTP ? (seen one extension, but ill prefer native)
the command itself is blocking
it doesn't matter whether you spawn it or call it
but, and please correct me if Im wrong, spawn is like running a new thread, so it won't affect main program...isn't it?
each individual command will behave the same in scheduled and unscheduled environments
spawn simply "suspends" execution if execution time has exceeded 3 ms
yet reading, but does what you said mean the scheduler only has 1 script running at a time, and hence the script (blocking function) would have impact on the other scripts waiting to run, right?
not 1 script at a time
it just goes through its queue
it picks the script that hasn't been executed for the longest time
then starts running its commands sequentially
if execution time exceeds 3 ms, it won't execute any more commands
if it doesn't, it moves to the next script
but the request itself could take up more than 3ms...how it handles "suspending a http request"?
anyway, let me quote the second part of my question...
is there a bbeter alternative, including extensions, to invoke HTTP ? (seen one extension, but ill prefer native)
it doesn't
the game execution will be blocked until that command is done (so if the command takes a long time, the game freezes)
ok...so a command can block the whole system until is finished, and then, as it exceeded 3ms, would go back to suspension
yes
dunno
that explain a lot about "unscheduled" and "non-warranted" execution times
i wanted to make HTTP requests... ๐ฆ
I'm not familiar with that. maybe someone else can help
thx. seems KK used them long time ago
Im trying to use setDriveonpath to make AI drive over user created bridges (Just a series of objects, such as concrete blocks). I brainstormed an algorithm using the calculatePath eventHandler, the issue is that I realized that the EH wont fire if the AI cant calculate a path. Any ideas on how to make something like this work?
Algorithm:
Add PathCalculated to every player controlled unit in the drivers seat of a vehicle
Break map into different "Zones" that could be optimized or crossed by a bridge
Create bridges, defined as a series of waypoints, First and last point are entry points
Wait until PathCalculated event handler fires
If return is null, path cannot be calculated, find nearest bridge that goes to island //Return will never be null, EH wont fire
Recalculate path to nearest bridge
[path] = [path] + [bridge]
[path] = [path] + (path_from_bridge_endpoint to destination)
Else check starting point and ending point of path
If they are in different zones calculate the Path Length
For each bridge, calculate the length of start --> bridge --> dest
if new path is shorter, reroute
Else do nothing because there is no need to cross a bridge
Currently looking at making some ambient air for a mission; looking to fly aircraft between airports. The allAirports command gives me the static airport ID's, but is there an easy way to turn these into positions that I can spawn an aircraft at, or will I need to go into the config from the world and pull some values?
config only im guessing
on tanoa though you can use nearestLocations, as they have "Airport" location type
private _fnc_getAirportPositions = {
private _config = configFile >> "cfgWorlds" >> worldName;
("true" configClasses (_config >> "SecondaryAirports")) + [_config] apply {getArray (_x >> "ilsPosition")}
}
Yeah thought that might end up being the case
Just to add to the inconvenience factor, I'll have to grab the 'main' airport
ilsPosition[] = {7920.78, 9515.73, 0};
ilsDirection[] = {0, 0.08, -1};
ilsTaxiOff[] = {7920.78, 9800, 7920.78, 10775, 7930.53, 10793, 7951.76, 10795.8, 8002.91, 10766, 8027.65, 10738.1, 8037.74, 10700, 8059.3, 10508.6, 8069.24, 10405.6, 8075.34, 10232.9, 8054.85, 10230.2, 8046.79, 10218.7, 8046.79, 10194.9, 8046.79, 10142.8};
ilsTaxiIn[] = {8046.79, 10142.8, 8046.79, 10094, 8035.38, 10088.4, 8002.87, 10088.4, 7994.4, 10080.6, 7994.4, 9846.88, 7994.4, 9646.85, 7993.03, 9629.61, 7984.71, 9617.25, 7965.14, 9607.53, 7946.52, 9600.64, 7930.45, 9606.08, 7921.45, 9621.13, 7921.45, 9638.23};
drawTaxiway = 0;
class SecondaryAirports
{
class Airstrip_1
{
ilsPosition[] = {600, 12285, 28.93};
ilsDirection[] = {-1, 0.08, 0};
ilsTaxiOff[] = {700, 12285, 1165, 12285, 1190, 12285, 1200, 12275, 1195, 12258, 1185, 12246, 1167, 12239, 835, 12162, 782, 12167, 700, 12200};
ilsTaxiIn[] = {700, 12200, 669, 12224, 646, 12243, 637, 12250, 626, 12263, 623, 12274, 635, 12285, 650, 12285};
drawTaxiway = 0;
};
};
As the first airport has a slightly different path
Do you guys know how to make a side get points from captured sector every 30 seconds?
I'm making an extraction script for a friend (MP mission) and I just wanna make sure this will work.
initServer.sqf-Game timer so your extraction script will execute
if (isServer) then {
PUB_gameRunning = true;
publicVariable "PUB_gameRunning";
sleep 300; //Change 300 to however many seconds the playtime is
PUB_gameRunning = false;
};```
**Trigger**-*Extraction Zone*
Type = None
Activation = Any Player
Repeatable = true
Server Only = true
Condition
```sqf
this```
Activation
```sqf
if (PUB_gameRunning == true) exitWith {};
execVM "playerExtract.sqf";```
On Deactivation
*Nothing*
**playerExtract.sqf**-*Extract process*
```sqf
if (PUB_gameRunning == false) then {
{
[_x, "AcinPercMrunSnonWnonDf_death", "NONE"] call BIS_fnc_ambientAnim;
//Fancy way to make them suddenly dissapear
_x setPos [0, 0, 0];
//Removes the player from the playing field (AKA should be debug/bottom left of map)
_x allowDamage false;
//Allows them to look at their inventory and screenshot their kit without dying
_x addAction ["<t color='#FF0000'>Switch to Spectator</t>", {_x setDamage 1;};
//Kills them switching them to spectator after death
} foreach thislist;
};```
initServer.sqf only runs on the server, no need to check if (isServer).
It's better to use ! instead of == false.
== true is always unnecessary.
You need to pass thisList to playerExtract.sqf as a parameter, otherwise you can't use that variable in there.
addAction has local effect, this code only runs on the server, so you need to remote execute addAction.
But it's the trigger that should break this first. It behaves like this:
Any player enters the trigger area, the trigger fires. From this point on the trigger will remain activated as long as there is any player within its area. Additional players entering the area will not activate the trigger again because it is still activated. Only after there are no more players in the trigger area will it deactivate, reset and fire again upon any player entering it.
This means that if any player(s) enter the trigger while PUB_gameRunning is true, the On Activation code runs once, quits on the exitWith statement and never executes again until all players have left the trigger area. So if the player(s) don't leave and the time runs out in the meantime, then PUB_gameRunning becomes false but nothing happens because the On Activation code doesn't run because the trigger doesn't fire because it is still activated.
Does anyone know of a piece of code to load the Device onto a flatbed truck?
https://community.bistudio.com/wiki/attachTo
That is usually used for such purposes.
I should've known it'd be attach to. Thanks
I'm not particularly good with scripting so how exactly would I be able to get the player as a param?
The player as a param? Where?
"You need to pass thisList to playerExtract.sqf as a parameter, otherwise you can't use that variable in there."
I meant that
https://community.bistudio.com/wiki/execVM
See if you can figure that out with the documentation, if not, get back to me ๐
Something like this?
Trigger
PUB_var = player in thisList;
playerExtract.sqf
PUB_var instead of _x?
Syntax: arguments
execVMfilename
Parameters: arguments: Anything - arguments accessible as_thisin the script
You can just do[thisList] execVM "playerExtract.sqf";. Then you can access the content ofthisListas_this # 0or_this select 0inplayerExtract.sqf. It looses its variable namethisList, but the content is still the same array. Because_this # 0is a bit annoying to write, we can useparamsto give the parameters of our script variable names of our choice by usingparams ["_playersInTrigger"];in the first code line of the script.
In the end, with parameter and remote execution, playerExtract.sqf looks something like this:
params ["_playersInTrigger"];
if (!PUB_gameRunning) then {
{
[_x, "AcinPercMrunSnonWnonDf_death", "NONE"] call BIS_fnc_ambientAnim;
//Fancy way to make them suddenly dissapear
_x setPos [0, 0, 0];
//Removes the player from the playing field (AKA should be debug/bottom left of map)
_x allowDamage false;
//Allows them to look at their inventory and screenshot their kit without dying
[_x, ["<t color='#FF0000'>Switch to Spectator</t>", {_x setDamage 1;}]] remoteExec ["addAction", _x];
//Kills them switching them to spectator after death
} forEach _playersInTrigger;
};
```I don't know if `BIS_fnc_ambientAnim` works in MP or if it requires some remote execution as well.
The problem with the trigger possibly getting stuck in activation still persists.
Iโll remote exec the animation to be safe.
bois
is there a BIS function to disable damage
like _animal setVariable ["allowDamage", false];
why function?
just use the command
well im trying to make animals fallow you arround
and I used the function
but after shooting them they stop fallowing you
@hushed tendon Luckily for you, I've previously encountered the trigger problem myself:
I had a trigger that was supposed to apply a full ACE heal to every player entering that area. Needless to say, the first player to enter blocking the players coming in a second later from getting healed until everyone leaves again is rubbish, I don't want to force them to go in one by one so that everybody gets to activate the trigger once to receive their full heal.
However triggers are far to comfortable to work with, so I uhh... repurposed the Condition field so that the code I want to run is executed every time the condition is checked:
{
[_x] remoteExec ["ace_medical_treatment_fnc_fullHealLocal", _x];
"You have been restored to full health." remoteExec ["systemChat", _x];
} forEach thisList;
false
```The trigger condition is evaluated every now and then (in this case I set the trigger interval to 10 seconds), but it is always `false` (because that code block always returns `false`), so the trigger never activates and can never get stuck in the activated state.
๐
I mean just use _animal allowDamage false
i did that
and after shooting the animal the fallowing the player stops
and the animal sits still
if it sits still it isn't dead
SF_petFollow = {
params["_src", "_animalType"];
private["_animalClassname"];
if ( _animalType == "Dog" ) then {
_animalClassname = "Fin_random_F";
};
if ( _animalType == "Sheep" ) then {
_animalClassname = "Sheep_random_F";
};
if ( _animalType == "Goat" ) then {
_animalClassname = "Goat_random_F";
};
if ( _animalType == "Rabbit" ) then {
_animalClassname = "Rabbit_F";
};
if ( _animalType == "Hen" ) then {
_animalClassname = "Hen_random_F";
};
if ( _animalType == "Snake" ) then {
_animalClassname = "Snake_random_F";
};
_animal = createAgent [_animalClassname, getPos _src, [], 5, "CAN_COLLIDE"];
_animal setVariable ["BIS_fnc_animalBehaviour_disable", true];
nul = [_src, _animal, _animalType] spawn {
params["_src", "_animal", "_animalType"];
_animalGoMove = _animalType + "_Run";
_animalIdleMove = _animalType + "_Idle_Stop";
if ( _animalType == "Dog" ) then {
_animalGoMove = "Dog_Sprint";
};
if ( _animalType == "Rabbit" ) then {
_animalGoMove = "Rabbit_Hop";
};
if ( _animalType == "Hen" ) then {
_animalGoMove = "Hen_Walk";
};
if ( _animalType == "Snake" ) then {
_animalGoMove = "Snakes_Move";
};
_animalMoving = true;
_moveDist = 5;
while {alive _animal} do
{
_animal allowDamage false;
if (_animal distance _src > _moveDist) then {
if ( !_animalMoving ) then {
_animal playMove _animalGoMove;
_animalMoving = true;
};
} else {
if ( _animalMoving ) then {
_animal playMove _animalIdleMove;
_animalMoving = false;
};
};
if ( _animalMoving ) then {
_animal moveTo getPos _src;
};
sleep 0.5;
};
};
};
[player, "Dog"] call SF_petFollow;
why on earth do you use allowDamage in a loop??
because im dumb
@little raptor so even after remove it from the loop it still stops the following loop after i shoot it
If I understood everything correctly this should be right.
initServer.sqf-Game timer so your extraction script will execute
if (isServer) then {
PUB_gameRunning = true;
sleep 300; //Change 300 to however many seconds the playtime is
PUB_gameRunning = false;
};```
**Trigger**-*Extraction Zone*
Type = None
Activation = Any Player
Repeatable = true
Server Only = true
*Run every second*
Condition
```sqf
if (!PUB_gameRunning) then {
[thisList] execVM "playerExtract.sqf";
};
false
Activation
Nothing
On Deactivation
Nothing
playerExtract.sqf-Extract process
params ["_playersInTrigger"];
if (!PUB_gameRunning) then {
{
[_x, "AcinPercMrunSnonWnonDf_death", "NONE"] remoteExec ["BIS_fnc_ambientAnim", _x];
//Fancy way to make them suddenly dissapear
_x setPos [0, 0, 0];
//Removes the player from the playing field (AKA should be debug/bottom left of map)
_x allowDamage false;
//Allows them to look at their inventory and screenshot their kit without dying
[_x, ["<t color='#FF0000'>Switch to Spectator</t>", {_x setDamage 1;}]] remoteExec ["addAction", _x];
//Kills them switching them to spectator after death
} forEach _playersInTrigger;
};
PUB_gameRunning doesn't need to be publicVariable as far as this is concerned.
Move the Activation code into the condition field and leave Activation empty.
Use the playerExtract.sqf I provided somewhere above, because _playersInTrigger is an array and the remote execution (and a ]) for addAction is missing here.
Q: if we've got some HUD related variables to set for each player, could we set them with the public option, then clients monitoring for that situation, where clients would see the variable in the respective 'player' object (?). would be better than connecting unnecessary server client events, probably. thoughts?
Updated ^^^^
It all good?
If you want to remoteExec BIS_fnc_ambientAnim, you can do it like this:
[_x, "AcinPercMrunSnonWnonDf_death", "NONE"] remoteExec ["BIS_fnc_ambientAnim", _x];
As long as those variables don't contain displays or controls (you can't send those over the network).
@willow hound thanks, appreciate the feedback. since we would be targeting specific players, we do not need for the variables to be "public", is setting them at all sufficient? or do we need the public boolean for the client to "see" it?
You need the public parameter for them to be sent over the network, yes. Without it, the variable remains local.
ah okay I see. the goal in this instance is for us to relay HUD overlay related bits. so we do need the public flag.
actually we could target just that particular player using owner _player, that would be perfect, actually, https://community.bistudio.com/wiki/setVariable
hey I was wondering if anyone can help me with tfar jamming?
I am creating an op during the cold war and insurgents need to be near a static radio on a table to use their radios
I was thinking there might be a way to jam all radio communications outside a given are
would that be possible?
or am I dreaming too much
Do anyone know how to ban Titan Launchers from the arsenal?
Or black list items in the arsenal.
Hey guys, when I do this formatting, the string comes out as this:
_str = format["getBanking:%%1%", getPlayerUID _player];
17:07:38 "getBanking:76561198119367976"
How could I make it doesn't strip the %'s from the front and back of my UID?
add a second argument, e.g sqf format ["%1%2", 100, "%"]
Thank you, is it possible to repeat like this: %1%2%1?
in your case,```sqf
private _str = format["getBanking:%1%2%1", "%1", getPlayerUID _player];
Thank you so much, been bashing my head off the table haha
been there done that (decades ago), so if I can save the painโฆ
Yeah, getting back into SQF from coding on LUA for months, has been strange. I swear I forgot 85% of the syntax :/
it's like bicycle, you always forget how to then hurt yourselfโฆ wait no
had to do an assessment for PHP and Javascript... started to write SQF instead...
Weirdly it's doing this now?
17:14:09 "getBanking:%176561198119367976%1"
im dumb
nvm
LOL
looks correct to me ๐คฃ
What is the command to disable a unitโs detection?
In what terms? disableAI?
I guess?
I want it to move around but not detect players
Itโs an OPFOR unit but I need it to do the thing
then disableAI what you want yes ๐
I just donโt know the thing that goes in โ____โ;
Like how itโll be โMOVEโ; if I wanted move
Wiki is always your friend :)
Hi, anyone who know how to script a restriction to arsenal items?
Seems like this adds weapons and that it do not remove.
[BIS_ammoBox,["launch_B_Titan_F"], true] call BIS_fnc_removeVirtualWeaponCargo;
Where do I go wrong?
Good point. I use the regular Warlords Arsenal.
The only thing I want to disable is the titan launchers.
Tried this to:
player removeSecondaryWeaponItem "launch_B_Titan_F";
didn't work.
Huhh... then probably you need to do some workaround using scripted eventhandlers. I'm not available to write some codes though
This was the best I came up with. Looks a bit silly.
addMissionEventHandler ["Map", {
params ["_mapIsOpened", "_mapIsForced"];
player removeWeapon "launch_B_Titan_F";
player removeWeapon "launch_I_Titan_F";
player removeWeapon "launch_O_Titan_F";
player removeWeapon "launch_Titan_F";
player removeWeapon "launch_B_Titan_short_F";
player removeWeapon "launch_I_Titan_short_F";
player removeWeapon "launch_O_Titan_short_F";
player removeWeapon "launch_Titan_short_F";
player removeWeapon "launch_B_Titan_tna_F";
player removeWeapon "launch_B_Titan_short_tna_F";
player removeWeapon "launch_O_Titan_ghex_F";
player removeWeapon "launch_O_Titan_short_ghex_F";
player removeWeapon "launch_I_Titan_eaf_F";
player removeWeapon "launch_B_Titan_olive_F";
}
];
But it does in a way fulfill it's intention. "You want to read a map? Well, no titan for you x)"
No not MEH but SEH
https://community.bistudio.com/wiki/BIS_fnc_addScriptedEventHandler
Good day. Is there a way to get an array of all civilian human classes?
The closest thing I found on the internet so far is this
(configfile >> "CfgVehicles") call BIS_fnc_getCfgSubClasses
But it's not quite it
"getNumber (_x >> 'side') == 3 and getNumber (_x >> 'scope') == 2 and configName _x isKindOf 'CAManBase'" configClasses (configFile >> "CfgVehicles") apply {configName _x}```
mindblown Thanks
Is there a way to get an AddAction to execute on server like there is with hold action?
Pardon?
] remoteExec ["BIS_fnc_holdActionAdd", 0, _myLaptop]; // MP compatible implementation
Hold action has this in one of it's examples but nothing like this is on the add action page.
not sure exactly how i'd copy that to an AddAction either
I mean maybe it doesn't need it like hold action does, I've never had a problem with add action but I thought it would be safer to make it execute on server rather than client if that's what it is doing.
I've always had problems with Hold action not working properly in MP (because I probably just used the enhanced eden editor one and not actually scripting it in with MP compatibility)
remoteExec and remoteExecCall work with every commands/functions. To implement some commands there, use this method: A command B -> [A,B] remoteExec ["command",...]Soplayer addAction [...] -> [player,[...]] remoteExec ["addAction",...]
i'll give it a whirl thanks!
hmm, ok yeah sort of getting it, there is actually an example with it I now see I should be able to figure it out with these thanks!
Hey is there a command to disable an objects/players collision without hiding that object/player?
disableCollisionWith but unreliable
Hm okay
setMass 1
Extremely small mass objects do not collide.
But it will only work for physx objects.
Howcome everytime i change Millers
- Unit name
His face changes and is no longer millers face?
Did killzone shutdown his site perma? @ me to reply
KK's Blog? It's up and running
Hi, I need some help with a script. Busy with a multiplayer Coop mission and need to have one of the players start as a hostage. I've got that part pretty much sorted. Player starts off handcuffed (Make Unit Handcuffed under Ace Options). The problem is that he has no interaction with menus or anything else. I need him to be able to trigger a custom action in some way (scroll menu/radio/something). Is there a way to give him some kind of interaction/action that he can do while handcuffed?
It seems that I cannot get to https://killzonekid.com/
Hosted by BI\ยฎ
but I can access it
we know it's you KK! what a trick to get some views!! ๐
Visit it without the https, @cedar field
http://killzonekid.com
leh gasp
Is it possible to change the titletext font?
Yes, by putting in Structured Text
https://community.bistudio.com/wiki/Structured_Text#Font
Ty. Dang just looked at that page, must of missed it.
haaave
if [] means any data type in param for expected data types, then how do I declare only arrays to be accepted?
[[]]
kk thx
if given the wrong data type, it states it will display an error. is this a hard stop error? or will the rest of the script continue to function?
will show error + continue with default value iirc
I have a player activating a trigger which will then execVM the sqf this code is in. Is the code for the MP titleText right?
{titleText ["<t font='LCD14'>Toresk Island</t><br/><t font='TahomaB'>Welcome to</t>", "PLAIN", 3, true, true];} remoteExec ["call", -2];
Because it's not showing up. Not even an error is popping up
Because you're the server?
I don't understand
If you're hosting it, you won't see this
Still, you're the server (considered so)
But it will still work for all players?
Other than you. Why not just use 0?
Basically that's what you're doing
Thanks
what if a player is also the server, aka player-hosted?
โ๏ธ This is why it didn't worked
Yeah it's 0 now instead of -2. Although I only really need it as 0 for testing as it will run on a dedicated server.
don't code for specific setupsโฆ? what's wrong with player-hosted ๐คจ you won't "save performance" that way
Hey, what's the best way to execute code on player machine on disconnect from server?
thats not something you should do. when the client leaves he should be gone for good. what about alt+f4? better to handle it on the server
Basically working on a system that can save loadouts to be automatically loaded up on mission init
It's set to store the loadout on mission end, but I'd like to add a disconnect function in case a player leaves before mission end
Plan B is to add an event handler or something that executes once every 5 mins but I figure it'll be a little more messy
The usual way of doing this is to require the player to manually save their loadout
That said, doing it on the server is probably the best approach. The server can match loadouts to player IDs (in theory, don't ask me to code it), and can also check the loadout of the disconnected player's surviving AI.
You'll not have much luck trying to get it to work playerside, as by the time the client knows it's disconnected, well.....it's disconnected and isn't in the mission any more, so can't check its loadout or run mission scripts
Outstanding, thanks!
What's the script/init to increase a vehicle's top speed?
Anyone knows the name of the function that draws the camera icon and vision cone in the 2D editor? Or is that inaccesible.
Have a question about the setcaptive script. Is there anyway to do the following two things: Make enemies shoot at the captive if he starts to shoot them and 2 have enemies target the captive if hes in a vehicle with other blufor.
Trying to set a blufor as captive so he can be a ww2 medic and enemies wont target him only issue is if the person playing as a medic shoots people they wont shoot back and if the medic is in a vehicle with other bluefor enemies will not shoot at that vehicle
will createDialog pull from a addon's config.cpp that I created that has the RscTitles definition in it?
or only a mission/campaign's description.ext
only the root
use a mission event handler that monitors entities killed. conditional if the medic kills a unit, he gets captive set to false.
you mean the root config.cpp from the addon?
root of configFile or missionConfigFile
(config.cpp or description.ext)
okay gotcha will try
side note if there is a better way of doing this im open to changing strategies
Set medic as captive, add EH to see if he shoots and set to BLUFOR again.
Could have a timer (since last time shooting) to set captive again.
Should work with vehicles as well, although I believe only if the medic would be driving.
tbf it's hard for enemies to see if a medic is in a vehicle (IRL). So would be realistic if vehicle stays BLUFOR
Evenin'
I'm looking at disabling player access to a number of UAVs, 3 destroyers and a carrier's full complement to be precise.
Am I correct in saying I have only these two options to disallow connections from any player?
- Monitor the player's inventory for changes and disable the connection with "disableUAVConnectability"
- Spawn AI units and connect them to said UAVs using "connectTerminalToUAV"
@dusk shadow You can lock the driver / gunner seat(s) of the UAV(s), then the UAV AI can still use them normally but the player can't take control of them. I think the player can still (un-)tick the Autonomous checkbox though.
hmm that's an idea, not being able to connect at all would be preferable though
can someone tell me why this isnt working? "Whiskey_Pilot" countType units player;
its displaying 0
but I have 3 guys in that classname slot
Are you sure that "Whiskey_Pilot" is the actual className?
yes
The desired unit's typeOf returns Whiskey_Pilot?
yep
_WhiskeyPilot = "Whiskey_Pilot" countType units player;
_WhiskeyLead = "Whiskey_Lead" countType units player;
_WhiskeyCount = _WhiskeyPilot + _WhiskeyLead;
this is the context
i want to add the total number of active players in these className slots
but even just
"Whiskey_Pilot" countType units player; is displaying 0
when there are 3 guys in it
Highly doubt that "Whiskey_Pilot" is the actual classNamesqf "B_Soldier_F" countType units playerWorked really fine for me
Hmm. Are they in your group?
nope
That's why
same faction blufor
Use units blufor
Returns an array with all the units in the group or group of the unit.
Read the wiki carefully
tldr units player returns all units from the group that player belongs. Not an Arma logic, that's how it does
I just need to finish and publish this mission T_T
In my outro, an AI dismounts an APC and runs up to the players to give the outro. Alls good, except he starts spinning on the spot.
Seems to happen with any unit I use a doMove command for.
hey all,
if i was to execVM something with a 30min sleep, is this gonna kill performance?
nopers
sick, i didnt think so but im not massively confident in how the scheduled to unscheduled environments
currently working on a module creation and I've made my lovely GUI and am now working on getting it functional. I have a global variable HYP_TELEPORTERS that contains all the static objects synced with the module. this is so far on my onLoad function for the display...
private _mainDisplay = findDisplay 6969;
private _listbox = _mainDisplay displayCtrl 6903;
_index = 0;
{
_grid = str (mapGridPosition _x);
_string = "Grid " + _grid;
_listbox lbAdd _string;
_markerName = "hyp_marker_" + str _index;
_marker = createMarkerLocal [_markerName, getPosATL _x];
_marker setMarkerTypeLocal "mil_dot";
_marker setMarkerShapeLocal "icon";
_marker setMarkerTextLocal _grid;
hyp_markers pushBackUnique _marker;
_index = _index + 1;
} forEach HYP_TELEPORTERS;
_listbox ctrlAddEventHandler
[
"LBSelChanged",
{
params ["_control", "_selectedIndex"];
_control setVariable ["hyp_currentSelection", _selectedIndex];
systemChat str _selectedIndex;
}
];
I'm currently thinking of a way to grab the current selection on the list, find it's object it points to, then add it to another ctrl event handler for a button down confirmation. If LBSelChanged only gives back the index, how could I go about doing this?
i'm trying to add a "VehicleDriverDisplay" to an aircraft via a patch mod, specifically to the left display manager, however when running the game with my patch mod, the left sensor panel no longer opens at all, right one still works tho
how would i diagnose this issue myself? the .rpt file is quite long and i've tried searching for relevant class names but see no errors
Is there a way for "respawn on start" to be different for each faction?
ie this in the description.ext
respawnOnStart = -1;
Have a VIP in a gamemode that won't re-spawn on Indi, blufor escort and can respawn as well as opfor which try and stop the vip.
no, you'd have to script your own work around.
alright, might try some funking bools being true and triggers to get around this
im not exactly sure what you are trying to do. rephrase it
blufor can respawn, opfor can respawn, independents cannot.
blufor and opfor start in the repsawn screen, independents go straight into the game.
and triggers
๐
Is there any scripting command to bring back a vehicle that's been damaged by going through water too deep?
Recreate it!
Spawn a new one in?
There's not like a variable or something?
ยฏ\_(ใ)_/ยฏ
wait it works lmao
respawnTemplatesWEST[] = {"MenuPosition","MenuInventory","Spectator"};
respawnTemplatesEAST[] = {"MenuPosition","MenuInventory","Spectator"};
by having this people on the independent team do no go through the respawn screen and just start on the map
ah thanks, yeah that looks like a pretty good way to do it too
I found the properties of "waterLeakiness" and *"waterdamageengine"*being mentioned in the context of config vehicles, is there any way I could change this from an init/script?
can't change configs with scripts
why don't you want to respawn it?
or rather, you could make it invulnerable when its posASL z value goes < 0
Hi I'm really really new to scripting. What I want to happen is to make an AI soldier move in an arc around a "center" object. I looked around the internet and found out that you can't make AI change the direction while they are playing a walk animation. (Is this true?). So to implement the arc movement, I tried to make the AI soldier move a small amount horizontally and look at the "center". These are the contents of initialization of the AI soldier. The sleep line doesn't work as intended. What should I replace it with? Also, is it possible to check if the AI soldier could fire at an enemy?
this playMove "AmovePercMtacSrasWrflDl" //horizontal movement;
sleep 0.5; //stop after 0.5s of moving. doesn't work as intended
this lookAt center; //look at the center of the circle```
your sleep line doesn't work because the init box of an object is an unscheduled environment
Sorry i have to clarify. Like i said im new. If i understood it correctly, I have to do something like put it in an sqf and execVM that sqf right?
Would it theoretically stop the animation 0.5s in and proceed to the the lookAt or would it continue the animation after 0.5s?
to make what you have written work now as you have it...
this disableAI "PATH";
this spawn {
_this playMove "AmovePercMtacSrasWrflDl";
sleep 0.5;
_this lookAt center;
};
but it won't give you the results you are looking for. look into while loops if you want something continuously running
Ah I see. you can add a spawn to make it scheduled
Thanks for the help, man! Much appreciated.
What do I put in deactivation field using setTriggerStatements command if I don't want anything on deactivation, since "An array with three arguments is mandatory for this function."?
I figured it out, apparently its "null"
An empty string "" would probably work too
Any way to make smokes more visible ?
CautionSpecialProfilingAndTestingBranchArma3
Also, does anyone exactly know what this command does?
hey guys im at a loss i have been trying to do some "modding" but im terrible at it, so i have a mission/mod called Kp liberation, i have been trying to make/change some units of RHS but i dont know how to do it, Simple words. I want to make/change my own units that i can then use in the mission. 2 questions I have made compositions of the units in the editor is there a simple and easy to way to make them actual units somewhere so i can use them in the mission ? 2nd question can i just simply go into lets say RHS units somewhere and simply change their outfits/gear ?
All have to do is edit kp_liberation_config.sqf and change the factions used. RHS is already supported.
I can't stop my AI spinning T_T
@exotic flax i said i want to make my own units :/ i already know that i can simply change to rhs in kp
Ugh, got it... had to disableai everything but MOVE and ANIM
It's not a command, it's the access password for the profiling branch of the game
Hi guys, im really new to scripting and after a little bit of help, how do you pass a variable from one script to another
im trying to write a reload script for my tank that allows me to select 1 of 6 round types
If the first script is spawning/calling/execVMing etc. the second, you can pass variables as arguments e.g. [_variable1,_variable2] execVM "script.sqf"
and then use the params command to access them in the second script
private ["_vehicle","_roundselect"];
_vehicle = nearestObject [player, "afuk_challenger2_base"];
//hint "Selected L31A7 Hesh HE";
removeAllActions _vehicle;
_roundselect = "afuk_l31a7";
_vehicle addAction ["<t color='#00FF00'>Load L31A7 Hesh HE</t>", {[_roundselect] call afuk_cr2_fnc_cr2reload;} , nil, 1.5, true, false, "", "true", 5, false, "", "gunneraction"];
_vehicle addAction ["<t color='#FF0000'>Select L3A2 Smoke/WP</t>", {(_this select 0) call afuk_cr2_fnc_load2;} , nil, 1.5, true, false, "", "true", 5, false, "", "gunneraction"];
_vehicle addAction ["<t color='#FF0000'>Select L23A2 APFSDS T</t>", {(_this select 0) call afuk_cr2_fnc_load3;} , nil, 1.5, true, false, "", "true", 5, false, "", "gunneraction"];
_vehicle addAction ["<t color='#FF0000'>Select L27A1 APFSDS DP</t>", {(_this select 0) call afuk_cr2_fnc_load4;} , nil, 1.5, true, false, "", "true", 5, false, "", "gunneraction"];
_vehicle addAction ["<t color='#FF0000'>Select L32A6 Hesh Squash Head/Practice</t>", {(_this select 0) call afuk_cr2_fnc_load5;} , nil, 1.5, true, false, "", "true", 5, false, "", "gunneraction"];
_vehicle addAction ["<t color='#FF0000'>Select L29A1 APFSDS Training</t>", {(_this select 0) call afuk_cr2_fnc_load6;} , nil, 1.5, true, false, "", "true", 5, false, "", "gunneraction"];
this is what i have currently
where i want to pass _roundselect to another script
iv tried {[_roundselect] call afuk_cr2_fnc_cr2reload;}
to try pass it but it doesnt work at the other script
the other script currently just does hint str _roundselect;
You need to use the params command in the other script to interpret the variables passed as arguments
Probably
params needs string, keep it mind
Oh yes, that too
params ["_roundselect"];
On a wider note, it looks like you're designing an individual reload function for every round type? This seems....horrible. You should be able to make one function that's completely type-agnostic and just loads whatever you pass it as an argument
Also also.........why are you making special functions to switch ammo types? This is handled perfectly well by the game already
i want to have a functional loader position
and make it so the gunner cant reload
also so it takes rounds from the inventory as apposed to the default way
so the reload will be handled one script but those other functions are to change the colour of the add action
I would not necessarily recommend this as a first project if you're new to scripting, it's likely to be quite complicated
In fact, this is something that is probably best done as a mod to create a completely new version of the vehicle that's configured to do this
im taking it in stages
for example, removeAllActions doesn't remove engine actions such as reload, so I think you're going to have trouble preventing the gunner from reloading
dont need to worry about thats as all it loads are 1 round magazines
also so it takes rounds from the inventory as apposed to the default way
This relies on the existence of vehicle magazines as inventory items, which, er......test that first
i have an idea how to do that
i just want to be able to select a round type then pass that to the reload script
for starters
Well, now you know how to do that. But I think you're approaching this from the wrong end - the reload script working at all is going to depend on underlying mechanics you need to develop first, if they're even possible
i know they are possible as there is another mod that does something similar
If I do this:
[{
_x addCuratorEditableObjects [units _grp, true];
},allCurators] remoteExec ["forEach",2];
will it work, or will it fail because _grp isn't defined on the machine it's being remoteExec'd to?
If you check the GitHub of Lib you can see how different factions are configured, which is all scripted.
The assumption that it will fail is correct. Best solution: Make NJT_fnc_addGroupMembersToZeus so that you can simply do _grp remoteExec ["NJT_fnc_addGroupMembersToZeus", 2];.
For various reasons that's not possible. But I have another solution, I just needed to know where the variable locality fell on that one.
Good day. There isn't "elseif" operand in SQF? Some analog maybe? (apart from "switch")
No ๐ฆ
Thanks
im not sure if im in the right place but i assume i need scripting ๐ What i want to do is set my Ingame Time at mission Start=My Local Time ๐
i would be glad for any pointer since i have not yet learned how to script in arma ๐
or is that not possible ?
Yes, you can use systemTime to get your local time and setDate to apply it to the mission (after trimming off the last two elements of the array, since setDate doesn't do seconds and milliseconds)
You must take care to only check systemTime on one client if this is a multiplayer mission, otherwise every client will use their own local time which could cause desync if there are clients in different time zones
i never play with other people ๐ i use arma purely as a singleplayer sandbox ^_^ Thank you at least i know that it works not now i just need to figure out how i do it ๐ can i also apply the same concept to the Date ?
ok so it will set Date and time ? ๐
ye i have those pages open ๐ just need to put it together thank you for confirming i can do it
i would put those into a empty trigger right ?
or the mission init ?
You could use either. Obviously the trigger can't be completely empty, it must have a condition set so that it actually activates. Init.sqf is the best way, though.
ye i use Eden advanced and the general settings have a Init field i assume thats that
I would assume it's either the same thing or has the same function.
ok thank you i just found the get started page ๐ time to learn scripting i guess
its not like C++ right ?
Arma 3 uses its own language called SQF. It probably shares some elements with other languages, but I don't know them well enough to say which.
For this particular purpose, all the code you actually need is:
// Save the current system time
_currentSystemTime = systemTime;
// Cut the saved array down to the size needed for setDate
_currentSystemTime resize 5;
// Plug the resized array into setDate
setDate _currentSystemTime;
Variables can be with or without _. It indicates a local variable, which is only saved in the context of the current instance of the current script. A variable without it is a public variable, which is available to - and can be overwritten by - other scripts.
ah ok ๐ thats why it complained about a local variable in the global space when i put it into the init ^^ in a trigger it works just fine tho ๐
Well that's interesting. Clearly the 3den Enhanced "init field" is not directly equivalent to init.sqf, because local variables are fine in init.sqf
i mean to be fair it might be me fucking up ^_^ but if so thats interesting i guess
Afternoon fellas, I'm having a little issue with a kill scoring mission I wrote. In summary, the script records vehicle kills only, either if all crewmen are dead (CREWKILL) or if the vehicle is destroyed (CATKILL). I also added a check to prevent double scoring when a vehicle crew is already dead and the vehicle is later on destroyed.
The scripts and functions work fine when using autocannons, they are able to tell that a vehicle's crew is dead and destroying the vehicle grants no extra points. However, things get out of hand when using any of the big guns which kill a vehicle and its crew in one shot. It records the crew kills three times.
R3vo will know, he made that.
im just glad i dont need to set the time manually now each time i play a senario ๐
thanks ill try to figure out further things myself and ask for advice not solutions ^_^
I have been at it for hours and cant figure out why. Here is the important code:
Triggers when any entity is killed based on "EntityKilled" Mission EH:
params ["_killed", "_killer", "_instigator"];
if !(_instigator in units player) exitWith {};
if (_killed getVariable ["alreadyDead", false]) exitWith {};
if (_killed in vehicles) then {
systemChat "Running fn_killLand";
_this spawn VVV_fnc_killLand;
};
if (_killed in allDeadMen) then {
systemChat "Running fn_killMan";
_this spawn VVV_fnc_killMan;
};
@potent dirge MP or SP?
The problem could be spawn.
I assume fn_killLand and fn_killMan set the alreadyDead flag at some point?
yes they do
spawn is the problem.
Okay I will try call
EH runs unscheduled, the code can't be paused by the scheduler. spawn runs scheduled, so your EH fires for the destroyed tank, spawns some code, the scheduler doesn't execute that code yet, the EH fires again for some crew member of the tank and also spawns some code. At some point later the scheduler decides that the time to run the code has come, but at this point you already have code for both the tank and the crew member(s) executing or awaiting execution.
Wow I think it works now. I replaced spawn with call and added two more checks for the deathflags.
