#arma3_scripting
1 messages ยท Page 324 of 1
but the response time after I responded badly was much faster, u can call it a logical fallacy, but I don't know what that term means
Dscha doesn't need help looking bad
โ
so arma makes a variable global if u have no _ before it, that is interesting
Global != Public
people respond faster if you start giving bad advice
@zenith edge That doesn't qualify as logical fallacy because it isn't even an argument. It's just one premise.
but if you read what I said, I said I don't know what that term means
I would've answered right away. But I only check Discord every few minutes. Makes no difference if somebody gives bad advice or no advice
but I am still trying to interpret dscha, why am I using the term global wrong
There are a lot of pedantic people. Maybe some of them are more likely to respond to errors than respond to asks for help.
a variable that is accessable throughout the program
Who said that?
well you corrected me, twice
I did?
The problem is that global variable simply is a shitty term in a MP based environment, because it refers to multiple concepts.
It is, yeah.
hmm, since I don't know sqf context, mine would be refering to, available across the entire mission in all scopes
unless you mean
localizd
as in across all clients
and sessions
i don't see any code, i thought this was a scripting channel ๐
_abc = Local Var, vanishes when script is done.
abc = globalVar, stays until end of round for example
abc = 1; publicVariable "abc"; = spread across all Connected Machines.
then I wasn't even thinking about localization
available across the entire mission in all scopes and that's wrong. there are scopes in which the variable might not be available
But that's going to far ๐
name one example
MyVar = true;
with uiNamespace do {
//different scope
if (isNil "MyVar") then {
systemChat "not defined";
};
};
Will output "not defined" although we defined MyVar right at the beginning
It is still available if you use this syntax:
missionNamespace getVariable "MyVar"
That's true.
And therefore what you said is false.
yea, i don't sqf really, so I didn't know arma 3 used global and public as global per client, and global across all clients/server
thought it was just local and global
what?
"global per client" ๐
Rephrase that pls, that makes no sense^^ yea, i don't sqf really, so I didn't know arma 3 used global and public as global per client, and global across all clients/server
each client would be a seperate instance of the program?
so it is available across all scopes, within that instance?
Local, Global = Client only
Public = Var spread across the Net, setting every GlobalVar XYZ on each Machine.
global being a generic term for all
global variables are by default local to one machine
public global variables are global (same on all machines).
Yes, I know.
But "global per client" makes no sense.
It's a contradiction.
so global, across all scopes on client. And global, across all scopes, across multiple machines.
depending on what you define the whole as
No.. public.
again, the word
I wouldn't use the adjective global outside of "global variable".
and the term
Public = everyone
Global = On my Machine
local = On my Machine in that scope.
are seperate things
To refer to global variables
you know you can use the word global in a context not relating to ther term global
lol
Long Story short: Shitty naming.
local = on my machine in that script instance
private = on my machine in that script instances scope and all it's child scopes.
access modifier
if we aren't talking about sqf
and talking variables
which is why I was confused
when you said public
I would abandon all knowledge of other languages when thinking about SQF :S
Public -> Sets GlobalVar XYZ on all Machine to its value.
There aren't really public global Variables though
You can execute a command to send your value of the variable to other clients in Multiplayer. But that doesn't make the variable Public. It's still a local global variable
Dedmen is technically right, but it helps to have "public global variable" as a concept when doing MP stuff.
So there are really only global/local variables. And SQF provides a way to send a copy of your global variable to other clients
It's more or less just "Hey, update this Var. I don't care what you do after that"
lol, this got into nitpicking wording when I just pointed out I learned sqf has 3 layers and not 2
It's not nitpicking. It's all basic stuff.
Unless you update it with publicVar again (wich is ... ah fk this... -.-)
you nitpicked me using both the word global, and the term global
Because it was wrong
^
global is an adjective
Doesn't matter in sqf
you assumed context that wouldn't make sense instead of context that does make sense
so nitpicking
Turn around, run against a wall, sqf was born.
I just said I wouldn't use it like you did, because it leads to confusion. Which leads to bugs.
โ
๐ถ
I was hoping I wasn't talking to the lowest denominator so I could used complex sentances ๐
and noone
could misinterpret
mmm
I spelt that wrong
there
besides, I have a white name, noone should trust me anyway
Now that is a logical fallacy.
I have a bad tendancy to beleive in people
I try not to
how closely does BE watch sql queries and returns from extdb3?
would it block certain returns?
would be nifty to change code of the mission mid mission ๐
kewl
I was hoping that was the case
seems like you could do interesting things to missions by modifying DB that mission pulls from
while mission is running
If mission is badly coded and doesn't sanitize inputs.. then sure
?
idk what you mean
I mean like being able to manage the game from a webpage.
by changing fields in the DB
mission checks the change, and implements code to effect game
without you ever launching game
things like that
or live updates to pricing
without having to load server with newer version
of the mission
and if mission is capable of compiling code and running it while game is running via a string, you could have some functions that can be bugfixed via DB, instead of updates to mission code
Yeah.. You can do all that. You can also just load scripts from a textfile that you can edit live.. Or write your own Extension to do whatever you want. Or just use Intercept and implement your own Server manager with direct access to SQF
and when you do the last one, make a linux .so for it please ๐
good to know dedmen, I was assuming it could. I'd like to develop a website that will balance and control game live while game is going/etc
since mission I play has a lot of units, and having people touch code to adjust balance
is bad
rather they touch a website
that everyone can view
that has access
DB's seem good for that
easy to filter/add/remove/etc balance via SQL
it would've sucked if I had started writing the code and idea wasn't possible ๐
After what you said already it sounds like you are more a C/C++/Java programmer than SQF right?
ya
Check out Intercept then. You might like it https://github.com/intercept/intercept
i looked at it vaguely once and thought it was great idea
but i wasn't modding
I am doing some help with a mission atm
and thought, man, they need some tools
๐
going into an sqf file to change balance seems silly when you are managing so many different items
@zenith edge then you might want to look into ArmA.Studio https://forums.bistudio.com/forums/topic/203020-armastudio-the-open-source-community-made-ide-for-arma/
latest release being available here: https://ci.appveyor.com/project/X39/arma-studio/build/artifacts
and the arma debugger being here: https://ci.appveyor.com/project/dedmen/armadebugengine
and the corresponding discord server https://discord.gg/RRaPyb9
hey, hopefully quick question. when and how often, is "thisList" updated upon a trigger activation? Is it constantly updated, or only once as it is activated?
btw, to anyone that was helping me before with the regen script, i got it to work
Triggers is every 0.5 seconds, no?
idk, im the one asking hehe
i can probably test that tho, now that i know that it does update periodically.
@little eagle sorry just one more question since you seem to know some stuff about triggers. If i were to spawn a script with the trigger activation. Could i then use this: ```sqf
_objArray = _thisList;
or this
_objArray = thisList;
to obtain the array of object? or would i need to pass some params into the function within the activation feild of the trigger?
[_thisList] execVM/ or call xxxx
_objArray = _this select 0; or better params ["_objArray"];
Is there a way to force the player to walk like this ? http://imgur.com/a/kT7ph
i can do it with player setdamage 0.5 but i don't want to modify his health
You can probably do it with setHitpointDamage
uhh ... you mean "just" walking? https://community.bistudio.com/wiki/forceWalk
because i cannot really see anything on that picture but that the guy is wounded
ok it's working with setHitpointDamage thanks
player setHitPointDamage ["HitLegs",0.5];
@queen cargo He is holding his right leg because it hurts so much
Could be done without setHitPointDamage by forcing the proper animation
Show how to.
Use the onAnimationChanged eventhandler. And if the player tries to walk replace it by the hurt walk animation. Easy. But kinda hacky. Hurts performance a tiny bit. And IMO too much work to get something done that can be done easier
Has anyone ever tried this? I see a ton of potential problems with this.
If something is "possible", but not feasible, then you might as well say it's not possible.
Replacing the Anim?
Yeah, but this is #arma3_scripting so it's implied to be done without config changes.
hmm
And I don't think ALWAYS limping would be the desired solution.
Hurts performance a tiny bit animations are barely swapped at all
impact with a simple if (_anim != "foobar") then switchmvoe "foobar" is ignorable
biggest problem should be different weapons need different moves
and using the wrong one renders the weapon unusable unless swapped twice
That is what i meant by tiny.
Also I'd expect such a short eventhandler to be coded in place. Meaning it's the if and switchmove and compiling all that everytime the eventhandler is executed even if the animation doesn't match
the latter actually can be harmfull
using switchmove or any other animation command doing that can break certain actions completly
they might fixed it by now
but back when i did it, it completly broke in certain idk ... edge cases? it just happened and felt random and out of place ...
I'll look over it again in a couple minutes. Maybe I'll find something else
private _color = WH_NT_FONT_COLOR_OTHER;
...
_color = [_color select 0, _color select 1, _color select 2, ((_color select 3) * (_alpha))];
->
private _color = + WH_NT_FONT_COLOR_OTHER;
...
_color set [3, (_color select 3) * _alpha];
private _showVeh = if (!isNil "WH_NT_SHOW_VEHICLEINFO") then [{WH_NT_SHOW_VEHICLEINFO},{false}];
Still think the missionNamespace getVarariable ARRAY syntax would help this one a lot.
Wow. That optimization possibility wasn't on my radar. Need to remember that.
Which bit? I wrote two things.
This:
private _showVeh = if (!isNil "WH_NT_SHOW_VEHICLEINFO") then [{WH_NT_SHOW_VEHICLEINFO},{false}];
is a weird way of writing:
private _showVeh = missionNamespace getVariable ["WH_NT_SHOW_VEHICLEINFO", false];
Which is simpler and faster.
Yes.
mission namespace is where all global variables reside by default.
You fetch a a global variable and if it's undefined, you use the default value instead (here: false).
Both statements are equivalent. I don't think there is any difference between them functionally. But the second one is as I said faster and avoids the super ugly = if
Yes. because https://community.bistudio.com/wiki/getVariable There is no getVariable that doesn't take a left argument.
Well. Atleast that says you have to have anything there. You could also use other Namespaces or objects or stuff. But not much sense in that
if(_u in units player) then
->
if (group _u == group player) then
This avoids the array operation.
Sure.
if (vehicle player isEqualTo player) then
->
if (isNull objectParent player) then
Uses unary operations exclusively which means it's probably twice as fast...
https://github.com/Whalen207/WH/blob/master/wh_nametags.Stratis/wh/nametags/fn_nametagDraw.sqf#L17
private ARRAY with one variable is not much different from private ARRAY with a dozen variables in it. Performance wise.
if (isNull objectParent player) then 2 unaries and one nular ๐ And the nular one is quite bad because of https://feedback.bistudio.com/T123419
You might actually improve performance by storing player in a local variable instead of calling player everytime. But at that point optimizing just get ridiculous
Plus. you define _nameColor as private twice.
https://github.com/Whalen207/WH/blob/master/wh_nametags.Stratis/wh/nametags/fn_nametagDraw.sqf#L65
The same nular operation is used twice is the current version though.
Ouhh yeah. Yours is an improvement anyway. Because the binary->unary
if (_fov > 1.67) then { _fov = 1.67 };
->
_fov = _fov min 1.67;
Not sure about this one, but it should be faster on average.
definetly. min is just a simple arithmetic operation. if/then are two quite complicated functions
Yeah, but you always assign a new value to the variable.
On the other hand, you trade two binary expressions for one. (>, then vs min)
That's cheap if the variable type doesn't change.
Does that matter in SQF?
private _team = assignedTeam _u;
_nameColor = switch (_team) do
{
case "RED": { WH_NT_FONT_COLOR_GROUPR };
case "GREEN": { WH_NT_FONT_COLOR_GROUPG };
case "BLUE": { WH_NT_FONT_COLOR_GROUPB };
case "YELLOW": { WH_NT_FONT_COLOR_GROUPY };
case "MAIN": { WH_NT_FONT_COLOR_GROUP };
default { WH_NT_FONT_COLOR_GROUP };
};
Something something namespaces.
Oh, I don't know about that. I was just thinking that the whole thing could be turned into a one liner. At least for the function that is used every frame.
// init
WH_TeamColors = [] call CBA_fnc_createNamespace;
WH_TeamColors setVariable ["RED", WH_NT_FONT_COLOR_GROUPR];
WH_TeamColors setVariable ["GREEN", WH_NT_FONT_COLOR_GROUPG];
WH_TeamColors setVariable ["BLUE", WH_NT_FONT_COLOR_GROUPB];
WH_TeamColors setVariable ["YELLOW", WH_NT_FONT_COLOR_GROUPY];
WH_TeamColors setVariable ["MAIN", WH_NT_FONT_COLOR_GROUP];
// each frame
_nameColor = WH_TeamColors getVariable [assignedTeam u, WH_NT_FONT_COLOR_GROUP];
The only downside would be, that you couldn't change the colors at runtime.
Oh.
CBA_fnc_createNamespace is highlighted. Neat.
testing:
CBA_fnc_createNamespace
CBA_fnc_notAFunction
hmm, maybe not.
a CBA hash would probably also suffice
or just
[WH_NT_FONT_COLOR_GROUPR,H_NT_FONT_COLOR_GROUPG,..] select (["RED","GREEN",...] find assignedTeam u)
Which is essentially a CBA hash in miniature form
Sure. You also need a + 1 to handle -1
and that will definetly be faster than a switch or a series of if statements
Or use param instead of select
-1 is not found right? assignedTeam can only return a fixed set of strings
select -1 errors out
Yeah. I just mean that the find cannot fail. Because you handle every possible case
But BI might add more Team colors.. theoretically
assignedTeam can return a bunch of stuff that is not documented...
Including nothing.
Whenever you remote control a drone or AI as zeus...
Ouhhh.. Okey then.
[WH_NT_FONT_COLOR_GROUPR,H_NT_FONT_COLOR_GROUPG,..] param [
(["RED","GREEN",...] find assignedTeam u),
WH_NT_FONT_COLOR_GROUP
];
Where WH_NT_FONT_COLOR_GROUP is the default color in case anything goes wrong
I'm hesitant to suggest things that improve performance at the cost of readability.
And this is so fucking ugly.
True. Just use a CBA hash and be done with it
I think CBA is meant to be optional, but you can always create your own pseudo namespaces without it I guess.
But yeah, Besides what's mentioned already, this one has potential for performance improvement.
You can still also put that https://github.com/Whalen207/WH/blob/master/wh_nametags.Stratis/wh/nametags/fn_nametagUpdate.sqf#L75-L81 into a select like you did for
https://github.com/Whalen207/WH/blob/master/wh_nametags.Stratis/wh/nametags/fn_nametagUpdate.sqf#L158
But please test if that improves performance. I'm not 100% on that
@tough abyss And then another select on the array of colors? That's exactly what I posted. Just that mine is more performant because it's using param instead of your if check.
If you do
_teamID = ['MAIN','RED','GREEN','BLUE','YELLOW'] find (assignedTeam _unit);
[WH_NT_FONT_COLOR_GROUPR,H_NT_FONT_COLOR_GROUPG,..] param [_teamID, defaultColor];
It would be the same as mine. Though IMO alot more readable. But looses a negligable amount of performance because of that variable assignment
_ents select {
// Only other entities...
_x != _unit &&
// ...and only if they're on the same side, or in the same group.
{(side _x isEqualTo side _unit) || {(group _x isEqualTo group _unit) || {(side _x isEqualTo civilian)}}}
//&& !(_unit iskindof "VirtualMan_F")}
}
yep. Literally copy pasted your if block. Because that's exactly what select does
ents
Lord of the Rings.
select just checks a condition. for each element in the array. If the condition returns true then that element will be included in the resulting array that select will return
Which is exactly what your if->then was doing
I think you could very easilly cache the vehicle Nametags.
Just setVariable it on the vehicle. And you can check if the cache is still valid using _cachedCrew isEqualTo (crew _vehicle)
That should work I think.
https://community.bistudio.com/wiki/fullCrew is probably better
@hasty violet I left a couple more comments as comments on your latest commit
Actually collected quite a bit of stuff there.
I really like your comments. I don't see such extensive comments that often.
That's about a dozen other recommendations. I'll go to bed now and come back tomorrow with new ones ๐
Very good. Keep it up ๐
Erm quick question.
Is there a way I can convert, "[x,.y,z]" which is a string to a array that works with setPos?
Im transfering the data over a gui using lbData which only allows a data type of string.
you can use call compile but there might be a better way to do it in 2017
I've never been able to figure this out, but doesn't Arma have a chat event that I can bind to for parsing player inputs? Like if I want to say (!command arg1 arg2) in global chat or whatever, I can parse and react to it?
I've never seen it in the list of Event Handlers but I feel like I've seen people implement that somehow on some servers.
@modern sigil http://www.armaholic.com/page.php?id=26377 just checkout what he did
Pro click, @queen cargo . Thanks man!
Ah I see what this guy did. He did it the React way in web development:
- Track all of the buttons that are pressed on the keyboard via the "KeyDown" event
- When the "chat" button is pressed, start memorizing the buttons until they hit Enter or Escape
- When they hit Escape, just abort and forget about it
- When they hit Enter, check whether the stuff it memorized matches a command
- If it did, run the command
hooking the textbox should be simpler
How could I check if a player is running up a hill?
Its for an auto-run script, I just need to know if their on a hillside, the script already does the running
man i can't seem to get the squad names to stick at the slot selection screen. You guys got any ideas?
lame
@hasty violet you can declare without initializing with private ["_vehicleName"]; or private "_vehicleName";
(can do multiple at the same time with the first one)
wil be 'nil' until you set it to something
i'm not sure if it'd really help performance or anything though if that's the plan (would be negligible anyway)
yeh it will be out of scope if you do it in the if statement
you could put the second if statement inside the first one
{
private _vehicleName = format ["%1",getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayname")];
.....
if (!(_vehicleName isEqualTo "")) then
{
drawIcon3D ["", _color, [(_position select 0),(_position select 1),((_position select 2) + WH_NT_FONT_HEIGHT_VEH * 3)],
0, 0, 0, _vehicleName,WH_NT_FONT_SHADOW,_sizeV,WH_NT_FONT_FACE_MAIN];
};
};
I was actually having a bit of an interesting time with something related. Can't get this to work: params["_unit"]; hint format["%1, %2",getText (configFile >> "CfgVehicles" >> typeOf _unit >> "displayname"),(parseText format["<img image=%1/>",getText(configFile >> "CfgVehicles" >> typeOf _unit >> "icon")])];
no errors, just no image.
not quite sure if/how that would work
because it's parsing text, then formatting it back from structured text into text
maybe params["_unit"]; hint parseText format["%1, %2",getText (configFile >> "CfgVehicles" >> typeOf _unit >> "displayname"),(format["<img image=%1/>",getText(configFile >> "CfgVehicles" >> typeOf _unit >> "icon")])];
assuming hint can use structured text
@vapid frigate well yes a hint can use structured text, just was wondering if i could trick it to do it all in one line instead of assigning it a variable and potentially losing performance and organization
what i pasted should work then
(building the whole string to parse and then parsing it)
ooooh, that makes a lot more sense. wow i feel stupid, thanks
@warm gorge i think you can use this to detect if the terrain is a hill
https://community.bistudio.com/wiki/BIS_fnc_terrainGradAngle
Nice, thanks FP guy @cedar kindle
who are you ๐
@simple solstice Perfect, just what I needed. Thanks
๐
Actually @cedar kindle I just looked deeper into the CBA way of doing this and it's actually the exact same thing but more obfuscated. The way the other guy did it works with vanilla, at least. So maybe I can use the first one for compatibility's and mission dependency's sake.
Hello guys, does anyone know if it is actually possible to run an sqf script when the server is getting stopped ?
nope
Not unless you're stopping it via script
Thx
@vapid frigate @subtle ore instead of parseText format [...] use formatText [...]
@queen cargo Is there actually a difference between those 2 methods ^?
it does not have an upper output limit like format @tough abyss
Ive always used parseText format, I guess ill use formatText now ๐
I have two arrays:
_letters = ["a","b","c","d","e"];```
How do I create a new array using these two to produce:
`_final = [[1,"a"],[2,"b"],[3,"c"],[4,"d"],[5,"e"]];`
there is no simple magic command
you have to iterate over both arrays and add them up
depending on your specs, the actual way differs
in case they always are even in length ```sqf
_outArr = [];
for "_i" from 0 to count _numbers do
{
_outArr pushBack [_numbers select _i, _letters select _i];
};
better question however is: why you want those two arrays joined like that?
I've got a number of objects, for each object I'm creating a marker. Then every 30 seconds I want the marker position to update based on the objects new position. I couldn't work out how to properly nest a foreach so I've hardcoded a nested array. however that relies on all the objects being present, which they might not be:
_escapeeMkr = [];
{
_Mkr = createMarker [str(_x), (getPos _x)];
_escapeeMkr pushBack _mkr;
} forEach _escapee;
{
_x setMarkerShape "ELLIPSE";
_x setMarkerSize [50, 50];
_x setMarkerColorLocal "ColorRed";
_x setMarkerAlphaLocal 0.3;
} forEach _escapeeMkr;
_finalarray = [[ind1,"ind1"], [ind2,"ind2"], [ind3,"ind3"], [ind4,"ind4"], [ind5,"ind5"], [ind6,"ind6"], [ind7,"ind7"], [ind8,"ind2"], [ind9,"ind9"], [ind10,"ind10"], [ind11,"ind11"], [ind12,"ind12"], [blu1,"blu1"]];
{
while {alive (_x select 0)} do {
_marker = (_x select 1);
_pos = getPos (_x select 0);
_marker setMarkerPos _pos;
sleep 30;
};
} forEach _finalarray;
so I want to change _escapee to something like ( allPlayers select { side _x == independent} ); and then join _escapee with _escapeeMkr to dynamically populate _finalarray
@X39#2180 thanks, I'll try that out now "instead of parseText format [...] use formatText [...]"
@X39#2180 seems like the formatText just spat out the string I fed it in the format in the second variable it was supposed to hint. parseText just remained empty.
You don't use parseText together with formatText
You replace parseText format with formatText
Hello, I have this script:
https://pastebin.com/DHHkUMTB
What it does is running a function of gear I created.
When I join the mission as the "PE_PL" for example, it won't find the others because I they didn't join the session.
It does give the gear of PE_PL though.
And I get an error says "undefined variable" on all of them.
What can I do to fix this? Is there a way to check if the other units has joined the sessions?
formatText already reports Structured Text and not String.
parseText formatText would be a syntax error and is shown as such on screen and in RPT
waitUntil {scriptDone processParamsArray};
This looks wrong.
Adir
@little eagle Well of course I didn't combine the two. hint parseText format[] and hint formatText[]
Then what did you do?
hint parseText format["%1, %2",getText (configFile >> "CfgVehicles" >> typeOf _unit >> "displayname"),(format["<img image=%1/>",getText(configFile >> "CfgVehicles" >> typeOf _unit >> "icon")])]; original, edited: hint formatText["%1, %2",getText (configFile >> "CfgVehicles" >> typeOf _unit >> "displayname"),(format["<img image=%1/>",getText(configFile >> "CfgVehicles" >> typeOf _unit >> "icon")])];
Why? @little eagle
I have processParamsArray = [] execVM "ParamsArray.sqf"; in init.sqf
init sqf runs after object init, so the variable will be undefined
Hard to tell what's wrong with just a piece of code that does exactly nothing effectively
formatText["%1, %2",getText (configFile >> "CfgVehicles" >> typeOf _unit >> "displayname"),(format["<img image=%1/>",getText(configFile >> "CfgVehicles" >> typeOf _unit >> "icon")])];
, <img image=/>
So no wonder hintshows nothing
Yeah, this is all backwards. Let me fix it for you.
@subtle ore The icon config entry is NOT a picture. You cannot display it
What if I do
if (!alive _unit) exitWith {};
@little eagle It's a string....
That was the whole point of parseText initially, getting that image path from that icon (a string) into the image.
That string does not represent an image though
_unit = player;
private _displayName = getText (configFile >> "CfgVehicles" >> typeOf _unit >> "displayname");
private _icon = getText (configFile >> "CfgVehicles" >> typeOf _unit >> "editorPreview");
hint formatText ["%1, %2", _displayName, image _icon];
systemChat _icon;
This works for example. But it uses an actual image.
editorPreview and not icon
Hmm, what about the picture entry?
pictureis for CfgWeapons and not CfgVehicles.
Are we talking about soldiers or vehicle vehicles?
vehicle vehicles.
Should probably rename _unit to _vehicle then
sigh I was quickly running it through, polishing it later.
Well that might've been a mistake.
Nah.
_unit = vehicle player;
private _displayName = getText (configFile >> "CfgVehicles" >> typeOf _unit >> "displayname");
private _icon = getText (configFile >> "CfgVehicles" >> typeOf _unit >> "icon");
hint formatText ["%1, %2", _displayName, image _icon];
works inside vehicles
icon is an image for vehicles
Yes, I'm not executing this anywhere other than the debug console. cursorObject and just feeding the vehicle through.
Problem solved?
Yep.
could someone explain to me why player SetPosASL [ (getPosASL _dest select 0) - 10*sin(_dir),(getPosASL _dest select 1) - 10*cos(_dir),getPosASL _dest select 2]; throws errors for a string near the first getPosASL?
formatText looks pretty shitty compared to the parseText format method though
Should've went with my instincts. X39 is again wrong.
private _vehicle = vehicle player;
private _displayName = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "displayname");
private _icon = getText (configFile >> "CfgVehicles" >> typeOf _vehicle >> "icon");
hint parseText format ["%1, <img image='%2' size='5'/>", _displayName, _icon];
This can be used to resize the image which might be necessary.
Yes I see, was looking at thow the different images can include line breaks with text and such. But I'll play back and forth with it. parseText looks like the way to go.
@tough abyss because _dest is undefined.
titleText ["", "BLACK OUT"];
systemChat "Teleporting to destination!";
sleep 1;
_dir = random 359;
player SetPosASL [ (getPosASL _dest select 0) - 10*sin(_dir),(getPosASL _dest select 1) - 10*cos(_dir),getPosASL _dest select 2];
systemChat "Arrived at destination!";
sleep 1;
titleText ["", "BLACK IN"];
//disableUserInput false;
systemChat "You are good to go soldier!";```
pretty sure it would be?
parseText can handle all the html stuff, while formattext can only piece together already done images.
It's essentially useless, because it's a worse version of parseText format
it worked fine with getPos but it'd spawn players in the water, hence setPosASL
And the 8012 char limit will never come into play anyways.
How would one make it where map marking could only be shared via Direct Chat?
yeah I saw the a3 example for it all, included a html variant of text posted there.
@tough abyss That doesn't help. What is _this? There is too many unknowns to answer your question.
it's an object
with a variable name
passed through with an addaction
needed to determine the position the player needs teleporting to
player SetPosASL [ (getPosASL _dest select 0) - 10*sin(_dir),(getPosASL _dest select 1) - 10*cos(_dir),getPosASL _dest select 2];
looks overly complicated.
well, edit x and y coordinate slightly and set the correct height, no?
Maybe it helps if you do one step of that in individual lines?
@tough abyss
_dest = tank;
player setPosATL (_dest getPos [10, random 360]);
This looks much simpler and I think it does what you were trying to do
Adir, your script does nothing. It's really hard to say why it wouldn't work.
It works.
The only problem is that it throws errors of "undefined variable", on the units that are not in.
For example if I'm PE_PL, and I'm alone in the server it will throw the errors on all of the other units.
So I wondered if there's a way to make it check if they are even exist it execute the script.
And it probably also doesn't work if these units jip
Most likely, I didn't check JIP yet
still according to the code _dest = (_this select 3) select 0; returns a string, not an object
even though it's an object
it's a general script for TPs
So I wondered if there's a way to make it check if they are even exist it execute the script.
If (!isNil "PE_PL") then {
};
What string does it report?
Maybe you should add some debugging with diag_log.
I don't follow What string does it report?
The question was for TheNightalk3r
oh
lol
ok
this addAction ["Teleport to Base","scripts\teleportBase.sqf",["base"]]; and then _dest = (_this select 3) select 0; should select the object with name base right?
any way for it to select the object called base?
pass the object as argument and not a string I guess.
I think it's still within scope though... because there's a loop, below, and I can't have it being re-initialized again and again throughout the loop
But if you are resetting that variable in every iteration of the loop. That doesn't matter. You are pulling variables into a scope where they are never used/needed.
What do you mean by re-initialized again and again?
@hasty violet And I don't see the script error in there. Maybe Arma.Studio's Linter can see it @queen cargo ๐
No. Why would it?
Everything between "" is a string. A string is not an object.
Beautifully said.
case 2:
{
If (!isNil "PE_PL") then {>```
```sqf
private ["_gear"];
waitUntil {scriptDone processParamsArray};
_gear = Gear;
switch (_gear) do
{
case 2: //MultiCam
{
If (!isNil "PE_PL") then {
[PE_PL,"BLUEFOR","PL", "multicam"] call gearscript_fnc_assignLoadout;
};
If (!isNil "PE_CM") then {
[PE_CM,"BLUEFOR","CM", "multicam"] call gearscript_fnc_assignLoadout;
};
};
}; ```
Looks like you made a mistake.
Well... The error is at your case 2 But you don't have that. So.. Arma is just fooling around with you.
Also wtf is up with that private _gear Gear thingy there.
just switch directly on Gear.
Sorry, I actually do have it.
But I just showed you case 2 but it's exactly the same.
I edited the code
I don't see it.
Why do you have multiple cases that do the same? In a switch that switches on a private ARRAY privatized local variable that really is just a Global variable
on case 0 it's "aor1" in case 1 it's "aor2", etc.
Maybe post the whole script and not an edit
ok
If you have 99% duplicate code and just one string or a single char inside a string is changing. You are doing something wrong
Wouww okeyyy.
Now give the full error. With line number ๐
_camo = ["aor1","aor2","multicam","multicam_alpine","multicam_arid","multicam_black","multicam_tropic"] select Gear;
waitUntil {scriptDone processParamsArray};
If (!isNil "PE_PL") then {[PE_PL,"BLUEFOR","PL", _camo] call gearscript_fnc_assignLoadout;};
If (!isNil "PE_CM") then {[PE_CM,"BLUEFOR","CM", _camo] call gearscript_fnc_assignLoadout;};
...
Now your script is 1/6th the size + a little bit faster + more readable
But it works.. I guess... Well. Actually it doesn't. Because of that error you posted.
case 2: { If (!isNil "PE_PL") then {> 21:54:02 Error position: <}; case 2: { If (!isNil "PE_PL") then {> 21:54:02 Error Missing { 21:54:02 mission_scripts\gear_script\gearSelector.sqf, line 91 21:54:02 Error in expression <"] call gearscript_fnc_assignLoadout;}; };
What's the goal? Make something that works or make something that can actually be maintained.
Dedmen, how does it select the camo?
_camo = ["aor1","aor2","multicam","multicam_alpine","multicam_arid","multicam_black","multicam_tropic"] select Gear;
Just read the code ^^
It select's the element of that array by the Index stored in Gear
If (!isNil "PE_PL") then {[PE_PL,"BLUEFOR","PL", "multicam"] call gearscript_fnc_assignLoadout;};};
This line has one {, but two }
But the two case blocks above have the same amount of opening and closing curly brackets.
No. case 0 is correct. The others aren't
Sure.
case 1 seems to be correct too
See? It helps knowing which line to look for.
Looking at this is hypnotising.
case 1: //AOR2
{
If (!isNil "PE_PL") then {[PE_PL,"BLUEFOR","PL", "aor2"] call gearscript_fnc_assignLoadout;};};
If (!isNil "PE_CM") then {[PE_CM,"BLUEFOR","CM", "aor2"] call gearscript_fnc_assignLoadout;};};
Look closer
Hmm. True.
Also these types of errors are why you should use a Linter
I don't want the variable to exist in any capacity unless I'm using it.
I'd like to hear the reasoning behind that
https://github.com/Whalen207/WH/blob/master/wh_nametags.Stratis/wh/nametags/fn_nametagUpdate.sqf#L17
Why does that variable need to be available in that scope?
You could define it as private
https://github.com/Whalen207/WH/blob/master/wh_nametags.Stratis/wh/nametags/fn_nametagUpdate.sqf#L72
and
https://github.com/Whalen207/WH/blob/master/wh_nametags.Stratis/wh/nametags/fn_nametagUpdate.sqf#L98
What is your reason to not do that?..
It's true. Right now you could access the variable of the last entity that was processed after the loop. But you don't do that and I don't see any reason to.
Well. Theoretically. In practice you are never assigning your Initial variables. Meaning that private _var code actually does nothing. Meaning they aren't private and not available in that scope
I think.
private _targetPosition;
is a syntax error
It's either
private "STRING"
or
private _var = value;
Currently it's:
private _undefined;
and the only reason it doesn't error is, that it's running in unscheduled environment.
yep. I think theoretically the engine sees that as reading a variable and just ignores... No. private is coupled to = so that's a syntax error
ahhhh. yeah. You are calling private ARRAY as private nil currently.
yup. Or private STRING. No difference.
I feel like that huge if-then-else-if construct could be a switch and it would be less indented.
I wonder how many people do stuff like this
_privateVariableName = "_myVar";
private _privateVariableName; //privatize _myVar
Hopefully no one.
https://github.com/CBATeam/CBA_A3/blob/master/addons/common/fnc_createPerFrameHandlerObject.sqf#L134
isnt both the same?
Elaborate.
If I want to create an object per script on another object, like on a table, is it enough to createvehicle with array and set "can_collide" or are there other things that need to be considered?
You could try.
I did and so far item spawns on table. The thing is that with arma and physics etc. from experience things can be a bit wonky, that's why I'm asking if there is anything else to consider.
I wouldn't worry about hypothetical problems until they arise or are shown to exist.
ok
Hi, I tried dedmen's way of the script
_camo = ["aor1","aor2","multicam","multicam_alpine","multicam_arid","multicam_black","multicam_tropic"] select Gear;
waitUntil {scriptDone processParamsArray};
If (!isNil "PE_PL") then {[PE_PL,"BLUEFOR","PL", _camo] call gearscript_fnc_assignLoadout;};
If (!isNil "PE_CM") then {[PE_CM,"BLUEFOR","CM", _camo] call gearscript_fnc_assignLoadout;};
...
But it doesn't give the gear, no errors.
I used params before in order to get the gear
class Params
{
class tfwp_gear
{
title = "Gear For The Mission";
values[] = {0,1,2,3,4,5,6};
texts[] = {"AOR1","AOR2","MultiCam","MultiCam Alpine","MultiCam Arid","MultiCam Black","MultiCam Tropic"};
default = 2;
isGlobal = 1;
code = "Gear = %1";
};
};```
Well. It does the same as before. Can't you make the values just be Strings? do they have to be numbers?
They have to be integers, yes
what about BIS_fnc_getParamValue; ?
Getting the value into Gear worked before.
Is your code really ... or did you add all your isNil checks back in there?
I removed the ... and added the others
Okey. Have to ask. Because there are such people here ๐
you could put a
systemChat _camo after the waitUntil. To check if your code is being executed
That way you also see if it choose the correct camo
yup it says "multicam" which is the right one in the parameter
but I still don't get the gear
ยฏ_(ใ)_/ยฏ
and if i run [PE_PL,"BLUEFOR","PL", "multicam"] call gearscript_fnc_assignLoadout; in the debug in does give me the gear
maybe PE_PL is still nil. For.. I don't know whatever reason
nono
Can you pastebin the full script again?
That is not what you posted above..
_camo = ["aor1","aor2","multicam","multicam_alpine","multicam_arid","multicam_black","multicam_tropic"] select Gear;
waitUntil {scriptDone processParamsArray};
If (!isNil "PE_PL") then {[PE_PL,"BLUEFOR","PL", _camo] call gearscript_fnc_assignLoadout;};
If (!isNil "PE_CM") then {[PE_CM,"BLUEFOR","CM", _camo] call gearscript_fnc_assignLoadout;};
...
is correct.
but
_camo = ["aor1","aor2","multicam","multicam_alpine","multicam_arid","multicam_black","multicam_tropic"] select Gear;
waitUntil {scriptDone processParamsArray};
If (!isNil "PE_PL") then {[PE_PL,"BLUEFOR","PL", "_camo"] call gearscript_fnc_assignLoadout;};
If (!isNil "PE_CM") then {[PE_CM,"BLUEFOR","CM", "_camo"] call gearscript_fnc_assignLoadout;};
...
isn't
You see the difference?
I can't find your error if you fix your code snippet before you post it here ๐
I actually did CTRL + H from aor1 to _camo
and didn't realise that it will keep the "
I didn't think about including the "" to the search
sry
I have the gear now
Thanks alot ^^
arrays are pretty cool lol
you could do the same thing with your 'roles' ("PE_PL") and turn the whole script into essentially a one liner with a bit of 'config' at the top.
Am I using this macro correctly?
#define SEL(ARRAY,INDEX) (ARRAY select INDEX)
parseNumber SEL(_query,2);
its throwing a Error Missing ; error and I'm not sure why
would be nice if my rpt would give me the full error line instead of chopping it off
did you add a ; at the end of the line?
We currently have a militarized server running the exile mod. Some of the air assets have radar that is just nuts, like being able to see things 18k out. would it be possible to run a script that would make all air assets not see or lock on to targets further than 3k? We would like to add back some of the better heli's and jets but being able to lock on at 5k-6k out just make them a little OP. I am just learning to script, but any help with this if possible would be greatly appreciated. Much thanks to any who respond.
@fast sphinx 18k km out? that's a stretch.
The Apache Heli is pretty close to that.
isnt 18km out realistic?
@delicate lotus It is, it's just like saying how we shouldn't have UAV's and just do it ourselves. Real radar stations would pick up on much more than it does ingame.
@fast sphinx Which?
not sure but maybe https://community.bistudio.com/wiki/setVehicleRadar would help @fast sphinx
@delicate lotus Yes it is realistic, but we are running the exile mod not a mill-sim. just makes them a little OP
would only help for AI though if anything
@vapid frigate AI variant, won't work on players afaik.
@fast sphinx "Over Powered" means absolutely nothing. It does what it is designed for.
Yes I know it is doing what it is supposed to. I would like to make it to where all air assets have the same radar distance so it is a level playing field.
i think you'd have to make config changes to do it
Why? What's the point of air superiority?
@subtle ore Nevermind
it's pretty obvious why it'd be overpowered in a pvp game
I don't think he understands
is a custom config an option?
#offtopic_arma , final words on this: Make your "balancing" magic happen then. Or don't have them at all, doesn't make sense why you would want to damper the power of the plane.
@vapid frigate It might be. Like I said, I am new to scripting but I do have some Dev's on our team that could maybe help with that. I figured I would come on here and ask where to start since the knowledge here is so vast.
to change them, but would have to modify the choppers configs to do so
(so it'd have to be in an extra pbo on server/all clients)
@vapid frigate I appreciate the assistance in a place to start. Going to get with one of our Dev's and see if he can assist in getting this in motion. Again thank you.
18:38:31 Error position: <params ["_destination","_destinationName>
18:38:31 Error Local variable in global space
18:38:31 Global namespace not passed during:
params ["_destination"
why would I be getting this on arma start when im not even compiling or running this .sqf, pretty sure its just being pulled out of the pbo
dev branch btw
doesnt happen on stable
it runs somehow then, probably through some event that fires during game loading
@meager granite the only reference to it is in a custom Cfg class
class CfgOverthrowMissions
{
class FactionWeapons
{
target = "Faction";
repeatable = 1;
condition = "_standing < 50";
script = "\ot\missions\factionweapons.sqf";
chance = 100;
};
its not compiled or run until much later than arma load
Not sure if its possible but has anyone considered trying to make the Praetorian 1C able to shoot down morters
is there a way to get the unit a curator is currently remote controlling?
as it stands, if a curator uses remote control on an AI, the player command will still point towards the curator, not the AI unit that he is controlling
nevermind, found out how to access it: missionNamespace getVariable ["bis_fnc_moduleRemoteControl_unit", objnull]
(found in BIS_fnc_moduleRemoteControl)
anyone got some insight about this? https://forums.bistudio.com/forums/topic/151099-scripting-discussion-dev-branch/?do=findComment&comment=3204138
@hasty violet worldToScreen.. Maybe? Dunno. I should probably look at what poscamtoworld does first
See https://community.bistudio.com/wiki/positionCameraToWorld the second Note
positionCameraToWorld [5,10,15] == _camera modelToWorld [5,15,10];
so you can use that + worldToModel
Hey guys, I've been trying to make a system to initiate variables to publicvariables on start with entries that have publicVariable = 1; and then the functionname. This is the code ```{
publicVariable (getText (_x >> "variable"));
[LOG_INFO, format ["%1 IS NOW A PUBLIC VARIABLE", _x], _fnc_scriptName] call log;
true
} count (configProperties [
configFile >> "CfgFunctions",
"isNumber (_x >> 'publicVariable') && {(getNumber (_x >> 'publicVariable')) isEqualTo 1} && {isText (_x >> 'variable')}"
]);
. I get the following errors 20:29:17 Warning Message: 'version/' is not a class ('publicVariable' accessed)
20:29:17 Warning Message: 'init/' is not a class ('publicVariable' accessed)
20:29:17 Warning Message: 'createShortcuts/' is not a class ('publicVariable' accessed)``` Any thoughts?
you are not checking isClass _x
But everything is a class in the config? @still forum
I had that before but removed it cause I didn't see a point of having it there
Or are you on about the properties below a class?
Ah okey then I see
version/init/createShortcuts are probably just entries that are not classes
Ah ye right
you can probably use configClasses instead of configProperties?
But it does not go through classes below?
I don't know
I was looking into it, but I think I came to the conclusion to use this since it can check inherit classes
Okey the error is gone now
it is still not making them public variables however
Maybe i am missing something... it seems like it does not go through the classes below the most parent class
Does anybody has a clue how the blue cylinder displayed in 3den when playing down a trigger is made? Is there a script command to create a cylinder?
@shut flower eg. https://community.bistudio.com/wiki/drawPolygon
isn't this polygon 2d?
and isn't this only for maps? I mean the 3d cylinder in 3den not the blue circle on the map
Hey guys, sorry if it's the wrong place. I'm looking for a script that basically blacks out the players screen if they're not connected to Task Force Radio, with maybe a text saying "this server requires you to have TFR connected on 123.123.123.124" or something. Anyone offer some wisdom?
Even when TFR is running but not connected to the channel or anything
Sorry I'm damn awful at making a script from scratch, could you maybe offer some further help? ๐
I'm not completely into TFAR (But @still forum is)
My solution would be to double check the channel the client is in with the channel he should be into
and then just use cutText
See #channel_invites_list I think the TFAR discord is in there
Ah I know what you wanna do
don't need tfar discord for that. One sec
Use
https://github.com/michail-nikolaev/task-force-arma-3-radio/blob/master/arma3/%40task_force_radio/addons/task_force_radio/functions/fn_getTeamSpeakServerName.sqf or
https://github.com/michail-nikolaev/task-force-arma-3-radio/blob/master/arma3/%40task_force_radio/addons/task_force_radio/functions/fn_getTeamSpeakChannelName.sqf
To check if server/channel is correct
1.0 also has https://github.com/michail-nikolaev/task-force-arma-3-radio/blob/1.0/addons/core/functions/plugin/fnc_isTeamSpeakPluginEnabled.sqf
But that doesn't make sure the Player is on the correct server
I'd probably have to use the teamspeakchannelname one
you should use both
The server/channel functions will return empty string if not connected
to make sure he is not on a different server which has a channel named like yours
Ugh I'm so sorry for asking this guys, but there isn't any chance one of you could write up a quick script for me?
If he is on the right server and you are using serious mode automove will kick in anyway. So server check should be enough
gimme a sec
Literally would mean so much to me
do you use cba?
Yeah
and lets switch to a private chat
Okay ๐ค๐ป
btw @still forum why doesnt tfar uses channel ids?
It could. I don't know. That was part of the old system before I joined. I can add that though.
I'll push that to my todo list
great, would be awesome so that the system is not depending on the channel's name
Serverid would also be neat. But I guess that doesn't exist
But the TFAR automove would still be depend.... Nah. I can make that a number too If I want to..
Hi, is there a way to run a SQF file from a FTP server?
...?
Download it. Enable filePatching. And run it
You can write a Extension that fetches it and gives you the code back as a string
Or you could use Intercept (Solves all Problems :D)
Is Intercept a managed dll?
managed means?
C++/CLI no. C# no. Plain C++ But I don't think that's what you mean with managed
I have no real clue about C++ by AFAIK there is managed C++ which can be using in C# like a C# library
and if not you need to use dllimport
but I assume it's not
Yeah no. Unmanaged
You can also use htmlLoad script command I think
But I'm not sure if htmlLoad can handle ftp
The annoying part about Intercept IMO is that the dll has to be whitelisted by be
Or is there a way to get around this?
@tough abyss It looks like you're tackling something that you shouldn't be
Or atleast, haven't thought about the best method to do it
You don't need whitelisting Serverside
but clientside
And somehow I also like that Idea of only running Intercept Serverside. the Server is a secured Area. And Intercept is quite powerful.
but how to handle scripts that has to run on the client? using intercept I have to write a client dll or am I wrong?
Yeah. You would need to do that. And get it whitelisted and stuff.
thats the annoying part
I would adore it if you just could whitelist dlls serverside with signatures
Not really a way to get around that. Even if BI would integrate Intercept. You would still need whitelist for your Plugins
Yeah. That would be awesome. That would give the Serveradmins the control on what is safe and what's not. And Serveradmins might not have a clue. But. They are sure not gonna whitelist a known Hack. That would also elliminate the Problem of BE going offline and everyone being screwed because TFAR/ACE don't work anymore
Write a Feature Request on the Feedback Tracker. I'm sure it will be ignored for eternity.
Problem of BE going offline and everyone being screwed because TFAR/ACE don't work anymore
which really happens too often
I'm sure it will be ignored for eternity
Like most things that are requested and really could be useful
Or Mods could just define their Extensions in their PBO's. So people would allow them on their Server by just allowing the bisigns of the PBO's
Btw we are planning to do exactly that in Intercept. That you have to provide a hash for your Plugin in your config. So it makes sure the right one is loaded
You could exchange the extension. At least they have to be signed in any way
LUL that feature request was created by Bohemia itself. 3 years ago. And it was even assigned
I think it was merged from the old issue tracker
The extension whitelisting was just a rash action as hackers found too many exploits
Quick implemented to "solve all problems"
but it's not a nice solution, it impedes extension makers
I think that feature request would solve a lot of problems. It would prevent Hacking even more than Battleye does currently.
Battleye even whitelisted my Debugger a couple weeks back. A completly obvious Hack that hooks deep into the Engine and can Manipulate any Script that runs. Whitelisted. Just like that. I just got messaged on Discord one day "Hey. The debugger was whitelisted"
With extension bisigns that couldn't happen. We just wouldn't provide a bisign for it. So no one can ever accept it except if they have bisigning disabled
How are you whitelisting extensions? Writing an email to suter like in good old days or is there now an easier way?
Yep. Exactly like that
Wow. A support panel would be nicer for such things
I think you could also just buy a couple hundred bucks code signing certificate and sign your Extensions. That would whitelist them automatically. Which is what all the Drivers do.
A lot of Hackers also do that btw. If you can spent like 300 bucks to get your Hack whitelisted. That you then sell for 80 bucks a piece to dozens of people.. You really don't care about the couple hundred for the cert
Do you really think so? I know that it was like that back some years but I think Be changed this completely and whitelisted all drivers and so on
because there are drivers hooking up into every program (which are definetly signed) but still get blocked by BE
Well.. A year back you could just create a certificate yourself and sign your dll. And BE would accept it. That is what I used back in the day to get my hack around BE.
There were also Companies leaking their certificates. So you could use that leaked certificate which BE was already accepting to sign your Extension. That also worked for a while. I think BE added a blacklist for these certs
You were a hacker?
Yeah. Well. Just experimenting. For research purposes not for Hacking purposes
I wanted to make a deeply engine integrated Cyborg HUD thingy. A bit Crysis like.
"research purposes" ๐
That could detect heat signatures through walls and stuff. Correctly implementing everything like I wanted never happend because I never had the Time. But I had a working ESP that could see enemies through walls. So.. Had a little fun on KotH with that till I got banned ๐
Haha, got banned from KotH too because I was flying around ๐
obviously not in a helicopter or jet
I can strongly advice anyone to try to build a Hack. It's a awesome learning experience. You learn a lot about how the Arma Engine works in its bowels. And also a lot of how Computers work in general.
And later you can use that experience for good. For example by contributing to Intercept. Although I finished most of the Hacky stuff already
that were my first c# experiences but I never managed C++, it's just confusing for me
goes to bed. 3AM is sleeptime
anyone know how to closeDisplay if the display is created like this
fnc_SpawnIt = {
//close the display here!
};
simply adding _display closeDisplay 1; did not work.
out of the fnc_SpawnIt i can call the closeDisplay correctly though
i know i can createDialog and closeDialog but that would require an extra file to hold the dialogs :/
is fnc_SpawnIt executed in scheduled or unscheduled environment?
I assume that _display is not available in the fnc_SpawnIt scope
so _display is undefined
and therefore you can't close it
are you passing _display as a param to fnc_SpawnOt? @tough abyss
no i dont pass _display. the fnc is called like this ```_buttonBox ctrlSetEventHandler ["ButtonClick", "_this call fnc_SpawnIt"];
this can't work
if you add an ui event handler the code will be executed in a different namespace and a different scope
therefore you don't have _display defined
yeah i figured so. i guess ill just make a pseudo dialog and replace it with the display
you don't have to
you can get your display in fnc_spawnIt like that private _display = findDisplay <idd>
and then it would work
you have to get the idd from the config
I read that very briefly, and I'm not 100% sure how you're carrying it out. But you can get the players direction (vectorDir), and aslong as your lines (plane) are normal to that, it will face the player
That will give you a normalised vector (in the same direction)
You might have seen it denoted as a unit vector
no, it's not
'normal' to a plane, is orthogonal
Does anyone know how to detect whether the player is actually controlling a UAV device and in that UAV interface mode?
That is why "normalized vector" is a shitty term and you should call it "unit vector". "norm" also refers to the length of a vector, so I argue that you might as well name the command "vectorDenormalized".
Nevermind my question earlier -- I figured it out and turned it into my very first pull request for the ACE mod! https://github.com/acemod/ACE3/pull/5308
@hasty violet use
```sqf
code-here
```
_vehicle = createVehicle["Penis", getPos player];
player moveInDriver _vehicle;
๐
You subtract the position from your target from the position of your origin. That is the vector from the origin to the target.
It seems weird to me that you calculate the cross product of a unit vector and a non-unit vector.
uhm
1,0 x 2,0 = 0,0
So length 0, but the non-unit vector had length 2
Why not do the cross product between two unit vectors? The result will be the unit vector orthogonal to the plane both vectors span.
So you can simply vectorMultiply the result with the desired length.
Which is (WH_NT_FONT_SPREAD_TOP * _fov) I guess?
You can normalize after getting the crossproduct if youre only interested in the direction of the result anyway
There is also only one orthogonal vector, you can just scale it infinitely
Why? The result of a cross product between two unit vectors will be a unit vector. Or 0,0,0 I guess.
But if you do the cross product between one or more non unit vectors, you won't get the orthonormal from what I can tell
Either start with two unit vectors or normalize the cross product, it makes no difference in the direction of the final result
You will
Really?
Was there a way to Calc Dir to Vector?
vectorDir is a thing
Nah, i need from e.g. input 90 output [0,1,0] for example
Oh rotation matrix
No clue, fighting with Vector a bit, achieved some stuff, still blackmagic for me
x = rcos(_a) + rsin(_a)
I'd try to make use of the screenToWorld and related commands
Do your foo in screencoordinates and translate back when ready to draw
STW is pretty neat (WTS also)
But maybe its time to return to the original problem
Whats the Prob?
(player - target) is from target to player technically, btw.
again: What are you trying to achieve?
Line 1, _unitVectorPlayerToTaget
stacked? Like they stay above the head?
_targetPosition = cursorObject modelToWorldVisual[0,0,2];
?
So your current approach is moving the vectorUp from the player to the target position, scaling for UI size? There's bound to be a more natural solution.
That would mean 2 meters above the feet, no?
get the MemoryPoint Pos of the Head
eyePos?
seems like the answer is right there above their heads
badum
No @hasty violet Use it as reference MempointToGround
So only using it for the Z-Axis, rest taken from getPos/worldToScreen or whatever you use
Then it's above his head?
Get world coordinates of center > transform to screencoords > move up N amount of pixels > drawIcon?
Thats why i told you:
Z = (memoryPoint "HEAD" distance getPosATL _Unit select 2) + 1
Whale wants "up" to be from reference of the viewing plane, not world
+Why using ScreenToWorld anyway? ModelToWorld is enough
Any tips on how to hook a mission ending via the #missions admin command? I was hoping the Ended mission event handler would catch it, but it doesn't seem to.
Youd have to keep track of dialog for every player and keep moving them on and off screen, thatd be non ideal for you
Again: You make it yourself harder than it has to be...
Sort them into one list and then process that list separately?
Youd know how many pixels youd need
Really you want a control solution here, though
Its a bit shit but its the 'nice' solution vs ducktaping together all kinds of broken parts
Id create like 15 controls, always keep them active, and move them on and off screen and change the text as you need
Some spectators do it that way, too
if(isNil "Control1")then{createthings}
otherwise use the existing one
you can ctrlCreate and ctrlDelete too
Its like you can make a canoe out of ducktape
But theres already some good materials right there
to do what you want you sorta need the camera up vector.. but not sure if it's possible to reliably get it
Id assume to always use vectorDirAndUp
Else youd roll and the tags would roll with you
Wierddd
i think vectorUp player in first person is always 0,0,1 though
๐คฆ
yeh sry, you would need the dir and up of camera.. but don't think you can get either?
And then the diff between player and target
And then construct the real up from that
Basically cheat a bit by saying your only interested in the plane spanned by dir and up, not their actual individual directions
because the cross product of the normalvector of that plane and the vector to your target would be your "relative" up
Then grab their modelcenter, translate along that axis, and use that as anchor position for your icon drawing
Et voila, super expensive nametags
๐คฆ
Or just use a control :D
The camera points always up 0,0,1
Yea but youre not really interested in their actual direction anyway i guess
Mainly the vector between player and target
And some normal vector to that
Which would always be the modelcoordinate [-1,0,0] i guess
(Or any multiple of it)
Actually better have it negative with the right hand rule and all
Adjust your vectorCross
Its wrong
[0,1,0] as an educated guess
If its sideways its just a matter of figuring out which axis you got wrong
Since youve just found a rotation of your desired solution anyway
Yea what is that vectorMultipy doing
so whats it look like now?
it does very much
right hand rule
pseudocode:
_x = player modelToWorld [0,1,0]; // Or [0,-1,0]
_r = _TargetPos vectorDiff player;
_up = _r vectorCrossProduct _x
Then normalize and scale.
thats just your vectorUp
try reversing the arguments in your playerdifftotarget
pretty sure you got the vector in the wrong direction there
yea
did you change that [0,0,1] too then?
since that implied your took the crossproduct of the wrong vectors
change how, the magnitude or the position of the 1 ?
yea thats expected
because of your vectorCross
tried adapting my earlier pseudocode above?
your working with the wrong vectors atm
vectorMultiply (1) is a placeholder, right?
As for the earlier discussion, me and whale worked out the coordinates.
removeMissionEventHandler ["Draw3D",missionNamespace getVariable ["drawHandler",-1]];
drawHandler = addMissionEventHandler ["Draw3D", {
_offset = 2;
_icon = "\a3\ui_f\data\map\Markers\Military\dot_ca.paa";
_target = cursorObject modelToWorldVisual [0,0,1];
_player = player modelToWorldVisual [0,0,1];
_dir = _target vectorDiff _player;
_side = (vectorDir player) vectorCrossProduct (vectorUp player);
_drawUp = (vectorNormalized (_dir vectorCrossProduct _side)) vectorMultiply _offset;
if ((_drawUp select 2) <= 0) then {
_drawUp = _drawUp vectorMultiply -1;
};
_drawPos = _target vectorAdd _drawUp;
drawLine3D [_target, _drawPos, [1,0,0,1]];
drawLine3D [_target, _player, [0,1,0,1]];
drawLine3D [_target, _target vectorAdd _side, [0,0,1,1]];
drawIcon3D [_icon, [1,1,1,1], _drawPos, 1, 1, 45, "Target", 1, 0.05, "TahomaB", "RIGHT"];
}];
Anything other than the relative axes coordinates such as offsets etc is irrelevant for this example, it includes some drawlines to see what happens.
How could I get x amount of positions evenly distributed around a circle? Would probs be a bit difficult to do
theres a few online functions you can seek out for that, its a fairly standard problem
im personally a fan of the sunflower one because golden ratio
Ill look that up, im not a fan of math so algorithms for stuff like that are confusing to me
https://pastebin.com/aXLYieYr
is a way too complicated function that tries to return the approximately closest water position using that algorithm
Why not getRelPos then checking if Z-height below ASL? oO
i dont remember
other than wasting an afternoon with this instead of studying so i kept overcomplicating for the fun of it
relPos gives you AGL Pos, so AGLtoASL should be doable.
Yeah, pretty overcomplicated^^
probably but whats the fun in that haha
^^
i think it started with using lineInterects radially and seeing when theyd first hit water
oh boy
then figuring out evenly spaced points on that disc
tide height
and then it all devolved into maths fun
it doesnt take waves into account yet either, i think ๐
Im having trouble finding algorithms for this point distribution around a circle
This adds Nยฐ to the current angle?
private _pos = _origin vectorAdd [_r*cos(_a),_r*sin(_a),0]; ```
yea but then the density decreases with the radius
also @warm gorge , just google "evenly distributed points on a disc"
youll have to convert whatever language to sqf though
i think i ended up playing with this one
http://blog.marmakoide.org/?p=1
because complicated can be a fun timewaster
0_o
if you could look back in this channel there were some earlier non-overengineered solutions but i only kept this one
or, perhaps. A solid solution?
Ill have a look at that link
This seems to be for spreading points completely over a whole disc/circle. I need just on the outer edges. Very confusing
Does anyone know of a way to add an action to each door
Basically anywhere the "open door" action exists I need this action to exist
here is uniform on disc:
https://pastebin.com/EdrSgsk1
here is uniform on edge:
edgePoints = {
params["_n","_origin","_radius"];
_positions = [];
for "_angle" from 0 to 360 step (360 / (_n - 1)) do {
_positions pushBack (_origin getPos [_radius, _angle]);
};
_positions
};
Perfect, works exactly as I wanted. Cheers ๐ @indigo snow
Wait the first example code above worked, whats the edited version for?
faster code
alternative getPos syntax beats a vectoradd, two multiplications and a cos and sin
i originally needed that to make sure the Z stayed 0 but you dont need that i think?
For some reason the edited one chooses positions in a straight line in 1 direction to a point of the outside
ah yep sweet
_position getPos [_radius * sqrt random 1, random 360];
i never realized arma has a map equivalent with linearConversion
@hasty violet what happens at L155-157 ?
Are there any known issues with playMusic? Im using its alternative syntax (playMusic [name, start]) to play part of a default arma track to all players via remoteExec, but for some reason it sometimes doesnt work, and only plays for some players
wouldn't you do _nameColor set [3, (_nameColor select 3) * (_alpha)] there too?
but aight i actually thought you overlooked a variable name change or something there
overcomplicated.
@warm gorge they might have music turned off / volume to 0?
youd still need to take into account the orthogonality of the player screen
heightDiff + DirDif + linearConversion -> X,Y Pos
so you need to transform the modeloffset according to the orientation of player and target
mhm
you could do some angle magic maybe
dot the vectorup and relative vector to find angle with horizontal and transform the Z offset vector
you can refactor it a lot
like the double vectorMultiply on L171
vectorUp player is also always [0,0,1]
Old code:
https://pastebin.com/3xBq2M9U
and i still cant visualize why ((vectorDir player) vectorCrossProduct (vectorUp player)) is just a modeltoWorld [0,-1,0]
pretty old code and was just for testing. Most of the stuff can be calced with linearConversion
you should cache a lot of stuff you calc in here
if you calc this every frame you should really store a lot of stuff like colours, classes etc
You mean me?
nah
rgr
but like whales colour blind colours, or the config lookups
getText stuff?
how far is that debugger? be interesting to see how the load is distributed
private _vectorDiff = (_targetPosition vectorFromTo _unitPosition) vectorCrossProduct ([cos(getDir player + 90), sin(getDir player + 90),0]));
private _targetPositionTop = _targetPosition vectorAdd (_vectorDiff vectorMultiply (WH_NT_FONT_SPREAD_TOP * _distance / _fov * -1));
private _targetPositionBottom = _targetPosition vectorAdd (_vectorDiff vectorMultiply (WH_NT_FONT_SPREAD_BOTTOM * _distance / _fov));
well yea
makes sense
drawicon is pretty slow but the other stuff matters too
yea but you can and should cache a lot of it
and possibly limit the total amount of draws
how often will they change colour blind settings?
if you add an ui event handler the code will be executed in a different namespace and a different scope not necessarly.
therefore you don't have _display defined if you grab it out of _this via params then you do
All non-scripted eventhandlers are executed in mission namespace. And scope is irrelevant too, because local variables carry over into child scopes.
It's different script instances.
@hasty violet do you mind if I pinch some of your code, with attribution of course
Using it for very different purposes so I'll be doing a lot of dissection but the work on managing stances and the math etc is really helpful
Thanks for continuing to contribute
Hi, I created this message box with BIS_fnc_guiMessage
[] spawn {
_result = ["Do you want to place the rally point objects?", "Rally Point Objects", "Yes", "No"] call BIS_fnc_guiMessage;
if ( _result ) then
{
hint "Yes";
}
else
{
hint "No";
};
}
My problem is that whenever I press the ESC button, it returns false, but I only want it to close the message and do nothing.
Is there a way to configure it the way I need it?
@tough abyss read this https://forums.bistudio.com/forums/topic/185602-problem-with-bis_fnc_guimessage/
Thanks
I was bored (and fiddled around with setVelocity and VectorStuff)
https://www.youtube.com/watch?v=tujlSbbT3fU
Slowly....
Also lands slowly, when it reaches you ๐
is this a public script? I want to play with ๐
I don't even have a use for it. just played around with that stuff.
dscha that's pretty spooky
+Nah, not public.
you implemented pathfinding in sqf?
That was the easiest part.
@jade abyss I really like this -- you could use this maybe on a unit to maybe try and get them to follow properly like escorting a hostage in vanilla.
how do you make it find a path like that?
it follows me, every 1s a Pos will be saved in an Array, when its reached -> DeleteAt 0 -> Select 0 (next Pos) in the next run and move to that Pos.
Thats why, it's not a big deal. Just looks funny, how that Box follows me sits right infront of me ๐
which would probably be possible.. but barely feasible let alone for nothing
!
Great idea -- what if you created a floating object, like a pet, that would follow you around? People would pay for that in Altis Life VIP slots or whatever.
just need to make it so when you turn around and look at it, it drops like at the end
would be like the metal gear guy is stalking you
Like the ghosts from Mario? ๐
Uh, explosion, good point. brb
!!
dscha's "follow me lootbox"
companion*
Yo -- what if it was a createVehicleLocal ammo box that you could store your equipment in?
http://i.imgur.com/ZrQmYCl.png
is there any way to format drawIcon3D to display multiple images and text like this or do I just need to stuff around with rendering multiple icons?
that's pretty much what the conversation all day today has been about
scroll up to see whale's problem
Alrighty
TL;DR:
No. Multiple draws must be done.
Damn
yeh.. and it requires some tricky maths to get right
so if it's at all possible, controls would be better
Gotta be a 3D render :/
why?
Failing that, I'll just change the design into a static readout
Making a C&C ripoff Zeus RTS
The effect of the text over the towns would look really nice
you can just use worldToScreenVisual (or related stuff) to position the controls
so they still show over the town or whatever
Hm
I tried making a Zeus RTS thing a while back but the problem is how that Danger.FSM thing works: as soon as the AI go into combat mode, everything is fucked and they don't listen to you anymore.
You'd have to make it into a mod with your own custom RTS AI overriding the vanilla stuff.
I'm strongly considering it
So far though, it's more of an evolution of Warfare and focuses on slower combat speeds
I think I've found a work around
@vapid frigate @hasty violet
Managed to get the multiple drawIcon3D icons to line up not terribly
Only works if you specify a specific render range though
_veh == "O_Heli_Light_02_F" || _veh == "O_Heli_Light_02_v2_F" This would be an or command right? this thing: ||
Yeah
sweet so i can add more in that statement?
if(_veh == "O_T_VTOL_02_vehicle_F" || _veh == "O_T_VTOL_02_infantry_F" || _veh == "O_T_VTOL_02_Infantry_hex_F") then Like this for all the colours of the xi'an?
Is it Okay to use same variable name but different type on Eden editor? e.g. variable name: AA1 of empty marker, aa1 of object(Turret).
@chrome mason yep. gp wo;d
Marker names and variables aren't the same thing @quasi rover
so it's fine to duplicate
@chrome mason
if(_veh in ["O_T_VTOL_02_vehicle_F","O_T_VTOL_02_infantry_F","O_T_VTOL_02_Infantry_hex_F"}) then ```
a good convention would be calling the marker "m_aa1" though