#arma3_scripting
1 messages ยท Page 360 of 1
@real tartan do NONE instead of FORM
@peak plover heli did not have gunner position, instead it has turret position
does one know which precedence isEqualTo has?
such a thing is not listed on biki ๐
thats why i am asking :3
if you could provide me with a list of all commands that are not default, that would be cool too
what is default? which number?
you're lucky. I'm just working for a export for Intecept ^^
idk
for my sqf-vm it is 0
as 0 is the lowest possible
everything else simply is higher then 0 and thus more important
My comment from some time ago says priority is a int from 0-5 so 0 is probably default
prio 4
which is default btw
that is horrible
bim 1 ||
bim 7 atan2
tfw?!
7 seems to be max
which is / ... (guess that is the config variant)
no
ohh ... no wait
^ is 9
50 + round(random 50) should give me a random whole number between 50 and 100, right?
Sure.
then why did it give me 408?
because you did something wrong ๐
^ ๐คท
well yeah
๐
but what the hell could I possibly mess up for something so simple
๐ ๐ ๐
UGLY!!!
@runic surge random takes min median max params
SQF VM says that's correct
confirmed^
@subtle ore no it doesn't. There is also a variant that takes that. But that's not what Rylan wants or needs
wait nvm I have it run the code multiple times and forgot to use a private variable so it just kept adding more for each new value
๐
@still forum Well yes, i am talking about that variant. Would be easier than just adding 50
@runic surge The hell man? ๐คฆ
Seeing a lot of those BTH functions pop up recently
also it was an if then statement instead of exitwith and it didn't call the resource object funtion inside it
@subtle ore I have a lot of them what can I say
making a dynamic type scenario for the first time and I have had a lot of trouble so far lol
I have no problem with them. Seems like they are very useful for getting starter
Is there a downside to having a large amount of functions for a single scenario?
no
So far I have made 16
higher RAM usage ๐
16 functions?!?! INSNANE!!!!
Woah man.
๐ต
for me that is a lot jeez
When I rewrote initFunctions There were over 500 functions with CBA and ACE
I got 4 functions 8 macros on my old cpu
๐ฑ
though ACE doesn't even show up in initFunctions ๐
If I ever get around to making a mod version of my current project it will likely be a lot higher
because. freedom.
Bit more than 0.001ms
Really?
Who rly?
CBA's function caching system is easier to expand for debugging and stuffz
0.00000001 MS?
@runic surge
50 + round(random 50)
Will give you a random number between 50 and 100, where
50 has a ~1% chance to appear,
51-99 have a 2% chance to appear and
100 has a ~1% chance to appear.
So, does this mean I should move all I have out of cfgFunctions
a case where the sqf-vm could help <3
lovely
If you have no specific reason to use CBA's system instead. then don't
CBAs system only really applies to addons
X39, you sure love your sqf vm
Yeah, I don't really see any huge positives, but maybe when I move some functions to a mod
Iirc cfgfunctions (re)compiles every mission?
Should recompile every time you load
But why?
Debugging. Easier to add stuff as you don't need a config.
Recompiles on preview/mission start
Youre stuck with that anyway, for mission side fncs
@subtle ore thats because you can actually execute SQF without arma inside of it
@queen cargo True, not doubting the usefulness.
#Intercept The only real thingy
Yeah, with CfgFunctions you either recompile everything or nothing. With CBA you can do specific components, so it is way quicker to restart the editor.
compile all functions once at game start and compile them in delicious C++
ACE too big : (
4k? pfft... 4k per face!
I wonder if Arma could handle a weapon with like.. a dozen 4k textures ๐
#1fps
Awww.. Nvidia Ansel....
when you can take pictures
Imagine
Ansel + Arma = pointless
360* pictures?
Oh yeah
Originally, i thought it was just a maneuverable camera in gamespacr
I have seen vids on that
could I do this: TeamObjects = []; TeamObject pushBack BTH_RTS_TEAM_BLU_flag = "Flag_Blue_F" createVehicle (getMarkerPos "respawn_west");
or would that just add the entire command into the array
No.
TeamObject pushBack BTH_RTS_TEAM_BLU_flag = you can't have commands / interpretation on the left side of the = assignment operator
alright I will just do it manually then
that would assign the return value from the assignment operation to your array which... no...
no no no no no.
I have never tried that.. I don't even know what would happen... Your Arma might even crash
It probably errors in the same way
_a = call { _b = 1 };
errors.
Xd
If I have GC on, is there a way to prevent a subset of units' bodies to not be collected? Have a small pile of bodies I want to make sure is present by the time the player gets there.
I could just make a trigger and spawn them when they're close enough I guess...
Or make your own GC
So I am trying to run this eventHandler (Take)
player addEventHandler ["Take", {hint str (_this select 1);}]
But it only returns "dummyweapon.p3d", which is wierd, because I am taking the item out of a crate, just curious if someone knows why it doesn't want to return the Crate that I took the item from
It only (so far) returns the correct crate, if I am taking a scope. But if I take ammo or a gun from the crate it returns dummyweapon.p3d :l
is there any option to control an object (e.g. a waterbottle) just like controlling a seagull
You can attachto
that could work
so there is no way to change the hitbox from player to object?
other question; do you know why some objects are lagging af if you attach them to the player?
so if i attach a waterbottle i haven't got any fps issues but if i attach a picnic table for example i have constantly 1-3fps
additional info: player is wearing a ghillie suit and is invisible
prop hunt for arma?
probably ๐
why the ghillie suit?
if it's to avoid AI detection you could just use unit setUnitTrait ["camouflageCoef", 0];
hiding would disable the collision, the ghillie can be textured so its invisible and keep the collision
the hiding thing is already done, but the attaching-fps prob still exists, thats the more important issue^^
you could just have a toggle action that hides the player and disables simulation and puts the object at their feet
of course you wouldn't be able to move as the object
so that isn't an ideal solution
or just have the object attach and detach every few seconds
that way when the player moves it updates every time it attaches
i dunno if it's a quite good and efficient workaround; do you have a clue why this fps drop issue is only present on certain objects?
can someone explain how text size inside structured text coresponds to the size of the control it's applied to?..if at all. trying to make text scale properly along with a ctrl of type RscStructuredText
u r using scripting commands to change the size?
Does <t size='1' not work?
yea but my buddy has the text cut off on his screen while it looks great on mine. i need it to scale well with different resolutions
i do it a really weird way but it does work flawlessly, give me a sec
i swear i had it working at some point but i can't find the code so i have no example to understand it. so much appreciated
2-(1.81818*(getResolution select 5))
private _h = ctrlTextHeight _controlSideText;
_pos set [3, (_h + (safezoneH/150))];
_controlSide ctrlSetPosition _pos;
that makes it size 1 on normal ui size
i think thats for normal text ctrls
hmm. i'll that. looks weird indeed though ๐
i'd like to have it by percentage of the control its applied to. would be really useful
like i say, the one i posted is kind of silly but it does work on every ui size. i was doing it another way but found the text still getting cut off eveyr now and then on bigger ui sizes.
I don't know how to change text size, but I know the control size stuffs
This is a button
That's always the same siz
No matter what screen/res/aspect
i believe its different for structured text cause u can modify it in the text itself
nigel. this is about the size parameter inside structured text. i think it works a bit different there. i already scale my controls adapting to safezone and stuff. is why i need the text to follow
so like the one i posted is 1 on small size uis, and 0.727274 on normal uis but they look the same
Are you able to define your own rscText?
nah. i do all my UIs with ctrlCreate whenever i can. i like to avoid configs
i'll play around some more. i just forgot the ratio. pretty sure i asked this before
<t size='1' >
that depends on the size of ur monitor tho?
Yeah
u need one to reflect the UI size ur using
Well if I want to make a control that's 0.25% of the screen I do safezoneH/4
which is 0.454545
on my display
hm. i'm thinking it might actually be the config that is the missing link
do you think there is a size value there and the size one inside the structured text just is a coef for that
?
class RscStructuredText
{
x=0;
y=0;
h=0.035;
w=0.1;
text="";
size="( ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) * 1)";
colorText[]={1,1,1,1};
shadow=1;
class Attributes
{
font="RobotoCondensed";
color="#ffffff";
colorLink="#D09B43";
align="left";
shadow=1;
};
};
ui_f.pbo
It would make sense that the text scales
yea but if u want to set the size in the text itself 0.04 is insanley small. depends how you want to do it i guess.
I think sizeEx is not needed for structured text
class ctrlStructuredText: ctrlDefaultText
{
type=13;
colorBackground[]={0,0,0,0};
size="4.32 * (1 / (getResolution select 3)) * pixelGrid * 0.5";
text="";
class Attributes
{
align="left";
color="#ffffff";
colorLink="";
size=1;
font="RobotoCondensedLight";
};
onCanDestroy="";
onDestroy="";
};```
maybe one is a coef for the other?
Hey guys ๐ Sorry for interrupting, but does anybody know how to disable shadows of playermodels but not of any other objects? ๐ค
Thank though... I'll try to ask it there ๐
You would have to edit the actual model I think
Can I define a local function in a script that is only used within that script like:
_fnc_Local_Function = {
_var doThing _var2;
};
Without having those variables defined? I want to set the function to be usable in an addAction so I don't have to copy and paste the same chunk of code for every command that needs it
if _var and _var2 are defined before u call _fnc_Local_Function i dont see why it wouldnt work.
this is what i mean:
_chat = {systemchat _msg};
_msg = 'Hi';
call _chat;```
ok thanks
So next week I'm going to make my first real multiplayer map, With one side having to take over one fob And the other side having to take there's Anything I should know?
you should be more specific about it, just google first, if you dont find anything there then come here if you are REALLY stuck somewhere and need help.
Valid question
Stud he might need to know is that unless he understood locality he probably will craft a broken mission
And even if he does, his first is going to be a catastrophe
The real lesson is that players never do what youll expect them to
@indigo snow Defensive Programming.
Incremental development is all he needs to really know.
@indigo snow You get it :D.
@sick drum Don't expect everything to work, expect some effort and test everything.
my last experience with this was: making a feature work in SP: 8 hours. Making it work in MP: 4 days. Work out every single kink including join in progress etc: 1 week
i need a to add a addaction to dead and incapacitated players, is the best way to add the action using cursortarget or can i instead add the action to the dead/incapacitated player ? if that makes sense.
@waxen tide Get a programming book on network architectures
You'd be able to cut that in half or more.
just spent the better part of three hours trying to find why a script was halting halfway though only to realize i missed a close bracket at the end of my switch. its deffinetly time to sleep
Should start by using a framework, maybe F3
zenophon's coop fw
Frameworks do a lot of stuff like jip and respawns, so you can focus on your mission, rather than the basics
Yeah but knowing how the nittygritty works helps.
@tough abyss i don't see how that would help. it is more about learning about armas locality, jip handling and things like that.
I think of locality in terms of networking models.
Multicasts, Unicasts, Broadcasts.
@quasi hare get an editor with syntax highlightning, bracket highlightning and a linter. sublime 3, visual studio code or githubs atom can deliver that. oh and autocomplete.
i think learning more about networks would confuse me further honestly.
Yeah, networking is just something you gotta learn
i disagree, networking is the thing you leave to ugly gobblins in the basement.
Multicasting is basically exactly like sending a remoteExec to a select set of clients
Server sends multicast -> clients recieve multicast
Clients send -> Unicast to server
Unicast is simply a message with 1 recipient
Multicast is a message intended for multiple
Broadcast is a message intended for ALL
within that network
so in case of arma 3 remoteExec [0,my_fnc_code,false];
Well thats a broadcast to all clients and server
Locality is even broken down into the Client <-> Server model.
It's just nested layers of it.
E.g
Side - the function will be executed only on clients where the player is on the specified side
Again this is a 'multicast' thats all there is it's simply a message who's destination is intended for multiple recievers @waxen tide
In this case if I passed west, then the multicast would be recieved by all blufor clients.
remoteExec [0,my_fnc_code,false]; wrong?
Sorry I forgot to put it in qoutes..
[parameters] remoteExec [0,"my_func_code",false];
[_params] remoteExec ["my_fnc_code"]; for all
Oh it changed again?
It was always like that
?
** Only 0 and 2 are special. When 0, the function or command will be executed globally, i.e. on the server and every connected client, including the one where remoteExec was originated. When 2, it will be executed only on the server.**
remoteExec ["fnc",_target,_jip];
[_params] remoteExec ["{systemchat 'bla'}"];``` also works
e.g.
```sqf
["blaaa"] remoteExec ["{systemchat _this}"];```
= "blaaa"
hmmm
The 0 does nothing. Might as well use Dscha's version instead.
You can use a object too. or a side
group
Just Bookmark that site and read it for yourself (alot is explained in there with examples):
https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3
Group would be a type of multicast as well
Object a unicast.
@waxen tide How come it took you several weeks to get it working?
Incremental develop as I said, start small
Decide what features do I want.
Then implement the "top priority ones"
to get a basic functionality.
Then you can add on the extras later, going in with a good design from the beginning will help a lot in terms of maintenance and expansion in future.
@tough abyss i think you missunderstood me greatly
@late gull what are you trying to achieve?
@simple solstice they are cas support, i want they stat waiting for support reequest, but they move like dumbs
How do I change the OnButtonClick event handler via script command
I've tried using ctrlSetEventHandler but it returned missing ;
paste the code you tried here and someone may spot an error
_display = (findDisplay 26500);
_ctrl = _display displayCtrl 2402;
_ctrl ctrlSetText decisionButton1Text;
_ctrl [[ctrlSetEventHandler]] ["MouseButtonClick", ""];
your last line is fucked
controlName ctrlSetEventHandler [handlerName, function]
_ctrl ctrlSetEventHandler ["MouseButtonClick", ""] maybe
although the wiki example looks fucked too....it's been a while since I've done any SQF but i can't remember it being this bad
lol how come it has the wiki formatting on it?
that is fucked
[[blah]] is what is used to link different pages
where blah would be a seperate page
example has been unfuckified @grand sleet
somebody edited it and didn't get that you can't link stuff tat is being used inside a code box
:/
I wasn't going mad then? excellent
you're one of the people with wiki editing powers?
yes
one of the few
is there? i thought people in here complained about not enough contributors
lol well they are all too lazy to ask for an account
i'm not sure exactly who to talk to about getting a wiki account
guess i don' get permission to @ anyone xd
not biminnions at least
ah, well good job fixing that example ๐๐ฟ
dwarden would be a good start i guess
Hey guys, it's possible to know if my object it's object terrain or a spawned object ?
kinda crappy
need to do comparison work
not sure if there is a speific one to check if it is a terrain object or not
@late gull well if you set their formation they are going to change positions
I don't think all these set at the beginning are necessary
@simple solstice i use them just for test, it hapens the same without them
Thanks @little eagle
well, this will not work, because when u request the support they do the same
they crash to buildings
can't help you, don't know much about AI :(
yeh, thanks anyway, seems they are just idiots xD
it does not matter, it happens when they go in action
guys please, im about to lose my mind
the stupid AI wont follow the convoy that its supose to do
its randonly decide to go to e diferent place and then follow the actual waypoint
is there any fix to this or at least a work around?
are they in convoy mode?
is there a mode to this?
the waypoints need to have a specific configuration for them to be in convoy mode
what configuration?
no its not
custom map? complex road network?
If that's not working you have other issues
the frist waypoint is literay 10 meters in front of they
yeah behavior should be set to careless and formation to column
they are already in careless and colum
Id avoid careless unless absolutely sure you dont want them to ever break and attack.
the tird car decide to go to a completly diferent road and go into a diferent place
Are they all grouped?
and then the number 4 car follow him on the mistake
yes same group
same stats
they are literay copy and paste of the frist car
Sounds like an AI pathing issue more than anything. Like its trying but cant find a path. Trying using a different road segment?
i can put they in file in the road and they do follow
but ahead in the mission the 4ยฐ fucks up and go to a diferent place
taking the other 2 trucks with him
is it a modded map? or the one from BI? altis,stratis,tanoa,malden?
Takistan
that might be the problem of its pathways, iam not sure tho
try the setup youre using on altis for example, see if it works
there is no way to do that
Of course there is
Merge scenarios togehter
Since it doesn't look like you have much in script
@astral tendon thats all in the mission sqm. I was talking about sqf in the mission root
So it would be easy to merge this to a new altis file
Guys i need help i put an virtual arsenal in one of my scenarios How do I expand it to support every mod That you may have while playing my scenario?
well, to fix my problem i had to do it by brutal force
i made a trigger loop to repeat every one second this code
car2 commandFollow car1;
car3 commandFollow car2;
car4 commandFollow car3;
onu1 commandFollow car4;
onu2 commandFollow onu1;
now they do follow a line and dont fuck up
they drive strange but i can survive with that.
I have a only a .p3d name, and i want to know if it's possible to know the path of it, to create a simple object with it ?
getModelInfo cursorObject
@sick drum does the "AllowAll" condition on the VIrtual Ammo Box do it? ["AmmoboxInit",[this,true]] spawn BIS_fnc_arsenal;
I cant use getmodelinfo, because my object are not created, i want to import object from TB, and some objects doesn't have classname, so i want to know if it's possible to find the path, and create the object with createsimpleobject command
@frail zephyr Let me try it
@tough abyss
I'm not 100% sure it will, just looking at the fnc while at work
TB will have the path to the p3d in the object library. (pretty sure about that, don't have enough free ram atm to start TB to check )
@sick drum There is also BIS_fnc_addVirtualItemCargo for adding items to a virtual container if you want to add a subset.
BIS_fnc_addVirtualBackpackCargo BIS_fnc_addVirtualItemCargo BIS_fnc_addVirtualMagazineCargo BIS_fnc_addVirtualWeaponCargo
Along with remove variants.
@frail zephyr Hey thank you it worked
Awesome! Great to hear that.
Glad I was able to help, was just guessing from work haha
im trying to fix up my Evolution mission- any reccomendations about what script/suite to use to manage spawning enemies and filling the city?
@ me if you got ideas ๐
you want to spawn them in houses? @unique pollen
maybe
i want them to spawn away from players in a marker/city
until the radio tower is blown, then stop
_soldierType = typeOf _soldier;
infantryarray = [["unit_classname", 30], ["unit_classname1", 45],];
_findUnitData = infantryarray find _soldierType;
So obviously this won't work, but I am trying to find a way to get the index in the infantryarray by finding the classname in one of the subarrays contained in the infantryarray
Is there a way I could do this?
something
private _index=-1;
{
if ((_x find _soldierType) != -1) exitWith {_index=_forEachIndex};
}forEach infantryarray;
or
private _index=-1;
{
if ((_x select 0) == _soldierType) exitWith {_index=_forEachIndex};
}forEach infantryarray;
the first one doesn't make sense
it's the same thing as @runic surge posted... Just instead doing the same thing over and over again and expecting a different result ๐
definition of insanity and such
well i guess iam braindead xD
@runic surge _soldierType = typeOf _soldier; _findUnitData = ((infantryarray select {_x find _soldierType > -1}) select 0);
I don't understand how that works what the hell
it doesn't work
That doesn't make sense
_findUnitData = (infantryarray select {_x find _soldierType > -1});
if (_findUnitData isEqualTo []) then {
hint "Awww don't found soldier type";
} else {
hint str (_findUnitData select 0);
};
checking all array inside infantryarray with _x variable, and try to find soldiertype, if found it this will be output an index > -1
And select output all array with this soldiertype classname
Remember find is case sensitive
If I am trying to find "unit_classname" with this, shouldn't _findUnitData return 0, which is ["unitclassname", 30] in the main array?
no it actually does return the correct subarray
I commented out the other bits of code I have and the hint is correct
not sure where the error is coming from
wait one
Can anyone tell me if modelToWorld takes into account the rotation of the object? Otherwise I need to rotate my offset vector before calling it.
No @frail zephyr
Rotate manually, got it
@little oxide I have no idea where the error was, everything is working as expected now
Yep, or else it will be at old coords
Might be a dumb question, but can I pass a local variable into an eventhandler?
Yep, pass it in in the function call along with the this/thisEventHandler params.
Err wait
fn_spawnUnits={
params ["_marker","_radius","_hprobability","_object","_interval","_sprobability"];
_houses=nearestObjects [getMarkerPos _marker,["House","Building"],_radius];
while {alive _object} do {
{
_posArr=[_x] call BIS_fnc_buildingPositions;
if (_hprobability > random 100) then {
if (count _posArr ==0) exitWith {};
for "_i" from 0 to (count _posArr)-1 do
{
if (_sprobability > random 100) then {
_pos=(_posArr select _i);
_pos=[_pos select 0,_pos select 1,(_pos select 2)+0.1];
_unit=createGroup east createUnit ["O_soldier_F",_pos,[],0,"NONE"];
};
};
};
}forEach _houses;
sleep _interval;
};
};
/*
example:
["myMarker",radius,house probability,object (radio tower),interval,soldier probablity] spawn fn_spawnUnits;
["mkr",350,2,myRadioTower,2,1] spawn fn_spawnUnits;
*/
something like that, change it how you want it to be, @unique pollen
Hold on.. local to the EH or to the thing making the EH?
local variable defined outside of the EH, passed into the EH itself
@runic surge You can with BIS_fnc_addStackedEventHandler, but that only supports a few EventHandlers
But the CBA Function CBA_fnc_addBISEventHandler can take all types.
if you use CBA
pls @copper raven use _x buildingPos -1 insted of [_x] call BIS_fnc_buildingPositions;
Why's that?
So I'm not using CBA, BIS_fnc_addStackedEventHandler won't work, and for some reason there isn't a way to pass variables into and event handler. Is there anything at all I can do?
@runic surge use setvariable
And getVariable in the eventhandler
Used that for a long time until I used the CBA one.
player setVariable ["evh_args",[arg1,arg2]];
player addEventHandler ["killed",{_args=player getVariable ["evh_args",[]]}];
wouldn't that require evh_args to be a global variable though?
wat
No its an object variable
They only exist if you OBJECT getVariable them
Global variables live in missionNamespace
@subtle ore totally didn't see the -1 param, that is so much better than a func call.
case sensitive find command + classnames + inconsitent casing for classnames = fuck
oh my bad did you mean all the identities a player used ?
Pretty sure Midnight knows about allPlayers.
@runic surge basically just toLower whenever you do stuff like that. There's some weird stuff with the classnames
_array apply { toLower _x} for ezmode
What if I like upper better
I would have to do the same thing to the classname when it is used in the code later on, right?
fUCK_YOU.exe
You fucked up.
๐
you fucked UPPERCASE
That's so bad I laughed after 3 seconds.
@Adanteh#0761 {toLower _x} forEach _array
pretty sure it should be that
other one doesn't work
wait nvm it uses subarrays that is why
Well it would be intresting to know why this happens... It is weird that my number changes....
https://puu.sh/xFtXE.jpg
If somebody would help me out it would be great and i would be thankful since i need that number as an comparison
toFixed
Float inaccuracy
Use a string instead of a number over 6/7 digits in length
Still has float inaccuracy unless you change how floats work ;)
Better off to use a string for a unique identifier
Torndeco this is intresting to know do you have an article about it also i will read into tofixed
No. He get's the number from the engine. So it will be as accurate as it will be after compiling the string.
commy2 i work with extDB3 i think torndeco could also help with that point
Depends were his vehicle id is coming from. Floats are inaccurate after a certain point. Tofixed won't help with that.
Well I didn't consider extension.
The vehID is comming from the Database
Serga just fetch the id from the databsae as a string, instead of a number
But everything that stays in the game will keep the same binary representation (when compiled and stringified with toFixed).
Isn't a int faster? shrugs thats why i try to use int but if there is no way around it i have to consider that
The game has only floats in SQF.
Floats are inaccurate
If its for a database id don't use toFixed
It will end up adding random decimal points if you add to much length to it.
Just use a string. If its extDB3, SQL_CUSTOM has option to return the insertID as a string (with newer versions)
Sure i will try that that throws me a bit back but should be possible
It will be simple enough you just store the id as a string in arma. It won't effect the database queries (you can still store it as a number in the database)
yes sure but finnaly this question is answerd
Had todo the same in Exile server recently, to many auto_increment ids for players characters
Ouh gawd ๐
Hey, just a quick question: I want to get the classname of all weapons, items, magazines and what so ever in an ammo box. How can I do that? (I want to put all thinks in an Ammobox in the editor that I later want to use in an arsenal. ^^)
allitems/
weaponCargo
magazineCargo
itemCargo
backpackCargo
???
This self awareness puts you above half of humanity already.
Sad but true and also thanks again commy2 i think i did not thank you before...
Well, not the first time that I'm a bit slow today. Its just not my day. xD
you can
how it just throws out errors if it wants the return value
where does it throw the error?
_a = call {nil};
There. Returned nil.
^
_return = if !(isnil "_returnarray") then {_returnarray1 = _returnarray select 1; _returnarray1} else {nil};
_return;
0:03:51 Error in expression <ay select 1; _returnarray1} else {nil};
_return;>
0:03:51 Error position: <_return;>
0:03:51 Error Nicht definierte Variable in Ausdruck: _return
0:03:51 File C:\Users\Lars Schill (Serga)\Documents\Arma 3 - Other Profiles\Serga\missions\Datenbank Projekt\Roleplay_Tannoa_Database_Dev.Tanoa\ExtDB3\read\fn_vehicleIDcheck.sqf, line 8
I really dont even wanna know what this is for
The problem here is that you're operating in scheduled environment and you're using an undefined variable, _return
That's what i meant by learning ๐
So the last line is the problem. Not returning nil with the if statement.
btw you can just:
if !(isnil "_returnarray") then {_returnarray1 = _returnarray select 1; _returnarray1} else {nil}
and leave out the _return thingy
Replace the whole thing with, hold onto your butts:
if !(isnil "_returnarray") then {_returnarray select 1}
about the optimisation i often have a learn process and then an optimizing prozess. This is the learning one. I often throw working code over and write it new ^^
also i know the last line gives (which therefore was limited in my brains to a variable) out the return value
But what you have is unnecessarily complicated and would take me more time to write down and think through than what I have.
Sure it is thats why i do such a bad run and then rewrite it to something smaller better.
Also in the begining i overthink to much about it :/
I guess it's just a difference in practice.
First I though that with enough practice there would come a point were I could write stuff that wasn't terrible. But now I realize that everything will look bad when you wait long enough and look back at it.
Exactly
Where should i run this code the best way BIS_fnc_addRespawnPosition and BIS_fnc_addRespawnInventory? init.sqf or initPlayerLocal.sqf or another sqf?
I have something similiar in the InitPlayerServer.sqf
You'd think the description of the function would tell you.
I think he wants to set a standart Respawnlocation if killed and add a loadout to it
The Question here is is it only the player oder all players(ServerGlobal)
I looked at the function and it has global effects.
So if you use it with SIDE or missionNamespace, do it only on the server.
If you do it with the player object, do it only on clients with interface.
Yup
Relevant part (similar for both functions):
//--- Commit
switch (typename _target) do {
case (typename missionnamespace);
case (typename sideunknown): {
_target setvariable [_varName,_inventories];
publicvariable _varName;
};
case (typename grpnull);
case (typename objnull): {
_target setvariable [_varName,_inventories,true];
};
};
The rest before that is just (clumsily) moving around local variables and params.
Hm intresting this Respawn Menu could be a great addition to my gamemode i am writting atm.
Does anyone know a solution to adjust / change the position of the third person player-camera? ๐
There is none.
Unlucky ๐ But thanks for the answer...
@little eagle "userlist" you can run #userList ingame to return their individual number. seems like serverCommand breaks when a nickname is inserted for executions like ban and kick
as in like this?
publicVariable str _a; // publicVariable '5';```
{
_x allowDamage false;
_x setDamage 0;
publicVariable str _x;
} forEach BTH_RTS_TeamObjects;
Just to update all of the objects in the array. In this case, not sure it is necessary, but scripts later on use the object positions and they are created after clients stop executing init.sqf
no that wouldnt work
Why not?
because _x is an object, so str _x would be "27dca159080# 620063: c_poloshirt.p3d" for example.
perhaps i havent understood the way u plan on making it work.
So I need to convert the variable names to strings first?
But, like I said, I'm not even sure this is necessary
what are you trying to achieve?
I'm just trying to figure out when I should use publicVariable
If I don't stop the client init.sqf with if (!isServer) exitWith {}; then all the objects are created twice (when testing with two players)
so I am just experimenting
yea but why do you need to publicvariable the objects?
their variable names are used in scripts executed locally by players later on (for example, to move one of the objects)
And when I tested earlier, the script executed fine, but the objects didn't visually appear to move
I would need to update the variable after that script too, I believe
Is UID spoofing a thing on Arma still?
pls help if can, simple question. whats better in a host-multiple clients situation: (not dedicated):
publicExec ["true", {
sign setObjectTexture ["swap_sign","billboard3.jpg"];
}];
or
==called only on host===
sign setObjectTextureGlobal ["swap_sign","billboard3.jpg"];
was hoping i could have the jpg only exist on host, and it pushes it over to clients
No reason not to just use setObjectTextureGlobal
mmm thats what i thought, except its being weird one sec testing it
Pretty sure publicExec isn't a real command
wont lie, it is in VBS which is what im using :P
so the issue with setobjecttextureglobal isnt working for me and im just going to blame VBS. ill put the textures on each machine locally. seems faster anyway. thanks
@tough abyss most likely it is the usual thing
you sure you execute the setObjectTextureGlobal command from where the sign is local?
yes
as the bs wiki has no further notes, check out the bi wiki
_block = createVehicle ["Land_VR_Block_02_F", player getPos [20, getDir player], [], 0, "CAN_COLLIDE"];
_block setObjectMaterialGlobal [0, "\a3\data_f\default.rvmat"];
_block setObjectTextureGlobal [0, "#(rgb,8,8,3)color(1,0,0,1)"];```
try that first maybe
Hey guys what do I do when you enter an area and on the bottom right hand side it says the name of the base, How do I put that there?
in theory, setObjectTextureGlobal is the better variant performancewise as it wont broadcast the sqf over net
but rather diectly do it (less trafic) but ... that does not rly matters for your scenario most likely
thanks X39, i didnt understand the material thing. it always has been working in local testing (and in one case it happened so the host failed the texture but the clients got it =/ )
Example In Hunter six you can drive into an fob and it tells you what the name is, I want that
wouldnt it just be a persistent trigger, calling a cutRsc text to the screen?
@sick drum triggers and a BIS fnc i forgot the name of
the triggers can be auto-generated unless you only want certain areas and not all locations
hmm Well something to begin on
https://community.bistudio.com/wiki/BIS_fnc_typeText
https://community.bistudio.com/wiki/BIS_fnc_typeText2
https://community.bistudio.com/wiki/BIS_fnc_infoText
https://community.bistudio.com/wiki/BIS_fnc_textTiles
https://community.bistudio.com/wiki/BIS_fnc_titleText
https://community.bistudio.com/wiki/BIS_fnc_typeText
one of theese
@sick drum
typeText is probably what you mean
arma3? since beta (as no medic system was around but the scripted BTC-Revive)
in general? for way too long
though ... same can be said for arma 3
i am mostly out of the actual scripting ... and started concentrating towards the tool scene
as you probably already know ๐
do you define your functions in config.cpp, or description.ext, or preProcess them in init.sqf and call the global handle for them, or....
im wondering whats the best overall way
i know ace does not uses cfgFunctions due to "performance" bla ...
i personally always used cfgFunctions
I thought there was discussion over that magical 0.0001 ms performance increase with their lovely cba alternatives to CfgFunctions ๐ค
there is actually a real impact by using cfgFunctions
for me in this age of speed, i think human readable is always better in general
but the impact is not rly noticable in reality
Certainly not worth throwing in a depdenency
no
Does it create a dependency or not?
Yeah but what's the point if there is no real noticeable difference?
there are other parts which rely more on CBA
in ace
preferences
probably
most things come down to preferences in the end
thats why there is the macro meme in this channel
the magic 0.00001ms
Ha, surely.
etc.
Bis_Funcs are so much better than VBS stuff
surprising how little VBS actually has
im ean it has some cool stuff like a fileAcces plugin
but it cant even draw lines in 3d environment
BIS_fnc_ is mostly just community made stuff
besides, you could just take it into VBS and it would probably work out of the box
difference between VBS and arma are neglectable anyways
im not so sure about that
vbs lacks stuff a3 has cause completely diff rendering engine
well not completely diff
a generation diff
this for examle is in my link list for GUI references in arma
and in case one asks himself why, because it is WAY better then the arma variant
yeah, that stuff is the same as A2 so thats fine
the differences in arma and VBS are commands available in one system are not in the other and vice versa
no need to
you can mimic that
ive been told by support that its impossible
they said "its only possible with fusion api" to which i responded, i thought fusion was just a layer to sqf and anything in fusion is possible in script
the reply again was "in most cases yes but not this one"
thats verbatim
if you can tell me how to mimic it boy would i be happy
no idea of VBS so cannot rly help you
how do i set 2 task at once?
mhh? @astral tendon
well there you go, maybe it cant be mimicked
i wanna set a optional task to the main task
but i cant set 2 tasks to be activated
Just make a second optional task
wouldnt you just set the task but in brackets write (optional) and not have win conditions in it
how i do it?
You make another task with different completion conditions
that isn't required to win the mission
he wants to have two tasks being the main task at once
that doesn't make sense
not for the native system
but there is also the scripted one
that is also used in the campaign
etc.
were i trow that (optional) thing?
anyways ... saying gn8 now guys
my bed is calling
https://community.bistudio.com/wiki/Arma_3_Tasks_Overhaul
https://community.bistudio.com/wiki/Tasks
leaving this here for you @astral tendon
the rest you have to either ask the people here or get via trial and error ๐
gn8 guys
that does not give any info about optional tasks
@astral tendon you do realize you don't really have to do any of those tasks, there is no such thing as an optional task. They're all tasks. Literally add "Optional" at the end of your task name
but they will receive the notification?
Yes.....?
You can set tasks for specific sides
read up on that tasks overhaul page please
@astral tendon whats the actual issue
you make multiple main tasks right?
and one of them you just label it "(optional)" at the end of the task name?
task2 = player createSimpleTask ["taskName2(optional)"];```
am i missing something?
Hey friends. I'm trying to dig in to a fairly lengthy medical script from the VETERAN mod so that I can get a similar feature to ACE's "Prevent instant death". Basically, a player will never instantly go to the death screen. They will go down with a certain amount of damage if they get shot in the head or something (keep them under the threshold for death but let them bleed out).
This is the script that handles the damage: https://gist.github.com/flexgrip/52e13e25c5205db8b7ec883cc69a5398
Does anyone with better sqf knowledge than me see any easy if statements or something I can throw into that script to keep it from killing folks on a lethal blow?
I've tried adding some damages up and then applying a reduced number, but the best I could do was cause every unit to be invincible. But ultimately I'd like to extend that portion of that mod so that I don't have to alter the core.
Thanks in advance if anyone is bored and wants to help take this up.
CreateSimpleTask is not network propergated.
@astral tendon
So you will have to write a networking system for it.
i figured out
https://pastebin.com/Gm8VT2fP I can't seem to get this to work in multiplayer
I can only see the action from the host player
the object is created only on the server but shouldn't using allPlayers add the action the the objects for everyone?
addaction is local, so no. ud need to remote execute the addaction with JIP for players to see it.
is that init.sqf?
whats the _this refer to in that context @runic surge
is it the result of allPlayers foreach?
shouldnt you use _x with forEach
no hes adding the action to the object. but he wants each player to see the action. the way he is doing it the server will have one action per player.
ah yep, seen
But it doesn't work as expected
i dunno, i feel like its just running it on the server multiple times
its not doing anything to the players
its just running it locally based on the amount of players
yea thats exactly what its doing
[_resObj,[
BTH_RTS_str_CollectResources,
{
deleteVehicle (_this select 0);
sleep 0.05;
private _teamSide = ([west, east, resistance] find side (_this select 1));
private _teamBank = ["BTH_RTS_TEAM_BLU_bank", "BTH_RTS_TEAM_RED_bank", "BTH_RTS_TEAM_GRN_bank"] select _teamSide;
[_teamBank, _amount, true] call BTH_fnc_ManageBank_RTS;
},
_amount, 10, true, true, "", "", 8
]] remoteexec ['addAction',[0,-2] select isDedicated,true];```
i think you need something like this instead Rylan
is it cause the _resObj is private?
addaction adds an action on the target for the client its executed on. the foreach is run on the server so only the server would see the add action (if the server is hosted).
I'm testing it through LAN
2 things you need to know about locality
Is the effect G global
or is the Effect L local
and Are the args Local
_local
or global
globalVar
Thats all you need to know Rylan.
Args : Global
Effect: Local
So if you want the function to be accessible to every client
you have to make it accessible to every client
init.sqf
initPlayerLocal.sqf
@runic surge Is this running on the server or client?
if (_rndDir) then {
private _newDir = random 360;
_resObj setDir _newDir;
};
its rylans code not ryans
Random numbers shouldn't be trusted with the client unless that is something needed like storing a random value on a client
the object is created only on the server
that script creates the object so that script is run on the server id assume. which is why the addaction isnt working.
Yeah server doesn't have a GUI
If you wanted to go from the initServer.sqf to the client you'd simply send it to clients on JIP
yea i know this. is what i suggested with the reomteexec.
if its a setup thing why not just put the code in init.sqf so it executes locally on everyone who joins
Becauses thats not necessary
initPlayerLocal.sqf
would be better.
yup yup
so either way, we've solved it @runic surge ???
I've seen how you can require an addon and override it's cfg. If I end up figuring out how to alter the script I posted above, is there a way to override a script in another mod? Or does that only work for classes/cfg in non sqf?
Or extend an event handler even?
heres my crappy version of a compass strip, and white phosphor night vision https://gfycat.com/gifs/detail/creativeembarrassedafricanhornbill
i would implement something like Slawa's https://gfycat.com/SpeedyUnpleasantFalcon if i had time, but i dont
Super cool man
{deleteVehicle _x} forEach thisList;
this is supouse to delete everyting inside of a trigger once activated, what i did wrong?
it only deletes the objects in thisList, which only contains objects that satisfy what the trigger is looking for
e.g. a Blufor Present trigger, thisList will only contain blufor units
i see
i was trying to test it with a radio command
but, some things are not deleted
like props
I'd use nearObjects and just find everything within the radius of the trigger that way
with position: Position, Position2D or Object (and triggers count as objects)
{deleteVehicle _x} forEach clear nearObjects 100;
generic error
clear is the name of the trigger
nice, now it worked
this will help save performacy
this trigger will be activated by another trigger far away
then you dont even need a trigger! you could use a marker for example, since you only really want to position to feed into nearObjects
for example: forEach (getMarkerPos "clearMarker" nearObjects 100)
you could execute that from the other trigger
btw, that radius follow a circle or a square form?
good to know, i was about to screwup
Man these extDB problems with floats vs ints.... How nice that #Intercept can just use int's :D
@runic surge It will work.. if each object has a assigned variable from 3DEN. But... Don't rely on that. The thingy from like 5 hours ago. about publicVariable str _x
@subtle ore The CBA function compilation vs CfgFunctions one has no runtime difference. But your Mission loads faster with the CBA way like.. several seconds.
Also you can use the CBA way without a CBA dependency.
i cant put a set task to multiple tasks? just one at time?
How hard is it A3 to attach a parachute...
Where the object isn't moving an abnormal speed.
targObj = cursorTarget;
targ = getPos(cursorTarget);
para = createVehicle ["B_Parachute_02_F",[0,0,1000],[],0,"FLY"];
para attachTo [targObj,[0,0,-2]];
cursorTarget setPos [targ select 0,targ select 1, (targ select 2) + 300];
targObj setVelocity [0,0,0];
Attach the crate to the parachute and not the other way around.
It's an offroad.
So? Same diff.
Okay. Makes sense.
Sort of... parachute spawns vehicle is attached to it.
Vehicle floats down with parachute.
The parachute is what floats down really.
Yeah but it's definitely logically inverse you'd think para chute attaches to vehicle no matter what...
irl there is no difference. Programming wise this one makes more sense.
It's not bizzare.. attachTo welds an object onto another.. Meaning the object you attach looses all it's simulation and just clings to the other object
It's the same in Garrys Mod for example.
You're just thinking about it wrong all your life and Arma #logic is enlightening you.
And if you make parachute ignore all it's properties and just do what the offroad does... Then ofcause it's gonna fall like a brick
Yeah, programming wise it makes total sense.
I would think the offroad is interacting with the physics and when you give it something that resists physics it would also inherit the characteristics of the object that it was attached to.
yes.. it does do that
if you attach it to the parachute... It glides down like you expect
Yeah I found the entry in the wiki about that little physics detail
That has nothing to do with this...
I just looked at the page and it's really missing that detail that the object you attach looses it's physical properties and just welds onto the object you attached to
Someone should add that
Scripting this really isn't worth the time or the effort.
No idea what you complain about. Irl there is no way to say which thing is attached to which. And programming wise this makes way more sense. You'd just complain either way.
There is no need to disable the simulation for para-dropping something.
I know that.
But this is a milsim game you'd think they'd add attach points on vehicles by default.
How many times does the military drop hardware into the field?
Often?
I'd rather have it like it is now. Many functions and moving parts you can put together and abuse creatively. Better than something premade. If you need a premade parachute script, google it. There're probably a few out there. And if there aren't, make one.
^
Makes plenty of sense.
Still just isn't worth it I'll stick to spending time on learning real languages.
how do I turn off this shitty discord channel categorization crap? ๐
That doesn't have much to do with the SQF language itself.. You'd have the same effect using C++/Lua/Python.
@halcyon crypt see #general_chat_arma ๐ No.. Don't think so
No but has everything due to a mismatch hodge podge of information. Wiki's have that issue.
At least we now have a voice chat of our own.
The wiki can be edited. Now that KK is gone, it probably won't get reverted.
Ask him not me?
@still forum The wiki is to blame. Atleast with C++ / Python / Lua there is standard books, manuals, etc
Not my responsbility....
The Wiki is community made. If you complain then fix it.
Are you saying any of my changes would be bad?
No a lot of changes are just bleh wrong.
Not my responsbility....
Pff.
Just don't let people believe there is no moderation
You are far more qualified to write the manual than me.
@tough abyss Fix them
Then stop complaining if you don't want to do anything
It's like not voting and then complaining about who won the vote
Man the Fedora community is more helpful than that... attitude...
Stop with the ellipses.
that's because the Fedora community is full of hippies while the Arma community is full of people being frustrated for years ๐
How much more helpful can you get? We already pointed out what's wrong, how to fix it and why it is the way it is, and why it's better that way.
I was just teasing
๐ฎ
hey hey whats that taco hate?
don't hate on teh taco~
hey, cant finde a tutorial for a button on a map to toggel a module. did somebody now a good tutorial? thank you anyway for having this good community
@deft owl not a tutorial and not very sophisticated but: https://github.com/ArmAIvan/ADMM3/blob/master/ADMM3.Altis/functions/mission_start/fn_carrier_deploy_vote_screen.sqf
looks like this ingame: https://youtu.be/BoosQgZodXo
cool thank you for the fast help
but it just looks like its not a way where you can set a status
like on or off
its liked to the mouse, hovering above it or nor
so that means when the mouse dont hover above the icon its off
G'day lads. I have a quick question. I am trying to get a trigger to activate as soon as at least 2 out of 3 vehicles enter the area. I got it working for 1 vehicle but I cant seem to get it running for multiple ones. Can anyone tell me what exactly I need to change?
this and [(conv1 && conv2) || (conv1 && conv3) || (conv2 && conv3)] in thisList;
Just put the vehicles into an array, the count thislist compared to the array if =>2 as condition
alright thanks
So ArrConv = [conv1,conv2,conv3], then count (thislist arrayIntersect ArrConv) => 2 something like that
Lukio's way is the best to go about it, but just to correct your code
[conv1, conv2] in thisList || [conv2, conv3] in thisList || [conv1,conv3] in thisList``` would be the way of writing what you've written
(afaik)
but the count method is superior
Ah alright thanks. Guess I am kinda stuck with thinking in Java >w>
Its so different
@deft owl if you click while being over the icon, that click is registered and triggers
@vale lintel
({ _x in thislist } count [conv1, conv2, conv3]) == 2
Variable '_this' does not support serialization. Call 'disableSerialization' in the current script (maybe '') if you need to use it.
but my function is like
disableSerialization;
// controls stuff
[] spawn {
disableSerialization;
// controls stuff
};
๐ฆ
count ([conv1, conv2, conv3] arrayIntersect thisList) >= 2
Every other answer shows your talentlessness.
@slender halo
Put the control or display you pass inside an array. You can't pass it directly without array.
oh, got it
Because that would mean that _this is a control or display before you can disableSerialization and the game hates that, because it thinks it's smarter than you which it clearly isn't.
๐
๐ was reading a forceWeatherChange docs note detailing that "Don't let the engine takw away your ability to change weather, manually set it and take it back"
count ([conv1, conv2, conv3] inAreaArray thisTrigger) >= 2
๐
what about
count ([conv1, conv2, conv3] in thisList) >= 2```
?
or no, never mind
is there an advantage to using inAreaArray / thisTrigger ?
It's no loop.
Ok - not sure I understand, but ok.
The less stuff you do in SQF the better. Don't you agree? This moves as much as possible into C++ land.
I have no idea of c++ land, never been there tbh, wasn't aware that arrayIntersect loops either so TIL
arrayIntersect doesn't loop. CODE count does.
CODE count: 5 commands, 6 variables, 4 scopes
inAreaArray / arrayIntersect: 3 commands, 4 variables, 1 scope
3 commands actually
You cut the computations by about 40-50% and delegate it all to the internal engine without SQF.
Ok I can see that regarding the scopes, never noticed it being an issue though
Well - not in the situations I use count ๐
{_x in thislist} count [conv1, conv2, conv3] >= 2
[conv1, conv2, conv3] // make array with 3 vars
CODE count ARRAY // walk through 3 element array and report
{_x in thislist} // check if _x in thisList, 2 vars
{_x in thislist} // check if _x in thisList, 2 vars
{_x in thislist} // check if _x in thisList, 2 vars
NUMBER >= 2 // check if float >= 2
count ([conv1, conv2, conv3] inAreaArray thisTrigger) >= 2
[conv1, conv2, conv3] // make array with 3 vars
ARRAY inAreaArray ARRAY // create new array from two arrays
count ARRAY // read array size
NUMBER >= 2 // check if float >= 2
And the count step is cheaper in B) too.
Interesting, I guess from now on I'll take this into consideration, thanks
If it's one trigger, it won't matter much. But you get big things by putting smaller together...
And there is no rational reason for the bias that exists for the count loop. It's only favored, because it's older and it seems that everyone "learns" from someone else's work (read: copy paste).
It would be a shame if inArea(Array) remains unused. They made those commands to be used.
Yeah well we all started off with studying old man murray's guide at one point, sometimes you just use the stuff you are familiar with. ๐
maybe not all, but surely many
I read the wiki. Biggest mistake maybe ยฏ_(ใ)_/ยฏ
At first you're overwhelmed by it, then you slowly begin to make sense of it all and finally you see that the wiki is wrong about at least half the things written there.
why not correct it?
I never said that.
Now that no one reverts it, you might even get somewhere with it.
๐ค
Wat?
Pretty sure in summary: research, multiple sources, solution found
I read the biwiki to help me find a command. I then a search the forums, to find my solution / example. (Thanks @subtle ore)
I had a fart in the brain
I've yet to find a single useful thread about scripting on the forums.
Your horse have taller hooves on today Commy? May need go give your back a rest ๐
Dunno what that has to do with today. It's not like I'll find a useful thread tomorrow there either ๐ค
What makes you think that?
I've seen what the ones before me fabricated and it may not be worse, but it's definitely not better than what we have now.
That's not what i am saying
What i am saying is that the older the threas
The more replies
More solutions
Many of times, a hot thread will detail more than one way of doing something in their own unique ways
I've yet to find a single useful thread about scripting on the forums.
that's a bit much
you might not find it useful but there are useful threads there
Sure, but how would I know if they're not useful to me?
I am telling you. Commy has stilts for hooves on his horse.
Should I better pretend I was a nice person?
ehh humans have a horrible API, with literally zero documentation.
also you helped me a lot with scripts commy2, so you're a nice person in my book.
Commy, i believe that no matter how low in hell your heart is. That as a shell, you're really just being stubborn
why is anyone trying to make it personal lol
this is #arma3_scripting not #bitching
grow up
@rancid ruin ๐
#passionate_scripting
Just trying to spice things up.
Wooohoo ๐ฎ
by the way the way i script is actually the best way
Agreed.
Which is?