#arma3_scripting
1 messages ยท Page 241 of 1
Can you give an example array?
Also make sure those vehicles actually exist in the missio
{
_obj = _objs select _i;
//_object = call compile _obj;
_object = missionNamespace getVariable [_obj,objNull];
_object setPosATL [getPosATL _object select 0, getPosATL _object select 1, (getPosATL _object select 2)- 100];
};
["shelf_1", "shelf_2", "ammo_1", "ammo_2", "ammo_3", "ammo_4", "ammo_5", "ammo_6", "home"];
_objs
Can anyone help me with syntax for enablechannels?
I need to enablechannels for _x in a foreach loop, can't find the syntax for that.
{
diag_log format ["[deployQueue] processing queue: index = %1, value = %2, total = %3", _x, _forEachIndex, _reinforcementSide];
if (!isNull _x && alive _x) then {
[_x, false] remoteExec ["hideObjectGlobal", 2];
[_x, true] remoteExec ["enableSimulationGlobal", 2];
{cutText ["Reinforcing","BLACK IN",20,false];} remoteExec ["call", _x];
sleep 1;
[_x, _heloObj] remoteExec ["assignAsCargo", 2];
[_x, _heloObj] remoteExec ["moveInCargo", 0];
sleep 1;
["Terminate"] remoteExec ["BIS_fnc_EGSpectator", _x];
2 enableChannel [true, true];
3 enableChannel [true, true];
5 enableChannel [true, true];
if (_x in _heloObj) then {
_reinforcementSide deleteAt _forEachIndex;
_assigned pushbackUnique _x;
};
} else {
// _reinforcementSide deleteAt _forEachIndex;
// unassignVehicle _x;
};
} forEach _reinforcementSide;
(_heloObj emptyPositions "cargo" == 0 || _reinforcementSide isEqualTo []);
};```
whats this button do
hey hey, i'm trying to remove all weapons from the new Xian, so far, it has removed the Gatling, but the missiles and rockets are still there, anyone any idea of their position?
{
_vehicleObject removeWeaponTurret ["gatling_30mm_VTOL_02",[0]];
_vehicleObject removeMagazinesTurret ["missiles_SCALPEL",[-1]];
_vehicleObject removeMagazinesTurret ["rockets_Skyfire",[-1]];
};```
maybe change -1 to a 0? ๐
Probably a better idea to remove the turrets rather than just the mags, otherwise someone could possibly rearm it
Look for the turrets in the config browser
will try that @native hemlock and already tried @runic spoke
@native hemlock, do you know off the top of your head the correct syntax for enablechannel in a foreach loop?
Why does that fact that it is in a forEach loop matter?
The enableChannel command needs to be run locally on each client for it to take effect
I don't know, but it's not working when I just stick it in there the way I normally use it.
So, I need to remoteexec foreach?
This is the context:
{
diag_log format ["[deployQueue] processing queue: index = %1, value = %2, total = %3", _x, _forEachIndex, _reinforcementSide];
if (!isNull _x && alive _x) then {
[_x, false] remoteExec ["hideObjectGlobal", 2];
[_x, true] remoteExec ["enableSimulationGlobal", 2];
{cutText ["Reinforcing","BLACK IN",20,false];} remoteExec ["call", _x];
sleep 1;
[_x, _heloObj] remoteExec ["assignAsCargo", 2];
[_x, _heloObj] remoteExec ["moveInCargo", 0];
sleep 1;
["Terminate"] remoteExec ["BIS_fnc_EGSpectator", _x];
2 enableChannel [true, true];
3 enableChannel [true, true];
5 enableChannel [true, true];
if (_x in _heloObj) then {
_reinforcementSide deleteAt _forEachIndex;
_assigned pushbackUnique _x;
};
} else {
// _reinforcementSide deleteAt _forEachIndex;
// unassignVehicle _x;
};
} forEach _reinforcementSide;
(_heloObj emptyPositions "cargo" == 0 || _reinforcementSide isEqualTo []);
};```
You need to remote exec the enableChannel commands.
Yes. The question is, what is the syntax for doing so correctly in this context?
Probably something like [2, [true, true]] remoteExec ["enableChannel", _x];
So if you need every client to check those conditions and then enableChannels, then every client should run the foreach loop themselves. However, if only the server needs to check those conditions and then when the conditions are met every client needs to enable those channels, then you should use remoteExec like robtherad mentioned
I'm not 100% on that syntax but it looks correct
So I'm starting to mess around withe event handlers
What's the best way to pass the return variables to a script?
Why would the event handler need to return a variable to a script? The point of event handlers is really to do something once the event has taken place
So you would run the script once the event handler was executed
And pass those parameters from the event handler to the script
But you can't use general expressions like "Sleep" without the script
For context I want diolague to play when you fire a missile from a jet
So you should run the script once the missile is fired
right but I only want it to happen when missiles are fired
so I should run a comparison in teh script?
or is there something I can do in the handler
no
No
against teh Fa-18 aim 120 and Javelin do not have missile warnings
ACE javelin that is
In any case...
Mess around with it a bit, I'll be back in an hour or so if you still need help
It should also be noted This EH will not trigger if a unit fires out of a vehicle. For those cases an EH has to be attached to that particular vehicle.
Ya, I got it on the plane itself
@jaunty drift, @native hemlock, thank you both very much for the syntax help. I think I can trial and error it from there.
plane1 addEventhandler ["Fired",{
_unit = _this select 0;
_weapon = _this select 1;
_magazine = _this select 6;
if(_weapon == "js_w_fa18_aim9xLauncher") then {
/*play voice line*/
};
}];
what I'm testing atm
It would seem there is problems with disableChannels atm
Seems to occasionally not work
Muting the whole server?
I derped
So yeah disableChannels doesnt work
using enableChannel doesnt work either when using it in a script executed by the mission
but running it in debug works fine..
again: Works for us. We disabled General, Side, Direct.
Hm it must be something within the mission thats overwriting it
but theres nothing.. i double checked it
Would you mind having a look at my mission?
checking
scrap it
I have to kill someone later.
disableChannels[]={0,1,2};
- (in Mission init.sqf)
0 enableChannel [false, false];
1 enableChannel [false, false];
2 enableChannel [false, false];
isn't that form of disableChannels now redundant?
Yes, but the new one doesnt work
It seems to work for me on a dedicated server: disableChannels[]={{0,true,true},{2,true,true},{4,true,true},{5,true,true},{6,true,true}};
Well it doesnt seem to work when hosting the server via ingame ui
Its really strange tbh..
...
(It also didnt work on a dedicated)
Pretty sure the game considers you an admin when you do that and admins have access to all the channels.
Negative
Teammate was able to use all channels aswell
Same for the test on the dedicated
Somethings really strange on my system..
Doesn't seem to work for players who are connected but not slotted when the mission starts who then slot in and join the mission.
Yeh for me it seems to work for some players, but not for others
0 enableChannel [true, true];
1 enableChannel [true, true];
2 enableChannel [true, true];
3 enableChannel [true, true];
4 enableChannel [true, true];
5 enableChannel [true, true];
6 enableChannel [true, true];
Disables all channels but Global and Group
Group = Text and Voice disabled
Global = Text and Voice enabled for everyone
*Meant to be false
copied from notepad accidently
I approve this bug report
me too
@native hemlock it wouldn't let me remove the turrets, the classnames were correct, checked in config, just went with removal of all ammo instead as we don't have any means to re-arm
Okay, I have a fully functioning helicopter redeploy script working in my PVP project for immersive respawning. What I need now is a way to divide arrays up based on number and then call the script twice if there are more than sixteen players in the queue array, three times if there are more than thirty two players in the array, and four times if there are more than forty eight players in the queue. Anyone have tips on where to start?
_myArray = [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u,v,w];
_myChalks = [];
_chalkSize = 16;
while {count _myArray > _chalkSize} do {
_myChalks pushBack (_myArray select [0,_chalkSize]);
_myArray = _myArray select [_chalkSize, count _myArray];
};
_myChalks pushBack _myArray;
// _myChalks = [ [a,b,c,d,e,f,g,h,i,j,k,l,m,n,o,p],[q,r,s,t,u,v,w,x,y,z] ]
something like that
then run the heli stuff forEach _myChalks
@indigo snow, thanks a bunch! Will try!
I'll have to start with low numbers at first, though, because I don't have 48 friends I could get on at once, haha.
you can run the pseudo code itself with some ai duders really
Ah! That's a good point.
Where should I create these chalk arrays? In the init?
Rats, I need to sort these chalks by side, too. Hmm. I'll think on it before I ask for more help. I'll do some trial and error and whatnot. Thanks again, @indigo snow.
_myGreenArray = _myArray select {side _x == resistance};
_myRedArray = _myArray select {side _x == east};
hi guys im making a mission in the editor and i have a trigger set to display a message when any player enters a zone and that works fine. But in the conditions field i want to have it so it only triggers when a player has a gps in the inventory
does anybody know what i need to add to the condition field to do that?
what is your current condition?
"gps" in (VestItems player + UniformItems player + BackpackItems player)
did you try "itemGPS" in (items player)?
@indigo snow i did just now, it doesnt work
my bad, theyre assigned so you should use assignedItems
to be absolutely safe you might want (items player + assignedItems player)
@indigo snow, I am having trouble wrapping my head around this chalk array you made. I can see how it works, but my brain just isn't creative enough to craft it to my situation.
I think I'm getting close to figuring it out, though.
the _chalk would be an array of arrays of units to deploy
I see that part.
so youd { _x call fn_myDeploymentfunction} forEach _myChalks
It's pretty plain syntax, very impressive to me how plainly you were able to make each statement.
@indigo snow so the condition would be "itemGPS" in (items player + assignedItems player) ?
@shadow sapphire Im about to head to bed and i dont know the specifics of your code, but youd use the snippet i wrote to break up a large array of units into an array or smaller arrays of units. Youd then call the code you used to run on the large array of units forEach _myChalks for example
@indigo snow, okay, thank you so, so much. I'm sure I'l be able to work it out, it'll just take me a while, haha.
@bronze trellis in is case sensitive, use "ItemGPS"
ah ya your correct, thats it. but now it displays the message as soon as i pickup the gps and not when i enter the zone with it?
i dont see any code that checks for the player being in a zone
normally, this in the condition field returns the boolean of the trigger check
so it'd be that && this, with that being the earlier code
i have problem with waste land script spawn vehicle stores and gunstores inside buildings
https://community.bistudio.com/wiki/addSecondaryWeaponItem would this load a mag directly to a launcher or is adding it to inventory only?
Directly to launcher
whats the maximum length for a string used like this: obj setVariable [string, value]
@deft zealot i would assume it is the same as the length for the normal string
any other assumtion requires t esting
and i highly doubt anybody ever tried
still 8k limit?
go higher
8k was for format command
From Arma 3 v1.55.133789 strings are limited to maximum of 9,999,999 (sometimes 10,000,000) characters
oh ya i remember they changed that
using str formatText [fooofoo, foofoo] you even can reach that with format
nah ... they just put a limit on it as far as i know
well ... shows more that some string manipulation commands use "<" and other use "<=" ๐
so the map on my server keeps going blank if i relog etc, not sure why but id love some explanation if anyone has it?
markers?
such as all my map markers not showing, a literal blank map where in reality all my npc'
npc's show up, etc. it seems to happen when i relog and appears only sometimes
People have had mixed results with changing the difficulty, but I haven't heard any response on adding "mapContent =1"
is "IsKindOf " the best way to compare classnames, or is that "IsTypeOf"
plane1 addEventhandler ["Fired",{
_unit = _this select 0;
_weapon = _this select 1;
_magazine = _this select 6;
if(_weapon isKindOf "js_w_fa18_aim9xLauncher") then {
AWACS sideRadio "R4F2_1";
};
}];
isTypeOf doesn't exist AFAIK @plucky beacon
(typeOf _weapon) == "js_w_fa18_aim9xLauncher"
Right, oops. Anyway that's what I mean. Is that better than isKindOf?
thanks penny ill try
@dusk sage https://gyazo.com/db7e2c2de04343756acbf4e5d309bff6 What object is this referring to? Is it not taking the weapon fired from the event handler?
The wiki only says it refers to one object which should be _weapon
The weapon parameter in the Fired EVH is a string
I guess I could use projectile?
It will be the weapon type
By default
I.e, if you shoot a katiba
weapon will be "arifle_katiba_F" or w/e
It's already a classname for you
But it's the classname in the form of a string
Yeh
_weapon isEqualTo "CLASSNAME"
You can't call typeOf on a string, it takes an object and returns a class
You already have the class
๐
@native hemlock hey, issue still here
That's all I got unfortunately, I haven't encountered the issue first hand
just for clarification @still forge ARE you using the dev-branch?
also are those markers created via scripts?
a minimal, complete and verifiable example would be great https://stackoverflow.com/help/mcve
@queen cargo , it's basically that my map markers that were set in the eden editor do not show up,( http://images.akamai.steamusercontent.com/ugc/487892961319738294/A1B127D4B04A3C18D25690532498DB048E888D3C/ ) the map will sometimes be completely blank until a full game restart OR changing my difficulty settings to recruit from veteran from when it for some reason goes to vet
weird ... but if what Pennyworth said is not helping ... youre kinda fucked :3
yes
Need a script to remove all objects of the same classname from a terrain. Possible?
@lyric isle you could use nearObjects with a big distance
@vapid frigate no!
doing that wont do any good ...
not to mention that nearObjects wont find everyhting
@lyric isle what objects
yeah, sorry, was thinking stuff he'd spawned
i thought you could get some terrain objects with nearObjects or nearestObjects
but not all
not only that @vapid frigate ... main problem is the performance especially on large maps
it could kill your game if youre unlucky
or you do not cover the whole map
in the end: polling the whole map is smarter (with eg. 500 meter radius)
{ hideobject _x } foreach (player nearObjects ["House", 100000])
works on altis, but slow
few seconds
Do anyone here know where i can get in contact with BadBenson? ๐
thanks X39 ๐
yo, so... http://pastebin.com/07rERLVh
That is my script.
areaOfPlay = execVM "scripts\ormp_ff_engine\ormp_ff_outOfBounds.sqf";
I have a trigger, set to Activation anybody, type present, and on deactivation that script gets fired.
It fires, sometimes, it's VERY inconsistant, and it is not working as intended
I am able to go out of bounds, sometimes it never re-fires
Sometimes it waits until I am to far out of bounds to fire, and then there is no way to get back.
Sometimes it simple doesn't fire at all.
On the activate side, I am calling terminate areaOfPlay;
to stop the script upon returning.
Ormp_FF_OutOfBounds = compileFinal preprocessFileLineNumbers "scripts\ormp_ff_egnine\ormp_ff_outOfBounds.sqf";
Also why is the above line breaking my mission?
it's in a single file ormp_init.sqf
which I am trying to #include "path/file.sqf"
yet if I include it, it breaks.
By brekas, I mean nothing works at all, as if I have no scripts runing.
anyone noticed that after the latest arma update, something went wrong with IgiLoad, you can not lock or access inventory on the Cargo, Repair and fuel pod. and its only localized to them, all the other pods works fine, something is broken but what?, i thought i might just ask if someone here has encountered the same issue. IgiLoad on Exile.
How secure is the BIS_fnc_MP function? I'm thinking of basing a callback framework around it but I'm worried about exploits and hacks that might be known about the function. Any ideas?
For start the BIS_fnc_MP is just for legacy and is pretty much absolute - you should use remoteExc instead and you can make it pretty secure by editing the CfgRemoteExec.
ahh I see, thank you this is what I needed.
Using remoteExec will be no different for what you're attempting
I was just worried about security holes.
Alot of further security went into rExec IIRC
BIS_fnc_MP now utilizes remoteExec though so in theory the same feature should apply
But you should still use remoteExec, the changes to BIS_fnc_MP to use it were backwards compatibility optimizations
Were all these optional TKOH parameters on the wiki before?
https://community.bistudio.com/wiki/addAction
I don't remember seeing them
Yes, I think they were.
Yes that would be a useful parameter.
But why?
So we don't have to write it in the conditions
You can use radius in the condition
I actually think radius might work
How come
Hey
If you type in a command and hit f1 it brings up "Scripting Help" https://gyazo.com/eb0d8c9a182ca1f1a7da8400b3e2f1a1
Any way to remove a shift-click placed GPS point using script ?
Because on respawn player always have his old GPS point
For addAction it shows radius as a parameter
You on dev branch?
oO i've never seen that one Penny
They mentioned they were adding to it in one of the changelogs
Perhaps this is it, as the unconcious thing is new
Seems so, this is main branch:
Dreams really do come true
Indeed they do
And it works as expected
๐
Missed 75% of the Convo.
tl;dr anyone? ๐
lol it was like 10 lines
<- lazy ๐
Whats radius doing (i assume, min. Dist. until the action appears) + Still need conditions, right?
Yes
So, just no Dist. check in the conditons anymore. hmm.. kk
I have no idea how you would edit the wiki when there is already an entry for one of the parameters that isn't the same in TKOH and A3
I have some end mission triggers that work on my own machine, but when I uploaded it for open alpha testing, the mission didn't end appropriately. What might be the problem?
The trigger:
CP1=CreateTrigger ["EmptyDetector", getmarkerpos "M1", true];
CP1 SetTriggerArea [200, 200, 0, false];
CP1 SetTriggerActivation ["EAST SEIZED", "PRESENT", false];
CP1 SetTriggerTimeout [60, 60, 60, true];
CP1 SetTriggerStatements ["this","[] execVM 'RedWin3.sqf'","false"];
This doesn't work for creating markers appropriately in multiplayer. I have to figure out a way to make the markers appear appropriately to only the side they belong to and hiddenfrom the other side.
if (side player == EAST) then {
CP4A=createMarkerLocal ["P4", getmarkerpos "M4"];
CP4A setMarkerShapeLocal "ICON";
CP4A setMarkerTypeLocal "Mil_Warning_NoShadow";
CP4A setMarkerColorLocal "ColorWEST";
CP4A setMarkerTextLocal "Defend";
};
if (side player == independent) then {
CP4B=createMarkerLocal ["PD", getmarkerpos "M4"];
CP4B setMarkerShapeLocal "ICON";
CP4B setMarkerTypeLocal "Mil_Warning_NoShadow";
CP4B setMarkerColorLocal "ColorEAST";
CP4B setMarkerTextLocal "Seize";
};
Should I try to go with a foreach or something?
@jade abyss hey mate! We make kill simulation... ;)
I have no clue, what you are talking about oO
Unit x killed by unit y
We talked about it few days ago
All sayd its impossible. :) They was wrong
Abs izi way!)))
Almost nothing is impossible with Arma scripting, @night void. The question is never "is it possible?" The questions are "how?" and "how hard?/Is it worth it?"
There has only been ONE thing that I've run into that was impossible so far. Everything else that everyone says is impossible has been made to work.
So, now we can simulate kills by game mechanic)
@night void Go on then, show us what you did
Whats the most efficient way to randomly select between 4 objects. it's on an event handler so I don't think making a new array would be most efficient.
not the BIS function?
BIS func is the old way
oooh
Returns a random element from the given array. Engine solution to BIS_fnc_selectRandom
before you would just use array random floor select array or whatever it was
@dusk sage u need it too?
I need to remoteexec createmarkerlocal based on a unit's side. Any guidance on the syntax for that?
besides call compiling formatted text, any way I can turn a variable of "[a, b, c, d]" into an array?
been crawling all over the wiki, there's gotta be a smarter way than how I'm doing it :<
@night void Nah just interested what your solution ended up being
@shadow sapphire Bet you can't solve the Halting problem with arma scripting ๐
Disregard my earlier issue -- solved it
// Given a named flag capture area marker, returns number of EAST players on flag
private ["_flag", "_side"];
_flag = this select 0;
_side = this select 1;
_onflag = [_flag,[],[_side]] call Zen_GetAllInArea;
systemChat format ["Total %1 on %2", _side, flag];
_cnt = count _onflag;
_cnt
This is missing a [ on line 9.
Am I doing the format wrong?
The format line, is line 9...
I see it.
/wrist
i have a ff_flagHandler.sqf
I make it a function
// takes flag marker, handlers the logic of capture and contest of a flag point.
ff_flagHandler = compileFinal preprocessFileLineNumbers "scripts\ff_engine\ff_flagHandler.sqf";
Yet, it always returns any.
For that matter, ALL of my defined functions return ANY no matter what I pass into the params/
Any one care to shed some light on this?
You have
params ["_flag"];
then _flag = this select 0;
the second one is wrong (_this)
And not needed, params has you covered on that
plane1 addEventhandler ["Fired",{
_magazine = _this select 5;
if(_magazine isEqualTo "js_m_fa18_aim9x_x1") then {
_fox2 = selectRandom ["R4F2_1","R4F2_1","R4F2_1","R4F2_2","R4F2_3","R4F2_3","R4F2_3","R4F2_4"];
player sideRadio _fox2;
};
}];
is there a way I can optomize this better? it freezes the first time you fire.
initplayerlocal.sqf
Any way to remove a shift-click placed GPS point using script ?
Because on respawn player always have his old GPS point
can I not // FLAG_TIMERS - Alpha, Bravo, Charlie
alpha_point setVariable ["flagCount", 0];
bravo_point setVariable ["flagCount", 0];
charlie_point setVariable ["flagCount", 0];
Set these to markers
???
?
@dull parrot: you can't setVariable on markers afaik
Hmm
Damn bis wiki is down
private ["_flag"];
// get the flag of current flag being handled
_flag = _this select 0;
_counter = this select 1
systemChat format ["flag = %1 | counter = %2", _flag, _counter];
_contested = true;
// Loop CHECK SIZE OF SIDES -> GET CAPTURING SIDE -> WINNING SIDE TIMER - 1 -> CHECK SIZE OF SIDES
// Get west on a flag.
_wcnt = [_flag, west] call ff_getTotalOnFlag;
// Get east on a flag.
_ecnt = [_flag, east] call ff_getTotalOnFlag;
// Compare the above to get the capture status of a flag.
_side = [_flag, _wcnt, _ecnt] call ff_getSideTakingFlag;
sleep 1;
if (_side == blue && _counter < 30) then { _counter = _counter + 1; };
if (_side == red && _counter > -30) then { _counter = _counter - 1; };
if (_side == contested) then { systemChat format ["%1 Is Contested", _flag]; };
if (_counter == 30) then { systemChat format ["%1 was captured by BLUE", _flag]; };
if (_counter == -30) then { systemChat format ["%1 was captured by RED", _flag]; };
So, I have three global variables....
// FLAG CAPTURE TIMERS
ALPHA_TIMER = 0;
BRAVO_TIMER = 0;
CHARLIE_TIMER = 0;
I would like to be able to intelligently alter the correct variable based on the name of the object passed as _flag
in my case, it's a marker.
I am thinking of a getFlagTimer func, but I am unsure as to how to point to my actual global variables.
I am trying to avoid a nested if statement...
_counter should be the correct global variable in question.
Incrementing the correct variable, based on the _flag object passed.
If this makes sense to anyone.
Questions on top of questions of top of questions
just a quick question -- I'm currently learning Python (1st language) and I'm not ready for scripting yet in Arma 3 or anything else; my q is simply, what sorts of things can you DO with scripting in Arma? (feel free to point me to web page or doc)
Kinky, to make things pretty when posting code you should use the discord markdown for code which is ``` https://support.discordapp.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline-
forums.bistudio.com is down too
As an example, if you join a server with no mods, you yourself could replicate all of those things with scripting
all of what things?
Anything you see.
It's way too broad of a question
Also, scripting is simpler than python.
What I'm saying is that all of the things happening in that mission you join are possible through scripting
So, if you understand basic python you shouldn't be to far off.
do you use scripting to make your own mods, or to enhance mods that are made with Eden editor, prehaps?
I would say just learning from the wiki is better than learning python
Although, scripting is only hard because unlike real languages, it's documentation and syntax and useage is fucking balls bad.
oh i am beginning to see what you mean
If there is a book, about sqf, and sqf ACTUALLY worked the way the book described, and it had ACTUAL control flows.
It would be fun.
Not the teeth pulling extravaganze it is.
is sqf the in-house bohemia scripting language?
Yeah
too bad they didn't use something standardized like python
It's a lil' different
Fucking hell man, they could have just let us right our shit in C++, it would be easier than this.
As it's run on the RV engine
so it's a bit of sore spot I see ๐
I don't think it's that hard....
There is plenty of SQF -> C++ projects out there ๐
You have to realize it's a scripting language
True penny.
one final question -- I like to fly helis and I am a bit dissatisfied with the collective controls -- can those be altered at all by scripting? (that is, any vehicle controls)
Are you dissatisfied because the controls don't seem to work properly, or the helicopter doesn't fly like you think it should?
that it doesn't fly like I think it should
they DO work the way they are supposed to, i'm sure
case 1: {}
};```
Trying to switch off the name of a marker stored as _flag
would _flag be the condition?
Your best bet Lee would be to edit the helicopter configs
come again
what file would that be? I'll have a look
Have you tried using the advanced flight model?
yes i've tried both adv and standard
Should I explain the issue in a little more detail or would that be inappropriate here?
it's really very simple
yes @dull parrot
I just say GLOBAL = whatever
yep
test = ["alpha_point"] call ff_flagHandler; sleep 1; systemChat "alpha point fired";
This trigger init is giving me a Generic Error in Expression
But not stating the error.
this is the on activation for a trigger, activated via Anbody, Present.
try
test = ["alpha_point"] call ff_flagHandler;
[] spawn {
sleep 1;
systemChat "alpha point fired";
};
to rule out the sleep
says I can
Can't
on activation type script expected nothing
is the error, when trying to put it in the box
I think with a trigger you would need to do nul = [] spawn {...
Wow, that is very odd.
The error is gone, I am guess it was the sleep. But my NESTED functions chat ouytputs fire, but my switch does not seem to fire.
I think I am going to have a single function per capture point.
I wanted it to be modular, but at this point I don't like the huge switch / if mess.
If a single function only ever affects a single point it will be easier on me.
private ["_flag", "_westcnt", "_eastcnt"];
_flag = _this select 0;
_westcnt = _this select 1;
_eastcnt = _this select 2;
systemChat format ["_flag = %1, wstcnt = %2, estcnt = %3", _flag, _westcnt, _eastcnt];
if (_westcnt > _eastcnt) then {
_side = "blue"; // West is capturing
systemChat format ["The %1 is taking %2!", _side, _flag];
_side
};
Why does the above not return a string?
Again, to make things pretty when posting code you should use the discord markdown for code blocks which is ``` https://support.discordapp.com/hc/en-us/articles/210298617-Markdown-Text-101-Chat-Formatting-Bold-Italic-Underline-
What do you mean by "not return a string"?
No systemChats? Or you are expecting _side to be returned to the function callings this?
_side shouod be a string.
Set via the if statements.
I bring in three privates, _flag, a marker, and two ints, westcnt and eastcnt
The purpose of the function is to compaire the two ints and fint out if which is larger, or if it's a tie, then output a string representing which side won.
This however is returning any
'''test'''
Then _westcnt isn't greater than _eastcnt
'''test
`
Well, there is two other checks.
not '
_side = "blue"; // West is capturing
systemChat format ["The %1 is taking %2!", _side, _flag];
_side
};
if (_westcnt < _eastcnt) then {
_side = "red"; // East is capturing
systemChat format ["The %1 is taking %2!", _side, _flag];
_side
};
if (_westcnt == _eastcnt) then {
_side = "contested";
systemChat format ["%2 is %1!", _side, _flag];
_side
};```
So, I should get ONE of these strings back.
And I am double checking the ints before they go in.
With me testing it will always be 1 over 0
In favor of blue.
is my _side getting destoryed by the if?
Is it because I need to declare _side outside the if statements, in order to return it?>
You would probably want
if (_westcnt < _eastcnt) exitWith {
_side = "red"; // East is capturing
systemChat format ["The %1 is taking %2!", _side, _flag];
_side
};
Ahh, thanks BoGuu
Is the BIKI down for other people too?
What do you consider "a while"? I'm sure they'll get it fixed when they wake up and are in the office within the next several hours
3+ hours now I think.
If your script returns Any, one of the variables you use is nil.
What is the syntax for calling a foreach loop for all units in a given side? Any links?
{ if(side _x == EAST) then { dosomething _x }; } foreach allUnits
or
{ dosomething _x } foreach (allUnits select {side _x == EAST })
Ah, I should have specified that it was a remoteexec I was needing. Thank you so much, though. I'll be more specific, I wasn't actually expecting help, haha.
all clients of units on a given side?
I need this:
CP4A=createMarkerLocal ["P4", getmarkerpos "M4"];
CP4A setMarkerShapeLocal "ICON";
CP4A setMarkerTypeLocal "Mil_Warning_NoShadow";
CP4A setMarkerColorLocal "ColorWEST";
CP4A setMarkerTextLocal "Defend";
};```
To be remoteexec'd for all of the clients on a given side.
looks like you can just use EAST for the targets param on remoteExec
Oh, that's good! I have lots of trouble with syntax, still.
yeh
so i guess put those 5 lines in a function, and remote exec that function for east
[] remoteExec ["stuff",east/west] etc
Okay! That's easy enough! Thanks SO much, both of you.
The targets you can use are here: https://community.bistudio.com/wiki/remoteExec
For the purposes of explaning the targets, I think stuff is fine ๐ Could also be a variable though... ๐
but you could use { CP4A=createMarkerLocal ["P4", getmarkerpos "M4"]; CP4A setMarkerShapeLocal "ICON"; CP4A setMarkerTypeLocal "Mil_Warning_NoShadow"; CP4A setMarkerColorLocal "ColorWEST"; CP4A setMarkerTextLocal "Defend"; } remoteExec ["bis_fnc_call", EAST];
eww
better to use a function though
Oh... I use it JUST like that, @vapid frigate?
you could, but it would have to transmit the script across the network, so not ideal
What do you recommend as the alternative, @dusk sage?
Put the code in some variable and use remoteExec
Either by using CfgFunctions or just a global variable
Hmm.... example? I get the feeling that's going to be over my head, man. I prefer what I can do and what works to what works that I cannot do.
Okay
yep, that's definitely the better, but harder to explain way ๐
So you can define a function like
myfunction = {};
And remoteExec that
Or make a new file called fn_myfunction.sqf
And put your code in there, then add it to CfgFunctions
Your new variable to rExec would be TAG_fnc_myfunction, for the latter
Ah, I see. Yes, my sandbox developer uses that pretty often to do lots of things.
Need to not* over complicate remoteExec to think about it
The function name is just a variable
Which contains the code to be executed, that is all
It doesnt matter how you put the code in that variable
Okay, that sounds doable, but it's definitely something I'm unfamiliar with.
Aslong as said variable exists on said client, it'll run it
Okay, I think I'll try this, but I've got to make a new mission to get a clean start, because building it into the old way would be too tough, haha. Okay, brb. I'll read up through these again when I get back, if you guys are gone.... well, I'll read up through them, anyway.
https://community.bistudio.com/wiki/Functions_Library_(Arma_3)
i'd learn to use cfgfunctions with that.. the most reliable way i think
I set up CfgFunctions & CfgRemoteExec with you before IIRC @shadow sapphire
https://community.bistudio.com/wiki/Functions_Library_(Arma_3) *
Your link is dead -> )
Yeah, I have my CfgRemoteExec still, I don't know if I have CfgFunctions, still. IDK where it went.
Confirmed, link is dead.
discord breaking it
rofl
Weird.
Should I make practically everything a function? I always regear all of my units in every mission. Would it be worthwhile to do make that script into a function as practice?
personally i make all scripts functions in cfgfunctions
not everyone does though
keeps it organized
@vapid frigate, what is the disadvantage of making them all functions?
Oh, so no network traffic issues or anything from things being passed?
nah, all cfgfunctions get compiled at load time afaik
and to remoteexec one, it would just need to pass the function name + parameters
Okay, so, I'm looking at this stuff... Could you walk me through making the first function, then I can try to practice on my own from there? I've started with a completely new mission file now. It's empty.
Well, it has mission.sqm.
in a mod or mission?
Step 2: add a folder 'functions' (or folder\functions)
Step 3: add your script to that folder, and name it fn_FUNCTIONNAME.sqf
Okay, done. Does anything special need to be done inside of the function.sqf?
Step 4: add the following to description.ext:
class CfgFunctions {
class YOURTAG {
tag = YOURTAG;
class YOURCATEGORY {
class FUNCTIONNAME {};
}
}
}```
What should my category be? Like, I just make that up?
yeah, doesn't really matter. afaik, it's just for showing it in the functions viewer
your tag is the important one
Okay!
after that, you can
call YOURTAG_fnc_FUNCTIONNAME;
or [] remoteExec ["YOURTAG_fnc_FUNCTIONNAME", EAST];
Ah, that makes sense! Awesome! So, should I just experiment with when things should be called or remoteExec'd?
What else?
that's it
You're forgetting one thing @vapid frigate
to make more functions can just add more class FUNCTIONNAME {}; and fn_FUNCTIONNAME.sqfs
yeah good point
Okay, and for subsequent functions, what would each one look like?
class ASG {
tag = "ASG";
class Loadout {
class Loadout {};
class Capture Points {
class Capture Point 1 {};
}
}
}```
you don't need a category for each
and can't have spaces in class names
class YOURTAG {
tag = YOURTAG;
class YOURCATEGORY {
file = "folder\functions";
class FUNCTIONNAME {};
}
}
}```
no spaces, use _
Oh, so they can all be in the same categore, gotcha.
Okay, so thank you so much! I'm going to experiment now.
need to add that file thing too, as @dusk sage suggested
Have a peek at this: https://github.com/ArmaLife/Framework/blob/master/Altis_Life.Altis/Functions.hpp
That is a good example of a large system of functions in different folders with different tags
Just... since I have your attention already, though, would I remoteExec or call a loadout script? I assume I'd remoteExec.
From initplayerlocal and for initplayerlocal.
Then it'll be called on every client by default
remoteExec is made for server to client.
you would call it from there, not remote exec
Ah! Okay, thanks!
But if you had some function that will be executed by a client and that client only, if you called something, it'd only occur on said client
If you wanted a global effect, you'd need to remoteExec said called thing
Hmm... so would I have issues, where the client was wearing different gear on their client than they were globally?
If you remoteExec on all clients in initPlayerLocal, you'd be executing on everyone, every single time someone joined, which isn't ideal
No, that'd be global
It depends on the command as to whether it's broadcast
Oh! Okay, that's good!
Look at the icons at the top of the wiki: https://community.bistudio.com/wiki/enableSimulation
It will tell you whether other clients are synced with whats going on
if you remoteexec it from initplayerlocal, with 30 players it'll run the script 30 times on each client
each player would be telling each other player to run it
Yeah, I don't want that to happen. I've dealt with that one when I first started mission making last year.
People suddenly had empty vests and stuff.
class CfgFunctions {
class ASG {
tag = "ASG";
class Loadout {
file = "functions"
class Loadout {};
}
}
}
Is acceptable?
Thanks!
you need a semi colon after all your } aswell
class CfgFunctions {
class ASG {
tag = "ASG";
class Loadout {
file = "functions";
class Loadout {};
};
};
};
class ASG {
tag = "ASG";
class General {
file = "functions";
class Loadout {};
class CapturePoint3 {};
};
};
};```
or
```class CfgFunctions {
class ASG {
tag = "ASG";
class General {
file = "functions";
class Loadout {};
file = "functions";
class CapturePoint3 {};
};
};
};```
the first
the file and tag will apply to all that follow
So each function within a category can come from the same file director?
Awesome!
yeah, you can specify a file inside the function class too
It will answer most of your CfgFunctions questions
but shouldn't need to
I've looked at it a touch, but was just too caught up in having direct attention.
๐
Super fast responses to my questions were too enticing.
But, okay! I'll go experiment alone now.
Hey guys, does anyone has issues with the GPS waypoint staying here after death ? Like, the player has a GPS, he places a point, so the waypoint is displayed on his screen. Now he dies, and respawn, without a GPS, and the point is still there (as he has no GPS anymore). How do to deal with that ?
are you saying the waypoint is on the bottom right side of your screen?
i think just on the map/radar, and you can't get rid of it
i don't think it's an actual waypoint?
No, you know when you have a GPS, you hold Shift + Left Mouse Click, and a point appears on your screen with the distance
You don't need a GPS to see that.
oh ok.. i guess our difficulty settings have that off
I know, I made it that so the player needs a GPS to do that. And no, this is not difficulty wise. I'm looking for the name of that point or a command that could delete it
i'm not sure what it is.. have you checked if it's a waypoint on the player or a task?
What is the difference between calling and spawning a function and which is used for what?
spawning = scheduled = can have sleeps, calling = unschedueled = no sleeps.
Thanks!
Call = priority
Spawn = can sleep
If you are in a scheduled environment already, call or spawn both give a scheduled environment, in which you can sleep
Ah, I see.
If you are in an un-scheduled environment already
Then spawn gives you a scheduled and call gives you an un-scheduled
Spawn no matter the environment will give you a scheduled one
It also creates a new thread, which will run in parallel with the script it was spawned from, so it will not wait for it to finish
in the end, don't spawn unless you need to.
If you are unsure the kind gents at BI gave us a command to use without breaking our stuff in 1.58: https://community.bistudio.com/wiki/canSuspend
Thanks, @dusk sage!
I was ending missions this way
"END6" call BIS_fnc_endMission;
};```
but this didn't work on the hosted server to end the mission for either side OR the server.
I learned that BIS_fnc_endMissionServer is required to end it on the server, but I am unsure of how to use the two variants in unison to get the desired effect of multiple endings.
Okay, searches indicate that the way to do this is only one way. Call the endmissions on all clients, sleep briefly, then endmissionserver. But, I still don't understand the syntax for calling for the clients. I would guess a remoteExec.
Wouldn't that be like ["END6"] remoteExecCall ["BIS_fnc_endMission"]; ^^
Very likely. Thanks for the input. I'll give it a shot, for sure.
Ah sorry, actually it should be "END6" remoteExecCall ["BIS_fnc_endMission"];
for your example
Will give it a try.
Has anyone done an onmouseenter display handler for list boxes?
so when I hover over a list item a smaller control box would appear on my pointer?
or just endMission..
BIS_fnc_endMission or BIS_fnc_endMissionServer is recommended by wiki and provides more options than endMission.
recommended due to the fact that just the script commands do not provide the same "feeling" like the script command
script function*
script function will also take care of the "effect" and sound
I want to adjust a single control in a helicopter -- I think I have figured out how to unpack/access the various config (pbo and bin) files using editor and tools -- but I'm having trouble finding the relevant heli control bits in these files. Any ideas?
Anyone know how to disable IK so I can play animations on armed soldiers?
For those that remember our addAction discussion the other day, KillzoneKid updated the wiki to include the radius parameter for 1.61+ https://community.bistudio.com/wiki/addAction
Hu?
BE protection kicked in for player id=123456, name='Dscha', msgType=10
Oo whats that?
VIP BE service lol
probably wrong signatures or stuff like that
I was executing stuff with publicVariableServer
nope
there you go
oh ? they changed the message ?
Seems like
Hey guys! Who good with explosives? Can i make own c4 but without planting animation?
I have tried using Transport Unload waypoint to get a helicopter to drop me and my team off, however it only kicks me out and then flys away with my team members. What's the best way to fix this?
Need a script to remove all the trees of a certain type. I believe I need an array to call all the trees of the same type. Could anyone help? Cheers.
Something like this:
{if (getModelInfo _x select 0 == "yourmodelname") then {hideObjectGlobal _x}
} foreach (nearestTerrainObjects [getpos player,["tree"],5000,false])
can I safely rely on locations on a terrain always being within map borders?
e.g I'll never download a map from armaholic, run nearestLocations @ [0,0,0] and find a location the mapper made @ [-100,-100,-100] ?
_v = cursorTarget;
_v addEventHandler ["Killed", {systemChat "Killed 1"; (_this select 0) removeEventHandler ["Killed", 0]}];
_v addEventHandler ["Killed", {systemChat "Killed 2";}];
For some reason Killed 2 never triggers, why is that?
removing event 1 instead of 0 does the same for some reason.
what index do you get for both?
@meager granite
It's a old bug. If you remove an event handler from inside that event, you will skip one.
I think this is because you are modifying an array in C++ land while iterating through it, which is undefined.
@velvet merlin
0 and 1
debug friendly version:
player addEventHandler ["fired", {systemChat "fired 1"; (_this select 0) removeEventHandler ["fired", 0]}];
player addEventHandler ["fired", {systemChat "fired 2";}];
Same as:
_a = [1,2];
{systemChat str _x; _a deleteAt _forEachIndex} forEach _a;
does not happen with CBA XEH ๐
What, it even happens if I delete different event handler, not Killed one?
I guess all event handlers are stored in same list
Yeah seems so
Hey all, I have added some custom attributes to the classes in my cfgidentities.
How can I access the value of that attribute when I have assigned that identity to a player?
class CfgIdentities
{
class Goodman
{
name="Herman";
country="USA";
speciality="rifleman";
ghostSound="male_2";
ghostRole="rifleman";
ghostSkill=4;
fullName = "Herman Goodman";
nameSound = ""; // Arma 3 only!
face="WhiteHead_11";
glasses="G_Combat";
speaker="Male03ENG";
pitch=1.0;
};
}
So if I wanted to find out what ghostSound is so I can play the appropriate sound for that identity?
You can't. there is no way to read the "identity" of a unit
Because "identities" are just a set of face, speaker, pitch, glasses and name
Hmmm, how can I set custom attributes for a unit. Or can I define my own classes are read them as objects?
I'm currently using this: '#lightpoint' createVehicle position player; to spawn a light but I want to spawn a light that is more like a cone shaped light...can someone tell me how I can achieve this?
looks like third param of https://community.bistudio.com/wiki/remoteExec is broken
guys, can anyone tell me if its possible to script an AI to fire in a long burst (hold down LMB) ?
Alternatively, you can tell them to suppress if they are in your group by opening the command menu (` or ~), and then hitting 3 and 9
@tough abyss that sounds interesting ands imple enough to implement. i just want the AI to shoot so that i can test sounds im working on. MG42 needs to be fired in bursts.
ill check it out. i have never worked with EHs before other than to set ammo to 1 (got that from a forum someday...). can i come back at you if i have questions?
thanks guys.
Is there a way to have a helicopter already 'spun up' at mission start? I've only found "<vehicle> engineOn true", however that only starts the standard spin-up sequence. The old editor had special:flying but iirc that's no longer a thing in 3den and besides that I want a spun-up heli on the ground.
My current 'workaround' is to drag the heli into the air in 3den (which has a similar effect to "special:flying" in the old editor) and then doing a setPos on mission start.
From Karel
Right now, helicopter and planes will turn their engines on when placed above ~20 m altitude. We're planning to add an indivual attribute which would give you full control over whether the engines should be running at the start or not.
https://forums.bistudio.com/topic/188266-helicopter-not-flying-at-start/?p=2984525
I'm not sure if there is a follow up to what that attribute is though...
Thanks, that was a very quick and super relevant answer! ๐
Is there AI in the helicopter?
You could probably spawn it high with an AI in it, remove the AI, set it low
that way it'll be staging down and won't take off on you
I have found at least some of the heli parameters in the unpacked config files, but I want to change the speed at which the Collective control responds to a keypress. Any ideas if and where this function may be found?
oh boy, what an amount of channels.. miss Skype already ๐ฆ
anyway, anyone know if the new screenshot (https://community.bistudio.com/wiki/screenshot) command works with dedicated servers / headless clients like "rendered" in memory?
nope it doesn't work on clients without a rendered scene, this command was introduced to create the 3DEN previews, nothing else
Ah pitty. Thanks.
anyone have any clue why the lightpoint flare's at night is looking ugly at night since the 1.60 update?, its like crosses, same with tracers.
remove any mod tweaking them (except ACE3)
another option is to reduce or disable the depth of field (or whatever it's called) option in the video settings
at least, that worked pre 1.60
is there a command like max for arrays?
private _max = 0;
{_max = _max max _x} forEach _array;
Anyone with experience having to overload the 4096 character limit for strings with ARMA2Net? There's a parameter for it, but I can't seem to get it to work right
@rich bramble you can set the velocity of the helicopter in the init line
I am doing that for my ghost recon missions where there is a helicopter insertion
hi
if i wanna foun buildings whats i must change in this code: ``` _atms = [];
{
if ((str x) find ": atm" != -1) then
{
_pos = _x modelToWorld [0,0,0];
if (surfaceIsWater _pos) then
{
_pos = _pos vectorAdd ((getPosASL _x) vectorDiff (getPosASLW _x));
};
_atms pushBack _pos;
};
} forEach nearestObjects [player, [], 999999];
copyToClipboard str _atms;
*/```
i try found dome on tanoa
Hey all,
I am trying to make the tasks display on the screen however they are only displayed on the map. I want to get that popup where it says new task assigned
Using this code from the BIKI
task1 = player createSimpleTask ["taskName1"];
task1 setSimpleTaskDescription ["To be successful in this example task you need to...","Example Task",""];
task1 setTaskState "Assigned";
player setCurrentTask task1;
@tough abyss BIS_fnc_showNotification maybe?
Btw, if I defined functions in CfgRemoteExec would I still have to define them in CfgFunctions?
Thanks, that worked @ruby spoke
@gilded rampart your nightvision script/mod looks awesome. If you don't plan to release it to the general public, could you maybe share the effect settings you used?
looks like some combination of radial blur & noise
@vagrant badge You need to change the keyword it's looking for in the object names
Can I use waitUntil with playing a sound to check the sound has finished playing or is there a better way to do this?
I am trying to loop some ambient radio chatter inside a helicopter, using the ambient radio chatter script as an example. However it only loops once. I want it to continously loop with a random time interval
ARC uses a trigger to continuously call the script, however it makes more sense if the script itself loops I think
BIS_fnc_selectRandom, selectRandom is a native command now. (saves you at least 3ms)
^ and you might as well make that array once outside of the while loop and then select random inside of the loop
Are all of the sounds the same length as well?
doesnt matter his sleep doesnt have a lower bound
They are all around 20 seconds'ish
you might want to include a lower bound on your sleep. 30 + random 20
Got it, lemme test it
Ok, it's not playing anything now
while {true} do
{
sleep 20 + random 30;
(0 fadeMusic 0.3);
_radioChatter = ["helicopter_radio1", "helicopter_radio2", "helicopter_radio3", "helicopter_radio4", "helicopter_radio5", "helicopter_radio6",
"helicopter_radio7", "helicopter_radio8", "helicopter_radio9", "helicopter_radio10", "helicopter_radio11", "helicopter_radio12",
"helicopter_radio13", "helicopter_radio14", "helicopter_radio15", "helicopter_radio16", "helicopter_radio17", "helicopter_radio18",
"helicopter_radio19", "helicopter_radio20"] selectRandom;
playSound3D [_radioChatter, player];
};
Complaining about a missing semi colon, although Poseidon editor is not highlighting any syntax errors
Ah they've moved the operand
Yeah you have the array on the wrong side of selectRandom
And isn't playSound3D global? So every player would hear each other's sounds overlapping?
every player would be broadcasting their own chattering yea
What would you recommend for a sound coming from a helicopter when you are inside it?
have the helicopter play the sound, not the player
Has anyone had luck working around the apex-preview issue with map markers not showing? (https://twitter.com/Arma3official/status/743353184224083972 and https://feedback.bistudio.com/T117215)
Now it is playing every single sound at once and then it stops :/
_loop = true;
while {_loop} do
{
sleep 20 + random 30;
(0 fadeMusic 0.3);
_radioChatter = selectRandom ["helicopter_radio1", "helicopter_radio2", "helicopter_radio3", "helicopter_radio4", "helicopter_radio5", "helicopter_radio6",
"helicopter_radio7", "helicopter_radio8", "helicopter_radio9", "helicopter_radio10", "helicopter_radio11", "helicopter_radio12",
"helicopter_radio13", "helicopter_radio14", "helicopter_radio15", "helicopter_radio16", "helicopter_radio17", "helicopter_radio18",
"helicopter_radio19", "helicopter_radio20"];
playSound _radioChatter;
};
Sleep is definently seconds yea, I wonder why the loop is ignoring it...
Does ArmA 3 kill infinite loops after a certain time?
Do you have -showScriptErrors on?
In debug console?
There you go
It is running in a nonscheduled environment so you cannot use a sleep
[] spawn {
_loop = true;
while {_loop} do
{
sleep 20 + random 30;
(0 fadeMusic 0.3);
_radioChatter = selectRandom ["helicopter_radio1", "helicopter_radio2", "helicopter_radio3", "helicopter_radio4", "helicopter_radio5", "helicopter_radio6",
"helicopter_radio7", "helicopter_radio8", "helicopter_radio9", "helicopter_radio10", "helicopter_radio11", "helicopter_radio12",
"helicopter_radio13", "helicopter_radio14", "helicopter_radio15", "helicopter_radio16", "helicopter_radio17", "helicopter_radio18",
"helicopter_radio19", "helicopter_radio20"];
playSound _radioChatter;
};
};
Ah ok, I guess I will have to do it in the helicopter init to test
Ah thanks
It works now ๐
There is also no need to create that array everytime the loop runs, so instead you would do this
[] spawn {
_loop = true;
_radioChatter = ["helicopter_radio1", "helicopter_radio2", "helicopter_radio3", "helicopter_radio4", "helicopter_radio5", "helicopter_radio6",
"helicopter_radio7", "helicopter_radio8", "helicopter_radio9", "helicopter_radio10", "helicopter_radio11", "helicopter_radio12",
"helicopter_radio13", "helicopter_radio14", "helicopter_radio15", "helicopter_radio16", "helicopter_radio17", "helicopter_radio18",
"helicopter_radio19", "helicopter_radio20"];
while {_loop} do
{
sleep 20 + random 30;
(0 fadeMusic 0.3);
_randomRadioChatter = selectRandom _radioChatter;
playSound _randomRadioChatter;
};
};
Yea that makes sense, probably also affects the probability of sounds repeating ?
Thanks
No, it should only be a slight performance improvement
So is playSound the best option then? How about
helo say _randomRadioChatter; ?
What performance increase would putting the array outside of the loop have
I guess it saves the engine from reassigning and fetching all the variables to create the array
They are just strings, putting it outside is just creating another variable
The inside would be indentical
Not really, it has to create an array with 20 indexes to select from every loop iteration
_arr = ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20"];
for "_i" from 0 to 5 do {
_random = selectRandom _arr;
};
//0.0097 ms
for "_i" from 0 to 5 do {
_random = selectRandom ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20"];
};
//0.0167 ms
There is 0 point to assigning variables in loops if they are going to be literally the exact same between each iteration, it's just going to be slower if you do
Only by milliseconds, but still
You do realize random [1, 10 ,20] exist, right ?
Yes, but I was building a string for the purpose of mimicking ecurb's original array of strings
I suppose you could use your random way to get a random index and then playSound after using format
just do ```
for "_i" from 0 to 5 do {
switch (random [1, 10, 20]) do {
case 1: {
// Your code
};
case n: {
// Your code
};
};
};
What?
That is so unnecessary for this
You'd have 20 cases with
playSound "helicopter_radio#";
didn't knew he wanted that, (haven't read above :P)
he can just use format for that
or joinstring, or +
playSound ( ["helicopter_radio", str (random [1, 10, 20])] joinString "");
};```
there.
Hmmm
playSound and playSound3D seem to behave the same, I can still hear the radio sounds even if the helicopter is over 400 metres away. Any ideas?
@lone glade do you also know that is a Gaussian distribution? So the middle values appear more than the edge values
And those sounds wouldn't work because that produces decimal values....
I don't think you'll be able to stop the sound once it is playing already, however say3D may be better as you can specify the distance
Ok, I am trying to check if a player is not in a vehicle. How would you phrase it?
if (!player in _vehicle)
if(player in _vehicle == false)
Neither seem to work
because in only works with arrays and strings
(vehicle player == player )
or (isNull objectParent player)
second one being faster
Thanks
don't know why you think that, but it's false.
Hey, Anyone know how to disable button's hover color?
It's kind of sad really
As we'd like it to be as fast as possible to array comparisons business
but it's checking for objects too
and locations
that syntax is kinda useless tbh
(isNull objectParent player) is faster than (bob in car) which is faster than (vehicle player isEqualTo player) which is faster than (vehicle player == player)
Well objectparent is not checking for a specific vehicle, so you'd hope it'd be faster
One last thing, I am compiling this vehicle chatter into a function. When I call it as a function it is complaining that the _vehicle local variable is undefined.
params ["_vehicle"];
[] spawn {
_loop = true;
_radioChatter = ["helicopter_radio1", "helicopter_radio2", "helicopter_radio3", "helicopter_radio4", "helicopter_radio5", "helicopter_radio6",
"helicopter_radio7", "helicopter_radio8", "helicopter_radio9", "helicopter_radio10", "helicopter_radio11", "helicopter_radio12",
"helicopter_radio13", "helicopter_radio14", "helicopter_radio15", "helicopter_radio16", "helicopter_radio17", "helicopter_radio18",
"helicopter_radio19", "helicopter_radio20"];
while {_loop} do
{
//check if player is inside a vehicle
if (vehicle player != player ) then {
sleep 10 + random 5;
(0 fadeMusic 0.2);
_randomRadioChatter = selectRandom _radioChatter;
_vehicle say3D [_randomRadioChatter, 1];
};
};
};
I call it like this:
ghost_helo call GhostFunctions_fnc_VehicleChatter;
because it isn't
I will try it with [ghost_helo] call
the spawn exit the scope of the call
pass _vehicle as an arg to the spawn and use params there
Ok got it
When it is just one variable I am passing to a function, do I need to use the array parenthesis still?
No, but params would handle it either way
"a string" spawn {
_value = _this; //"a string"
};
["a", "string", "and", "another"] spawn {
_allOfIt = _this; //["a", "string", "and", "another"]
_firstIndex = _this select 0; //"a"
_secondIndex = _this select 1; //"string"
};
It is still complaining that vehicle is undefined with it being passed as an argument of spawn
params ["_vehicle"];
//because spawn starts a new thread outside the scope of this call, you need to pass any variables in the function call through here
[_vehicle] spawn {
_loop = true;
_radioChatter = ["helicopter_radio1", "helicopter_radio2", "helicopter_radio3", "helicopter_radio4", "helicopter_radio5", "helicopter_radio6",
"helicopter_radio7", "helicopter_radio8", "helicopter_radio9", "helicopter_radio10", "helicopter_radio11", "helicopter_radio12",
"helicopter_radio13", "helicopter_radio14", "helicopter_radio15", "helicopter_radio16", "helicopter_radio17", "helicopter_radio18",
"helicopter_radio19", "helicopter_radio20"];
while {_loop} do
{
//check if player is inside a vehicle
if (vehicle player != player ) then {
sleep 10 + random 5;
(0 fadeMusic 0.2);
_randomRadioChatter = selectRandom _radioChatter;
_vehicle say3D [_randomRadioChatter, 1];
};
};
};
You have to declare the _vehicle again
_vehicle isn't defined anywhere in what you posted
Sorry I edited the missing line from top
params ["_vehicle"];
...
Ahh
also your function would error out if the vehicle is null
How should I handle that?
params [["_vehicle", objNull]];
if (_vehicle isEqualTo objNull) exitWith { /* error code */};
Ok got it
This functional style of programming is really hard to get my heard around sometimes. Thanks for the help ๐
The reason you have to declare the variable again is because it's a different scope when you use spawn
If you'd like to learn more about it and private variables, this post will help http://foxhound.international/arma-3-sqf-private-variables.html
private all your local vars
The params command is so convenient for that and setting variables passed to functions
One of the best command additions in recent time
that and apply ๐
This is probably the most fun though... https://community.bistudio.com/wiki/setAnimSpeedCoef
and by far the one with the most interesting results huehuehue
Does the distance function work if an object is cargo of another object?
I am just going to check
Interesting as cargo inside a helicopter I get a distanec of 2.98
I wonder why that is?
Is there a specific point in the helicopter it is measuring from, perhaps the tail ?
I'm pretty sure it measures from (theObject modelToWorld [0, 0, 0]), which might be the boundingCenter
Let me check
So I was wrong, about boundingCenter
However these two are the same
player distance theObject;
player distance (theObject modelToWorld [0, 0, 0]);
nice to see you again Pennyworth, I have a question for you (and scripters generally) which should be easy to answer ... helicopters in arma 3 have a control called the Collective, somewhat analagous to a throttle. When you engage it, there is a brief pause, then it begins to move slowly, then a little faster. I'd like to speed that process up a bit, -- make the RATE of movement controllable.
Is that even possible?
I have found the heli references in the unpacked config files but that's as far as I've got
Quick one, would this exit a script if the player was using stream friendly ui?
if !(isStreamFriendlyUIEnabled = false) exitWith {};
the return on that command will be true or false. so you should be able to just do if !(isStreamFriendlyUIEnabled) exitWith {};
yeah good point, the if is looking for the boolean, thanks
@native hemlock pardon the interruption, did you see my question just now in #arma3_scripting?
You can't check if a player has a certain setting or not
give people some time to get you an answer vicious
Yes, I just know nothing about editing helicopter controls
That's actually something I don't think is possible with script commands
That's more of a config or possibly controller setup thing
can you suggest who / where I might inquire further?
Do you have a joystick?
I use PPJoyMouse and a game controller
i don't want to change any of the joystick-related controls
however i CAN tell you that when I experimentally map collective(analogue) to joystick or any controller, I see the same slow response
I can't really point you to anyone specifically, but you might be best writing up a post with what you see as the issue and posting it here https://forums.bistudio.com/forum/162-arma-3-addons-configs-scripting/
It's easy for things to get missed here on discord, as sometimes chat scrolls fast and people ask questions at the same time
thanks I will do that
dslyecki would probably have something to say on this but I cannot seem to get hold of him
...even when I spell his name right ๐
dslyecxi*
People will usually be constructive and helpful if you show that you've put some effort into the post, rather than "helicopters don't fly like I think they should, how fix?"
yes I understand
i actually have managed to unpack and find many of the heli related parameters
I know absolutely nothing about helicopters, their terms, and their configs. If you see something in the config that you think is relevant to the issue, just throw it into google with "arma" in it and see if anything turns up
Some config entries are well documented on the Arma 3 wiki or the VBS wikis, but not all
i've been doing that, no luck so far... i'll keep digging for a while to make sure I'm well informed before making a post
i suspect that the control I want to acquire is hardcoded, binarized, under the hood etc.
like suppose you wanted to change the rate at which a gun can reload, it would be analogous to that
If you've extracted the game data with Arma 3 Tools, nothing in configs should be hidden or binarized
Something pertaining it to though might be hard coded in the engine
indeed
in fact the tweak i have in mind might be considered a cheat
but I would like to propose it as a desirable change and I think I can make a case for it
I just thought it would be nice to DEMONSTRATE it and so illustrate my idea concretely
@lone glade
because in only works with arrays and strings
wrong
Alternative Syntax
Syntax:
unit in vehicle
Parameters:
unit: Object - person
vehicle: Object - transport
Return Value:
Boolean
check what I wrote below that
Is there any way to force max FOV via script?
afaik not
afaik not, most of those settings aren't possible to change via commands
How about detecting the height of the player 3rd person view above the terrain?
take the cam Height
would be fucked in buildings
currently searching, where i made that before.
@lone glade Doesn't matter, when you check the Dist to the ground
should've precised ๐
We could ref the player rather than the terrain
Can't fkn remember where it was. I just remember, that i took LineIntersect***something, then checking the distance to the ground
That is enough for me to find a fix @jade abyss. Thanks!
lol I know why you are wanting to know this information
pretty sure all of us know why here ๐
yep
Someone with a reasonably big following was streaming battle royale last night and it was revealed that the guy who was first or second on the leaderboards plays with ridiculously high FOV
^^
If LineInters... would be more precise, the fkn "I bend me through the wall too look at the other side" would be over -.-
doesn't really matter when you can actually clip your head through walls
It would
I feel like this would be hard to script around
tho gun occlusion was sneakily added back
Since then, you can simply say -> Fk you, get back to "Stand" and not "lean"
We already have code to detect the wallhacks, but the x2 FOV gives players a massive advantage in the final circles.
Yeah
you could try https://community.bistudio.com/wiki/camPrepareFov
hm, that one is new for me
(wich, i assume, doesn't work for normal views, but... could be a workaround
like -> Creating a cam behind the player and block the normal 3rd Person button
lol look at this https://www.twitch.tv/1080p__/v/73233544?t=1h52m45s
Especially when you double zoom out
the "I have a uav above my head" feel
I'm sure he is not the only person to do it, but it seems hard to restrict
Yeah, not very fair imo
looks like splendid cam rofl
Best solution would be to convince BIS to add a server.cfg value that was something like restrictFOV
Yep
As I'm sure they wouldn't want people abusing this type of thing in PvP/TvT game modes
this ^
^^
In a perfect world everyone would play first person, but you can't get force that upon the masses
lol oh lord the markers
"let's fix polyline markers, BY REMOVING ALL OF THE MARKERS"
I can't run a preview of BR Tanoa due to this!
haha
lol you can't see the zones?
"First person is shit!" - People that play Battlefield, Call of Duty and other first person only games
^^
"first person is shit, I can't see behind walls"
If only we were able to understand those people
but, tbh, Arma in 1stPerson only is hard after a while
I played a king of the hill the other day
The same guy killed me 5 times, had no idea where he was. I shadow played it
And saw his muzzle in the wall
Literally had no idea
I like it, but sometimes i rly need need 3rd ๐
don't worry dscha, in the next ACE3 version mission makers will have the option to disable THE WHOLE FUCKING UI
And lag
Goes pretty much for any gamemode in ArmA, I am total shit at PvP
Yeah, you are.
Has anyone been able to figure out what exactly causes the map marker issues? Like do both createMarker and creatMarkerLocal not work?
BI fucking up when they added the server setting for polylines
ermmm
absolutely no markers work, mission tasks and drawIcons do
it's bull
Yeah, ive seen alot of Markers in the past
sometimes the markers work, sometimes they don't
We were playing Domination last time, Markers worked as before oO
Yeah I don't think the difficulty changing really works, I attempted it myself with no luck
It just seems super inconsistent
Tbh I haven't had any issues with markers lately
Are you running 1.62 @tame portal ?
I tried to recreate the issue myself, but I had no luck
Yeah hosted my mission on dev branch and it worked fine
Aswell as on stable and preview
wat
^^
Gun game needs markers?
want my profile and the mission + server.cfg I tested it with?
"ARS" - Arma Random Shit
Sure
Penny you cheeky cunt xD
Is it that the markers are just invisible for some people, or that they don't even exist?
Like with allMapMarkers actually return anything?
I went back to preview now but Ill check later if my mission still works flawlessly
It wasn't supposed to be cheeky ๐ I legitimately didn't think you would need them, unless you are referring to a different mission
markers exist, they are invisible
Does creating it again make it reappear?
hmm.. what's uro'ing (breaking) it? Zeus? Does it work in normal Missions?
no idea what's breaking it, you can only see the markers through zeus
they seem to be invisible
the only markers that work 100% of the time are task ones
What difficulty is the server on and what value do you have for mapContent?
tried both mapContent ticked and unticked, no change (local MP)