#arma3_scripting
1 messages ยท Page 405 of 1
I wish we had a different sign for it
atan2 is actually a thing in coding outside of sqf though. And I must say that whoever came up with the name did a great job.
I wish we had a different sign for it
If I ever make a language, it would use : for division, and / for the fraction bar. With the fraction bar being the lowest priority command of them all, and : being the same as *.
"after the commy rose, now introducing CommyCode (CC)"
Which namespace do variables in onButtonClick field exist in?
wat
I mean the onButtonClick attribule in the button control
@stable wave you can use currentNamespace and isEqualTo
I think he asking about wich varspace he need for he's script above, there he have just nothing_here getVariable
no, his sentence still makes no sense
If there is a function called A which spawns vehicles, if I remote execute it with for every player in the game, it will spawn 1 * number of players vehicles or only one?
one for each player
so you can actually make your server crash if you do this, nice
you can make everyone crash, server included if you call a recursive func
in this case, should be used createVehicleLocal if I want to remote execute that function for everyone except server
wait, what
currentNamespace getVariable default doesn't sound like a bad idea.
i'll explain better with a sqf example
If the goal is to crash the game, then you don't need to create vehicles.
// Function A
createVehicle ... ;
// remoteExecCall
[] remoteExecCall ["functionA",-2];
That would create one vehicle per connected client, except the host.
the goal is to optimize the life garbage ๐
Looks more like a bug.
or an offering to the fire gods
I guess it depends on what the vehicle is that is created.
unless it's a lightsource...
but instead of spawning 1 vehicle, it spawns from 2 to 4 for each player
If it's something that should be for every player, then it's ok I guess.
yes, lightsource
createVehicle ["#lightpoint", getPos _vehicle, [], 0, "CAN_COLLIDE"];
that changes everything
Except that it assumes dedicated server, which is dumb. Why would you intentionally make your mission not being debugable in SP?
oh wait.... that's for "police lights" isn't it....
yep
No, it doesn't. #lightpoint is supposed to be created with createVehicleLocal.
actually, now I'm realizing why you don't like life missions xD
Not sure what would happen if you createVehicle (global) a local simulation.
Depends on how CV handles this.
It is very confusing though, and since confusing code = bad code, it's bad code regardless.
How would you go about go about creating an ingame banner sized texture over a plank of wood of some sort? Ive seen servers do it to place above shops but unsure how its achieved
exact same way people do billboards or how the ACE slideshow works, setObjectTextureGlobal
Ah figured it out, thought it was some fancy way I didnt know of. Simply just using a user texture object with an image with transparency to give the effect that its smaller
also there setFlagTexture if you need make custom flags
@peak plover It's not like the wiki says Return Value: Array for isFaltEmpty
@queen cargo Intercept math commands are already done. That was the first in Intercept-CBA
I know @still forum
is there a single command to remove all items, magazines and weapons from an inventory?
Sure the wiki says it, but the name kind of implies that it's a bool
Wiki > Name
Q: Is this position flat?
A: [3541345,13451541,0];
Q: Where is this postion?
A: Yes
logic
For Arma. Yes
I just spent hours writing a script and when i run it all it breaks, that was the reason
shopInventory addItemCargo (getItemCargo box1)
Does not work for me, I have an idea why
I'm trying to transfer stuff from one box to another
getItemCargo returns 2 arrays one for the class name, and another for the number of that particular items
[["optic_Aco","acc_pointer_IR","NVGoggles","G_Tactical_Clear","H_HelmetB"],[1,1,1,1,1]]
https://community.bistudio.com/wiki/addItemCargo
https://community.bistudio.com/wiki/getItemCargo
True @thorn saffron They are incompatible
I kind of worked out this myself ๐
private _target = shopInventory;
private _cargo = getItemCargo box1;
{
_target addItemCargo [_x,((_cargo param [1])param [_forEachIndex]);
}forEach (_cargo param [0]);
I guess it won't run if I just put it in the console, right?
is shopInventory and box1 assigned to your objects?
yes
try to hint them to be sure that they are assigned
wtf @meager granite
wtf lel
Have seen worse tho
Having tabs for each level would've been a cherry on top of it
Hard to find something worse
lol
Non-quiksilver stuff wasn't part of the challenge
@still forum
(don't come up with quakslivers stuff :smile: )
That's where call {if()exitWith{}} would have helped
Non-quiksilver stuff wasn't part of the challenge
That would be a perfect example where one should use a switch
Now find something worse than that
In this case? Yeah, switch. For the sake of readability
quicksilver stuff >๐ก
using ' instead of "
using private array
Not to you ๐
Worst publically visible script BI ever made
Still waiting for @peak plover 's answer
i disagree with switch dscha
You're a french, aye?
because you'd have to make it a switch (true)
inb4: ๐คฆ
@jade abyss ' instead of " is good. But if he cars of that small helpful '. Why is he using private array? Everryone knows the array variant is slower
We already established that he is an idiot
could also just make it a loop and use BREAKOUTTTTTTTTTTTT
You could also put a finger up your blackhole
how do you make SQF syntax show up in discord?
```sqf
CODE
```
#define DSCHAISLAME(var1,var2,var3) if (sd_xp >= var1) exitWith { sd_level = var2; sd_xpNeed = var3 };
call {
DSCHAISLAME(7000,15,8000);
DSCHAISLAME(6200,14,7000);
}
special commy method
It's good tho
private _target = shopInventory;
private _cargo = getItemCargo box1;
{
_target addItemCargo [_x,((_cargo param [1])param [_forEachIndex])];
}forEach (_cargo param [0]);
{_cargo removeItem _x;} forEach (_cargo param [0]); ```
ok, so this creates copies of the items from the box1, but ```{_cargo removeItem _x;} forEach (_cargo param [0]); ``` does not remove the original items.
bis arsenal is 3k lines 1 file
I would personally make an array of xp,level,xpneed and iterate till I find the right one
yeah same dedmen
And? Nigel?
@thorn saffron Does box1 have more than 1 of that item?
because removeItem removes one
and if you move everything anyway why don't you just remove all items
looks girlish
looks girlish
You would know
Yeah, cause i know some girls ๐
@jade abyss You doo? Are they really as glibbery as everyone says?
sooo true
Scooby doo
@still forum Depends on what you do to them ๐
Guess why some ppl call me DschadoMaso
(okay, noone does... but it sounds cool)
Anyway, @thorn saffron , what are you trying to achieve in the end +where does the Array come from?
you should call yourself dschinghis khan
@jade abyss If you read the code you'll see where it comes from
I already did, Dschangis Kahn
oh, i missed it ๐
@inner swallow https://i.gyazo.com/cc2998de628178854b4e4517d870c29d.png
Yeah, from 1 crate to another @still forum , still wanna know what he is trying to achieve
๐๐ฝ
private _target = shopInventory;
private _cargo = getItemCargo box1;
{
_target addItemCargo [_x,((_cargo param [1])param [_forEachIndex])];
}forEach (_cargo param [0]);
clearItemCargo box1;```
works but if I use _cargo instead of box1 I get the generic error
```clearItemCargo _cargo;```
because: _cargo is the ItemList
duh
clearItemCargo box1```
Ofcause you get an error if you do bullshit that doesn't work
also you don't get a generic error.
Read a few lines lower. Thanks
This looks like the makings of a good life mod
@still forum Hey, i have little idea when it comes to any kind of scripting
Read Biki. Always read Biki.
If you have little idea when it comes to any kind of reading too. You're screwed I guess.
We don't do anything different. We either read Biki or remember what is written there
And how the fuck I'm supposed to know what exactly to look for
You are using clearItemCargo So I would look for clearItemCargo
You were using getItemCargo before. So I'd suggest looking for getItemCargo
it is, yeah. If you know the basics, it's pretty simple.
No need to memorize, at least not everything.
Yeah cause I didn't look at it and I totally did not figure out that the return out of getItemCargo is 2 arrays that are incompatible with addItemCargo
Though granted the Biki isn't that good in explaining the basics. As in syntax. You can read the syntax on every commands page as examples. But it doesn't really explain that well why it is like that
Yeah Taro, thats a pretty big fk up by BI, in that case
ยฏ_(ใ)_/ยฏ
Welcome to scripting, thats a new layer of madness (compared to configs)
I don't know which idiot decided to put the counts in a seperate array.
But I also don't know which idiot decided on the save format of the Arsenal
save Format of Arsenal is? (too lazy to search)
But I know that KK is most likely responsible for get/setUnitLoadout which was good
save format of arsenal is "bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage","bandage",.....
dafork
get/setUnitLoadout is ["bandage",50]
Reminds me on the DayZ Databases ๐
getItemCargo is [["bandage"],[50]]
class Item7
{
class data
{
class type
{
type[]=
{
"STRING"
};
};
value="rhs_mag_30Rnd_556x45_M855_Stanag_Tracer_Red";
};
};
class Item8
{
class data
{
class type
{
type[]=
{
"STRING"
};
};
value="rhs_mag_30Rnd_556x45_M855_Stanag_Tracer_Red";
};
};
This is the true power of arsenal
This!
@peak plover Remove the tabs pls
And that's why storing an array of duplicate strings is the best idea ever
{
_target addItemCargo [_x,((_cargo param [1])param [_forEachIndex])];
}forEach (_cargo param [0]);
For me its hard to create stuff like this, often I just can't wrap my head around this kind of stuff
because not only that format is dumb. But also the way BI serializes Arrays is even dumber
{
_target addItemCargo [_x, (_cargo select 1) select _forEachIndex];
} forEach (_cargo select 0);
๐ก
Or if you want even easier
{
_target addItemCargo [(_cargo select 0) select _forEachIndex, (_cargo select 1) select _forEachIndex];
} forEach (_cargo select 0);
That's probably easier to understand
You just go through all items. Pick the name from the first array and the count from the second
param is harder to understand than select? It's prety much the sam
pretty much the same but what better says select that element from this
this select that or this param [that]
The first basically says exactly what it does
That I kinda figured out that I had to do it like this, the issue with scripting for me is HOW to do what I want
Sure
I guess it depends on case and this case it's better to select
I still have some old stuff where I used select and then did isNil check ๐คฆ
Use the right tool for the job. Always.
param has no place in this job
all, is there a way to retrieve terrain elevation under an object?
not the object elevation itself, the terrain level
fo instance if I want to set an object on the ground under a flying one.
you could do ASL - ATL or something
Terrain elevation under a object?
they mean, if something is flying at 500m and the terrain height below the thing is at 350m, then they want to obtain 350m
yes
i mean i suppose you could only get the X,Y coordinates of the flying thing
and for whatever you want to set under it, it just spawns at X,Y,0 ATL
ok so that would be ATLtoASL [X,Y,0] for absolute, I guess
ยฏ_(ใ)_/ยฏ
i was thinking of a multi step process, but maybe that works too
not familiar with ATLtoASL
cheers
@candid jay
all, is there a way to retrieve terrain elevation under an object?
getTerrainHeightASL getPosWorld _object;
@austere granite ๐ฉ
What happend to your name commy
thanks!
Or do you mean the objects elevation above the ground?
It's a fake account. Some guy is pretending he is commy :U
Now the tables have turned. : /
- Get kicked.
but why
๐ฉ abuse.
Can only get banned so. temp ban which auto removed groups then
You cannot abuse poo ๐ฎ
i wish dedmen would get kicked for his shitty name ๐ฆ
No
Is there any difference between setVehicleLock and lock?
No I have read the wiki and it looks the only difference is one takes a number and one a string
@grizzled spindle that is the difference between them
Just like the note that I told to read on the wiki page that I linked says
Well sorry if that rustled yall feather but i was wondering if there was somehting i missed. Like why create 2 functions that do the same thing? Anyway ill drop it now. Happy new year
Made me physically furious. Happy new yearss
@grizzled spindle Don't ask for reasons, in 99% of the time.
One takes Enum as string which can cause enum errors. The other takes it as number.
both of these commands (not functions) are over 12 years old now.
and lock didn't take enum back when it was added. That was only added 2 years ago
So no one created 2 functions that do the same thing. Back when they were created they were doing different things.
10 years later one of them was extended so it can also do the stuff that the other command can.
@little eagle no longer blue? interesting ๐ค
One of us! One of us!
commy is still blue even if you don't see it
Yeah, he sobs the whole day
Nah, but it's funny being asking by EVERYONE about it.
poop abused ๐
The ๐ฉ is dead, long live the ๐ฉ!
how do you do that?
๐ฉ
๐
Wow, much bulli
Result:
0.219925 ms
Cycles:
4547/10000
Code:
{_x distance player < 150}count allunits;
Result:
0.0366 ms
Cycles:
10000/10000
Code:
count(allUnits inAreaArray [(getpos player),150,150,0,false])
rewriting old scripts is funny
The question is, why is it that much faster? ๐ค
Sounds right
das bretty gud
I would have thought its because theres more done in C++ without going back to SQF
That's right. I was about to write that.
Mine or nigel?
You.
@peak plover @tame portal reason is because count actually calls the code which takes time
whilst the later just iterates over all elements in native code
๐
Bretty gud
You essentially remove an SQF loop, for the price of one C++ loop. Which is much much better.
@tame portal arma also has one if you actually would use community tools ..
ArmA.Studio
I meant an "official" one ๐
though ... the debugger currently is dead due to no interest in it and an update broke it
I've used yours before
Type your code into a terminal
This warrants a poop.
hahah
๐ฉ
sepErate
separate
@tame portal Arma also has a official debugger. It's just BI internal sadly and they never published it.
it's NOT:
defiantly
definately
definily or whatever other variation ๐ก
like i would listen to someone that doesn't like Atom
I've seen 5MB scripts.
Definitely
ASk quicksilver
such a great editor
So have I, and I choose to not have them
what if you missclick a binary file?
Bluescreen
^
soooo tru
brain is having a fart
private _patrolWPs = missionNamespace getVariable ['ai_ins_patrolWPs',[]];
_patrolWPs pushBack _wpPos;
only works if the var already exists
๐ค
You need to setVariable this too.
so use setvar
Because the default isn't already attached.
nope
Yes.
you do if it does the defaeult return
^
But he creates a new one in case it was undefined.
there is no original if it uses default return
And that one doesn't stick.
but if it doesnt exist, it creates a new one but doesnt save it as a global var again
oh, I was assuming it existed
ASUMING
Yeah It's got achance that htis will run before
with extra S
๐ฉ
Asks script related question
Multiple people are typing
learn to read?
Well, this is the scripting channel.
unless he's telling me to type assuming with three S ๐
๐จ ๐บ ๐ท ๐ท ๐ช ๐ณ ๐น ๐พ ๐ช ๐ฆ ๐ท
Ofcourse we are talking about scripting and not poop or random stuff
triggerring initiated
I was pointing out that as soon as theres a question in the room everyone races to answer it ๐
Never seen that in other channels lol
It's more of a competition
because they're fairly easy to answer for everyone involved
Make it a harder question.
now, if commy asked some questions related to his sqf catenary mathemagics nobody would answer
tfw so smart no one can answer your question
i have that problem with UI now in arma ๐ฆ
....
Points intensifies
I'LL HAVE YOU KNOW COMMY WROTE A LOBBY IN 3 DAYS
and rested on the 4th ๐
(we don't have troll emojis, i'm improvising)
thonking
the actual interesting part is getting the lobby working ingame
the actual coding is mostly just busywork
literally sqf in a nutshell
If I write something, and this might seems strange to you, it is implied that it actually works. EVEN INGAME.
filled with bugs
gibs me lobby lol
not sure what you try to imply @little eagle
@little eagle you might want to make sure you add a thing that you can limit slots to a Donator tag
ctrl+F in ui_F -> done
where did I put my torch again...
It's easy to expand for anyone with a bit of knowledge in sqf. Atm it's pretty bare bone.
bit of knowledge in sqf
life
maybe you can implement the AltisLifeCoin crypto too to unlock slots
I have P as a project in ST3. So all I need to do is to ctrl+shift+F if I want to find something in the games sqf source.
Is ST3 some sort of atom package?
burn him
Kappa
no blobs, no kappa, discord is clearly the inferior product
Someone attach a ๐ฉ to this worthy post.
commy blue power got absorbed by dedmen, in the end there can only be one !
https://github.com/acemod/ACE3/pull/6000
6000 Pull requests ๐
I wonder how many i'm at
Actually it's issues and pull requests, but shh.
And the number of commits on master will double once medical-rewrite is merged.
319 for commy
defenetely time for that.
question, how can I get the name of a object im looking at when I use addAction, im tryna make a force pull action cause why not XD
nopenvm
I got it
hey guys i'm wondering if you may have a solution for this. I'm spawning a function with a parameter. Is it possible to change that spawned function by calling it with [0] spawn _oxygenON; or how would you go about breaking the loop?
[1] spawn _oxygenON;
oxygen.sqf
_oxygenON = {
_state = _this select 0;
while {_state == 1} do stuff
i guess that would just be calling the function all over again
@echo rivet
while{_state == 1} do
{
if(_state == 0) exitWith
{
//exit current scope
};
};
omg kill me
Lol
it is noit @echo rivet
you probably gonna need an actual global variable
alternativly you could just take the spawn script handle and use terminate on it later on
spawn itself however, will always create a new instance of that (and not affect the existing instance)
I need someone to help me find the reason why my function isn't executing using the call command
Basically what this script does is create an ambient heli that is spawned randomly 3000 meters around the player. Then it moves across somewhere near the player. It works when executed via execVM but when I call it it doesn't execute. The function is defined.
ok
๐
I tried calling the function with sqf _w = [] call a3e_fnc_AmbientHeli; but the code never executes
Just first what i see private <array> and private <string> are deprecated
function is defined ?
where you call it ?
is this exact how you call it ?
_w = [] call a3e_fnc_AmbientHeli
yes
where ; at the end ?
_w = [] call a3e_fnc_AmbientHeli versus _w = [] call a3e_fnc_AmbientHeli;
yeah ik I just typed it out quickly, it wasn't a copy paste
so when you call it nothing happens or some errors ?
No errors are thrown that's why I'm so lost
execVM works perfectly fine keep that in mind
then maybe something wrong in cfgFunctions
i mean where you define it and how you do it
file name ?
functions.hpp
no that function file name
you have there
class CfgFunctions
{
class A3E
{
class drn
{
class DRN
{
class AmbientHeli {};
};
};
};
};
what is
class drn
{
};
hmm
not sure but all the other functions work properly
_w = [] call drn_fnc_AmbientHeli;``` Now that I think of it I might have been using this instead
I can't currently test my script bc I'm away from home and don't have access to arma, is there a way I can test it online?
i don't think so
Dash was supposed to implement something along the lines
Dash ?
yeah its an IDE for arma 3
oh ok
SQF-VM could. But it doesn't have CfgFunctions
Is there some restrictions on compiling a block of code? Could there be anything preventing it from being compiled?
If you have a syntax error it won't compile
If you are still here in an hour I maybe can take a look at it. Maybe I'll see something
Right, the thing is I don't have a syntax error because the script runs perfectly ok with execVM. When you have the time take a peek. https://pastebin.com/vDR6H9Y3, fn_AmbientHeli.sqf. https://pastebin.com/bkACQKWT, functions.hpp.
https://community.bistudio.com/wiki/Functions_Library_(Arma_3)#Tag
Meaning your function is DRN_AmbientHeli not a3e
yes I think you just need remove that subclass drn
yes sorry
yeah I realized that earlier, I did infact call the function using sqf _w = [] call drn_fnc_AmbientHeli;
I was reading that if you have call return a something and the function doesn't return anything it will throw an error. Does this mean it could halt the function completely?
asking does this make a difference sqf _w = [] call drn_fnc_AmbientHeli; vs sqf [] call drn_fnc_AmbientHeli;
i think it depends on where you are using it and how, if function not returning anything that not mean that it will throw an error
and error can hold anything i believe if just halt ๐
I'll just wait till I get home tomorrow and try again
glhf
@ะะตะปะบะพะฝ#5567 I was reading that if you have call return a something and the function doesn't return anything it will throw an error. There is only one very rare case how you can make a function return nothing. And that thing is a bug in the script engine
@worn igloo
I need a script to put in the debug console to damage the vehicle I'm in, what do I type?
(vehicle player) setDamage <damage>
what value do I put in just for a little bit
has anyone been successful in making the player switch to another team and unit on death? (MP-mission)
I have tried to create a new unit by script and use selectPlayer _unit, but nothing happened.
also tried to join the player to a new group from the correct faction, but then it seems like respawning starts to freak out.
what I want to do is whenever a west player dies they change faction to resistance, and if they die again as resistance they just respawn as normal
@scenic shard use createAgent command and not createUnit. (EDIT: selectPlayer should apparently work with createUnit as well)
selectPlayer _agent;```
And also, thats not really possible with ArmA right now, you are all in different factions, Blufor, Independent, Opfor, Civ etc. I mean the closest you'd get would probably be to put everyone on civ and then just spawn them with different clothing.
Your player will always be the faction he selected in the slot selection. You might be able to find some workarounds to make other people believe he is of a different faction
Easily doable with selectPlayer. If it doesn't work for you, you made a mistake.
hm ok, then I'll go back to that version and try to see why it didn't work
If you post your createUnit code we can maybe help you a bit better.
@scenic shard post your code or pastebin link and that will help people here to spot obvious errors / make suggestions
Has anyone heard of an issue where players spawning sometimes become invisible and cant move until they relog?
No.
That sounds quite strange.
Follow exactly what happens when they log in and you will most likely find an issue that comes with it.
@warm gorge
Yeah always get complaints but can never reproduce it myself
Check your code before they log in / gets logged in and try to think what code can cause some of these issues.
hey, i'm trying to pass a bool value to this function using the following. But I get Error ==: type bool, expected number, string, not a number etc etc. I don't get why this doesnt work >.<
[[player, true], "A3W_fnc_oxygen", false, true] call A3W_fnc_MP;
to function
oxygen.sqf
private ["_player","_state"];
_player = _this select 0;
_state = _this select 1;
while {_state == true} do
{
_player setOxygenRemaining 1;
hint "Oxygen";
if (_state == false) exitWith {};
};
Did you try to read the wiki?
yeah i stayed up for hours last night trying to find whats wrong, tried different solutions
If you read that you'll know that you can't use == with bool's
And if you'd further think about that you'll notice that comparing bools actually doesn't make any sense
What's the purpose of this?
Because bool == true is the same as bool
and bool == false is the same as !bool
while {state} do
... if (!_state) do
What's the purpose of this?
because it gets stuck in the loop
Well yes
keeping the oxygen from dropping
A3W_fnc_MP
Again
Scroll all the way down and read the last note
waitUntil only exits if you exit with true. You however exit with nil which is not true
also.. Your exitWith doesn't even make sense because if _state is not true it will exit anyway
There is no waitUntil in his script
And you also never set _state to false
SQF isn't magic. Variables don't magically change their value
think i bit off more than I could chew, im quite new to scripting in arma
Yes there is no waitUntil. Didn't even see that
@echo rivet Where do you set _state to true?
So this is for a diving mission - not addon - that's supposed to make the player be able to hold breath forever?
@still forum I pass true from [[player, true], "A3W_fnc_oxygen", false, true] call A3W_fnc_MP;
until I change it
it's not even that
@echo rivet Where do you change it?
it's not BI_fnc_MP
That was what I originally wanted to ask. when you set it to false not true.
later in the code with [[player, false], "A3W_fnc_oxygen", false, true] call A3W_fnc_MP;
Why is this be ing remote executed
Most likely a copied function from BIS_fnc_MP though @lone glade
You are calling the function a second time with a different parameter
that doesn't change the first instance of that function
why do you set the servers oxygen on serverside anyway?
@echo rivet I would say use a global variable instead, if you want the loop to ever end, you need to set that to false somewhere
I dont think its serverside if hes passing player
Nevermind I didnt read the code properly, my bad
Tbh, I think the player needs to be local in order to set the oxygen
This is like 5 lines of code if done properly. No idea why you're all making it so complicated.
Again a reason why it doesn't make sense to remote execute it
^^
lurre_globalVar_state = _initialState;
while {lurre_globalVar_state} do
{
player setOxygenRemaining 1;
hint "Oxygen";
};```
ok so here is the code I use to try and switch side:
player addEventHandler
[
"Killed",
{
params["_oldUnit"];
if (side (_unit) isEqualTo WEST) then
{
private _group = missionNamespace getVariable "indGroup";
if (isNil "_group") then
{
_group = createGroup resistance;
missionNamespace setVariable ["indGroup", _group];
};
_newUnit = "B_RangeMaster_F" createUnit [position _unit, _group];
selectPlayer _newUnit;
}
}
];
seems like a unit is created fine but I dont get control over it and get sent to the respawn screen
i read it was best practice to execute such scripts serverside to prevent hacks
@echo rivet read my paste above
Don't believe everything you read on the internet.
Then just change lurre_globalVar_state to false whenever you want to end it
@echo rivet You should stop caring about "best practices" that some idiot told you if you don't even know the basics
Doesn't make sense to think about security if your code doesn't even remotely work at all
@scenic shard I immediately see that you use createUnit wrong:
NOTE: THIS SYNTAX RETURNS NO UNIT REFERENCE!
https://community.bistudio.com/wiki/createUnit
So of course you can't use selectPlayer if you don't have the object reference.
Also, oxygen is not really something that is critical to have very secure.
@still forum yeah that makes sense
im just in it for the learning, its' a pretty useless script even if it works ๐
@echo rivet did you see my snippet?
_initialState is a parameter
That code needs some breaks though. No point in resetting the players oxygen 12 hundred times per frame.
just use a waitUntil instead of a while
^ this tbh
Why?
Because waitUntil only loops once per frame
1 code block, not 2.
@little eagle aw crap, thanks!
while loops forever until 3ms are filled
could sleep it for a couple of seconds, it takes a while to drown
Or maybe 10k executions. but I guess the 3ms is reached first
Or if (oxygenRemaining < 0.1) then {setOxygenRemaining.......};
@echo rivet
Instead of sleep
You will always drown with this if the player has low enough fps, and enough other scripts are running, because the scheduler is ๐ฉ.
You could use a waitUntil block as these guys said, but then inside the while loop
Also now when I think about it, pretty pointless to have an initialstate parameter so you could remove thath @echo rivet
Just set the lurre_globalVar_State to true at the top
Also, I would recommend to not have this running all the time, but rather if (surfaceIsWater position player)
That check is probably worse than just using the setter anyway every time.
Maybe even using onEachFrame for this
Wouldnt really help if the player has low FPS though
Dunno, if he never experiences the scheduler falling asleep with your setup, who cares. Hard to motivate people for edge cases if it means they have to use their brains abit.
Don't think you can drown between frames ๐
That is most likely true, hehehe, but they could if their FPS was really really low and it checked for getOxygenRemaining.
I suppose.
No, because you'd reset it.
Even if the simulation is slow, you reset it every frame.
I didn't mean reset each frame, but check each frame
if (getOxygenRemaining < 0.1) {setOxygenRemaining...};
You mean like the frame is so long that it's enough for oxygen to reach zero, and we assume the check to kill you happens before sqf?
Something along those lines ๐
Pretty sure other things start breaking down at 0.1 FPS.
Could be tested if it actually happens. I still have my doubts. I bet oxygen reduction is slowed down with simulation time.
Would be fair.
The actual damage script is in an FSM I think
Ayy, that would make sense.
Except for AI stuff though, what actually is a good use of FSM? I've never really used it much.
Everything that operates in states, I guess.
^ for real state machines
I like how the first example is showing something that could be implemented in SQF without the FSM editor.
As a design concept it's fine, but the actual FSM editor and .fsm files are horrible.
join the chat someone
Y-you just tagged a random person.
Discord didn't even show me when I wrote the mention
Discord says there is no "someone" so I thought I could post
Ok thanks for the input everyone. Here is the fully functioning script. It will be available for admins on a wasteland server.
if (isDedicated) exitWith {};
if ((getPlayerUID player) call isAdmin) then
{
if (isnil "OxygenSwitch" ) then {OxygenSwitch = 0};
if (OxygenSwitch == 0) then
{
OxygenSwitch = 1;
OxygenRefill = true;
while {OxygenRefill} do
{
player setOxygenRemaining 1;
hint "OxygenON";
sleep 10;
};
}
else
{
hint "OxygenOFF";
OxygenRefill = false;
OxygenSwitch = 0;
};
};
admin aboose
tss ๐
when I exec this part from the debug menu I spawn a new unit and take control of it as it should. but when it's wrapped in a killed EH I die and respawn as normal.
any idea how to fix it?
private _group = missionNamespace getVariable "indGroup";
if (isNil "_group") then
{
_group = createGroup resistance;
missionNamespace setVariable ["indGroup", _group];
};
_newUnit = _group createUnit ["I_Soldier_A_F", getMarkerPos "respawn_west", [], 0, "NONE"];
selectPlayer _newUnit;
because the respawn code is ran after the killedEH
is there any way around that, or any way I can disable the respawning for that unit. as it is no longer the "real" player unit and should not be used anymore
set the respawnTime to 0.1 and use respawn event instead?
hmm, is it possible to have different respawnDelay's for different factions?
No.
ok, should be fine anyway. just need to duplacate all the respawn markers for both teams.
Modify the existing fields with your units, vehicles and groups.
In the initVar.sqf, when the files are compiled and called, add a condition to run your files when a condition is met.
Load the game with the mod of that faction.```
Any idea how I could do this?
Antistasi trying to change the faction from CSAT to NATO
Am a total noob when it comes to scripting so bear with me
@still forum
15:22:56 [0,310.372,0,"XEH: PreStart started."]
15:24:09 [0,383.486,0,"XEH: PreStart finished."]
Do you see how bad it is?
70ms ain't bad
70 seconds, alganthe.
@little eagle did you profile how much of that is ACE?
All minus 2 seconds.
Do you want me to add that to my profiler? Log the compile time for EVERY compiled script?
So you can find what scripts take the longest?
It's preprocessFile, not compile.
preproc is cheap tho
Hence, preprocess at addon build.
Well that is what you all keep saying, but the numbers don't add up.
How about you compile at addon build? :3 Dats awsm
No ACE, duh.
ye
2 sec preprocess / compile for CBA looks right.
Maybe I'll do that when I can dev again
Though even that could be sped up.
not even onsite
well..
I have a offsite backup off some of that stuff
but I deleted that after moving it away
did you lose anything important? ๐ฆ
so it's only theoretically a backup of some of the stuff
not yet
It isn't fully dead yet
sucks ๐ฆ
Hey ace people need quick tip
I converted the ACE3 settings to cba settings
where does I put them ?
from a mission?
For server
build the template that comes with cba
https://github.com/CBATeam/CBA_A3/tree/master/template/cba_settings_userconfig
why does this code throw a missing ; error?
_lightSource = createVehicleLocal ["#lightpoint", getPos _vehicle, [], 0, "CAN_COLLIDE"];
did you copy-paste that or typed it off?
what about the lines above/below that?
need more context
How do you know that exactly that bit throws the error?
_vehicle = vehicle player;
_lightSource = createVehicleLocal ["#lightpoint", getPos _vehicle, [], 0, "CAN_COLLIDE"];
this into the debug console
okey
Well. I see that your code is wrong and absolutely won't work like that
but I don't see a missing ; error in there
yes
yes it is
The error message usually shows exactly where something is wrong
AHH
I see
before [
the createVehicleLocal command doesn't exist
๐ค
There are 3 types of commands nular (0 arguments), unary (1 argument), binary (2 arguments)
and there is no unary form of createVehicleLocal
unary?
meaning the game falls back to reading that as a variable. So you have written
_var = _var2 [array]
which doesn't make sense obviously. So the compiler uses the universal "missing ;" fix
@jade abyss https://en.wikipedia.org/wiki/Arity
In logic, mathematics, and computer science, the arity ( listen) of a function or operation is the number of arguments or operands that the function takes. The arity of a relation (or predicate) is the dimension of the domain in the correspondin...
I always like saying how it really is although that confuses everyone. But it's how it is. That command doesn't exist.
A different command with the same name does exist. But that one in the code doesn't
yes
๐ค
"A different command with the same name" could confuse people. As most people assume "same name == same command"
Creates an object of the given type. ๐ค confus0rt what you mean with "not the same command"?
There is no "createVehicleLocal ARRAY"
A command exists of name and number of arguments
The createVehicleLocal 1 argument command doesn't exist
Ah, you mean != same syntax's available
but there is a createVehicleLocal 2 argument command that does exist
You really confused that to no end Dedmen lol.
Syntax is part of the command
dfsgndsfngdnfsgndfsgn
They are not seperate
Yes, that isn't of any confusion.
Like
- ARRAY
and ARRAY + ARRAY
Completly different commands
But most people would say it's the + command. But it really isn't
Are you drunk? ^^
I honestly thought you were implying that createVehicleLocal was createVehicle just with local effects applied
no ^^ Just a Intercept dev that knows how Arma works
But yet, the command createVehicleLocal is there ๐ค
The binary command createVehicleLocal exists.
The unary command createVehicleLocal doesn't exist
You overcomplicate stuff atm
nular/unary/binary is part of the command's identity
That is how things work in the engine. It's the reality
Yet, you overcomplicate it^^
I'd say that's needed to understand why it complains about a "missing ;" when you just missed an argument
"Cookie_F" createVehicleLocal _cookiePos:
//real
"RaisinCookie_F createVehicleLocal[_pos]
//not real
Is that what you're trying to say?
no
Or? I am confused
I think everyone is atm
"Cookie_F" createVehicleLocal _cookiePos exists
createVehicleLocal _cookiePos doesn't exist.
That was never in question?
That is what caused the error though. So.. I'd say that was in question
In what way? An array was used as the right param?
He used a syntax that doesn't exist. Which is some kind of wrong
No. He only had one parameter
There is no createVehicleLocal command that takes one parameter
Yep
Arma has 3 tables of script commands. 0, 1, 2 arguments.
He had a command with 1 argument with the name createVehicleLocal.
So Arma sees "Hey! 1 argument" so it looks in the table for commands with 1 arguments.
That table doesn't contain a createVehicleLocal command. Thus it doesn't exist
And again, you overcomplicate and confuse ppl, when you write: the command xyzdoesn't exist.
But that's how it is
furry
And that's why Arma tells you "missing ;" instead of "invalid argument"
๐ฟ
Just type: Wrong Syntax.
ppl get that quicker and easier, than your binary,unary, whateverarty stuff from above.
ยฏ_(ใ)_/ยฏ
Okey yeah. The syntax was wrong. Here is how it would be correct:
_lightSource = createVehicleLocal;
["#lightpoint", getPos _vehicle, [], 0, "CAN_COLLIDE"];
Just like Arma recommended to you in the error message
no
It could add a unary createVehicleLocal command though with same syntax as createVehicle
Which would make the error go away
Useful? I guess?
IMO createVehicle and createVehicleLocal should support the same kinds of arguments
/shrug
But this is Arma.
ยฏ_(ใ)_/ยฏ
Intercept won't be only on the server if you also use it on the client
Well is there any indication as to why it wasn't so to begin with?
Some BI dev was too lazy/forgot/didn't think about it
Heh
aka "never needed it"
I mean, the initial Version was the same, just the Alternative Syntaxes are different
Right
Syntax:
type createVehicle position
type createVehicleLocal position
Just why not make it consistant?
Then find the guy that forgot to update createVehicleLocal and throw some old newspapers at him
Old newspapers? Hot coffee, he'll remember weeks after to get into gear
@little eagle - It didn't work ๐ฆ
_vehicle = vehicle player;
_attach = [[-0.37, 0.0, 0.56],[0.37, 0.0, 0.56],[-0.5, 2.1, -0.95],[0.5, 2.1, -0.95]];
_lightBlue = [0.1, 0.1, 18];
_lightleft = "#lightpoint" createVehicleLocal (position _vehicle);
_lightleft setLightColor _lightBlue;
_lightleft lightAttachObject [_vehicle, _attach select 0];
_lightleft setLightBrightness 0.2;
still can't make it work properly, everything seems to run without any error, but I still can't see anything. It is supposed to create a blue lightpoint.
the funny thing is that with createVehicle, it works
with createVehicleLocal nope
I'm retarded and need sleep
thanks to all your replies before
still tricky to me with all this fancy stuff
Table indexโs start at 1 k bye
Ok, i'm gonna ask here as well
How do i move a group of players, into a vehicle on a dedicated server
because i can NOT get it to work
I currently used this setup, and it only moved a few people into the vehicle:
4 groups named alpha, bravo, charlie & delta and 2 vehicles names plane1 & plane2
@winter dune Is this being executed on a client? Server?
any ideas why [_foreman] remoteExec ["SCAR_UCM_fnc_addActionsToForemanLocal", 0, _foreman]; run on server, does not call SCAR_UCM_fnc_addActionsToForemanLocal when a player dies and reenters game?
_foreman is an invincible AI.
You use another function with foreman as id, that replaces this one?
no this is the only one.
Well, JIP is only executed if you join in progress. They probably never disconnected from, the game.
settings are respawnOnStart = -1; respawn = 3; respawnDelay = 5; respawnDialog = 0; respawnButton = 0;
ok but then they should still have actions
my issue is that actions on foreman are lost.
and i have no clue
How many of these foreman there may be?
Then just use true as JIP flag, and consider this syntax to be broken.
Wouldn't be surprised.
i have the same issue with other ai, and those can be killed
addActionsToForemanLocal is CfgFunctions?
itโs one of those moments where i really want to uninstall arma and set it on fire
yes it is.
So you're saying if I do:
{
diag_log [clientOwner, _this];
} remoteExec ["BIS_fnc_call", 0, cursorTarget];
as local host, it will print on a second machine, but not if I go back to lobby and reenter?
That is something that can be tested.
Btw., again. If you use the same object as JIP flag twice, you will overwrite the previous RE from the JIP stack.
So this syntax is in any case really shitty for this
Is it possible script a gear dialog open for vehicles like you can a player?
Since no vehicle weapons or mags have icons, I'd say no.
Well no i am talking as if the player were to open the inventory of the vehicle to see their MX for example whilst out of the vehicle
Just press G/I and switch from container to "player" or something like that. Done that before.
So workaround time? Lovely
I don't get what you mean. You press G/I and there's your inventory?
Where's the workaround?
scripted
So I assume just opening the dialog the normal scripted way doesn't work?
do you know if variables set with setVariable and global are set on clients before init.sqf is called on them for JIP?
Pretty sure they are.
Who knows. init.sqf is always a toss.
This works for me. Second array on the right was before I (the unit looked at) returned to lobby and reentered.
So it was executed again.
Note how I used player as JIP id, and it just reported it's netId. I'm 99% sure you just re-use the id in a second script and it overwrites the previous function from the stack.
You went back to being a noob? ๐ฎ
๐ฎ
the veteran tag ๐
lol
i am not, itโs running only once on server. oh well.
I can't reproduce then.
Probably. Looks fine for me. Sometimes it converts to jpg, and on jpg it's always hard to read texts.
{
diag_log [clientOwner, diag_frameNo];
} remoteExec ["BIS_fnc_call", 0, player];
Was the code.
do you mind pasting that code here so i can see it?
Done.
Executed locally on the host.
Back to lobby: frameno updated, owner the same
DC from game: frameno updated, owner incremented by 1.
So it always executes again.
Using mods? Maybe a mod uses RE with jip id.
Just make a small framework out of this. Put all RE functions in an array and setVariable public them. Then on client, walk through that array on all units or something.
This RE syntax is wonky anyway.
ok
Hey, can anyone help me with (what I think to be) a small project? I'm trying to figure out someway to make an ingame chat command or something where you can type in a password to gain access to curator or become a moderator. I'm a very novice scripter so while I have the idea in my mind, I don't know how to create it.
Yeah, I know that, but what if you wanted a second zeus that wasn't admin? Since you can only have one admin on at one time.
hmm then no clue
Couldn't there be way to trip some sort of trigger that assigns curator to the player who triggered it?
Using game logic and an outside script?
If this is typed then call upon code elsewhere?
I really don't know.
Using mods?
No, trying to do this for my unit's public server, but I can use mods for regular operations
I think this is a two part problem. First to make custom chat commands, second to assign a curator by script.
Both of which are possible. But don't know where your problem is.
The issue I havve is I have little idea how to do it. I don't know how to script it.
Both steps?
๐ฆ
Most of the scripting I'm doing right now is searching online for code and editing it as I go
Oh boy.
It's working so far, we're making an annex and invade. I just don't know the syntax or the functions to use
It's working?
What I've been doing, the annex and invade, I've gotten a teleporter script to work and an automated gate script.
but I haven't gotten anywhere with this because I don't know where to start
I was looking online and found something for custom chat commands, but I wouldn't know how to use it to assign a curator by script
// '#skipTime 12' will make it night
["skipTime", { parseNumber (_this select 0) remoteExec ["skipTime"]; }, "admin"] call CBA_fnc_registerChatCommand;
You mean this? Because it requires CBA / mods.
But it would make one step easier for sure.
wow
Thanks, I didn't know about that
So if you change "skipTime" to something else and type it in while CBA is active, it will make you admin?
Would there be a way to directly add curator without becoming admin? I mean not that it matters to much because you could have a MCC zeus then a second zeus using this method (or atleast I'm assuming you can).
Something like this is how you add curator by script:
// init.sqf
if (isServer) then {
commy_ZeusGroup = createGroup sideLogic;
commy_fnc_assignCurator = {
params ["_unit"];
private _logic = commy_ZeusGroup createUnit ["ModuleCurator_F", [0,0,0], [], 0, "NONE"];
_unit assignCurator _logic;
};
};
And this is how you'd execute it on client:
_unit remoteExecCall ["commy_fnc_assignCurator", 2];
Wait so how does this work?
Creates a zeus module and assigns the passed unit to the zeus module, which means Y can be used to open the curator interface etc.
_unit is a global command right?
No, it's a local variable, but close.
So if I have this in the init of a unit, then they can become a curator?
Well, _unit would have to be this for the init box.
And I guess the init box is executed on every machine already, so the RE part should be adjusted to not spawn a ton of curator logics for no reason.
Isn't this the same as creating two game masters and making units the owners of the module?

