#arma3_scripting
1 messages Β· Page 453 of 1
I think this was the first time I tried to add a note via the way it was intended to... And it failed..
Yeah I just added it manually now
Thanks, I was rolling around google to find a exemple like that I made, that will help allot of new mission makers.
you're pipes are probably leaking. You should call a plumber
while (drained ud9d-1) do {ud9d-1 drink water;};
feck water.
thats what a nice bourbons for
@digital hollow generic error in expression expected number type number
More like liver.exe out of memory.
looks around
psst, ud9d-1, there are a lot of germans here
shh
they might hear you.
They will admit it π
I have a german bar round the corner from me, they server drinks in glass boots , I went out a while ago, and tried wearing the boots... didn't end well.
string syntax
π€
Just put getAllHitPointsDamage into a watch field and copy the results out.
copyToClipboard str (getAllHitPointsDamage _thing # 1);
???
@digital hollow, that's a good idea!
@little eagle, interesting. WHY is it that way?
Why is what the way it is?
My orca is named Orca.
Oh, I mean, could you explain to me why the syntax for that goes that way.
copyToClipboard str (getAllHitPointsDamage Orca # 1)
I don't understand why we do it that way, or why it should be done that way, if that makes sense.
π€
There is no "why". It is the way it is, because the people that made SQF made it that way.
It's arbitrary. Just like any language.
getAllHitPointsDamage reports an array containing three arrays.
Array one is the HitPoint names, which are not unique and therefore useless.
Array two is the selections of the hitpoints. The part in the model that can detect and receive damage, which are unique and therefore infinitely more useful than hitpoints.
And array three is the current amount of damage.
Elements in the three arrays belong to each other by index.
You're only interested in the selections, so you pick array number 2 (index 1).
To copy the array to the clipboard, you need to convert it to a string. Because for some reason, copyToClipboard only works on strings.
That's it. All commands explained.
VERY cool. Thanks so much. I am actually finally getting to the point where I'm understanding this stuff, but the page on strings was just not helpful. It looked like gibberish.
You mean the description of the str command?
Yes.
Converts any value into a string by placing " and " around the argument. Since Arma 3 v1.63.137891 this command will correctly escape all " inside a string:
// Before the fix:
hint str "string "" string"; // "string " string" <- invalid string
call compile str "string "" string"; // ERROR
// After the fix:
hint str "string "" string"; // "string "" string" <- valid string
call compile str "string "" string"; // OK
When used on object, object debug name is returned.
Oh, I guess that's the issue.
I didn't realize it was a command? IDK.
Still don't quite get that one, I guess.
" and " is a dumb way of saying something, because it's the same character twice.
err...
str ANY is a unary command that stringifies/serializes the input on the right side and returns a string.
But! Thanks to you two I got the hit points on the Orca. Answered a question I've had for years now. Haha, going to try to make the hull invulnerable on helicopters if they are below a certain speed and radar altitude, to prevent this dumb shit: https://www.youtube.com/watch?v=c2JtfFpALJA
Did you think str was some special keyword and not just another command of the thousand plus we have?
No, I thought a string was just a format like an array or something.
well, it is?
So str != string?
....
we should have a command like srt but reverse to remove strings
str is a command, and not data.
Gotcha.
str 80085 >> "80085"`
That was probably the primary source of my confusion.
wait a sec
str is a command to "stringify" any type of data
typeName "80085" >> 'STRING'
typeName 80085 >> 'SCALAR'
Just like how parseNumber is a command to parse a string to number.
@astral tendon > "we should have a command like str but reverse to remove strings"
call compile π
parseNumber "80085" // 80085
call compile cannot deserialize everything you used str on.
str and call compile are not bijective for every data type.
@winter rose
call compile "hi"; //returns nothing
str player >> "B Alpha 1-1:1 (Adanteh)"
call compile "B Alpha 1-1:1 (Adanteh)" >> REEEGETTHEFUCKOUTWHAREAAYOUEVENDOING
@astral tendon and what do you want it to do? it will return hi variable content
just remove the string
player call BIS_fnc_netId // "2:0";
"2:0" call BIS_fnc_objectFromNetId; // player
hi = "lololo";
var2 = call compile "hi"; // var2 = "lololo"
but yes, call compile is not always working.
thats why i said would be cool have comand just to remove the strings
str and call compile is a mess. Avoid it. It's funny how it happens to work for SIDE type only for west and east, because:
str west // "west"
str east // "east"
But not for resistance, because
str resistance // "guer"
because "fuck you" -BI
No, you're not supposed to use str call compile.
"remove the quotes" is quite⦠general
Just a bad habbit that spread. It's your own fault for it failing.
I liked how nigel said fuck it and used
guer = resistance;
civ = civilian;
to work around it.
Suspects_Pos = call compile (format ["%1Suspects_Pos", MissionSelected]);
Civs_Pos = call compile (format ["%1Civs_Pos", MissionSelected]);
Officers_pos = call compile (format ["%1Officers_pos", MissionSelected]);
Cut_Camera = call compile (format ["%1Cut_Camera", MissionSelected]);
publicVariable "Cut_Camera";
One exemple in my mission were I just need to remove the strings
I also remember that one of you in this channel argued for hours that resistance somehow is something else than independant. Guy just wouldn't get it that they're aliases.
You mean, remove the quote marks.
" is not a string. It's a quote mark.
reverseStr str (hint "OK") would still do nothing hehehe
Also, you should just write the script as:
Suspects_Pos = missionNamespace getVariable format ["%1Suspects_Pos", MissionSelected];
Civs_Pos = missionNamespace getVariable format ["%1Civs_Pos", MissionSelected];
Officers_pos = missionNamespace getVariable format ["%1Officers_pos", MissionSelected];
Cut_Camera = missionNamespace getVariable format ["%1Cut_Camera", MissionSelected];
publicVariable "Cut_Camera";
west = blufor = "west"
east = opfor = "east"
resistance = independent = "guer"
yay, have fun
https://community.bistudio.com/wiki/side for string values
My fav side is sideLogic
Suspects_Pos = call compile (format ["%1Suspects_Pos", MissionSelected]);
Suspects_Pos //returns AirportSuspects_Pos (Airport is the name of the misson area NOT THE ATUALL MISSION)
Suspects_Pos = (format ["%1Suspects_Pos", MissionSelected]);
Suspects_Pos //returns "AirportSuspects_Pos"
Suspects_Pos is also a game logic placed on the editor
that is for some dynamic CutScene for the end of each mission
then evreyone gets teleported back to the base to chose other mission
about the side stuff
BI dude 1: "Hey lets make it easy and put the name equal to all others"
BI dude 2: "LOL no, lets just make they figure it"
that, or last minute change
I remember reading a blog entry stating they debugged Hardware T&L compatibility for OFPv1.00 minutes before delivery
so, if they changed guer to resistance to be more "pro", well, shit happens
what exactly?
You're not supposed to use call compile to reverse str. It's really hard to get this into peoples heads, but west being stringified to "WEST" and that resembling uncompiled code that matches the command named west is an accident.
If you use this method, you're relying on accidents, and ofc it will only work in some cases.
A list of all weapons in the game?
Can anyone Help me with my RscListBox Weapon list ?
missionNamespace getVariable seens just as hard, thats why i said it would be good a reversed command for str
missionNamespace getVariable is the correct way though, Roque, even if the command names look long and intimidating at first.
though beside speed, what does it really matters?
Command names are arbitrary though. A command like spawn has a really short name, but what it does is probably starting the most bloated and complicated machinery in the game as far as scripting goes.
"true" configClasses (configFile >> "CfgWeapons")
???
: though beside speed, what does it really matters?
It always works.
How would it fail if i use call compile?
call compile str resistance
will try to use guer command, failing
call compile str player fails iff the player has no vehicle var name.
^
It works iff the player has a vehicle var name.
in which case would you want/need to rely on it @astral tendon ?
Stuff like this is script errors waiting to happen. Bad practice.
@astral tendon call compile "hi" does exactly what you expected. it removes the "strings" aka quotes. And a hi without quotes is a variable. And trying to get a variable returns the contents which is what you got.
@winter rose is just me getting complicated bilding missions really
it would take some time to explaim
Actually for call compile str player to work you need more than a vehicle var name.
You need:
- player object to have a vehicle var name
- a global variable pointing to the player, and
- the global variable being the same as the vehicle var name (case insensitive at least)
well, for that case i would use just player to get the variable
I dont really need to put and remove the string
player object could be replaced by any other object. Same thing. Just the easiest example. Same stuff for cursorTarget.
using str and call compile is not the same thing as JSONifing stuff, it's more of a .toString() (if you code a bit)
If only there was a easy way to turn a object into a globally unique ID and back
Oh wait.. Every object has it's oid that is globally unique and the same on every machine...
But we cannot access it without Intercept
You could even trick it:
bob = cursorTarget;
player setVehicleVarName "bob";
call compile str player // same as cursorTarget
wat
the player is trying to aim at it self?
lol
that right
player have the variable bob and call compile str player has the variable of the unit
Yep.
How can I get the gunner's turret heading, but without looking it via weaponDirection?
If you disect it it's clearer. str player -> "bob"
call compile "bob" ->
bob
-> content of bob variable
The correct way is:
bob = cursorTarget;
player setVehicleVarName "bob";
(player call BIS_fnc_netId) call BIS_fnc_objectFromNetId // works, same as player
jesus
though
missionNamespace getVariable str player
also return the name of the unit
And is like 10x faster (approximate numbers used)
How can I get the gunner's turret heading, but without looking it via weaponDirection?
getDir on the gunner? π€ @thorn saffron
Yeah, it's also broken, because the problems of stringifying players is an issue with str, not call compile.
Result:
0.0011 ms
Cycles:
10000/10000
Code:
missionNamespace getVariable str player
Result:
0.0015 ms
Cycles:
10000/10000
Code:
call compile str player
eh....
Hah! see!v almost 2x
OBJECT type simply cannot be serialized reliably.
@little eagle sqf "true" configClasses (configFile >> "CfgWeapons") how do i show this in a RscList
_ctrl setText '"true" configClasses (configFile >> "CfgWeapons")'
hueue
"true" configClasses (configFile >> "CfgWeapons") apply {_list append (configName _x)}
replace append by the proper command to append stuff to a RscList control
BIS_fnc_netId and BIS_fnc_objectFromNetId. Remember these, get used to them.
this one is nice also https://community.bistudio.com/wiki/BIS_fnc_showRespawnMenuInventoryLimitRefresh
I like how # is the only command that doesn't need any whitespace between the adjacent command.
getPosATL player#2
so @still forum so i use both and replace append a the right command?
both scripts/
The first one was a rather obvious joke
Yeah. That sounds right
The second one just errors, because append is used with rhs being a STRING not ARRAY.
read ze comment
lbAdd I believe
@little eagle https://s.sqf.ovh/Discord_2018-05-02_18-02-08.png
"true" configClasses (configFile >> "CfgWeapons") apply {_list lbAdd(configName _x)}```
like this?
ye
Are we doing apply > forEach now or what?
oh
Didn't even notice that
wanted to use apply to get a array of strings and just changed my mind
I don't mind.
SQF control structure.
@meager heart > this one is nice also https://community.bistudio.com/wiki/BIS_fnc_showRespawnMenuInventoryLimitRefresh
dafuq Oo
will document this one (one dayβ¦)
i mean what dou mean Apply foreach/
π€
Are we doing apply > forEach now or what?
Yeah, because I expected the statement to use forEach and not apply.
AdminWeaponList = {
disableSerialization;
_list = _display displayCtrl 9110;
lbClear _list;
{
"true" configClasses (configFile >> "CfgWeapons") apply {_list lbAdd(configName _x)}
} foreach ;
};```
?!?!!?!
like that u mean?
At some point they added apply, and it does what forEach does plus more, except that the array is written first and then the code, and not the other, super confusing, way around.
No.
Just forget about it @molten folio
AdminWeaponList = {
disableSerialization;
_list = _display displayCtrl 9110;
lbClear _list;
"true" configClasses (configFile >> "CfgWeapons") apply {_list lbAdd(configName _x)}
};```
??
wow...
Why don't you try out your code instead of posting it and writing ??
lgtm
not working
_display defined?
"true" configClasses (configFile >> "CfgWeapons" >> _x >> 'displayername') apply {_list lbAdd(configName _x)}``` i've added Displayer name but now how can i show the Picture ?
is it like this sqf "true" configClasses (configFile >> "CfgWeapons" >> _x >> 'picture') apply {_list lbAdd(configName _x)}
and How do i only show the weapons xDD not the uniform?
https://community.bistudio.com/wiki/BIS_fnc_itemType
_item call BIS_fnc_itemType select 1 == "AssaultRifle"
?
Someone was wrong on the internet... about SQF. How do I cope?
you don't, cave in and cry.
life is unfair, just accept it...
someone shuffled your deck incorrectly in the game.
All the warnings were ignored when your scenario was being compiled.
Is there a way to make say3d play on a dead body? I am using the killed event handle to use the say3D
But... he is dead
or kill the source with setDamage for example. I guess that's a no then?
You could use createSoundSource then.. That should work
JUST DO IT
createSoundSource loops the sound
private _dummy = "#particlesource" createVehicleLocal [0,0,0];
_dummy setPosWorld getPosWorld _corpse;
_dummy say3D "whatever";
_dummy spawn {
sleep 5;
deleteVehicle _this;
};
I disagree
Since when do we ask for your permission again?
That will do it
@little eagle Well
mind to put that exemple as a commet in the say3D page as a workaround for dead objects?
particlesource is atleast better than spawning a invisible helipad
I actually don't know, since you said you're gonna call people that disagree with you a bot lul
If you put it on the wiki, then do it like this:
private _dummy = "#particlesource" createVehicleLocal ASLToAGL getPosWorld _corpse;
_dummy say3D "whatever";
_dummy spawn {
sleep 5;
deleteVehicle _this;
};
π€
@still forum Schnell schnell, zackig zackig.
Sometime it's really hard to tell if commy is being serious or not. It's a risk to answer
any description to that?
Example X
Workaround for dead bodies.
Sometime it's really hard to tell if commy is being serious or not.
Depends on what you mean by "serious".
"If you need to make the say3D work on dead bodies/objects you can use this work around"
that kinda of stuff
@molten folio
private _weaponTypes = ["AssaultRifle","BombLauncher","Cannon","GrenadeLauncher","Handgun","Launcher","MachineGun","MissileLauncher","RocketLauncher","Shotgun","Rifle","SubmachineGun","SniperRifle"];
{
private _thisWeaponInfo = [(configName _x)] call BIS_fnc_itemType;
private _thisWeaponType = _thisWeaponInfo # 1;
if (_thisWeaponType in _weaponTypes) then {
private _index = _list lbAdd (getText (_x >> "displayName"));
_list lbSetPicture (getText (_x >> "displayPicture"));
};
} forEach ("true" configClasses (configFile >> "CfgWeapons"));
``` has not been tested
displayername
:]
shh
π₯
changed it
bork bork πΆ
@wary vine ur a legend β€
nobody saw anything
@little eagle be happy
share at least
i'll share a bowl?
"true" configClasses (configFile >> "CfgWeapons")
beginner level
"true" configClasses configFile/"CfgWeapons"
enlightened level
@little eagle do you wanna take this outside ?
π₯
Everytime I see that emojie in the mobile Version of discord I am remembered of an adult toy

A dragon toy?
π₯ π π₯
:[
Oh.. Probably not a dragon toy
oh god, commy stop
@little eagle I don't know, thats hard to tell aswell
@queen cargo you been playing with'em too much
More something to stuff my dragon into π π
π π π
Ahhh I understand
Looks like a salt shaker to me.
^^
π
thats what I thought it was first
@tame portal what have i said about playing with your pineapple in public π
The only person I consider their criticism about my pineapply worthy of being noticed is commy because it's hard to study him
Pine apples are a fraud. They aren't apples and they don't grow on pine trees.
You're*
Your welcome.
Actually.. never thought about that.. Why the 2?
Shh
It's short/cute for Commander2.
it started when he was just a boy.
how cute
My name also started when I was just a boy. That didn't know enough english to know how to properly write his name
No, I had two classmates and we were Commander 1 , Commander 2 and Commander 3.
xxx-pu$$sy-sl8yr-xxx
And I named myself after a hacki boi apparently, we all have sad background stories
@gleaming oyster EXACTLY
Haha commy that's kinda cute :p
Yup the other Optix.
Commander 1 is who started BWA3 btw.
He's a politician now.
German politican, interesting
Commanding for real π
No. We enforce them.
Hah
ahahaha
Yeah, His grandfather was a communist, so obviously his grandson is a conservative.
Nah
We usually just annectade
"obviously" :^]
But got a lot of spare time where we act like we would do politics
That is also why Merkel still is chancelor
anyone wanna take a look at tidying something up for me π
it works fine.
just could be neater π
make pr on git <- @wary vine
Why wouldn't it be like that? Being a politician is more hereditary than any specific ideology.
It contains public variables that anyone could manipulate. So definetly not 100%
private _left = 0.368 * safezoneW + safezoneX;
private _right = _left + (0.261937 * safezoneW);
private _top = 0.273 * safezoneH + safezoneY;
private _bottom = (_top + (0.4532 * safezoneH));
It should be left, top, width, height
Learned yesterday that you cannot allow anyone to access anything of your stuff
nope
else they will break it and say "your fault for not protecting it"
Dedmen is trolling now.
Kinda.. Refering to the github conversation about ace arsenal
@little eagle i need those specifically
or he's taking on commy's sense of serious
getMousePosition params ["_mouseX","_mouseY"];
This looks like something I would write.
Its missing a macro for that though
its a mess but its works
The macros? Yes
Perfect
π
the event stuff always triggered me
I'm just like "FFS show me what you are doing finally"
HAHAHA
i have not go around to using macros yet xD
But I do show it. E.g. global event does:
CALL_EVENT(_params,_eventName);
SEND_EVENT_TO_OTHERS(_params,_eventName);
:kappa:
xD
I just like everything being infront of me , for me, its easier to read
xD
Because you can't read what you can't see
Good point.
E.g. use flat copy here, which would speed it up...
takes notes for upcoming pull request
custom log.dll pfft.. Intercept
Meh,
Im just sending client errors to the server in playerUID.txt
so if they report an issue, all i gotta do is check that file.
always thought that was a stick figure pushing that rock
Nah, it's an oily and naked buff dude.
Pushing rocks.
is there a way to add cba to a server only and only call the cba functions with the server?
is that how you see yourself commy?
oily and naked buff dude < not commy2
@glad venture Since the last version of CBA. Yes!
I added a optional PBO in the last update that disables the "YOU ARE MISSING MODS!" warning that get's posted on all clients if they join without CBA
oily and naked maybe... buff dont know about that one. dude are you sure ?
Just move the optional pbo into addons and load as servermod
xD
@wary vine I mean, if anythimg he's gotten buff in the brain from occupying his time in #arma3_scripting
xD
And your brain being buff = swell = bad
swell == bad?
Oh boi
I have been using swell wrong all my life π¦
You're letting the kids get to you dedmen,
boi
is that how you see yourself commy?
lol definitely not as Ancient Greek Γbermensch.
Ever read anything by A. Camus?
Nope
Absurdist philosophy. I don't agree with any of it, but it's a nice book cover.
.<
And reading this channel definitely feels absurd quite often.
https://gyazo.com/fa47c26a99c07ce0a788a80f3b8a21ac o.O I googled dedmen
I never watched Futurama, so idk if that old guy is a good character or not.
gotta go get some more ice, back in 10
htf did i run outta ice cubes before whiskey -.-
Do you not have a tray?
ice in whiskey....
coolio
only thing i have ever drank was some canadian whiskey and some mead. Mead was brewed by someone i know. I like the mead over the whiskey
it sure is
gotta make a 2d version of it for my phone now xD
better make mobile arma for it, so you can play arma while playing arma π
@wary vine you typoed my name while googling
@little eagle honestly I read the stranger and his shit made me wanna kill myself
Google doesn't even let you google for me π muhahahaha
does endmission only happen locally?
yes
In multiplayer scripting, do I need to define a script as a function to use it in remoteExec?
If so, do I need to define the allowedTargets, or is by default allowed for anything?
I'm scripting with a small group of irl friends, so security isn't a concern.
{player setAmmo [primaryWeapon player, 1];} remoteExec ["bis_fnc_call", 0];
Something like that will work fine, just replace the code that gets passed to the call function
is bis_fnc_endmission global or also local?
This should be used instead in a multiplayer environment. https://community.bistudio.com/wiki/BIS_fnc_endMissionServer
But I'm not 100% sure if an answer for your question
It is global.
Description:
Ends the mission properly for all players in a multiplayer environment
https://gyazo.com/753cd0244be108ac2a6a09809d7dc84f dafuq is it giving me this for in vscode ?
What is the proper way to wait until all players have loaded in with a script? I've seen various methods, such as "wait until time > 1", but don't remember which ones have issues.
afaik there is no decent way to wait for everyone to be loaded. Especially with JIP compatible code
<< new to vsCode @still forum where would I change that. I have downloaded the syntax's
If i need to do somehting after a player has loaded in, i use initPlayerLocal.sqf
I wish I kept better records of when I use to do all this stuff 
@tough abyss you could have each client set a variable in the player namespace, then have the server wait for all connected clients to have that variable set, but you would still need to be careful with JIP
I am confused on how to utilize parameters from an event handler.
For a GetIn example, I want to get the unit that triggers the event.
Documentation is as follows:
this addEventHandler ["GetIn", {
params ["_vehicle", "_role", "_unit", "_turret"];
}];
Does anyone understand the above?
It means that you now have variables by those names
is there a way to delete a player's variables and actions and reset them when they leave a server?
_vehicle will contain the object of the vehicle
So if I were to pass something to a script, I'd do ?
this addEventHandler ["GetIn", {
null = ["_unit"] execVM "somescript.sqf";
}];
[_unit], ["_unit"] is just the string of "_unit"
Typo, but null = [_unit] execVM "somescript.sqf"; doesn't work.
How is somescript receiving the variable?
params ["_unit"];
@glad venture Anything that is a part of a mission is utilized since that player leaves server to a lobby, besides something specific I can't remember for now. That happens because any global variable is a part of a missionNamespace which is reset when you leave mission, same for any mission functions, JIP and stuff. Something like addAction or anything that has object as an argument is also utilized, since any mission object is NULL since that moment. The only namespaces kept alive is parsingNamespace|uiNamespace|profileNamespace and some displays like findDisplay 0.
when i do ctrlCreate ["RscPictureKeepAspect",-1], how do i actually add in a picture?
string as in within quotes?
@tough abyss ```sqf
this addEventHandler ["GetIn", {
params ["_vehicle", "_role", "_unit", "_turret"];
[_unit] execVM "somescript.sqf";
}];
@ruby breach thank you β€
_ctrl ctrlSetText 'a3\ui_f\data\map\MapControl\hospital_ca.paa';
would the mission path just be '\filename'?
okay, thank you π
can i use any filetype picture, or are some more preferable than others?
also, are things like transparency saved when the picture is shown?
Hey does anyone know if there's a way to check when a vehicle hits a building?
trying to build a bulldozer that can remove map buildings.
@kindred lichen EpeContact* EVH
new to vsCode... where would I change that
main settings there https://gyazo.com/db1d3733125d8aeec0aef0762f2a66ac
some extensions for "better SQF expirience" https://gyazo.com/e69481454139f76553dc30dc9e679292
also when you will set it up, do not miss this things
"sqf.enableCBA": true,
"sqf.enableACE3": true,
"sqf.enableTOH": true,
"sqf.enableARMA": true,
"sqf.enableARMA2": true,
"sqf.enableARMA3": true,
@wary vine
still defaults to C++ on cpp files xD
How can I do a timer without locking-up scripting?
Say I want something to start a timer in the middle of a script, and still have the script continue without waiting for the timer:
//do stuff
execVM = "aTimer.sqf";
//do more stuff
dismantled weapons, such as mortar tube, mortar bipod, static launcher, are backpack or weapon or item? for its addBackpackCargo or addWeaponCargo or addItemCargo e.g..
backpack
thx, commy2
how to translate velocity to speed? π
vectorMagnitude and either divide or multiply by 3.6
thanks checking
alright. so i want to limit the speed of a vehicle if it goes over maxSpeed config paramter (+ some threshold)
would the approach be meaningful to apply the opposing velocity to the current one based on the vector delta of currentSpeed to maxSpeed multiplier (basically)
Pseudo:
if (speed > maxSpeed)
setVelocity (vectorNormalized velocity vectorMultiply maxSpeed);
Nothing you will be able to achieve with scripting will make physical sense. That's something you have to accept.
yes thats clear. willing to pay that price over tanks rushing downhill like crazy
_speed = 10;
_vehicle setVariable ["limit_speed", _speed];
_s = _vehicle spawn
{
while {canMove _this} do
{
_this limitSpeed (_this getVariable ["limit_speed", 10]);
sleep 0.1;
};
};``` @velvet merlin
(A3 1.24)To clarify, limitSpeed only do effect on non-player controlled AI units, it has continuous effect and AI wonβt break through the speed limitation until one is contacted, engaged or regrouped.
@real tartan are you saying it works now also for players/any vehicle?
from what i understand its just meant as an "order" for AI
you did not specify that you need it for players also, or I did not notice
well true. however are AI actually capable of rushing down hills/is a problem with AI in the first place?
_vel = velocity _vehicle;
_dir = direction _vehicle;
_speed = 10;
_vehicle setVelocity [(_vel select 0)+(sin _dir*_speed),(_vel select 1)+ (cos _dir*_speed),(_vel select 2)];
@tough abyss see spawn on the BiKi
hint "starting";
[] spawn {
sleep 2;
hint "other stuff";
} ;
sleep 1;
hint "current stuff";
Depending on the size of each code to execute, choose where to put it, in the spawn or somewhere else.
Be wary of local variables (_vv) that are not passed to spawned code, unless you give them as parameters
Is that related to my timers post? If so, thank you.
Yes it is, it went down under the radar due to a flow of messages but I gotcha π
Thanks, I appreciate it. I've actually asked about it a few times and never got a definitive answer.
spawn creates another thread, so it is completely isolated from the parent's thread
it will run in parallel. check the BiKi page, and tell me if you need further help
I had always interpreted it as being similar to call, only it would wait for when the scheduler had time. So less likely to be immediate, but more efficient. So I completely missunderstood that, thank you.
you're welcome :+1: anytime
@little eagle did i misunderstood you with this?
_vehiclePlayer setVelocity (vectorNormalized ((velocity _vehiclePlayer) vectorMultiply _maxSpeedVehiclePlayer))```
this stops dead the vehicle essentially:
["speed",58.8517,48]
["velocity",[9.66028,11.5584,-6.35416]]
["vectorMultiply",[463.693,554.802,-305]]
["vectorNormalized",[0.590876,0.706974,-0.388656]]
["velocityAfter",[1.29093,1.59705,-0.910017]]```
for now this approach seems to work OK:
_vehiclePlayer setVelocity
[
((velocity _vehiclePlayer) select 0) * 1/((speed _vehiclePlayer)/(_maxSpeedVehiclePlayer)),
((velocity _vehiclePlayer) select 1) * 1/((speed _vehiclePlayer)/(_maxSpeedVehiclePlayer)),
((velocity _vehiclePlayer) select 2)
];```
(with if ((speed _vehiclePlayer) > (_maxSpeedVehiclePlayer + 10)) then)
its still a bit sudden and could be smoothed by some means
If I was fired by UAV of my side, who is the "_this select 3 (the source unit that caused the damage.)" in "Handle Damage" Event Handler ? UAV machine itself or the player who controlled the UAV?
The controlling player iirc @quasi rover
thx
if (_speed > _maxSpeed) then {
_vehicle setVelocity (vectorDir _vehicle vectorMultiply (sqrt (_speed min _maxSpeed)));
};
limit speed thing π€
@velvet merlin
did i misunderstood you with this?
Yes.
_vehiclePlayer setVelocity (vectorNormalized velocity _vehiclePlayer vectorMultiply _maxSpeedVehiclePlayer);
You used too many parenthesis.
@wary vine you can't. C++ code is C++ code. Just ignore the warnings. Or I guess there might be someway to completly disable language checking. Dunno how.
Obviously you want to scale the vector to the speed max length after you turned it into a unit vector.
What you did is scale the current vector times the speed limit scalar and then turned it into a unit vector, meaning that the vehicle would always move at 1 m/s.
thanks my bad
Oof
Are you unhappy with this, Mario?
@still forum i just did what @meager heart said seemed to work.
Is there a way for me to replace a variable (h1) with every vehicle that is an ace medical vehicle?
setVariable var?
Oh hold on my question is much less clear written than it was in my head
You can set variables to things yeah π You can also use arrays to put many things into a variable.
You mean you want something to retrieve a list of all vehicles, currenly in the mission, that are ace medical vehicles?
Yes!
vehicles select {_x getVariable ["ace_medical_isMedicalFacility", false]}
???
Would that be where I use something like forEach?
Yep. That select syntax is "something like forEach"
Would use what. You never told us what you want to do.
Neat, Iβll show you what Iβm trying to do just to make sure
Iβll admit I didnβt write this script, I just found it and wanted to adapt to work with all vehicles marked as a medical vehicle with ace rather than one vehicle with an assigned variable
while {alive h1} do {
waituntil {sleep 0.5; {alive _x && _x in h1} count allPlayers > 0};
h1 setCaptive true;
waituntil {sleep 0.5; {alive _x && _x in h1} count allPlayers == 0};
h1 setCaptive false;
};
π€ What's that?
a script that makes a vehicle captive if people are in it apparently
I don't think setCaptive works with ACE.
Well. I can tell you what it is.. It's dumb.
iterating over all players and filtering out the players inside the vehicle.
instead of just iterating over the players inside the vehicle FFS
GetIn EventHandler instead of loop would improve it as well.
Sorry to barge in.... Should be an easy one. Trying to create a trigger which is rearm . BUT I want one trigger to do multiple class of vics. Can I place if ((_veh isKindOf "Air,"CAR") && (driver _veh == player)) exitWith { or do you need to create separate triggers?
waituntil {
sleep 0.5;
private _medicalVehicles = vehicles select {_x getVariable ["ace_medical_isMedicalFacility", false]};
{private _p = _x; alive _p && _medicalVehicles count {_p in _x}} count allPlayers > 0
};
That's even dumber though
Is there something that is not dumb or am I doomed to my own ignorance
Yeah. Searching for a good way to write it
private _allMedicVehicles = vehicles select {_x getVariable ["ace_medical_isMedicalFacility", false]};
{
_x addEventHandler ["GetIn", {
params ["_vehicle", "_role", "_unit", "_turret"];
if (local _unit) then {
[_unit, "setCaptive", "commy_isMedicVehicleCrew", true] call ace_common_fnc_statusEffect_set;
};
}];
_x addEventHandler ["GetOut", {
params ["_vehicle", "_role", "_unit", "_turret"];
if (local _unit) then {
[_unit, "setCaptive", "commy_isMedicVehicleCrew", false] call ace_common_fnc_statusEffect_set;
};
}];
} forEach _allMedicVehicles;
@uncut trout
There.
Even better than my idea
Put it into init.sqf
Will only work with vehicles that are present at mission start though
GetInMan on all the player characters?
This is only for players yes, and the only medical vehicles present in the mission should be those at the beginning of the mission (unless Zeus spawns a new one for whatever reason, but that generally doesnβt happen
// init.sqf
["vehicle", {
private _unit = call CBA_fnc_currentUnit;
private _vehicle = vehicle _unit;
private _isMedicalVehicle = _vehicle getVariable ["ace_medical_isMedicalFacility", false];
[_unit, "setCaptive", "commy_isMedicVehicleCrew", _isMedicalVehicle] call ace_common_fnc_statusEffect_set;
}, true] call CBA_fnc_addPlayerEventHandler;
There. It won't get easier and cheaper than that.
Thanks! I will try and dissect what you did so I can learn
"vehicle" CBA_fnc_addPlayerEventHandler
executes the code in the curly brackets every time the avatar's vehicle changes, e.g. mount or dismount
CBA_fnc_currentUnit
is like player, except that it works when remote controlling with zeus
_isMedicalVehicle is self explanatory I think.
you have ace. So you could use ACE_player instead of calling a func :u
pff ace
You could also use player, because this breaks when switching out as zeus anyway.
"setCaptive" ace_common_fnc_statusEffect_set
is just like setCaptive, except that infinetly many systems can use the command instead of each one overwriting the other.
The player is captive as long as one reason for it remains, a reason here is "commy_isMedicVehicleCrew" and that is an arbitrary string unique to your system using setCaptive.
I see. Why does it check isMedicalFacility?
Because you wanted medical vehicles. And not "all" vehicles
Wouldnβt isMedicalVehicle check for that though? Or does the MedicalVehicle function depend on MedicalFacility?
_isMedicalVehicle is just a variable. You can name it _banana if you want or just _.
I prefer giving them names that make sense, so I can remember what they are next week and in a year too.
So a variable that is true if the thing it's about is a medical vehicle is named "is medical vehicle".
What the correct format is under a EDEN condition area I want to CALL multiple cfgvehicle types? call {(_x iskindof "ship") || (_x iskindof "HAFM_Submarines") || (_x iskindof "HAFM_NAVY") || (_x iskindof "sfp_vehclass_ship")} && speed _x < 1} count thislist > 0 }
you cannot call a type.
One can call functions or scripts, but not classnames.
call{{_x iskindof "plane" && speed _x < 1} count thislist > 0 }
What purpose does that call serve?
That does nothing
seems useless to me
{_x iskindof "plane" && speed _x < 1} count thislist > 0
^^^ same thing
{(_x iskindof "ship" || _x iskindof "HAFM_Submarines" || _x iskindof "HAFM_NAVY" || _x iskindof "sfp_vehclass_ship") && speed _x < 1} count thislist > 0
You mean that?
Does || need braces commy?
No.
Trigger activation example...
Oh wait. That code is complete crap. One sec
|| is lower prio than normal binary commands.
{(_x isKindOf "ship" || _x isKindOf "HAFM_Submarines" || _x isKindOf "HAFM_NAVY" || _x isKindOf "sfp_vehclass_ship") && speed _x < 1} count thisList > 0
There fixed.
@pulsar tide Full sentences please. I have no idea what you are trying to say
commy, about speed limit things from the above... so vectorNormalized is better in that case, because of accuracy or ? π€
I see useless call's there that make no sense
and a local variable that also makes no sense
and taking something out of an array just to again turn it back into an array.
So yeah.. Get rid of the call it serves no purpose
Better than what?
hmm... lets say vectorDir
Completly different things π€
vectorNormalized velocity
reports the direction the object is moving
vectorDir
reports the direction the object is facing
Objects can move sideways, you know.
vectorDir takes object and normalizes it's direction as direction vector.
and vectorNormalized takes a vector and normalizes it
I was basically trying to have 1 trigger take care of Heli's, car and tanks.
vectorDir
reports the direction the object is facing
Objects can move sideways, you know.
that why i'm was using it π
And as i said. Get rid of that call it's useless. No matter if you copied that from somewhere else. Doesn't fix it's uselessness
But in a curve, your vehicle is moving in a different direction than it is facing...
Dedmen, if he's not using CBA, then the call could be to trick the editor into ignoring return values.
Why would you want to ignore return values.. On a condition
or on a piece of code that already has a assignment and thus doesn't have a return value
Idk, that's the only pupose I can come up with.
Otherwise it does literally nothing of value.
Probably another case of people copying things they don't understand. And telling others to use it like that
Probably.
ok got it... commy π
He, reminds me of Absurdism again. Dedmen, did you ever disprove dialetheism?
yes
Absurdism π€
Remember the worst script ever?
hmm... yes (not sure)
who proved dialetheism in the first place π
@still forum Thank you sir.
cough maybe maestro q cough
Lou, who said things have to be either true or false?
I know a guy.. What was his name again... SchrΓΆdinger I think..
there is always a why that can't be answered, but that doesn't prove you're right, it mostly states the other possibility could be wrong π
They say there're no dumb questions, but "why" is a dumb one for me.
why
oh lol just realised what happened, sorry my mab lol (no time to seat down and chat the crap out of it, absurdic answer is fixed) so Absurdism is me for today... π¬
also "why" was only because i'm bad with vectors... π€·
They're the best we have, because we don't have quaternions or even complex numbers in Arma.
Complex numbers would be perfect for a scripting language. The only reason you wouldn't want to use them in C++ is performance probably, but by using them in script, you would delegate a lot of math to C++ and keep the script short.
arma probably uses quaternions but just aren't accessible
well complex numbers don't work well b/c for some reason hardware isn't optimized for that
Yeah, in C++ et al. But if we're talking about a script language, things may change. It's the same as the vector commands really.
and since it is a vector computation should be done on gpu like hardware
I'm a 100% sure this is not the case for SQF.
@wary vine u gave me this sqf private _weaponTypes = ["AssaultRifle","BombLauncher","Cannon","GrenadeLauncher","Handgun","Launcher","MachineGun","MissileLauncher","RocketLauncher","Shotgun","Rifle","SubmachineGun","SniperRifle"]; { private _thisWeaponInfo = [(configName _x)] call BIS_fnc_itemType; private _thisWeaponType = _thisWeaponInfo # 1; if (_thisWeaponType in _weaponTypes) then { private _index = _list lbAdd (getText (_x >> "displayName")); _list lbSetPicture (getText (_x >> "displayPicture")); }; } forEach ("true" configClasses (configFile >> "CfgWeapons"); but its not workiing cause this line sqf private _thisWeaponType = _thisWeaponInfo # 1;
are you sure its that line ?
ye it poped in a black small console when i join my dev server
this is how im putting it sqf AdminWeaponList = { disableSerialization; _display = findDisplay 385300; _list = _display displayCtrl 7777; lbClear _list; private _weaponTypes = ["AssaultRifle","BombLauncher","Cannon","GrenadeLauncher","Handgun","Launcher","MachineGun","MissileLauncher","RocketLauncher","Shotgun","Rifle","SubmachineGun","SniperRifle"]; { private _thisWeaponInfo = [(configName _x)] call BIS_fnc_itemType; private _thisWeaponType = _thisWeaponInfo # 1; if (_thisWeaponType in _weaponTypes) then { private _index = _list lbAdd (getText (_x >> "displayName")); _list lbSetPicture (getText (_x >> "displayPicture")); }; } forEach ("true" configClasses (configFile >> "CfgWeapons"); };
so it wasnt that code ?
Does the engine treat underscore variables in a special way or is it just a naming convention?
"underscore variables" are called local variables
and can only be a local var that's wrong.
Right, so it's a coding practice, not an engine distinction?
If you assign a variable, if it's identifier starts with _, then it becomes a local variable.
Only when assigning local variables one can use the private keyword.
@digital hollow https://community.bistudio.com/wiki/Variables
And private STRING, private ARRAY and params too can only be used with local variable identifiers (starts with _) as strings.
_localVariable
globalVariable
Of course there are exceptions, because why have consistency... Those are not of concern if you're a beginner though I guess.
HC_Array = [owner hc_1, owner hc_2];
(HC_Array select 0) publicVariableClient "Units";
Type Array, expected number.
Am I missing something?
Post the full error message from the rpt file.
2018/05/03, 19:27:41 Error position: <publicVariableClient "Units";
diag_log>
2018/05/03, 19:27:41 Error publicvariableclient: Type Array, expected Number
2018/05/03, 19:27:41 File serverSide\initHC.sqf, line 26
the only thing that should be possible is that the array has no values
but it shouldn't throw the type array error
The line before that?
if (getPlayerUID hc_1 == "") then { HC_UID = [getPlayerUID hc_2]; HC_Array = [owner hc_2]; };
if (getPlayerUID hc_2 == "") then { HC_UID = [getPlayerUID hc_1]; HC_Array = [owner hc_1]; };
if ((getPlayerUID hc_1 != "") && (getPlayerUID hc_2 != "")) then {
HC_UID = [getPlayerUID hc_1, getPlayerUID hc_2]; HC_Array = [owner hc_1, owner hc_2];
};
};
(HC_Array select 0) publicVariableClient "Units";
this is the full code
I'll throw some debug code to see the exact value
No, post the full error from RPT. It's usually 4 lines.
First line should be something like "Error in expression: <some sqf>".
It starts with the error position, but that's only the rhs of the error. Literally the part I don't need to see.
What is that confusing indentation
People need to put 100 chars in a line, because long scripts are scary, Dedmen.
text to long
if (getPlayerUID hc_1 == "") then { HC_UID = [getPlayerUID hc_2]; HC_Array = [owner hc_2]; };
if (getPlayerUID hc_2 == "") then { HC_UID = [getPlayerUID hc_1]; HC_Array = [owner hc_1]; };
if ((getPlayerUID hc_1 != "") && (getPlayerUID hc_2 != "")) then {
HC_UID = [getPlayerUID hc_1, getPlayerUID hc_2]; HC_Array = [owner hc_1, owner hc_2];
};
};//wtf is this?
wrong copy pasta xD
xAndreei, use pastebin.
Another case of someone wanting help but not showing the actual script that he's using
Not even the full error message :(
Isn't he trying to public it as https://community.bistudio.com/wiki/units
That too
found the error, I was using that variable in another script which required a number and I was giving a full array without selecting anything
So it won't work even if you fix your script error
units was the first thing that came in my mind
Use tags
nothing related to that
Andr_Units
π
This is how I would write this:
HC_UID = [];
HC_Array = [];
if (getPlayerUID hc_1 != "") then {
HC_UID pushBack getPlayerUID hc_1;
HC_Array pushBack owner hc_1;
};
if (getPlayerUID hc_2 != "") then {
HC_UID pushBack getPlayerUID hc_2;
HC_Array pushBack owner hc_2;
};
idk, seems more procedural and logical.
hmm yeah, even better than mine lol
I always focus on functionally first and then on "optimization"
But this isn't about optimization.
If it were, the script would probably look ugly af.
HC_UID = [];
HC_Array = [];
{
if (getPlayerUID _x != "") then {
HC_UID pushBack getPlayerUID _x;
HC_Array pushBack owner _x;
};
} forEach [hc_1, hc_2];
Easier to extend
Yeah.
I like that one.
I'm trying to write something actually optimized, just so you people see that that is NEVER what I am going for, but it hurts physically.
just so you "plebs" was better π
Yea, well I am the pleb, because I can't figure it out.
If i restrain a player using this player playmove "AmovPercMstpSnonWnonDnon_Ease"; it keeps reverting. How do i make this animation stay
getPlayerUID hc_1 isEqualTo "" && {
getPlayerUID hc_2 isEqualTo "" && {
HC_UID = [];
HC_Array = [];
true
} || {
HC_UID = [getPlayerUID hc_2];
HC_Array = [owner hc_2];
true
}
} || {
getPlayerUID hc_2 isEqualTo "" && {
HC_UID = [getPlayerUID hc_1];
HC_Array = [owner hc_1];
true
} || {
HC_UID = [getPlayerUID hc_1, getPlayerUID hc_2];
HC_Array = [owner hc_1, owner hc_2];
true
}
};
There.Optimized. (No guarantee the logic isn't inverted.)
π€’
Control structures are for plebs. Everything is a lazy eval.
piece of π°
It just takes getting used to.
It's not any more irrational than if-then-else. In fact, this one is more basic.
HC_UID = [];
HC_Array = [];
[hc_1, hc_2] apply {
if (getPlayerUID _x != "") then {
HC_UID pushBack getPlayerUID _x;
HC_Array pushBack owner _x;
};
};
```pleb version v2.0
huehue*
I'm thonking about ways to further optimize my version. π€
Wait..
Why do HC's even have getPlayerUID?
HC's don't have steam accounts. They shouldn't have player ID's
Probably the servers.
But then they would all have the same
And?
Why store it in an array then
Why store the uid at all? No one cares what the uid of a hc is.
In fact, why store the owner ids? Just set them globally via PlayerConnected, and reset them via HandleDisconnect.
What if say, you wanted to target a certain HC that could take more of a load than the others
Why do you need the owner of a hc?
Well.. Just choose one of the HC's then?
the first HC in the array will always be that one HC
so. if you want one of them to take heavier load. Just choose the first
The whole script shouldn't be needed, unless I'm missing something. But when people ask about their scripts here, and I answer: "your script is needed, delete it", I feel bad.
So then I suggest how to make them readable, but they answer: "I optimize later".
Even though I haven't even begun optimizing anything. I don't even want to go there, because - well you can see how that'd look.
As far as optimization goes, in the truest sense of the word (= optimal), due to the existance of lazy evaluation, if-then-else control structures in SQF are deprecated. Which is hilarious to me.
@lost iris I believe you can use playMoveNow, which replaces the 'queue' of animations with whatever you want.
There is also a way to wait until an animation is finished, at which point you could loop it, but I don't remember the call.
Bear suggested this one:
HC_Array = [hc_1, hc_2] select {getPlayerUID _x != ""};
HC_UID = HC_Array apply {getPlayerUID _x};
And I like it a lot.
Can we no longer register for the community wiki? It's been locked for months, and lately I've come across a lot of dead code examples and pages with no information at all that I could fill out.
Locked.
Gah.
we have special locked animations, there are 8 total with special exit anims, so while animation is played unit can't move... until the exit anim will be played...
try this in the console
player spawn {
private _animIndex = round (1 + random 7);
_this switchMove format ["Acts_AidlPercMstpSlowWrflDnon_warmup_%1", _animIndex];
_this playMove format ["Acts_AidlPercMstpSlowWrflDnon_warmup_%1", _animIndex];
sleep 10;
private _animDone = switch (true) do {
case (currentWeapon _this == primaryWeapon _this) : {"Acts_AidlPercMstpSlowWrflDnon_warmup_%1_out"};
case (currentWeapon _this == secondaryWeapon _this) : {"Acts_AidlPercMstpSlowWpstDnon_warmup_%1_out"};
default {"Acts_AidlPercMstpSnonWnonDnon_warmup_%1_out"};
};
_this selectWeapon primaryWeapon _this;
_this playMove format [_animDone, _animIndex];
};
```@lost iris
@meager heart Thanks, now i am having abit of trouble executing this on other players
Bear suggested this one
do you speak with bears, commy ? π€

@BaermitUmlaut
lol
He left the server, because you people are so horrible.
internet anyway was a mistake π
Forgot to delete the original post, my bad.
disableSerialization;
_display = findDisplay 385300;
_list = _display displayCtrl 2222;
lbClear _list;
_VehicleTypes = ["Car","Helicopter","Motorcycle","Plane","TrackedAPC","Tank","WheeledAPC","StaticWeapon","Submarine"];
{
_thisVehicleInfo = [(configName _x)] call BIS_fnc_objectType;
_thisVehicleType = _thisVehicleInfo select 1;
if (_thisVehicleType in _VehicleTypes) then {
_index = _list lbAdd (getText (_x >> "displayName"));
_pic = getText (_x >> "Picture");
_list lbSetPicture [(_index)-1,_pic];
_list lbSetData [(_index)-1,_x];
};
}forEach ("true" configClasses (configFile >> "CfgVehicles"));``` i got this vehicle list and a button to spawn the selected vehicle , but how do i give the vehicle list the classes?
?
How to give the list the classes?
Ahh
just use lbSetData to save the classname
wait.. you are already doing that
yh
_list lbSetData [(_index)-1,_x];```
You are already giving the classes to your vehicle list.. uh.. What was your question again?
_x is CONFIG, not STRING
you need to use _data = lbData (lbCurSel 2222)
configName to get the classname
_selected = lbData [2222, lbCurSel 2222];
_veh = _selected createVehicle position player;```
this is the button
_class = getText(configfile >> 'CfgVehicles' >> _x >> 'vehicleClass');
_list lbSetData [(_index)-1,_class];```
dude
k ill forget about it
What is so hard at reading two messages π
It's like you are just ignoring our advice and continue going your own way which turns out not to work in the end
configName. As in the command
configName takes a CONFIG as parameter
and as commy told you. Your _x is CONFIG
So what do i replace with _x
Well. I'll help you at reading messages then.
You wrote _list lbSetData [(_index)-1,_x];
Where commy answered _x is CONFIG
Then I told you to use configNameto get the classname. And configName takes a CONFIG as parameter
so what do you think you should do?
CfgVehicles??
Troll yourself dude. Goodnight.
fml
Er schaut wie eine Sau ins Uhrwerk.
Sometimes errors don't show up ingame, but I know they're there. Why is that?
nvm ik now
Enable the showScriptErrors start parameter in the launcher
Wouldn't no errors at all show up if that wasn't on?
In the editor it's always enabled.
I'm playtesting through the editor presently
_class = configName (configFile >> "CfgVehicles");
_list lbSetData [(_index)-1,_class];``` this what i understood from Wiki page
Β―_(γ)_/Β―
Man. I just cannot comprehend
I gave you a single line of script. And a single script command to fix your issue
you somehow magically manage to turn it into 2 lines and multiple commands that make no sense
You really need skill to get something like that done
dude
Can you maybe just read my messages and turn on your brain
This has to be Quiksilver trolling us or something.
....
Or do I really have to write everything 5 times to make you read all 5 words seperately?
Without skipping 90% of my sentences everytime?
Here. Just because I'm such a nice guy
configName takes a CONFIG as parameter
and as commy told you. Your _x is CONFIG
Just read it FFS.
Assuming troll, 7/10, lacks the fun, frustrating even for those who're in on it. Otherwise, you're not made for coding it seems. :(
it's like.. Here take this fork and use it to pick up that carrot.
5 minutes later you come back with a shoe superglued to a potato
Sounds like a fun time
you did not try
I literally explained it like for a 3 year old. configName takes CONFIG. _x is CONFIG.
Just like "Round things fit into this hole" "This ball is round"
You are the 3 year old that still tries the triangular hole.
_list lbSetData [(_index)-1,(configname _x)];```
holy shit
So I'm trying to get this script to work. The script is not running, nor is it giving me an error.
Fire:
deviceTruck addEventHandler ["GetIn", {
params ["_vehicle", "_role", "_unit", "_turret"];
null = [_unit] remoteExec ["scripts\deviceTask.sqf", 2];
}];
Script:
params ["_unit"];
if( side _unit == west) then
{
hint "player";
//Next task
["task2", "SUCCEEDED",true] remoteExec ["BIS_fnc_taskSetState", 2, true];
["task3", "Assigned",true] remoteExec ["BIS_fnc_taskSetState", 0, true];
}
else
{
hint "ai";
//Kick out AI
_unit action ["eject", vehicle _unit];
};
I can't tell what's wrong. I'm assuming it might have something to do with the parameters, but arma 3 isn't giving me any error at all. showScriptErrors is on.
null = is useless
with or without it, it doesn't make a difference.
script is the thing you call via remoteExec? _unit is undefined
people use it because you can't get a return in a init box
otherwise in script it's useless
parameters are passed inside _this. you need to pull them back out. using params ["_unit"] for example
or _this select 0 but please don't use _this select to grab parameters.. please..
(β―Β°β‘Β°οΌβ―οΈ΅ β»ββ»
There is no point in using remoteExec inside a GetIn eventhandler, as GetIn fires for remote objects anyway.
Also, remote execing to the server and then telling the server to display a hint isn't going to accomplish much
getin
Triggers when a unit enters a vehicle. It can be assigned to a remote vehicle **but will only fire** on the PC where the actual addEventHandler command was executed
I think that's just for debugging which is fine local hosted.
Ahh, I didn't even think about local host
Well, the idea is to add the eventhandler on every machine. Or just on the server if you only want to execute server stuff.
So the comment you posted just confirms what I wrote.
Regardless, the script itself isn't running.
Well duh, because that's not how you use remoteExec.
But why correct that if it isn't needed in the first place?
So much harsh about strange things people trying to do π
Oh... Didn't even notice the broken remoteExec
what is broken about it
This same fuckin' discord told me otherwise last night
Can you show who and when?
You could execute execVM instead to launch a file
what is broken about it
It exists inside GetIn. It should never be put inside GetIn.
Whoever said that should be shot in the shoulder then
So my whole issue was misinformation from this discord, and most of everyone who replies just criticizes the code instead of helping me get it working, except Dedmen, who gives me the actual answer. Thank you.
What?
No one said that that I can remember.
"Why do you have hint"
"Why are you doing X with the getin"
"Why this"
The why doesn't matter, there's something broken with the code. Seriously feels like stack overflow
Dude, remoteExec is just wrong inside GetIn period. Even if you fix the syntax error, your script will not work. Why post anything here if you don't want it to be critically evaluated?
I'm very good at criticising code. But right now I'm laying on my belly on my bed and typing on the laptop that is standing next to my bed at head height and my neck is hurting
Well, anyways thats pretty your fault too. Reading Wiki helps. Everytime I write some, I always turn to wiki to remind myself how I'm trying to achieve that exactly. Its no shame in reading man.
GetIn fires locally.
No it doesn't
you missunderstood what the wiki said
it fires where you added the eventhandler
if you want it to execute on the server. Then add the eventhandler on the server and you are golden
To correct myself, it fires where you added it, so if I added it locally it fires locally.
@little eagle systemChat is local mate, FYI
No need to add it on client and forward it to the server. If you could directly execute on the server
also _unit action ["eject", vehicle _unit]; < with just this, unit will be not happy about that accident and he will try to get back in his vehicle...
@tough abyss Its stricly AG EL, so it will be assigned to anytihng local or global, but always will fire the event for that particullar PC.
Why would you add it locally? To which client? If the client disconnects the script stops worlking for anybody else?
That's just bad.
Yes, you're right Dedmen. I understand that now, but it is incredibly frustrating when you ask for help, and the replies are just "Your code is bad."
Help me fix it, because something is wrong and I need to learn what it is. In this case, files cannot be ran over remoteExec. Then you can rip the code apart and tell me how bad it is.
I said what you have to do ffs.
@meager heart Making me very happy that I don't build missions.. Wouldn't want to handle that mess
If there's a blatant mistake like that, I'm clearly missing something I don't know. It's important to learn or I'm just going to be back here with the same issue later.
Β―_(γ)_/Β―
Can't learn to swim if you tell me to just take a bridge.
I even told you why what you wrote doesn't work. Like thrice now.
Mate you apply non-applicable syntax and blaming for no help. As I said you could at least investigate wiki pages of the commands you use.
Also IMO no further bashing needed. I think he got it π
Just think of the other guys that come to this channel. It's nice having someone who actually wants to learn.
It's like 10PM and certain people should be sleeping instead of reading scripts π
I wanted to sleep an hour ago.. I hate you guys
BIS_fnc_taskSetState inside remoteExec is another error. The point of the task system is to be synchronized in MP. By executing the same function everywhere, you probably just break it.
That's good to know. I haven't done much scripting since pre-Arma3-campaign
@meager heart That is for AI situation right? You need to unassign it before?
if (isServer) then {
deviceTruck addEventHandler ["GetIn", {
params ["_vehicle", "_role", "_unit", "_turret"];
if (side group _unit == west) then {
//Next task
["task2", "SUCCEEDED", true] call BIS_fnc_taskSetState;
["task3", "Assigned", true] call BIS_fnc_taskSetState;
} else {
//Kick out AI
_unit action ["eject", _vehicle];
};
}];
};
This assumes all AI belongs to the server. Otherwise this works in any scenario.
So if all tasks are synchronized, what would I do if I wanted to complete a task for one player, but not another?
Don't use BIS_fnc_taskX
The old SetTaskState will work with the new task system?
Doubt, but not sure.
I'll have to tinker with that at some point.
Above works like a charm, thanks commy.
@unborn ether yes, or allowGetIn π€·
Just kicking the AI out is weird. They'd... just try to get back in again, no?
yes ^
Is there a way to lock a vehicle only to AI?
I remember having issues with that in prealpha
https://community.bistudio.com/wiki/allowGetIn looks like it
if (isServer) then {
deviceTruck addEventHandler ["GetIn", {
params ["_vehicle", "_role", "_unit", "_turret"];
if (isPlayer _unit) then {
//Next task
["task2", "SUCCEEDED", true] call BIS_fnc_taskSetState;
["task3", "Assigned", true] call BIS_fnc_taskSetState;
};
}];
};
Getting shorter and shorter. I almost like it.
It probably should check if task1 is already completed.
@still forum what does configName do ?
Changes your profile name.
OH SHIT
π©
would be nice
2 bots
!wiki configName
a bot linked with the wiki would be nice tho
it's been done.
where ?
Ask @rotund cypress
HoldAction requires the object to have collision with the player's hitbox, meaning it cannot be used on many Things, apparently.
is there a script that adds items to the player without it classed for example : uniform selected from list , but dont want to have the script spawner to have adduniform
you will have to make an item handler.
aight
using BIS_fnc_ItemType
ye
gimmie a sec, I might have something for you to work from.
its an old script of mine and not optimized, but it did work.
aight
There are probably better handle items scripts out there.
im guessing its a life server, do you know what framework you are using ?
there might already be a handleItem function in it.
does anyone know how to make this work in multiplayer? I've tried _x, _unit and a few other things but it doesn't respond.
player setVariable ["#rev", 1];```
Is there a way to get lets say the 4 item in an array?
_arr select 3 or _arr # 3
that only seems to return the 3 character though
so (the array var) ``(select or #) ``(then the index you want - 1)
i.e 0 would return the first index
1 would return the second, etc etc
i have an array like [2018,03,05,22,05] and i want to get the 4th item which should be 22
i think i am being stupid hang on
[2018,03,05,22,05] select 3 // 22
yeah not sure what i was doing but it works now thanks
well how do i convert this "[2018,03,05,22,05]" into and array apparently it was a string
parseSimpleArray "[2018,03,05,22,05]";
legend, i didnt know that was a thing thanks
@unborn ether hey thanks man, little late, but saw the ping, that exactly what I was looking for.