#arma3_scripting

1 messages ยท Page 358 of 1

simple solstice
#

happy to see that you solved it yourself, keep up the good work!

lavish hamlet
#

thanks.. ill be back for more pointers in the future ๐Ÿ˜ƒ

errant herald
#

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?

robust hollow
#

you're wanting to attach them to the ship yea?

errant herald
#

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

grizzled spindle
#

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));

robust hollow
#

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.

grizzled spindle
#

yeah lol

#

ty

robust hollow
#

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?

grizzled spindle
#

`

robust hollow
#

๐Ÿ˜ฎ

#

yea that

grizzled spindle
#

xD

robust hollow
#

thought it would do this with just one tick

grizzled spindle
#

Yeah dont think its needed

errant herald
#

well the two .p3ds in that script i mentioned have only ROADWAY LODs

grizzled spindle
#

I know it makes hardly any performance difference but i guess looping each array would potentially

#

idk lol

errant herald
#

trying to bypass the issue of arma not recogninzing roadways farther then 50m

robust hollow
#

mm, im not the smartest one out so someone else may be able to help you better.

errant herald
#

that script i posted

#

can it function

#

?

#

i dont know much about scripting

grizzled spindle
#

post it again please

errant herald
#

_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

grizzled spindle
#

bit weird way of doing things

#

i guess it would work

errant herald
#

hmm dont know why its not working ๐Ÿ˜ฆ

robust hollow
#

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

grizzled spindle
#

could just trial and error the parts using attachto

errant herald
#

ah ok

hallow spear
#

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

sly sun
#

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?

robust hollow
#

@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.

hallow spear
#

excellent. ty

sly sun
#

@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?

robust hollow
#

to make the lightpoint itself you can do "#lightpoint" createVehicleLocal pos; and then use the other commands to edit it how you wish.

sly sun
#

@robust hollow Thanks for the help, i couldn't get anything to work, maybe another day!

robust hollow
#
_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.
chrome hedge
#

Any help would be appreciated

robust hollow
#

you dont have any parameters for the execvm so _this would be nil

#

_handle = vehicle execVM "loadout.sqf";

runic surge
#
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

indigo snow
#

createVehicleCrew returns Nothing, so you have a nil of the group-type

#

debug your values!

queen cargo
#

Love those errors
Type group expected group

runic surge
#

how could I get the group name of the created crew?

indigo snow
#

something like group driver _vehicle?

still forum
#

group (leader _vehicle); ?

runic surge
#

I suppose that was pretty obvious

#

thanks anyway

queen cargo
#

Someone here could be so kind to provide me with the different side strings?

#

str west etc.

#

Found em

runic surge
#

onMapSingleClick does it only count the next place you click on the map?

still forum
#

It set's a eventhandler that fires everytime you click on the map

#

works just like every other EH

runic surge
#

I'm trying to make it activate only once after a script is executed

still forum
#

reading...

runic surge
#

I guess I just need to reset the event handler

still forum
#

๐Ÿ‘

runic surge
#

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

still forum
#

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.

runic surge
#

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?

still forum
#

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

simple solstice
#

why are people so scared of global variables

rancid ruin
#

scared of globals? it's just not always the neatest way to do things

runic surge
#

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?

simple solstice
#

i dont understand, what you are trying to do?

runic surge
#

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

simple solstice
#

why dont u just call the code from the EH

#

and pass the position as a parameter?

runic surge
#

do the local variables work inside an eventhandler?

still forum
#

sure

runic surge
#

they need to be determined outside of that

peak plover
#

Yeah

still forum
#

it's SQF. Local variables work in SQF.

runic surge
#
_var1 = "thing";
onMapSingleClick "hint _var1; openMap false; onMapSingleClick '';"

So this would hint "thing" and clear the EH upon clicking somewhere?

still forum
#

No...

#

Local variables only work in the local script

simple solstice
#

what are we saying

still forum
#

the eventhandler is a different script.

simple solstice
#

is that you can pass eg. _pos

runic surge
#

that is what I thought

simple solstice
#

like that [_pos] call my_super_function;

#

inside the EH

runic surge
#

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

little eagle
#

@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] 
runic surge
#

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

slender halo
#

@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

tough abyss
#

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)

slender halo
tough abyss
#

thats just the position of the eye

peak plover
#

saveProfileNamespace

#

Causing lag

tough abyss
#

i need to modify the light itself to face the way my gaze is, in real time

peak plover
#

Any workaround ? when should I save it?

#

Is profilenamespace saved automatically at any point?

#

@tough abyss AttachTo not working?

#

Can't you attachto head?

slender halo
tough abyss
#

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

still forum
#

@tough abyss setVectorDirAndUp. Get vector dir from cameraViewDirection or.. eyeDirection is probably better

slender halo
#

they say you have to use this on a player

tough abyss
#

that looks like what i want, cheers :D

slender halo
#

hum, actually they are talking about position, not direction, but what if in third person

still forum
#

getCameraViewDirection is not talking about position

tough abyss
#

yeah its returning a 3D vector

#

so thats good

slender halo
#

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]

still forum
#

yes.. Because that's not lagging behind so much

slender halo
#

@tough abyss you might experience "laggy lights" with moving #lightpoints since engine seems to update them like a couple of time a second

peak plover
#

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

still forum
#

no

slender halo
#

^^

still forum
#

atleast not really

tough abyss
#

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

slender halo
#

@peak plover actually you would have to drop the game to 2fps

peak plover
#

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 ๐Ÿ˜ฆ

tough abyss
#

do you mean like when in wasteland you hit escape and it saves ytour profile?

peak plover
#

Wait, does hitting escape do it automatically by default ?

tough abyss
#

in wasteland it does

#

your wasteland profile saves anyway, which is probably just a single command to the server, updating their sql

peak plover
#

hmm, how could i do that with an EH?

tough abyss
#

sorry im watching rick and morty, i need to re-read your problem again :P

peak plover
#

Yeah SQL is probably a lot better for saving, because the lack of framedrop

slender halo
#

i've seen some BIS_fnc_dbXXXX functions

#

i don't know what they are for

tough abyss
#

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

peak plover
#

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

tough abyss
#

if you want to manually save it, cant you just spawn it off so it runs in a thread and shouldnt kill fps?

peak plover
#

Nah, writing to disk kills fps no matter what

#

Because it freezes the game until it's done so it does not corrupt

still forum
#

afaik saveProfileNamespace doesn't do anything anymore

peak plover
#

Does

tough abyss
#

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

still forum
#

besides telling the game to save on next loading screen / escape menu

peak plover
#
[] 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

tough abyss
#

not that i know how saveProfileNamespace executes, but maybe put a sleep 0.,25 on both sides of it

peak plover
#

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

tough abyss
#

eventhandler for map i gues

peak plover
#

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

tough abyss
#

thats the risk vs reward thing you have to weight up

peak plover
#

FUCK ME

tough abyss
#

every 5 minutes, plus an event handler

peak plover
#

I can't do every 5 minutes

#

That would mean every 5 minutes everything rubberbands

tough abyss
#

well, koth does it somehow

peak plover
#

Every 10 hours maybe/

tough abyss
#

they save it all locally

halcyon crypt
#

KotH only stores a couple of things, like money, level and perks I guess

peak plover
#

That's player profiel 'tho

tough abyss
#

so what vars are changing on your server, that you need to change the profile namespace constantly?

peak plover
#

Tasks, alive/dead players, but I want to extend this to AI and objects

tough abyss
#

rock a db then

peak plover
#

Well I'd like to keep it vanilla

slender halo
#

it will be vanilla for players

peak plover
#

but not for server

#

Hmm

#

How often does server profile save on default?

#

when?

#

Google did not help ๐Ÿ˜ฆ

peak plover
#

๐Ÿ˜ญ

#

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 ๐Ÿ˜ฆ

tough abyss
#

is there a filewriting script for arma?

still forum
#

no

peak plover
#

dll can do that

#

But needs mod

tough abyss
#

nothing vanilla then

peak plover
#

saveProfilenamespace writes a file and I see it as something that can be very terrible if a hacker would use it...

slender halo
#

you still can trigger a saveprofilenamespace on some player events with remoteExec

peak plover
#

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...

slender halo
#

it is a mp mission right ?

peak plover
#

yehh

slender halo
#

so you definitly should save everything server side

#

and gather most data from server

peak plover
#

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

tough abyss
#

oh right this is for public on workshop

#

not just like, you and your mates

peak plover
#

Yeah, I don't have any mates... So it's for others

tough abyss
#

whats the mission anyway?

peak plover
#

It's a baseline / framework for missions.
Currently some dudes fighting in desert

tough abyss
#

cool

little eagle
#

@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.

indigo snow
#

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

little eagle
#

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.

indigo snow
#

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

little eagle
#

Is that the correct way of doing things though when your interface (3den attributes) ends up with inverted angles?

indigo snow
#

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

little eagle
#

No, when I put z=90, it rotates clockwise.

indigo snow
#

someone at BIS might really misunderstand vector maths

#

look up the wiki image for addTorque

#

and what they call clockwise

little eagle
#

They all rotate clockwise. Which is enough to throw me off.

indigo snow
#

(thats not CCW >< )

little eagle
#

Oh, maybe it's not that they don't understand vectors, but they don't understand clocks. :S

peak plover
#

Well...

still forum
#

Guy was probably sitting in his office.. and they have a clock on a transparent wall..

peak plover
#

If you look at it from the bottm....

indigo snow
#

then the arrow points in the negative direction ๐Ÿ˜‰

peak plover
#

Red points awway from you

#

And green is counter cockwize

indigo snow
#

and away is negative, right hand rule doesnt care about your viewing angle

#

its a maths/universe thing

peak plover
#

right hand rule?

little eagle
#

It apparently doesn't apply to Arma.

indigo snow
#

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?

little eagle
#

step 1: invert angles
step2: figure out the order to multiply the matrices

peak plover
#

@median bronze

#

?

little eagle
#

step3: multiply result with [0,1,0] (dir) and [0,0,1] up

#

step4 solve trigonometric equation system

indigo snow
#

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?)

little eagle
#

Who knows. They're already inverted :S

grand berry
#

What are you guys trying to solve? Sounds interesting.

little eagle
#

Get the euler angles for the editor/terrain builder from any ingame object

indigo snow
#

ive solved 3den

#

apparently TB is different

little eagle
#

hmm, I thought they're the same. What is the solution to 3den?

indigo snow
#
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

grand berry
#

I have a function that takes an object, xyz rotation around object axis and converts to setVectorDirAndUp if that helps?

indigo snow
#

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

grand berry
#

Yea but if you have that the opposite would be easy no?

little eagle
#

Do you need it with atan2 ?

#

I thought that should handle it.

indigo snow
#

you might put some geometry to simplify

#

but thats basically the projection of direction vectors on various planes

little eagle
#

I'll try this. It looks suspiciously wrong to me.

indigo snow
#

tell that to NASA ๐Ÿ˜›

#

it works but you get the inverse sometimes (upside down)

little eagle
#

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.

indigo snow
little eagle
#

What's the N for?

indigo snow
#

uh wiki

#

dont use it anymore

little eagle
#
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...

indigo snow
#

you also dont need to normalize for X but hey

little eagle
#

Yeah, it cancels the minus

indigo snow
#

definitely worked a few months ago

#

theres also the atan2 command which i mightve used but that shouldnt matter

little eagle
#

[10,10,10]

#

result:
[10,10,10]

#

wew

#

[-10,-10,-10]
result
[-10,-10,-10]
nice

indigo snow
#

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

little eagle
#

120,120,120
gives me
[-60,60,-60]

indigo snow
#
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

little eagle
#

I think it just dies -pi/2<x<pi/2

#

Because tan

#

atan

indigo snow
#

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

little eagle
#

Looks to me like this doesn't happen with -90<x<90.

indigo snow
#

check my values above, where xrot is ~30

little eagle
#

[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

indigo snow
#

yea so you need something to check against.

little eagle
#

I'll change it to atan2

indigo snow
#

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

little eagle
#

Nah, atan2 made it worse, but at least it fixed dividing by 0

#

^^

simple solstice
#

@peak plover at this point I would suggest you using extdb. many benefits

indigo snow
#

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.

peak plover
#

@simple solstice thanks. I'll look into that. I'm pretty sure I'll need it eventually

simple solstice
#

@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

little eagle
#

It doesn't seem like 90...270 matters. The rotations are equivalent.

simple solstice
#

can I exitWith {} from an for "_i" from 0 to 1 step 0 do loop?

peak plover
#

yeah

simple solstice
#

and it performs better than a while {true} loop IIRC?

peak plover
#

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

simple solstice
#

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?

peak plover
#
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;};
simple solstice
#

so it is faster..

peak plover
#

apparently ?

little eagle
#

publicVariable "weaponarr"
Why not like this?

simple solstice
#
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.
peak plover
#

1 to 0 might not work

simple solstice
#

from the description

little eagle
#

lgtm

simple solstice
#

so what I wrote is correct?

#

and that will reduce traffic if the weaponarr is already defined, right?

indigo snow
#

90-270 isnt equivalent, its pointing the exact opposite direction

little eagle
#

While that is true

peak plover
#
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;};
little eagle
#

[[16.3381,163.073,191.627],[196.338,16.9266,11.6269]]

#

are equivalent

peak plover
#

for "_i" from 0 to 1 step 0 do is faster

little eagle
#

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.

indigo snow
#

That middle one is wierd, seems like a minus got nixed there

little eagle
#
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.

slender halo
#

๐Ÿ™ƒ great, i try this

little eagle
#

It's for the editor, not the terrain builder.

#

I never used the terrain builder. What even are the angles there?

slender halo
#

does your object remain in position when you try with near 90ยฐ pitch or roll rotated objects ?

little eagle
#

You mean getPos?

slender halo
#

nope, rotations

#

the equator is fine but it starts getting messed up on poles

little eagle
#

I don't see the problem.

slender halo
#

here are the originals objects

little eagle
#

Can you give me more context for "original"?

slender halo
#

as you can see, there is some drifting on poles

#

the objects i try to export from arma

#

need more detail ?

little eagle
#

Yes, I don't get it. How did you make them stand up in the first pace?

slender halo
#

setDir and BIS_fnc_setPitchBank

little eagle
#

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.

slender halo
#

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

tough abyss
#

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

little eagle
#

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.

slender halo
#

i don't

tough abyss
#

could that be a rounding error?

slender halo
#

my question is, is it TB interpretation issue or is there some mathematics in the function that could explain this ?

tough abyss
#

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

slender halo
#

i try that

little eagle
#

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.

tough abyss
little eagle
#

No. Do it with only some of them.

sick drum
#

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?

little eagle
#

They might be all wrong and just appear to form the sphere, because they're all wrong.

tough abyss
#

i don't get what you are after

little eagle
#

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.

tough abyss
#

the position has nothing to do with all of that tho

#

but yea i know what you mean

little eagle
#

@sick drum

{alive _x} count (units group1 + units group2 + units group3) == 0
sick drum
#

Oh yes that makes sense Thanks

slender halo
#

exploding the exported string and creating 3DEN entities with it

#

perfectly fine

tough abyss
#

so that means tb seems to expect something diffrent

slender halo
#

yep

little eagle
#

๐Ÿค”

indigo snow
#

gotta ask the devs for more info then

#

or try all the rotation sequences

#

just like figuring out 3den is XZY

little eagle
#

I wonder what the reasoning behind picking XZY is.

tough abyss
#

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 ๐Ÿ˜„

peak plover
#

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;

still forum
#

=3; ;=3

peak plover
#

wait a minute...

#

might have happened because I had no "respawn_guerilla"

still forum
#

๐Ÿฆ

tough abyss
#

are you woring on emoji sqf again? ๐Ÿ˜„

slender halo
#

@little eagle @indigo snow thanks for your help, sad there is no solution...

little eagle
#

Have you tried the other transformation orders?

slender halo
#

nope

little eagle
indigo snow
#

Id ask someone at BIS first

#

might be way faster ๐Ÿ˜›

little eagle
#

XZY is the editor right?
Because the solution on this paper is different.

tough abyss
#

devs that made TB don't work at the company anymore

#

and TB was made at BIsim not BI

indigo snow
#

I was using XZY

peak plover
#

What's TB

little eagle
#

Ah, because it says XZY you have to switch up and dir :S

tough abyss
#

TerrainBuilder @peak plover

simple solstice
#

A nightmare @peak plover

little eagle
#

You could also just try it out by messing around with it.

peak plover
#

allMissionObjects ""
Any faster alternatives?

little eagle
#

entities ""

peak plover
#

Ohh nice thanks

#

Only difference I'm seeing is missing vehicles/modules

#

and 10ms

little eagle
#

It does list vehicles.

peak plover
#

ohh nvm

#

I thought arrayintersect

#

is opposites

little eagle
#

allUnits
if you just want persons

peak plover
#

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?

indigo snow
#

can any config file access itself?

peak plover
#

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

little eagle
#

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...

indigo snow
#

I'd try XYZ

#

then ZYX

#

or wait they funk up with dir = Y

#

ZXY / YXZ would be eulerish

little eagle
#

It's relatively easy to figure out the correct order if you "play" with it.

peak plover
#

Is there a way to edit the classes in mission.sqm

simple solstice
#

@peak plover

onLoadName
onLoadMission
onLoadIntro
author
#

I have this in mine description .ext

little eagle
#
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.

slender halo
#

i can try it

#

i can give you my script to generate and export objects too

little eagle
#

already fucked up and edited -.-

peak plover
#

@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

slender halo
little eagle
#

That doesn't look right.

#

But hey, it's beautiful.

#

Just to make sure. You did use my latest edit, right?

slender halo
#

yes, i noticed your 2nd edit

#

at least, i noticed one edit after your message

little eagle
#

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.

slender halo
#

ok

#

here are the scripts if you are interested

#

pitch x
roll z
yaw y

little eagle
#

Doesn't it say x,y,z rotation?

slender halo
#

that's what is written in tb

#

i give you the screen in few secs

astral tendon
#

im trying to disable fatighe but once a character respawn he have it enable back

slender halo
#

sorry, edited the last message about pitch roll yaw

astral tendon
#

any fix to that?

indigo snow
#

Roll is Z???

#

Surely not

little eagle
#

@astral tendon respawn eventhandler

indigo snow
#

Oh, didnt they switch y and z in TB? Or was that in models?

astral tendon
#

what to do with that?

little eagle
#

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.

slender halo
little eagle
#

red green blue

astral tendon
#

player addMPEventHandler?

little eagle
#

(jus to make sure)

#

No, addEventHandler

slender halo
#

i applyed those rotation according to what tb says

#

so, red is x, blue is y and green is z

little eagle
#

No, I mean the arrows on the object

#

nvm

astral tendon
#

how it should look like?

little eagle
#

Yeah, the TB doesn't use XZY. Now I'll have to figure out what it is.

astral tendon
#

this addEventHandler ["respawn", {enableFatigue false;}];

#

just a generic error

little eagle
#

enableFatigue needs an object on the left side

#

@slender halo why does 90,0,90 and 90,90,0 look the same???

astral tendon
#

this addEventHandler ["respawn", {this enableFatigue false;}];

#

still does have fatigue

#

when respawning

little eagle
#

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.

slender halo
#

ยฏ_(ใƒ„)_/ยฏ

astral tendon
#

this addEventHandler ["respawn", {player4 enableFatigue false;}];

#

this one works

#

i just added the unit name

#

thanks commy2

little eagle
#

@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?

slender halo
#

ok

little eagle
#

thanks

#

If it looks the same then I have no idea...

slender halo
#

it looks the same

little eagle
#

:S

indigo snow
#

@little eagle is possible theyre equal

#

if they happen to have the same combined axis of rotation

little eagle
#

I tried them all, but it doesn't work for C and D

forest plaza
#

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

runic surge
#

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

forest plaza
#

i know nothing i'll start from beginning and when i google like this i didn't find what i was looking for

little eagle
#

Guide says:
Pitch (X) and Roll (Z)

#

Yaw (Y)

tough abyss
#

Hi there

thick sage
#

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)?

tough abyss
#

Is there any guide helping me to do the config for implementing in game a grenade?

#

We made the model & textures on it.

runic surge
#

lol scripting channel is worse than the terrain channel

little eagle
#

Is it? ๐Ÿ˜ข

runic surge
#

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

little eagle
#

Oh, yeah. That's true,

astral tendon
#

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

neon snow
#

Hello there. Is there anyone willing to help the noob in two scripts?

indigo snow
#

post concrete questions and you might get some help

runic surge
#

@little eagle see?

neon snow
#

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;

indigo snow
#

Look up a sqf syntax guide

#

Also if this is config, you cant use sqf code in there directly

neon snow
#

Hmm, so what do I use if I want to script a condition to "setUserMFDvalue"?

thick sage
#

riverX, install SQFlinter, and it will show you all kinds of errors

neon snow
little eagle
#
private _i = 0;

switch (toLower worldName) do {
    case "stratis": { _i=1; };
    case "altis": { _i=2; };
};

???

#

i swear world name was a command.

peak plover
#

yeah?

neon snow
#

@little eagle and how to return value ?

little eagle
#

Dumb discord highlighting

peak plover
#

I though so as well

little eagle
#

It is

neon snow
#

I know that, thats why I put it in pseudocode

little eagle
#

The return value of the last statement in a function is the return value of the function.

neon snow
#

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

halcyon crypt
#

what's the proper way to isNil check something that contains a macro?

#

e.g. MOD(REQUIRE_INITIALISED)

little eagle
#

I never used it, RiverX.

#

#ifdef

#

#ifdef REQUIRE_INITIALISED

#endif

indigo snow
#

You seem to just set numbers with that command, and configure the MFD to use those numbers

halcyon crypt
#

it's a runtime global var though

little eagle
#

Then you can't do this Macros are resolved when the file is preprocessed.

halcyon crypt
#

ah right hmmm

little eagle
#

I'm not sure what you're trying to do.

neon snow
#

one more thing, Is there a way to script the if (keypressed=Custom key 20) or something like that?

little eagle
#

Yes. Google it.

#

Thousand sites with that.

halcyon crypt
#

we have a waitUntil {MOD(REQUIRE_INITIALISED)}; but it might be uninitialized so as a quick fix adding an isNil check is good enough

indigo snow
#

isNil QUOTE(MACRO) ??

neon snow
#

Ok, thank you

little eagle
#

isNil 'MACRO_NAME'

#

isNil {MACRO_NAME}

indigo snow
#

Ah forgot about the cheaty quotes

little eagle
#

But why would a macro be a global? That seems redundant, no?

indigo snow
#

I assume like GVAR?

little eagle
#

Hmm.

halcyon crypt
#

now I'm confused ๐Ÿ˜›

little eagle
#

Yeah, it sounds weird.

halcyon crypt
#

I'll just use the output of the macro and stop worrying about it ๐Ÿ˜›

indigo snow
#

But the macro is its own output

#

You dont need to worry about it unless is within " "

halcyon crypt
#

waitUntil {!(isNil "alive_require_initialised") && {MOD(REQUIRE_INITIALISED)}}; ยฏ_(ใƒ„)_/ยฏ

little eagle
#

single quote marks!

halcyon crypt
#

already forgot about it ๐Ÿ˜

little eagle
#

What is REQUIRE_INITIALISED?

halcyon crypt
#

the name of the global variable that's created at some point

little eagle
#

And MOD() adds the alive_ ?

halcyon crypt
#

yeah

little eagle
#

alive_require_initialised can be false? Or is it either nil or true?

halcyon crypt
#

nil or true

#

apparently anyway

#

probably some old ass code

little eagle
#
waitUntil {!isNil 'MOD(REQUIRE_INITIALISED)'};
#

there you go

halcyon crypt
#

ah lol, no need to check for true ๐Ÿคฆ

little eagle
#

Yep.

halcyon crypt
#

thanks ๐Ÿ˜ƒ

little eagle
#

It's like a three way boolean!

halcyon crypt
#

the more the merrier, right?

little eagle
#

Indeed

halcyon crypt
#

any reason for single quotes or would double quotes work just as well?

little eagle
#

That is what single quotes are for. Still getting preprocessed.

halcyon crypt
#

alrighty ๐Ÿ˜ƒ

indigo snow
#

within ' ' gets evaluated by the pre processor, between " " not.

#

makes you wonder if QUOTE() is still needed then

still forum
#

You are cheating the system!

little eagle
#

It isn't^^

#

It can be nice for double quotes.
'QUTE(blabla)'

#

strings in strings

halcyon crypt
#

is this even documented somewhere? The preprocessor page doesn't mention anything about it

little eagle
#

Probably not then.

halcyon crypt
#

I'll just have to blindly trust you since I can't test myself at the moment ^^

little eagle
#

I remember seeing it one day and it made sense to me.

still forum
#

Someone add it to the preproc page! ๐Ÿ˜„

#

I'm sure some admin will mark your edit as checked ^^

halcyon crypt
#

lol I guess another option was to use isNil QMOD(REQUIRE_INITIALISED)

#

it's used in more places

#

oh well

little eagle
#

QMOD^^

halcyon crypt
#

oh shit, I just now realized that MOD and QMOD are our own macros and not CBA's... my baaadd ๐Ÿ˜ƒ

forest plaza
#

@runic surge thank you

halcyon crypt
#

QMOD just does a QUOTE

#

and MOD does a GVARMAIN

little eagle
#

nuke em

halcyon crypt
#

meh

neon snow
#

How do I initiate script for a vehicle? What do I have to do to config of that vehicle?

indigo snow
#

are you using CBA?

neon snow
#

no

#

Do I have to?

little eagle
#

It would've made it possible.

#

Otherwise it's a headache with scripting alone.

indigo snow
neon snow
#

Yes it is, so for example, blackwasp uses this eextendedEventHandlers for Tailhook?

indigo snow
#

youd need to check in the config viewer, but possibly?

neon snow
#

the tailhook is scripted in sqf

#

Ok I will look into it

indigo snow
#

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.

neon snow
#

๐Ÿ˜ฎ thank you ๐Ÿ˜ƒ

indigo snow
#

I plucked that straight from the wiki page above

neon snow
#

that is true, but the link didnt open for me for some reason earlier

astral tendon
#

what the hell is this error?

peak plover
#

Wrong params used for function

indigo snow
#

_this select 3 is type CODE not OBJECT apparently

#

just checking youre aware the first element of an array has index 0

astral tendon
#

what fucntion?

indigo snow
#

some ambient animation thing

#

BIS module?

astral tendon
#

[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

indigo snow
#

yea why do you think you can use code there?

#

the fourth passed value should be an object, as listed there

astral tendon
#

snaptoObject?

indigo snow
#

Optional - The object where the unit will be snapped to

astral tendon
#

so, were is the error for?

indigo snow
#

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

astral tendon
#

well, this is on the exemple document

indigo snow
#

no its not listed on the wiki

#

look under examples

#

you might be looking at some other function

astral tendon
#

i mean inside the editor

little eagle
#

The editor tooltips are notoriously bad. But do they even have them for functions?!

indigo snow
#

im assuming hes looking at the header in the functions viewer

astral tendon
#

jesus crist

little eagle
#

Haha

astral tendon
#

what is realiable info here?

indigo snow
#

you made a typo

astral tendon
#

or were i can actually find it

indigo snow
little eagle
#

BIS_fnc_ambientAnim != BIS_fnc_ambientAnimCombat

indigo snow
#

or you looked at the function file for ambientAnimCombat, anyway

peak plover
#

is it possible that setGroupOwner does not work until briefing is over?

astral tendon
#

the thing is, i dont wanna he canceling animation wile under fire

indigo snow
#

just use the right function

astral tendon
#

he is supรณuse to repair under fire

indigo snow
#

dont put the name of an other function with other input arguments there

little eagle
#

nigel, you mean have no effect until it's over? Or fail?

peak plover
#

No effect

indigo snow
#

groups are wonky at mission start

#

dont use

little eagle
#

And when the game starts it does have one.

indigo snow
#

give time to acclimatize

#

here @astral tendon i fixed your typo : [this,"REPAIR_VEH_KNEEL","ASIS",{(player distance _this) < 5}] call BIS_fnc_ambientAnimCombat;

peak plover
#

I think so

#

That's my current only explenation

astral tendon
#

never mind

#

just removed the {(player distance _this) < 5}

little eagle
#

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...

indigo snow
#

Group variables arent synced right at the start of the mission

#

Every client will have different groups

#

Hey sync after game start

little eagle
#

Yeah, that is super annoying too.

indigo snow
#

Im assuming thats the underlying cause

peak plover
#

aww ,fuck me ๐Ÿ˜ฆ

indigo snow
#

No GROUP setVariable either, even if you dont broadcast it!

#

All runs the risk of getting axed

frank ruin
#

How do I block these UAV's in the createvehicle.txt?

#

As that ain't seem to work.

still forum
#

Yes

runic surge
#

if (missionNameSpace getVariable [_gearType,false]) exitWith {hint "Loadout already unlocked"}; would this activate the hint if the variable _gearType is true?

still forum
#

no

#

if the variable by the name in the string that _gearType contains is true

runic surge
#

so if _gearType = "var1", and var1 = true, it would activate?

robust hollow
#

yea

runic surge
#

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

tough abyss
#

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

runic surge
#

I already fixed the issue

#

also I have no idea how I would do that

tough abyss
#

try {} catch {} throw {}

#

It slows the script performance considerably however.

runic surge
#

Well script performance isn't important when diagnosing an error so I wouldn't want to keep it on

tough abyss
#

No.

#

You probably should do some type checking too

#

you know how to do that?

runic surge
#

not sure what that is

tough abyss
#

In ArmA 3 there is a number of "types"

#

e.g sides

#

objects

#

vehicles

#

strings

#

numbers

#

code

runic surge
#

right

tough abyss
#

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.

runic surge
#

is there a way to remove existing diary records?

subtle ore
#

@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.

runic surge
#

It just doubles the records everytime I respawn

#

I will just add a param that determines whether or not to add them

runic surge
#
    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

cloud thunder
#

(createGroup _unitSide) doesn't return a group. Try creating the group before the unit

subtle ore
#

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

cloud thunder
#

The Group parameter MUST be an existing group or the unit won't be created.

subtle ore
cloud thunder
#

Looks like there may already be west units/group in your photo?

subtle ore
cloud thunder
#

Then wiki is wrong?

subtle ore
#

no, biki isn't wrong. createGroup returns newly created group.

#

Oh you mean in createUnit?

#

This was probably an OFP limitation or outdated info

cloud thunder
#

then you should show him that example

subtle ore
#

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

runic surge
#

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

subtle ore
#

No alt syntax purposefully doesn't return unit reference

#

afaik

runic surge
#

odd

#

well, thanks anyway

subtle ore
#

Np.

cloud thunder
#

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.

runic surge
#
_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

subtle ore
#

variables _this and _target will save you time as they are already passed to the code and condition in addAction

runic surge
#

I know but if I was using different variables not normally passed to an addAction

#

would this be a good solution?

subtle ore
#

Sure.

sick drum
#

Hey Does this work? !alive cop1 && cop2 && cop3 && cop4

#

Nvm

#

got it to work

delicate totem
robust hollow
#

h1 land 'LAND';h1 landAt lz1

#

try that

delicate totem
#

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.

robust hollow
#

yea ur not wrong ๐Ÿ˜•

delicate totem
#

Ah well.

robust hollow
#

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.

sick drum
#

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?

robust hollow
#

is one of the attackers still alive?

sick drum
#

Nope I kill them all

#

Does the script look ok?

robust hollow
#

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)

sick drum
#

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

zenith edge
#

uve tried "!alive Attacker1" by itself?

delicate totem
#

@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.

indigo snow
#

Did you put it in the condition box, @sick drum ?

#

The snippet you posted is valid, error is somewhere else

sick drum
#

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

little eagle
#

Are they all in a group?

sick drum
#

Yes

little eagle
#

Why not name the group and do this?

{alive _x} count units AttackerGroup == 0
#

oops

sick drum
#

Can you give me an example how would that work?

sleek nova
#

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?

little eagle
#

Can you give me an example how would that work?
? That is the example. Are you asking me how it works?

sleek nova
sick drum
#

Let's say I have 10 Attackers Do I name the group or every person individually

little eagle
#

@sleek nova You're using handleDamage wrong. Your buildings can still be one shotted.

#

The group.

#

Click the group symbol above the group leader.

sick drum
#

Oh I see now let me try that

#

Hmm well Can't get it to work for some reason

little eagle
#

HandleDamage sucks. Nothing new.

sleek nova
#

buttah

little eagle
#

cheese

sleek nova
#

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

little eagle
#

You want it to be only damageable by satchels?

sleek nova
#

yeah

little eagle
#

Because the explosion splash damage will not pass the satchel ammo as projectile.

sleek nova
#

okay

sick drum
#

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

little eagle
#

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

sick drum
#

Oh!! I see

little eagle
#

And reports the number of all units that satisfy the condition
{alive _x}

sleek nova
little eagle
#

where _x is an element of the array

#

And if that count is 0

#

they're all ded

#

hence
number == 0
reports
true

sleek nova
#

_x is the element contested/checked in the array. If it comes back true count will add 1.

little eagle
#

Therefore trigger fires

sick drum
#

Oh i got to work

#

like So many Thanks

#

This is going to save me so much time

sleek nova
#

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

little eagle
#

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.

sleek nova
#

okay so it is better to use _oldDamage and set the value to that

little eagle
#

_section
It's named "selection".

sleek nova
#

and i will nee to add another eventhandler "killed"?

little eagle
#

What for?

sleek nova
#

so i can check if the building is killed?

little eagle
#

The setDamage is weird too. I wouldn't use that one inside handleDamage, but just return what you have.

sleek nova
#

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?

little eagle
#

_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

sleek nova
#

yeah i know i need to check the section as well

little eagle
#

I'd cancel the && alive _objectpart. It does nothing effectively.

sleek nova
#

it seems i am on the right track

little eagle
#

It's called seLEction, not section

#

Section is something else.

sleek nova
#

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

little eagle
#

But it's not a section. You don't damage sections. You damage selections.

sick drum
#

One more thing If I'm making more than one group what do I have to do?

sleek nova
#

okay i'll change the code ๐Ÿ˜ƒ

little eagle
#

Add them together.

sick drum
#

with &&?

little eagle
#

Eh.

#
{alive _x} count (units AttackerGroup1 + units AttackerGroup2) == 0
sick drum
#

Ah yes ok

#

Thanks

#

{alive _x} count (units Attacker1 + units Attacker2 + units Attacker3 + Attacker4 + Attacker5) == 0

Like this?

little eagle
#

If those are groups, then yes iff you also add the missing "units" commands

sick drum
#

oh lol I didn't see that thanks You are literally the best person Ever!

sleek nova
#

haha

little eagle
#

F-flattery will get you anywhere!

sick drum
#

haha

sleek nova
#

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...

little eagle
#

If it is not deleted the eventhandler will still fire everytime
And? Where's the downside?

sleek nova
#

idk i thought maybe fps?

little eagle
#

No.

#

keep it simple s

sleek nova
#

๐Ÿ˜ƒ

peak plover
#

๐Ÿ™ƒ

tough abyss
#

@sleek nova An EH can handle buildings being destroyed

#

I've done it before.

sleek nova
#

yeah, the "BuildingChanged", but it does not give me the ability to check which ammo was used

peak plover
#

hit EH?

sleek nova
#

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

peak plover
#

Handle my damage ๐Ÿ˜‰

sleek nova
#

aw jisss

neon snow
#

Couldnt find anything, or I am blind. How to script the condition based on UserAction 1 key pushed?

little eagle
#

keyDown eventhandler

#

But don't use the user action keys. It will not work properly due to long story short: indices and rounding errors.

warm gorge
#

Is UID spoofing still a thing? Im not sure if I need to be concerned about it with something like an admin script

neon snow
#

@little eagle thank you

mild pumice
#

hello guys, do you know if it's possible to prevent people from switching weapons ?

peak plover
#

btw fps binaries are exquisite for debugging .sqf performance

little eagle
#

Mods or vanilla?

#

Joker ^

peak plover
#

Well yesterday I had issues with server freezing because of saveprofilenamespace etc. It's a lot easier to detect with unlimited fps

little eagle
#

saveprofilenamespace is so pointless.

peak plover
#

Need it on the server 'tho

little eagle
#

Why?

#

Just let it write to the disk when the exe is closed.

peak plover
#

server never writes to profile by default

#

I ran a bunch of vanilla missions etc. reloaded, won, lost, closed server etc. profile vars didn't update