#arma3_scripting
1 messages ยท Page 358 of 1
thanks.. ill be back for more pointers in the future ๐
hi
im trying to connect two .p3ds via script
In the BI Forums someone told me to look at Nimitz Mod
This is my init:
_car = _this select 0;
if(isNil "_car" || !hasInterface)exitWith{};
_car execVM "military_ship\scripts\spotlight.sqf";
[_car] execVM "military_ship\scripts\lights.sqf";
params[["_militaryship", ObjNull]];
private ["_parts"];
_parts =
[
"militaryship_ladder_2",
"militaryship_ladder_3"
];
_militaryship setVariable ["carrierParts", _parts, true];
when i pack my mod it seems liek the .p3d aren't joined together. Do you know why that might be the case?
you're wanting to attach them to the ship yea?
yes
because of Roadway LOD
u cant go out more than 50m
but my ladders extend
more then 50m i herd if u attach the .p3ds together they would work
Was just looking at some altis life functions, mresArray specifially... and saw in a loop it changed 34 to 96 any one know the reason for this? ```private ["_array"];
_array = [_this,0,[],[[]]] call BIS_fnc_param;
_array = str _array;
_array = toArray(_array);
for "_i" from 0 to (count _array)-1 do
{
_sel = _array select _i;
if ((_i != 0 && _i != ((count _array)-1))) then
{
if (_sel isEqualTo 34) then
{
_array set[_i,96];
};
};
};
str(toString(_array));
it is meant to prevent some issues with saving data to the db, ive never had a problem not using it tho so i dont know what its trying to avoid.
so it would turn " into that backtick thing i cant to cause discord will highlight my text (if you havent figured that out already).
uhmmm mark, are the ladders attached somewhere else cause from what i can see in that script,it doesnt do it?
`
xD
thought it would do this with just one tick
Yeah dont think its needed
well the two .p3ds in that script i mentioned have only ROADWAY LODs
I know it makes hardly any performance difference but i guess looping each array would potentially
idk lol
trying to bypass the issue of arma not recogninzing roadways farther then 50m
mm, im not the smartest one out so someone else may be able to help you better.
post it again please
_car = _this select 0;
if(isNil "_car" || !hasInterface)exitWith{};
_car execVM "military_ship\scripts\spotlight.sqf";
[_car] execVM "military_ship\scripts\lights.sqf";
params[["_militaryship", ObjNull]];
private ["_parts"];
_parts =
[
"militaryship_ladder_2",
"militaryship_ladder_3"
];
_militaryship setVariable ["carrierParts", _parts, true];
like idk what params or private means
i just kinda copied it over from the nimitz mod
hmm dont know why its not working ๐ฆ
the BI uss freedom does a similar thing to build the ship. they spawn each part and attach it to a point on the base. ur script isnt spawning anything so idk
could just trial and error the parts using attachto
ah ok
has anyone asked about why the watchlist in the escape menu of editor doesnt work? why i try to input new commands ( ie player ) it glows orange and displays nothing
Hey trying to change some lights while im in the editor, i modified the streetlight object with
this setLightColor [5,0,0],
this setLightAmbient [5,0,0]
But the light remains the same, am i putting this in the wrong spot?
@hallow spear you need to click out of it to see the results. it glows orange/red while ur editing the code in it so you arent spammed with errors
@sly sun those commands are for light points, not lamp objects.
excellent. ty
@robust hollow Ah i see, i was trying to make streetlight or floodlights different colors, is this possible? If not how do i create said lightpoint to create the lighting effects?
to make the lightpoint itself you can do "#lightpoint" createVehicleLocal pos; and then use the other commands to edit it how you wish.
@robust hollow Thanks for the help, i couldn't get anything to work, maybe another day!
_light = "#lightpoint" createVehicleLocal getpos player;
_light setLightColor [250,150,50];
_light setLightAmbient [1,1,0.2];
_light setLightAttenuation [1,0,0,0];
_light setLightIntensity 10;
_light setLightUseFlare true;
_light setLightFlareSize 0.2;
_light setLightFlareMaxDistance 50;```
use this as a template if you want. that as it is makes a yellow light.
Hi guys, I need help with a simple script. For some reason it just wont work. This is the reddit link to the issue i've been having. https://www.reddit.com/r/armadev/comments/70sp0j/need_help_with_script/
Any help would be appreciated
you dont have any parameters for the execvm so _this would be nil
_handle = vehicle execVM "loadout.sqf";
if (_teamBalance >= _vehCost) then {
private _vehicle = _vehType createVehicle getMarkerPos _teamGarage;
private _vehCrew = createVehicleCrew _vehicle;
private _vehGrp = group (leader _vehCrew);
{_x hcSetGroup [_vehGrp]} forEach synchronizedObjects _teamCommand;
[_teamBank,_vehCost,false] call BTH_fnc_ManageBank_RTS;
} else {
hint "You cannot afford that vehicle!"
};
I get an error on the hcSetGroup line that tells me "Type Group, expected Group"
not sure what to do here
createVehicleCrew returns Nothing, so you have a nil of the group-type
debug your values!
Love those errors
Type group expected group
how could I get the group name of the created crew?
something like group driver _vehicle?
group (leader _vehicle); ?
Someone here could be so kind to provide me with the different side strings?
str west etc.
Found em
onMapSingleClick does it only count the next place you click on the map?
It set's a eventhandler that fires everytime you click on the map
works just like every other EH
I'm trying to make it activate only once after a script is executed
I guess I just need to reset the event handler
๐
onMapSingleClick "_vehPos = _pos; clicked = 1; openMap false; onMapSingleClick ' ';";
is this the correct way?
I notice some of the examples just have true; at the end
read the wiki if you wanna know what that true means
that looks okeyish.. but useless
you are setting a local variable that you can't get out.
I was just doing that for testing purposes to override another variable
but I can't so it is useless I guess
is there a way to get those values out?
use a global variable
use the stacked eventhandler like BIKI tells you to. Then you can pass an array as parameter and edit the value inside the array as reference
why are people so scared of global variables
scared of globals? it's just not always the neatest way to do things
I suppose this variable would get updated everytime the function is called so it doesn't really matter
How can I dynamically insert that variable though
that is the issue I am having
format string maybe?
i dont understand, what you are trying to do?
Get a position from the map click EH and use it in code below that is separate from the EH and uses many local variables (that are dynamic and depend on player team, player position, amount of resources the player has) so I need to be able to get that info out of where the player clicks on the map
do the local variables work inside an eventhandler?
sure
they need to be determined outside of that
Yeah
it's SQF. Local variables work in SQF.
_var1 = "thing";
onMapSingleClick "hint _var1; openMap false; onMapSingleClick '';"
So this would hint "thing" and clear the EH upon clicking somewhere?
what are we saying
the eventhandler is a different script.
is that you can pass eg. _pos
that is what I thought
I am simply trying to find a way to pass a position into a function that isn't a set location. It is activated through a diary record, so I can't pass the player object as a variable easily and get the position that way, so I would prefer to avoid that approach. onMapSingleClick also doesn't seem like it could work this way either, so I will try and figure something else out
@slender halo
params [["_object", objNull, [objNull]]];
private _noseDir = vectorDir _object;
private _noseUp = vectorUp _object;
_noseDir params ["_dirX", "_dirY", "_dirZ"];
private _direction = _dirX atan2 _dirY;
private _pitch = asin _dirZ;
private _wingDir = [-_dirY, _dirX, 0];
private _wingUp = (_wingDir vectorCrossProduct _noseDir);
private _bank = (_wingDir vectorDotProduct _noseUp) atan2 (_wingUp vectorDotProduct _noseUp);
_bank = 180 - _bank;
_direction = (_direction + 360) % 360;
_pitch = (_pitch + 360) % 360;
_bank = (_bank + 360) % 360;
[_direction, _pitch, _bank]
I figured it out (hopefully)
the part of code that adds the diary records is run locally for each player upon loading in or respawning, so I simply did this:
private _vehCode = format ["private _vehPos = (position player); [%1,%2,%3,_vehPos] spawn BTH_fnc_BuyVehicle_RTS", str _vehType, _vehCost, str _playerTeam];
private _vehDisp = getText (configFile >> "CfgVehicles" >> _vehType >> "displayName");
private _vehStr = format ["Vehicle: " + "<execute expression='%3'>%1</execute>, " + "Cost: %2", _vehDisp, _vehCost, _vehCode];
private _vehAdd = _player createDiaryRecord ["Buy Assets", ["Vehicle Drops", _vehStr]];
should have though of that sooner
simple solution
@little eagle unfortunatly those are not the rotations that TB expects, sorry โน
your function return the same values as BIS_fnc_getPitchBank and getDir
i'm looking for rotations around world axis
on wikipedia, Euler rotations are described as
but what i'm looking for is more like
rotations are always performed around world axis
that's what TB expects
say i wanted to create a light source on a helmet. say i use this_light = "#lightpoint" createVehicleLocal pos; _light setLightBrightness 1.0; _light setLightAmbient [0.0, 1.0, 0.0]; _light setLightColor [0.0, 1.0, 0.0]; _light lightAttachObject [_object, [0,0,0]];
from https://community.bistudio.com/wiki/lightAttachObject
I chuck it in a while loop , and do {_light setDir (getDir player)}
that obviously just points the light in the direction im facing, but how would i make it follow my head movements vertically? So if i look up, it points it up, etc....
(im setting it to a spotlight btw, not an ambient light, just copy pasted that)
thats just the position of the eye
i need to modify the light itself to face the way my gaze is, in real time
Any workaround ? when should I save it?
Is profilenamespace saved automatically at any point?
@tough abyss AttachTo not working?
Can't you attachto head?
@tough abyss https://community.bistudio.com/wiki/eyeDirection
as far as im aware, a lightpoint is not a physical object, so cant attachto and have it be effected by what it is attached to
so eyeDirection is the goal of what i want, but what command do i give it to actually face it to the eyeDirection?
so, setDir is for an azimuth, is there a setVector or anything, so i can point it to an azimuth and an elevation?
like, 90 degrees, 10 degrees would be facting east, and 10 degrees above the horizon
@tough abyss setVectorDirAndUp. Get vector dir from cameraViewDirection or.. eyeDirection is probably better
that looks like what i want, cheers :D
hum, actually they are talking about position, not direction, but what if in third person
getCameraViewDirection is not talking about position
yep, but in the description of this comand they are talking about how to get camera position
for human player the origin should be taken from player camera position positionCameraToWorld [0,0,0]
yes.. Because that's not lagging behind so much
@tough abyss you might experience "laggy lights" with moving #lightpoints since engine seems to update them like a couple of time a second
Is there a way to force 30 FPS with scripts? like run a script that makes sure there's been 33.3 ms between every frame?
If you could do that, you could force 30 FPS while the light is on, so it's not laggy light
no
^^
atleast not really
thanks @slender halo , hopefully my use cases are only a few seconds at a time anyway. actually ive tried this already (with just the setDir) and in one case it was very smooth, and in another it was laggy. so something affected it
@peak plover actually you would have to drop the game to 2fps
Ohh, then that
Anyone got any ideas when I could save profilenamespace and not lose fps. What events to do it on for ex.?
I need to make sure player profile saves before he crashes
So there need to be things he does when fps can be decreased like opening map
I need same for server, but that's a lot harder. Probably need to do one when there are no players and maybe one every 30 minutes or sth, but I got no idea when to do it ๐ฆ
do you mean like when in wasteland you hit escape and it saves ytour profile?
Wait, does hitting escape do it automatically by default ?
in wasteland it does
your wasteland profile saves anyway, which is probably just a single command to the server, updating their sql
hmm, how could i do that with an EH?
sorry im watching rick and morty, i need to re-read your problem again :P
Yeah SQL is probably a lot better for saving, because the lack of framedrop
so all im seeing so far is The data is only actually written to the harddrive when either a different profile is chosen, when VBS is exited, or when saveProfileNamespace is executed.
(sorry,, i checked VBS to see if it had more info)
same stuff though
Ok hitting esc saves profilenamespace, running cba. But I assume this is vanilla behavior
That's why there's a stutter when hitting esc
It's writing to disk
if you want to manually save it, cant you just spawn it off so it runs in a thread and shouldnt kill fps?
Nah, writing to disk kills fps no matter what
Because it freezes the game until it's done so it does not corrupt
afaik saveProfileNamespace doesn't do anything anymore
Does
interesting, i have my own AAR recording thing set up, writing x,y,z and time data to a text file, multiple of them, all spawned off...no frame drops
besides telling the game to save on next loading screen / escape menu
[] spawn {
for "_i" from 0 to 10 do {
sleep 0.5;
saveProfileNamespace;
};}
https://i.imgur.com/ndKUpyZ.jpg
notice the spikes in frametime (10 to 47)
It freezes the game
Dangerous command as you could add crap to profiloenamespace that inflates it and then constantly save it to crap somones drives
not that i know how saveProfileNamespace executes, but maybe put a sleep 0.,25 on both sides of it
I had a loop that ran every 1 sec that saved the profile on the server, it caused a liot of rubberbanding on clients
So I need to save it only at certain times
eventhandler for map i gues
Player should be when map or inv is opened, but for server, I got no clue
What if the server crashes and loses all it's vars ๐ฆ
But If I save during gameplay, then there's a huge rubberband
thats the risk vs reward thing you have to weight up
FUCK ME
every 5 minutes, plus an event handler
well, koth does it somehow
Every 10 hours maybe/
they save it all locally
KotH only stores a couple of things, like money, level and perks I guess
That's player profiel 'tho
so what vars are changing on your server, that you need to change the profile namespace constantly?
Tasks, alive/dead players, but I want to extend this to AI and objects
rock a db then
Well I'd like to keep it vanilla
it will be vanilla for players
but not for server
Hmm
How often does server profile save on default?
when?
Google did not help ๐ฆ
๐ญ
But I wanted to use the profilenamespace
Well, atleast I can just edit the functions I already have and they should work well with that ๐ค
It's just that I wanted to upload my missions to the workshop so everyone could play them...
Not everyone is going to have inidb
But everyone would have profilenamespace
And as I fucking expected... The profilenamespace on server seems to NEVER save on it's own
So a command would have to be used ๐ฆ
is there a filewriting script for arma?
no
nothing vanilla then
saveProfilenamespace writes a file and I see it as something that can be very terrible if a hacker would use it...
you still can trigger a saveprofilenamespace on some player events with remoteExec
Not really. Because that will cause lag/rubberbanding
And the map thing is also off the table, because If you are driving a car
and open a map
You would rubberband in a convoy and kill EVERYONE
I guess I'll leave the inidb for the future, as an opportunity and I could just save everything on the server / inidb in the future...
it is a mp mission right ?
yehh
so you definitly should save everything server side
and gather most data from server
Not really, I mean I've got the functionality to save stuff on remote clients etc.
I'll just slug it off for the future, when I move everything to a mod then include iniDB in there
Currently just do it like this... Because it's fine
It would be really nice to have 'tho
Yeah, would be best to gather all data on server and save it to iniDB. That way if client crashes, everything is kept or if server crashes everything is still kept
Yeah, I don't have any mates... So it's for others
whats the mission anyway?
It's a baseline / framework for missions.
Currently some dudes fighting in desert
cool
@slender halo I think I get it. Those are the pitch/bank/heading of the vehicle it's perspective. But the editor always rolls in the same direction depending on the world axis, not the vehicles axis.
It's probably the same in the terrain builder.
and those are hard to compute manually unless you happen to know what rotation order BIS uses (XYZ, ZYZ, etc)
they're probably different from 3dens?
e.g. 3den iirc uses XZY
I have the matrix on a sheet of paper already, but the order isn't clear to me yet
Doesn't help that the vehicles themselves point towards y /o\
I wonder if we can't trick it with modelToWorld
Also, is it just me or are the angles all backwards?
Right hand rule doesn't work.
its probably the direction the rotation matrix points to
if you take the transpose, you rotate back to the origial / (0,0,0) rotation situation
Is that the correct way of doing things though when your interface (3den attributes) ends up with inverted angles?
you mean the object ends up upside down?
thats inherent with euler angles
you need to real part of the actual quaternion to determine that
No, when I put z=90, it rotates clockwise.
someone at BIS might really misunderstand vector maths
look up the wiki image for addTorque
and what they call clockwise
They all rotate clockwise. Which is enough to throw me off.
Oh, maybe it's not that they don't understand vectors, but they don't understand clocks. :S
Well...
Guy was probably sitting in his office.. and they have a clock on a transparent wall..
If you look at it from the bottm....
then the arrow points in the negative direction ๐
and away is negative, right hand rule doesnt care about your viewing angle
its a maths/universe thing
right hand rule?
It apparently doesn't apply to Arma.
armaverse is real
but yea to solve the angles issue i guess wed need to know what system BI actually uses for TB?
havent the XCAM guys done this already?
step 1: invert angles
step2: figure out the order to multiply the matrices
step3: multiply result with [0,1,0] (dir) and [0,0,1] up
step4 solve trigonometric equation system
you can actually make the in game matrix from vectorUp and vectorDir, but that doesnt help you a lot
either the rows or columns of the matrix are (dir cross up,vectordir,vectorUp)
(or was it up cross dir?)
Who knows. They're already inverted :S
What are you guys trying to solve? Sounds interesting.
Get the euler angles for the editor/terrain builder from any ingame object
hmm, I thought they're the same. What is the solution to 3den?
Y = vectorDir vv;
Z = vectorUp vv;
X = vectorNormalized(Y vectorCrossProduct Z);
_xrot = atan((Z select 1)/(Z select 2));
_yrot = atan(-(Z select 0)/sqrt(1-((Z select 0)^2)));
_zrot = atan((Y select 0)/(X select 0));
That thing
I have a function that takes an object, xyz rotation around object axis and converts to setVectorDirAndUp if that helps?
plus your step of checking with [0,1,0] and [0,0,1]
the opposite is what were trying
and thats non trivial from the other way around
Yea but if you have that the opposite would be easy no?
you might put some geometry to simplify
but thats basically the projection of direction vectors on various planes
I'll try this. It looks suspiciously wrong to me.
Ah, yee. The sqrt of the sinยฒx+sinยฒy=1 thing is annoying. But I'll keep it for now. Maybe I am stupid.
Ive got two images to help visualize maybe
https://i.imgur.com/Vfa2DAQ.png
https://i.imgur.com/1UlqOtF.png
What's the N for?
Y = vectorDir vv;
Z = vectorUp vv;
X = vectorNormalized(Y vectorCrossProduct Z);
_xrot = atan((Z select 1)/(Z select 2));
_yrot = atan(-(Z select 0)/sqrt(1-((Z select 0)^2)));
_zrot = atan((Y select 0)/(X select 0));
^ this definitely does not like what I am expecting. We'll see...
you also dont need to normalize for X but hey
Yeah, it cancels the minus
definitely worked a few months ago
theres also the atan2 command which i mightve used but that shouldnt matter
yea but sometimes it does this (first = eden values, second = computed values)
[[34.7932,229.788,18.0742],[214.793,310.212,198.074]]```
so off by 180 degrees about certain axes
but your proposal of test with [0,0,1] and [0,0,1] might work out well there
or compute the rotation matrix from these angles, and from the in game vectors, and compare
120,120,120
gives me
[-60,60,-60]
Y = vectorDir OBJ;
Z = vectorUp OBJ;
X = Y vectorCrossProduct Z;
// Let sub-arrays be either columns or rows of the rotation matrix, depending on BI's convention
C = [X,Y,Z]; // Let C be the rotation matrix
Yea thats the euler bit
its called gimbal lock or superposition
you basically rotate about the same axis twice and that loses you information
but you can now compute from original axes to the actual object axes and compare
Looks to me like this doesn't happen with -90<x<90.
check my values above, where xrot is ~30
[31.8953,244.858,38.0153]
y<-90
30,250,30
[30,-70,30]
So it's just because y < -90
0...90,270...360
90-270 needs fixing
yea so you need something to check against.
I'll change it to atan2
purely mathematically that would be checking the real part of the rotation quaternion but were working backwards here
id honestly just apply the transform to [0,1,0] and [0,0,1] and go from there
if they match, voila, if not, add 180 to the offending angle
@peak plover at this point I would suggest you using extdb. many benefits
apparently you can check the sign on the following:
w = sqrt(1 + X select 0 + Y select 1 + Z select 2)/2; (no guarantees)
this should be positive , so if not, you gotta correct some angles.
@simple solstice thanks. I'll look into that. I'm pretty sure I'll need it eventually
@peak plover grab DB handling files from RP FRAMEWORK or altis life to ease your life of running queries
but without them you still can do much, just more to write
It doesn't seem like 90...270 matters. The rotations are equivalent.
can I exitWith {} from an for "_i" from 0 to 1 step 0 do loop?
yeah
and it performs better than a while {true} loop IIRC?
Yeah, because conditions are not checked, but if you do an if with an exitwith in there, then it's virtaully the same as a while loop
if the condition is {true} i dont know if it needs to check much ๐
@little eagle if I want to CBA_fnc_publicVariable an array, thats defined lets say weaponarr = [...]
_broadcasted = ["weaponarr", weaponarr] call CBA_fnc_publicVariable;
do I do it like that?
Result:
0.0034 ms
Cycles:
10000/10000
Code:
private _time = 0;while {true} do {if (_time > 0) exitWith {};_time = _time + 0.01;};
Result:
0.0013 ms
Cycles:
10000/10000
Code:
private _time = 0;for "_i" from 1 to 0 do {if (_time > 0) exitWith {};_time = _time + 0.01;};
so it is faster..
apparently ?
publicVariable "weaponarr"
Why not like this?
Broadcast a variables value to all machines. Used to reduce network traffic.
Does only broadcast the new value if it doesnโt exist in missionNamespace or if the new value is different to the one in missionNamespace. Nil as value gets always broadcasted.
1 to 0 might not work
from the description
lgtm
so what I wrote is correct?
and that will reduce traffic if the weaponarr is already defined, right?
90-270 isnt equivalent, its pointing the exact opposite direction
While that is true
Result:
0.118963 ms
Cycles:
8406/10000
Code:
private _time = 0;for "_i" from 0 to 1 step 0 do {if (_time > 1) exitWith {};_time = _time + 0.01;};
Result:
0.135318 ms
Cycles:
7390/10000
Code:
private _time = 0;while {true} do {if (_time > 1) exitWith {};_time = _time + 0.01;};
for "_i" from 0 to 1 step 0 do is faster
And if all you're doing is getting these angles from the object in space, there is no way to differentiate between the two.
Think about it.
So your solution is all that's needed, except with atan2 to handle dividing by 0.
That middle one is wierd, seems like a minus got nixed there
params ["_object"];
private _dir = vectorDir _object;
_dir params ["_dirX"];
private _up = vectorUp _object;
_up params ["_upX", "_upY", "_upZ"];
private _side = _dir vectorCrossProduct _up;
_side params ["_sideX"];
private _xRot = _upY atan2 _upZ;
private _yRot = -_upX atan2 sqrt (1 - (_upX ^ 2));
private _zRot = _dirX atan2 _sideX;
_xRot = _xRot call CBA_fnc_simplifyAngle;
_yRot = _yRot call CBA_fnc_simplifyAngle;
_zRot = _zRot call CBA_fnc_simplifyAngle;
[_xRot, _yRot, _zRot]
This is what I have.
And if I use
testobj set3DENAttribute ["rotation", ARR]
with ARR being:
[random 360, random 360, random 360]
Then the result from the function above is equivalent to ARR
I can replace ARR with the result and the object doesn't rotate.
CBA_fnc_simplifyAngle isn't needed either, but it's easier for my brain.
๐ great, i try this
It's for the editor, not the terrain builder.
I never used the terrain builder. What even are the angles there?
does your object remain in position when you try with near 90ยฐ pitch or roll rotated objects ?
You mean getPos?
I don't see the problem.
Can you give me more context for "original"?
as you can see, there is some drifting on poles
the objects i try to export from arma
need more detail ?
Yes, I don't get it. How did you make them stand up in the first pace?
setDir and BIS_fnc_setPitchBank
So you do
cursorObject setDir 90;
[cursorObject, 90,90] call BIS_fnc_setPitchBank;
And wonder why it's not 90,90,90 ?
dir, pitch, bank are relative to the object, while x,y,z in the editor are relative to the world.
You'd need a BIS_fnc_setPitchBank version that only rotates pitch and bank around the world axis. They do it around the object axis.
i think it doesn't matter how i set the object, ultimatly i just want to extract data that can be read by TB
which seems to be world relative angles
you might need to setVariable the rotations applied to the object, add/substarct if needed and in the end just getVariable those values instead of relying on a sqf command or function to calculate the world space rotations
i think this is how MB and xcam does it too
basically selfmaintained worldspace roatations setVariabled to each object
If you have an object and want to get the rotation angles around the world axis (pluar?) then use the function cptnnick and I posted.
Just don't think you can use BIS_fnc_setPitchBank with them.
i don't
i used the function to export objects to TB format and here is what it looks like in TB : https://i.imgur.com/x3XCj6V.jpg
could that be a rounding error?
my question is, is it TB interpretation issue or is there some mathematics in the function that could explain this ?
what happens if you recreate the tester setup in surfacepainter based on the exported values?
should theoretically end up the same
to leave TB fuckups out of the game
i try that
I have no explanation. It works for the editor as far as I can tell.
But you export a whole lot of objects. Maybe they're all wrong and it just happens to end up in a sphere, because you did all at once.
@little eagle they should end up in a sphere
expected result in TB: https://i.imgur.com/2g9fINv.jpg
actual result in TB: https://i.imgur.com/x3XCj6V.jpg
No. Do it with only some of them.
I was wondering, If I'm making an invasion Force How do I link all of them together so you have to kill all of them for you to complete the objective how do I do that?
They might be all wrong and just appear to form the sphere, because they're all wrong.
i don't get what you are after
You test things with single objects not a sphere full of them.
Maybe the bottom left one ends up in the top right and vice versa.
@sick drum
{alive _x} count (units group1 + units group2 + units group3) == 0
Oh yes that makes sense Thanks
so that means tb seems to expect something diffrent
yep
๐ค
gotta ask the devs for more info then
or try all the rotation sequences
just like figuring out 3den is XZY
I wonder what the reasoning behind picking XZY is.
it hasen't been cracked by MB nor xcam and devs that made TB don't work at the company anymore
@little eagle because BI, no other reason ๐
Anyone ever see player re-appear where he died when he respawns?
For like a split second
Any way to avoid this?
I'm using ```sqf
respawn = 3;
=3; ;=3
๐ฆ
are you woring on emoji sqf again? ๐
@little eagle @indigo snow thanks for your help, sad there is no solution...
Have you tried the other transformation orders?
nope
https://ntrs.nasa.gov/archive/nasa/casi.ntrs.nasa.gov/19770024290.pdf
I mean this one ^ Appendix A
XZY is the editor right?
Because the solution on this paper is different.
I was using XZY
What's TB
Ah, because it says XZY you have to switch up and dir :S
TerrainBuilder @peak plover
A nightmare @peak plover
You could also just try it out by messing around with it.
allMissionObjects ""
Any faster alternatives?
entities ""
It does list vehicles.
allUnits
if you just want persons
hmmm
entities does not have the things like objects placed
everythign else is there
Seems like it
I don't know if bug, but allMissionObjects didn't give me any lag on single player/editor. But local server/ dedicated gave me a nice hit in the frametime
Can missionconfig file be accessed in the description.ext?
can any config file access itself?
Hmm okay... How can I set the summary / title for the lobby in description.ext ?
Because since 3den update, they moved those both into the editor
And they are both in separate menus
briefingName only changes the mission name in the #missions screen
Hmm, I'm trying to figure out what order the rotations in TB go, but I have no idea how to place an object here...
I'd try XYZ
then ZYX
or wait they funk up with dir = Y
ZXY / YXZ would be eulerish
It's relatively easy to figure out the correct order if you "play" with it.
Is there a way to edit the classes in mission.sqm
@peak plover
onLoadName
onLoadMission
onLoadIntro
author
I have this in mine description .ext
params ["_object"];
private _dir = vectorDir _object;
_dir params ["_dirX"];
private _up = vectorUp _object;
_up params ["_upX", "_upY", "_upZ"];
private _side = _dir vectorCrossProduct _up;
_side params ["_sideX"];
private _xRot = -_upY atan2 _upZ;
private _yRot = _upX atan2 sqrt (1 - (_upX ^ 2));
private _zRot = -_dirX atan2 _sideX;
[_xRot, _yRot, _zRot]
This should be XYZ, but I can't figure out how to place objects to test it.
already fucked up and edited -.-
@simple solstice
I've defined all of those in my description.ext, but in lobby, there are still blanks...
I have to name the mission in editor to see anything in the lobby
@little eagle https://i.imgur.com/w0bUKyJ.jpg
That doesn't look right.
But hey, it's beautiful.
Just to make sure. You did use my latest edit, right?
Can you make a screenshot of an object with X,Y,Z:
0,0,0
0,90,90
90,0,90
90,90,0
So four of them. I think I can figure it out from that.
Doesn't it say x,y,z rotation?
im trying to disable fatighe but once a character respawn he have it enable back
sorry, edited the last message about pitch roll yaw
any fix to that?
@astral tendon respawn eventhandler
Oh, didnt they switch y and z in TB? Or was that in models?
what to do with that?
Models fr sure, but it might also apply to the TB.
Roque, you add a respawn eventhandler to your player and disable the fatigue of the new body.
red green blue
player addMPEventHandler?
i applyed those rotation according to what tb says
so, red is x, blue is y and green is z
how it should look like?
Yeah, the TB doesn't use XZY. Now I'll have to figure out what it is.
enableFatigue needs an object on the left side
@slender halo why does 90,0,90 and 90,90,0 look the same???
this addEventHandler ["respawn", {this enableFatigue false;}];
still does have fatigue
when respawning
no, this doesn't exist in the respawn scope
The eventhandler passes the new unit and the corpse in an array in the _this variable.
The first element is the new body.
ยฏ_(ใ)_/ยฏ
this addEventHandler ["respawn", {player4 enableFatigue false;}];
this one works
i just added the unit name
thanks commy2
@slender halo I really don't want to annoy you with this, so say when I should shut up, but can you redo this image with 89 instead of 90?
ok
it looks the same
:S
@little eagle is possible theyre equal
if they happen to have the same combined axis of rotation
I tried them all, but it doesn't work for C and D
i have a bomb model for planes how can i make it a real working mod for arma 3 i mean where can i find tutorial files
First, wrong channel. Second, you couldn't do a little research on your own before coming here?
You should learn the basics of config editing, and for implementing the model, if you have trouble, ask in #arma3_model
i know nothing i'll start from beginning and when i google like this i didn't find what i was looking for
Hi there
consider this define #define INIT(func) class func {file = QUOTE(Missions\func.sqf); preInit = 1}, used as follows: INIT(notThis);. This would cause an error because it gets converted to something that contains \n. Any way to overcome this besides not using this particular idiom (e.g. always use fnc or equivalent as prefix)?
Is there any guide helping me to do the config for implementing in game a grenade?
We made the model & textures on it.
https://community.bistudio.com/wiki/Weapons_settings
https://community.bistudio.com/wiki/Arma_3_Weapon_Config_Guidelines
https://community.bistudio.com/wiki/Arma_3_Cars_Config_Guidelines
https://community.bistudio.com/wiki/Arma_3_Characters_And_Gear_Encoding_Guide
credits to Rylan just 7 posts above
lol scripting channel is worse than the terrain channel
Is it? ๐ข
see here you get people asking about pretty much everything without doing some basic research first, in #arma3_terrain usually it is just people asking about terrains or complaining about errors with some life terrain's source files
Oh, yeah. That's true,
im having a trouble were i still have the "theat my self" option afther respawn, and even if i select it it does not go away
Hello there. Is there anyone willing to help the noob in two scripts?
post concrete questions and you might get some help
@little eagle see?
I have to make two scripts which pseudocode I will post below, which I will use in a vehicle mod(more precisely in class MFD). The result of script should be a number which I will use later in that class. These are codes: Script 1:
i=0;
name = worldName;
if(name=="Stratis")
{
i=1;
}
else if(name=="Altis")
{
i=2
}
...
return i;
Look up a sqf syntax guide
Also if this is config, you cant use sqf code in there directly
Hmm, so what do I use if I want to script a condition to "setUserMFDvalue"?
riverX, install SQFlinter, and it will show you all kinds of errors
private _i = 0;
switch (toLower worldName) do {
case "stratis": { _i=1; };
case "altis": { _i=2; };
};
???
i swear world name was a command.
yeah?
@little eagle and how to return value ?
Dumb discord highlighting
I though so as well
I know that, thats why I put it in pseudocode
The return value of the last statement in a function is the return value of the function.
oh ok, now I have a question concerning that setUserMFDvalue
on the wiki they say that I can use that to script a condition for HUD
what's the proper way to isNil check something that contains a macro?
e.g. MOD(REQUIRE_INITIALISED)
You seem to just set numbers with that command, and configure the MFD to use those numbers
it's a runtime global var though
Then you can't do this Macros are resolved when the file is preprocessed.
ah right hmmm
I'm not sure what you're trying to do.
one more thing, Is there a way to script the if (keypressed=Custom key 20) or something like that?
we have a waitUntil {MOD(REQUIRE_INITIALISED)}; but it might be uninitialized so as a quick fix adding an isNil check is good enough
isNil QUOTE(MACRO) ??
Ok, thank you
Ah forgot about the cheaty quotes
But why would a macro be a global? That seems redundant, no?
I assume like GVAR?
Hmm.
now I'm confused ๐
Yeah, it sounds weird.
I'll just use the output of the macro and stop worrying about it ๐
But the macro is its own output
You dont need to worry about it unless is within " "
waitUntil {!(isNil "alive_require_initialised") && {MOD(REQUIRE_INITIALISED)}}; ยฏ_(ใ)_/ยฏ
single quote marks!
already forgot about it ๐
What is REQUIRE_INITIALISED?
the name of the global variable that's created at some point
And MOD() adds the alive_ ?
yeah
alive_require_initialised can be false? Or is it either nil or true?
ah lol, no need to check for true ๐คฆ
Yep.
thanks ๐
It's like a three way boolean!
the more the merrier, right?
Non-classical logics (and sometimes alternative logics) is the name given to formal systems that differ in a significant way from standard logical systems such as propositional and predicate logic. There are several ways in which this is done, in...
Indeed
any reason for single quotes or would double quotes work just as well?
That is what single quotes are for. Still getting preprocessed.
alrighty ๐
within ' ' gets evaluated by the pre processor, between " " not.
makes you wonder if QUOTE() is still needed then
You are cheating the system!
is this even documented somewhere? The preprocessor page doesn't mention anything about it
Probably not then.
I'll just have to blindly trust you since I can't test myself at the moment ^^
I learned it from this file: https://github.com/CBATeam/CBA_A3/blob/master/addons/main/script_macros_common.hpp
I remember seeing it one day and it made sense to me.
Someone add it to the preproc page! ๐
I'm sure some admin will mark your edit as checked ^^
lol I guess another option was to use isNil QMOD(REQUIRE_INITIALISED)
it's used in more places
oh well
QMOD^^
oh shit, I just now realized that MOD and QMOD are our own macros and not CBA's... my baaadd ๐
@runic surge thank you
nuke em
meh
How do I initiate script for a vehicle? What do I have to do to config of that vehicle?
are you using CBA?
Is this for a mod with a custom vehicle? If so, https://community.bistudio.com/wiki/CfgVehicles_Config_Reference#EventHandlers..._Class
Yes it is, so for example, blackwasp uses this eextendedEventHandlers for Tailhook?
youd need to check in the config viewer, but possibly?
It's probably configured as an action if its activated from the action menu
never used it myself
but basically you can add this to the vehicle config:
class EventHandlers
{
class MyAddon
{
init = "_this call myFNC";
};
};
to call your own functions on vehicle init.
๐ฎ thank you ๐
I plucked that straight from the wiki page above
that is true, but the link didnt open for me for some reason earlier
Wrong params used for function
_this select 3 is type CODE not OBJECT apparently
just checking youre aware the first element of an array has index 0
what fucntion?
[this,"REPAIR_VEH_KNEEL","ASIS",{(player distance _this) < 5}] call BIS_fnc_ambientAnim;
this is the kinda of script im using
and it is working
yea why do you think you can use code there?
the fourth passed value should be an object, as listed there
snaptoObject?
Optional - The object where the unit will be snapped to
so, were is the error for?
either way the error is because youre not supposed to put a piece of {code} there
{} isnt and object
the script expects an object there, not code
in fact, nothing in the script uses a code input value
so im not sure why you put it in there or expect it to work
well, this is on the exemple document
no its not listed on the wiki
look under examples
you might be looking at some other function
i mean inside the editor
The editor tooltips are notoriously bad. But do they even have them for functions?!
did you make a typo and mean to use https://community.bistudio.com/wiki/BIS_fnc_ambientAnimCombat?
im assuming hes looking at the header in the functions viewer
jesus crist
Haha
what is realiable info here?
or were i can actually find it
instead you used https://community.bistudio.com/wiki/BIS_fnc_ambientAnim
BIS_fnc_ambientAnim != BIS_fnc_ambientAnimCombat
or you looked at the function file for ambientAnimCombat, anyway
is it possible that setGroupOwner does not work until briefing is over?
the thing is, i dont wanna he canceling animation wile under fire
just use the right function
he is supรณuse to repair under fire
dont put the name of an other function with other input arguments there
nigel, you mean have no effect until it's over? Or fail?
No effect
And when the game starts it does have one.
give time to acclimatize
here @astral tendon i fixed your typo : [this,"REPAIR_VEH_KNEEL","ASIS",{(player distance _this) < 5}] call BIS_fnc_ambientAnimCombat;
time doesn't pass during the briefing. So maybe some changes for transferring the group have no effect until time > 0.
Like updating map markers...
Group variables arent synced right at the start of the mission
Every client will have different groups
Hey sync after game start
Yeah, that is super annoying too.
Im assuming thats the underlying cause
aww ,fuck me ๐ฆ
No GROUP setVariable either, even if you dont broadcast it!
All runs the risk of getting axed
if (missionNameSpace getVariable [_gearType,false]) exitWith {hint "Loadout already unlocked"}; would this activate the hint if the variable _gearType is true?
so if _gearType = "var1", and var1 = true, it would activate?
yea
How can I find out what is wrong with a function if absolutely nothing happens upon activation, but there isn't an error message?
I know the function is executing because if the _gearType variable is true, the hint works, otherwise, nothing
spawning the function instead of calling it seems to have worked
Make your own error messages?
@runic surge
Sometimes the engine isn't helpful in errors I have on occasion seen an error occur with no error message.
Make your own error handler
Well script performance isn't important when diagnosing an error so I wouldn't want to keep it on
not sure what that is
In ArmA 3 there is a number of "types"
e.g sides
objects
vehicles
strings
numbers
code
right
If you are getting an error in a piece of code you probably should type check it.
Hmmm indestructible trees in Tanoa are really immersion breaking.
Wonder if there is a way I can make them easy to knock down
or allow vehicles to drive over the mountain terrain without getting stuck on tree geometry.
is there a way to remove existing diary records?
@runic surge as far as I can see there ins't any commands to remove diary records.
second best thing I would assume is just to set the text to a blank value.
It just doubles the records everytime I respawn
I will just add a param that determines whether or not to add them
private _unit = _unitType createUnit [(getMarkerPos _teamBase), (createGroup _unitSide)];
private _unitGrp = group _unit;
{_x hcSetGroup [_unitGrp]} forEach synchronizedObjects _teamCommand;
[_teamBank,_unitCost,false] call BTH_fnc_ManageBank_RTS;
This gives me the same error I was having issues with earlier (Type Group, expected Group) even though I am using the unit's group
not sure why this one doesn't work
(createGroup _unitSide) doesn't return a group. Try creating the group before the unit
createGroup west for ex does
but I am pretty sure that is the incorrect syntax for createUnit
group createUnit [type, position, markers, placement, special] all required params
The Group parameter MUST be an existing group or the unit won't be created.
Looks like there may already be west units/group in your photo?
Then wiki is wrong?
no, biki isn't wrong. createGroup returns newly created group.
Oh you mean in createUnit?
This was probably an OFP limitation or outdated info
then you should show him that example
Eeek, hold on. Alt syntax doesn't even return unit reference
private _unit = (createGroup _unitSide) createUnit [_unitType,(getMarkerPos _teamBase),[],0,"NONE"];
private _unitGrp = group _unit;
{_x hcSetGroup [_unitGrp]} forEach synchronizedObjects _teamCommand;
[_teamBank,_unitCost,false] call BTH_fnc_ManageBank_RTS;
spacebar galore
alt syntax is broken then? Or does it just lack some things that the original syntax has?
either way I guess it doesn't matter
Np.
Anyone ever crack the nut as to why after some time in mission players sometimes globally become Error: No unit? Seems like once Error: No unit then always Error: No unit goes back to lobby and restart.
_player addAction [
"<t color='#919191'>More Options</t>",
{
private _player = ((_this select 3) select 0);
private _playerTeam = ((_this select 3) select 1);
[_player, _playerTeam] call BTH_fnc_ExtraPlayerActions_RTS;
},
[_player, str _playerTeam], -1, false, true, "", "true", 1.5
];
Is this a good way to pass multiple arguments into an addaction? Of course I could just use (_this select 1) to get the player but I just want to know if this is a good idea
variables _this and _target will save you time as they are already passed to the code and condition in addAction
I know but if I was using different variables not normally passed to an addAction
would this be a good solution?
Sure.
https://community.bistudio.com/wiki/landAt
Is the alt syntax for helicopters not working?
heli landAt helipad
I tried with a helicopter named h1, a helipad named lz1 and nothing.
h1 landAt lz1;
The heli will land at the nearest helipad object, or just land if there's no helipad nearby.
I did try with two helipads, one further away. The LandAt was ignored as far as I can tell.
yea ur not wrong ๐
Ah well.
looking at how arma uses it, they set a waypoint to the helipad and then use that combo i posted as the waypointstatement
_wp setWaypointSpeed "NORMAL";
_wp setWaypointStatements ["true", format ["%1 land 'GET OUT'; %1 landAt %2", _heliString, _LZString]];
_wp setWaypointType "TR UNLOAD";```
makes sense i guess.
Guys I don't know what I'm doing wrong I am making a scenario where you get Attacked And once you kill all of them the game ends but It's not ending.
!alive Attacker1 && !alive Attacker2 && !alive Attacker3 && !alive Attacker4 && !alive Attacker5 && !alive Attacker6 && !alive Attacker7 && !alive Attacker8;
This is the scripting I am using on one Trigger so why is it not ending?
is one of the attackers still alive?
u could make it look a bit nicer but yea it would work. are all the attackers defined as Attacker#? is the trigger a trigger once thing or does it just keep checking? (i dont do triggers so im not sure what it can do)
How it works is I got eight men I have to name all of them Attacker1, Attacker2, Attacker3, So on and so forth, I place down a trigger And I do that code And when they all die the game Supposed to end immediately
uve tried "!alive Attacker1" by itself?
@robust hollow Thanks. I still couldn't get the helicopter to go to a specific helipad, so I don't think landat works for helicopters, but it's not a huge deal, landing at the nearest is good enough.
Did you put it in the condition box, @sick drum ?
The snippet you posted is valid, error is somewhere else
Yep if i put !alive Attacker1; It works, so I'm going to keep adding
I think I have it figured out
brb
yes! ok i got it, it was Because I named one guy Attacker9 Instead of 8
Are they all in a group?
Yes
Can you give me an example how would that work?
Hello people with wisdom, i have a question about eventhandlers and damages...
I placed a building and only want to let it be destroyed by the following explosive array _explosives = ["DemoCharge_Remote_Mag","SatchelCharge_Remote_Mag"];
I also added an eventhandler "Handledamage" to the building (only gets added to the server) so that i can check if the ammo that is used is in my explosives array. That works for bullets and grenades, but when i hit it with an AT rocket the building still gets destroyed. Do i need to add other eventhandlers as well or did i just have bad luck? Or is there another way i can do this?
Can you give me an example how would that work?
? That is the example. Are you asking me how it works?
see the following code: https://gist.github.com/WhistleTDNL/a8006204f31d98b9acfc7f5c12925aff
Let's say I have 10 Attackers Do I name the group or every person individually
@sleek nova You're using handleDamage wrong. Your buildings can still be one shotted.
The group.
Click the group symbol above the group leader.
HandleDamage sucks. Nothing new.
buttah
cheese
how would i go about this then? i just changed my gist a bit, because i think it should be returning 0 if the projectile is not in explosive array
but the oneshot thing is still a problem
KK says on his website This code makes Bob invulnerable: _eh = Bob addEventHandler ["HandleDamage", {hint "IMMA INVINCIBLED!"; 0}];
so i did that for when the projectile is not in the array, and when the projectile is in the array return the damage as it comes through the params
You want it to be only damageable by satchels?
yeah
Because the explosion splash damage will not pass the satchel ammo as projectile.
okay
To make it clear what I do is make a group of enemies name them something in my case it's "ok" then {alive _ok} count units AttackerGroup == 0 or am I getting this completely wrong because I'm sleep deprived
AttackerGroup is obviously the group name.
units AttackerGroup
is an array of all soldiers in that group
{...} count
a.k.a. CODE count
iterates through the array of units of the group
Oh!! I see
And reports the number of all units that satisfy the condition
{alive _x}
please see the alternative syntax of count: https://community.bistudio.com/wiki/count
where _x is an element of the array
And if that count is 0
they're all ded
hence
number == 0
reports
true
_x is the element contested/checked in the array. If it comes back true count will add 1.
Therefore trigger fires
it doesn't matter for me if the splash damage doesn't get through. It still does a lot of damage to the building without splash damage (tested that yesterday)
but i'll give the gist a go and see what happens
The way you have it now it will heal the building when it's hit by anything else.
And in is case sensitive
And when it's dead and hit by something else, it gets healed but will remain dead. Very weird.
okay so it is better to use _oldDamage and set the value to that
_section
It's named "selection".
and i will nee to add another eventhandler "killed"?
What for?
so i can check if the building is killed?
The setDamage is weird too. I wouldn't use that one inside handleDamage, but just return what you have.
like so
but still i will have the risk a building will get oneshotted by an at and there is nothing i can do about that?
_oldDamage + _damage
That is not what _damage is
_damage is the new total damage, not the received damage
You'll effective double the damage with the second hit
And triple it with the third
yeah i know i need to check the section as well
I'd cancel the && alive _objectpart. It does nothing effectively.
it seems i am on the right track
i read several things and one of them said "section" so i just go with that, but simply said it is just the part of the vehicle that got hit
and the first selection/section is always "" which shows the damage dealt
But it's not a section. You don't damage sections. You damage selections.
One more thing If I'm making more than one group what do I have to do?
okay i'll change the code ๐
Add them together.
with &&?
Ah yes ok
Thanks
{alive _x} count (units Attacker1 + units Attacker2 + units Attacker3 + Attacker4 + Attacker5) == 0
Like this?
If those are groups, then yes iff you also add the missing "units" commands
oh lol I didn't see that thanks You are literally the best person Ever!
haha
F-flattery will get you anywhere!
haha
okay so now it will add _damage if it is in the explosives array. if not, it will just do _olddamage
i will only change the global var "LT_BuildingDamage" on the building if the selection == ""
Now i need to check if the buildings is still alive or not. If it is not deleted the eventhandler will still fire everytime
but that should be it...
If it is not deleted the eventhandler will still fire everytime
And? Where's the downside?
idk i thought maybe fps?
๐
๐
yeah, the "BuildingChanged", but it does not give me the ability to check which ammo was used
hit EH?
does not always fire when dead + does not give me the ammotype
i could use hitpart
but id rather use handledamage at this point
but thanks so much for the input guys
Handle my damage ๐
Couldnt find anything, or I am blind. How to script the condition based on UserAction 1 key pushed?
keyDown eventhandler
But don't use the user action keys. It will not work properly due to long story short: indices and rounding errors.
Is UID spoofing still a thing? Im not sure if I need to be concerned about it with something like an admin script
@little eagle thank you
hello guys, do you know if it's possible to prevent people from switching weapons ?
btw fps binaries are exquisite for debugging .sqf performance
Well yesterday I had issues with server freezing because of saveprofilenamespace etc. It's a lot easier to detect with unlimited fps
saveprofilenamespace is so pointless.
Need it on the server 'tho