#arma3_scripting

1 messages · Page 398 of 1

still forum
#

pos objectA - pos objectB -> relative position. Magic

candid jay
#

WAT

#

I thought I had to use modelToWorld or similar

#

trying now

still forum
#

if A is at 0,1,0 and B is at 0,3,0
The relative position of B if A is the center is 0,2,0. Two steps to the right.
And 0,3,0 - 0,1,0 = 0,2,0. It's the same

#

You'd probably want to use modelToWorldVisual [0,0,0] instead of getPos to get more precision.. maybe

candid jay
#

so I need vectorDiff

still forum
#

yep

candid jay
#

so... (A modelToWorldVisual [0,0,0]) vectorDiff (B modelToWorldVisual [0,0,0])?

still forum
#

yep

candid jay
#

wat

#

ok trying

still forum
#

Maybe swap A and B.. dunno. Just try it out ^^

candid jay
#

hum

#

So, I get this as rel: [-5.14209,-0.00708008,21.7773]

#

ok that worked

#

n0ice

jade abyss
#

getRelPos ?

candid jay
#

that is with distance

jade abyss
#

getRelDir?

candid jay
#

the above works

jade abyss
#

ObjA getDir ObjB

still forum
#

Direction != relative pos 😄

still forum
#

Mr Banandscha

jade abyss
#

No, Dschaguevara

#

(tomorrows name will be the crown)

still forum
#

Dschalala?

candid jay
#

all good

still forum
#

DschaDschaDscha 💃

jade abyss
#

Better

still forum
#

That looks like you wanna use caternary ropes

candid jay
#

of course

#

i'm building a rope generator for powercables

#

it's impossible to use standard wires in 4km+ length power towers on hill terrains with 40 deg slopes

#

I mean, it's close enough to my cablecar except that it needs to be catenary, and thanks to commy2 we have the code

#

just giving it a try

little eagle
#

@candid jay Want to try the build of cba with the modules? They should be ready to use for this task.

stable wave
#

What's the meaning of the code following then in ```sqf
if (a != b) then [{"true"},{"false"}]

still forum
#

that's the same as

#

if (a != b) then {"true"} else {"false"}

stable wave
#

lol. I thought it was an array. Are there any explanations for such usage?

little eagle
#

Which is just the same as:

str (a != b)
still forum
#

It is an array

#

CODE else CODE
just returns [CODE,CODE]

little eagle
#

Else is just a high priority command that does this ^.

#

So you skip a step.

still forum
peak plover
#
Result:
208.8 ms

Cycles:
5/10000

Code:
private _west = []; 
private _nil = { 
 private _unit = _x; 
 if (side _unit isEqualTo west) then { 
  _west pushBack _unit; 
 }; 
 private _nil = { 
  if (side _x isEqualTo side _unit) then { 
   _west pushBack _x; 
  }; 
  false 
 } count allUnits; 
 false 
} count allUnits;
Result:
210.8 ms

Cycles:
5/10000

Code:
private _west = []; 
{ 
 private _unit = _x; 
 if (side _unit isEqualTo west) then { 
  _west pushBack _unit; 
 }; 
{ 
  if (side _x isEqualTo side _unit) then { 
   _west pushBack _x; 
  }; 
  false 
 } count allUnits; 
 false 
} count allUnits;
Result:
216 ms

Cycles:
5/10000

Code:
private _west = []; 
private _nil = { 
 private _unit = _x; 
 if (side _unit isEqualTo west) then { 
  _west pushBack _unit; 
 }; 
 private _nil = { 
  if (side _x isEqualTo side _unit) then { 
   _west pushBack _x; 
  }; 
 } forEach allUnits; 
} forEach allUnits;
Result:
213.4 ms

Cycles:
5/10000

Code:
private _west = []; 
{ 
 private _unit = _x; 
 if (side _unit isEqualTo west) then { 
  _west pushBack _unit; 
 }; 
 { 
  if (side _x isEqualTo side _unit) then { 
   _west pushBack _x; 
  }; 
 } forEach allUnits; 
} forEach allUnits;
#

🤔

#

doesn't add up

still forum
#

Soo spammy

#

what doesn't add up?

peak plover
#

using private is faster when using count

#

But slower when using forEach

still forum
#

measurement error

peak plover
#

Maybe beacuse count returns a number?

#

aah

#

That makes sense

little eagle
#

What do I see here?

peak plover
#

I guess I need more units

#

2.5k units

#

arma freezes

#
Result:
19811 ms

Cycles:
1/10000

Code:
private _west = []; 
private _nil = { 
 private _unit = _x; 
 if (side _unit isEqualTo west) then { 
  _west pushBack _unit; 
 }; 
 private _nil = { 
  if (side _x isEqualTo side _unit) then { 
   _west pushBack _x; 
  }; 
  false 
 } count allUnits; 
 false 
} count allUnits;
Result:
19860 ms

Cycles:
1/10000

Code:
private _west = []; 
{ 
 private _unit = _x; 
 if (side _unit isEqualTo west) then { 
  _west pushBack _unit; 
 }; 
{ 
  if (side _x isEqualTo side _unit) then { 
   _west pushBack _x; 
  }; 
  false 
 } count allUnits; 
 false 
} count allUnits;
earnest ore
#
_curUnit = getAssignedCuratorUnit zm1;
_result = ["#shutdown"] remoteExecCall ["serverCommandAvailable", owner _curUnit, false];

The above is remote executed through the debug console, this is giving me an empty string. Am I missing something?

little eagle
#

That is what remoteExec reports if you have JIP flag disabled (false).

#

serverCommandAvailable is a getter and you can't use them like this to get values from other machines.

earnest ore
#

Hmm.

peak plover
#

Why owner _curUnit

#

Just do 2

still forum
#

@peak plover If you are over 10-20ms you are already getting precision error by alot

#

as you can see "cycles 1"

#

That measurement is useless with just one cycle

peak plover
#

hmmm

earnest ore
#

@peak plover Need to know if a client is admin, 2 is server so that's moot.

peak plover
#

So you are a remote client and you wanna know if the curator has serverCommandAvailable?

#

Jus set a public variable on the curator when he starts it

earnest ore
#

A serverside script wants to know if a curator is logged in as admin, basically.

peak plover
#

jus do that an avoid the trouble

earnest ore
#

Mm, good idea. Thanks.

little eagle
earnest ore
#

... Right. The more you know!

little eagle
#

It's a brand new command, but it's exactly what you need as far as I can tell.

#

Well, 1.70, but pretty sure it was broken for a long time.

earnest ore
#

Works like a charm, thanks.

stable wave
#

Can anyone explain why for "_i" from 5 to 93 step 7 do {hint str _i}; would hint 96 instead of 89?

still forum
#

Because Arma.

#

I can check and explain.. But do you really wanna know why something in the backend is going wrong?

stable wave
#

lol. If it is the backend's fault, I think I'll have to forgive it.

tough abyss
#

Pretty sure its just a different type of loop it checks the condition at end of loop instead of start i.e repeat vs while loops

stable wave
#

The tutorial is out of date. The bug is now corrected. Just tested it in game.

little eagle
#

Couldn't you think of an easier repro. This math is hurting my brain.

stable wave
#

lol

quartz coyote
#

Hello,
for some reason, my _LEADERNAME var is displaying the name of the killer for 1 second and then switching back to the real leader of the scoreboard. Can anyone help ?

private _Array = (if (isMultiplayer) then {playableUnits} else {switchableUnits}) apply {[getPlayerScores _x param [5, 0], _x]};
    _Array sort false;
    _LeaderName = name (_Array select 0 select 1);
    LeaderScore = _Array select 0 select 0;
    publicVariable "LeaderScore";
    if (LeaderScore == 0) then
    {}
    else
    {
    ((UiNamespace GetVariable "dm_hud") DisplayCtrl 15001) CtrlSetText (Format ["Leader : %1 (%2 kills)",_LeaderName,LeaderScore]);
    };```
#

It is like the the first column of the array gets changed when someone kills someone else

still forum
#

squint wat

candid jay
#

All, how can I get the relative position of an object in relation to another? I'm currently using

(_x modelToWorldVisual [0,0,0]) vectorDiff (_obj modelToWorldVisual [0,0,0]);

But this works only if the model has a 0 heading (so it naturally heads north). If it's 90 deg rotated in OB, then it does not work.

still forum
#

wut

#

position should still be the same

#

no matter where it faces

#

maybe just use getPos?

#

vectorDiff is the correct way. But then using modelToWorld _relPos probably creates the "wrong" result

tough abyss
#

whats the craziest script you have ever runned?

#

Ive done, Bullets turning into cars, and removing only the clothes from the opposing force, they still had vests and backpacks tho :p

#

and guns

#

it didnt make the AI any less bad

candid jay
#

yes dedmen, it basically rotates the results 90 deg

#

let me try getpos then

#

nope, still rotated

still forum
#

How do you turn rel pos back into world pos?

#

using modelToWorld?

quartz coyote
#

@still forum it is not giving me the position. But the name...

candid jay
#
    private _pos = ATLToASL(_obj modelToWorld _relPos);
    private _sign = "Sign_Sphere10cm_F" createVehicle _pos;
quartz coyote
#

I ment the position in the Array

still forum
#

modelToWorld _relPos is you problem @candid jay
Not getting the rel pos but turning the rel pos into world pos

#

why do you use modelToWorld anyway?

candid jay
#

I'm just trying to make it work

#

I can't seem to get coordinates of spheres in relation to an object

still forum
#

just use getPos obj + relPos

candid jay
#

?

still forum
#

A-B=C
So B+C=A

lone glade
#

shhhh, modelToWorldWorldRealWorld

still forum
#

@quartz coyote I hate your coding style. It's a confusing mess of code.
Why do you even PVAR that variable?
And I have no Idea why it would swap randomly

lone glade
#

it's being PVAR'd somwhere else / not using private

candid jay
#

ok

still forum
#

Btw @quartz coyote your isMultiplayer doesn't even make sense. because getPlayerScores doesn't even work in non MP

little oxide
#

@candid jay Use getdir and getpos can do what you want too

still forum
#

@lone glade No. The PVAR'd variable is not the issue and private also isn't

#

@little oxide No getDir won't work because that is 2D only.

quartz coyote
#

@still forum well it is giving me correct values so dunno what your talking about

still forum
#

Wut

#

I never said it gives incorrect values.. Well you said that.. When you posted your code here asking why it would display incorrect values for a second...

#

So.. If it is giving you correct values then the problem already solved itself I guess

#

so @candid jay
_relpos = getPos A vectorDiff getPos B;
_worldPos = getPos B vectorAdd _relPos;

candid jay
#

yes that's what I'm doing now, unfortunately height are off now. will dig.

still forum
#

use getPosASL instead of getPos

quartz coyote
#

Right... I guess you're not taking any pleasure in helping me and that's fine with me. Have a nice day.
If anyone has some time to help me out you're more than welcome.

still forum
#

You asked why your code is sometimes giving incorrect values. I asked question about your code. You said your code is always giving your correct values and refused to answer my questions.
I dunno how I should help you if you apparently don't even want help.
And if your issue was getting incorrect values. And you say you are getting correct values now I'd assume you solved it yourself.

quartz coyote
#

I thought I was clear but may wasn't sorry :
My script is working, it is displaying the name and score of the leader of the scoreboard.
My only problem is that it is displaying the name of the killer when someone kills someone else. Then switched back to the scoreboard leader again after 1 sec

still forum
#

Yeah that was clear.
Does the "x kills" also display a wrong value?
Also your "x kills" is incorrect. You display the total score and not the number of kills

#

did you try to diag_log the whole array and see what it actually contains at the time the error is happening?

quartz coyote
#

No but thanks for telling me. I'll do that first before anything else

#

And I'm taking total score because it's infantry only so I don't care about anything else. 1 infantry kill = 1 point

stable wave
#

Why won't hint image "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\transport_ca.paa"; work? The image didn't show up.

quartz coyote
#

@still forum
17:16:02 [[1,B Alpha 1-1:1 ([UNA] Flash-Ranger)],[0,B Alpha 1-3:1],[0,B Alpha 1-4:1],[0,B Alpha 1-5:1],[0,B Alpha 1-2:1],[0,B Alpha 1-6:1],[0,B Alpha 2-1:1],[0,B Alpha 2-2:1],[0,B Alpha 2-3:1],[0,B Alpha 2-4:1],[0,B Alpha 2-5:1],[0,B Alpha 2-6:1],[0,B Alpha 3-1:1],[0,B Alpha 3-2:1],[0,B Alpha 3-3:1],[0,B Alpha 3-4:1],[0,B Alpha 3-5:1],[0,B Alpha 3-6:1],[0,B Alpha 4-1:1],[0,B Alpha 4-2:1]]

still forum
#

Looks correct to me? You did a kill and now have one point and are the first in the array

quartz coyote
#

yes that is correct indeed. my problem is that when i'm not alone in the game, if a friend kills me, then his name is displayed for a second after his kill even though I'm leader of the scoreboard. As if, when you kill someone, the array shift's with the last killer for 1s and then goes back to normal

orchid saffron
#

Does someone know if you can invert the attached Object on a rope? Instead deleting the rope and creating a new one😫

#

Let me explain it: When you create a rope between 2 objects (A to B). If you do: A (first object) attachTo player you can move the second object (B) but if you do the same changing the attach on B object you can´t move A because that´s how the ropes work. So i searched on the biki and tried lot of things but i don´t know if you can change the order (A-B,B-A) by script instead deleting the rope and creating a new one.

still forum
#

I don't think there is another way

orchid saffron
#

Me too

still forum
#

But you can't move A?

#

How do helicopters sling-load then? A and B can both move there.

orchid saffron
#

No no

#

If i create a rope between A-B

#

I can attach A to myself and move B

#

But not in reverse order

still forum
#

Ah yeah.. No. That's how attachTo works. The object you attach completly looses their free will so to say

orchid saffron
#

Because i´m creating a hose system so i need to pickup both ends on a rope

still forum
#

So you won't get around un-attaching it

orchid saffron
#

I know but it´s not because of attachTo command, it´s because how the ropes work

still forum
#

What happens when you try to move the thing that you cannot move?

orchid saffron
#

Mmm

#

When i try moving A by attaching B on a (A to B) rope

#

A is static on the ground

#

And won´t move

still forum
#

What happens if you drag the rope away? Does it just disconnect/break ?

orchid saffron
#

mmm it increases its length

#

Until it break

#

Let me record a video showing it

#

It would be more clear

still forum
#

I can already see what happens

young current
#

physx objects may pull each other

#

but man is not a physX object

orchid saffron
#

Well yes

#

But in my case

#

It´s not that thing because you can do it on one side but you can´t in the other one

#

That´s what i´m doing

tough abyss
#

would this work ?? if !((side _x) isEqualTo (west or empty)) then

little eagle
#

No.

#
if (side group _x in [west, sideEmpty]) then {

This would though.

tough abyss
#

wait is in another word for equal?

still forum
#

no.

#

in means... in. If something is in a list

#

If it would mean equal then that would also not work because a side can't equal an array

little eagle
#

a isEqualTo b is essentially a weaker version of a in [b], where [...] has only one element.

tough abyss
#

if !(side group _x in [west, sideEmpty]) then so this would execute aslong as the unit wasnt west or empty?

little eagle
#

Yes.

tough abyss
#

thank you

#

well i tried it, and it didnt work, i mean im sure its right, just you might of needed the context

#
[] spawn {{
                if !((side _x) isEqualTo west) then {
                (getAssignedCuratorLogic player) removeCuratorEditableObjects [[_x],true];
                };
                } forEach (allUnits + vehicles);
};
#

that makes it so that zeus can only control units of the west side, The only issue is, It cant control empty units

little eagle
#

It would be easier to read and edit if you formatted it correctly.

tough abyss
#

sorry, im new to this. Is there a guide?

subtle ore
#

Well to begin with, don't tab it to death

lone glade
#

don't use tabs

#

4 spaces = life

little eagle
#
[] spawn {
    {
        if !(side _x isEqualTo west) then {
            (getAssignedCuratorLogic player) removeCuratorEditableObjects [[_x], true];
        };
    } forEach (allUnits + vehicles);
};
subtle ore
#

@lone glade or 4 spaces into a tab

little eagle
#

What's the spawn for?

tough abyss
#

Its tied to a description.ext

#
class Extended_Init_EventHandlers {
class Man {
init = "_this call (compile preprocessFileLineNumbers 'classes\unitInit.sqf')";
};
};
little eagle
#

Uhm, a script doesn't belong in a config?

#

Oh.

#

hmm

#

What's it supposed to do?

subtle ore
#

Are CBA EH's supposed to be in the description.ext?

tough abyss
#

When alive places units, It will take away the zeuses ability to edit them

little eagle
#

They can be, Midnight.

subtle ore
#

Hmmm, neat.

little eagle
#

config.cpp or description.ext

subtle ore
#

Okay, makes sense.

quartz coyote
#
player addEventHandler ["killed",
{
    _unit = _this select 0;
    _killer = _this select 1;
    _unit addScore -1;
    _killer addScore 2;
}];```
Can someone see something badly written ? Am I missing something ?
little eagle
#

I'd do
params ["_unit", "_killer"];
instead of the _this select N lines

tough abyss
#

so commy, how would i go about adding an (or 'empty')?

little eagle
#

I'm still parsing "When alive places units, It will take away the zeuses ability to edit them"

#

Who's alive? ALiVE mod?

tough abyss
#

yup

lone glade
#

and what does it take away?

#

the units weren't there in the first place

tough abyss
#

When alive or an arma 3 module places units, the zeus can automatically fuck with them

little eagle
#

Alive spawned units should not be editable by zeus. Is what I'm getting.

tough abyss
#

well, Honestily i wish that were the case.

little eagle
#

Yea, it was prescriptive "should", not descriptive "should".

#

The difficulty is figuring out which objects are ALiVE spawned.

#

I don't know how that goes.

tough abyss
#

Well cant we just detect if its either west or empty?

#

it already works with west units

lone glade
#

alive probably has units arrays, it has to.

little eagle
#

I don't know what being west or sideEmpty has to do with ALiVE.

tough abyss
#

accross the board, it disables the curator from being able to edit anything that isnt west

little eagle
#

One problem with removeCuratorEditableObjects is, that it's hard coded to only work when executed on the server. Because reasons.

tough abyss
#

the code already works, for all units except west, i just wanna add all units except west & empty.

little eagle
#

I always thought no objects were curator editable, except when placed as curator. And you had to make them editable first.

lone glade
#

that's the case

#

same thing for 3DEN

little eagle
#

Then why would east units for example suddenly be editable when they are spawned with ALiVE?

lone glade
#

go figure

tough abyss
#

......

little eagle
#

Trying °_°'

tough abyss
#

okay, well what if that was the case?

#

what if, for some reason, Everything on the map was editable by zeus

#

and now we just wanna limit him to west and empty

little eagle
#

Then there is probably a script in the mission responsible for this. And that script would have to be edited.

subtle ore
#

hey Alganthe, is that arsenal of yours final product in terms of visual representation? It feels almost too spread out

tough abyss
#
[] spawn {
    {
        if !(side _x isEqualTo west) then {
            (getAssignedCuratorLogic player) removeCuratorEditableObjects [[_x], true];
        };
    } forEach (allUnits + vehicles);
};
``` this code works, Why doesnt a standard &&  work in the if statement?
#

sorry not &&, and or

#

an&

#

an*

little eagle
#

You lost me.

still forum
#

you can edit your last message by pressing Up arrow button

tough abyss
#

thanks

little eagle
#
if !(side _x in [west, sideEmpty]) then {

???

#

I think we were here before.

still forum
#

yup

little eagle
#

Maybe sideEmpty isn't actually what bling0 needs.

#

I don't know what objects are sideEmpty.

tough abyss
#

empty cars?

#

buildings

little eagle
#

Aren't those civilian side?

tough abyss
#

arent those purple instead of yellow?

little eagle
#

You lost me again.

#

"purple"? What?

tough abyss
#

like in the zeus, lol

#

zeus has em all catagorized

little eagle
#

side cursorTarget
will know the answer.

tough abyss
#

ill try it

little eagle
#

sideEmpty does not mean the side of empty stuff. It's essentially sideNull.

quartz coyote
#

I'm having trouble with this... I put it in initplayerLocal am I right ?

player addEventHandler ["killed",
{
    params ["_unit", "_killer"];
    [_unit,-1] call BIS_fnc_addScore;
    [_killer,2] call BIS_fnc_addScore;
}];```
#

is an addscore of -1 allowed ?

tough abyss
#

what is the side of empty stuff then?

little eagle
#

civilian ?

little oxide
#

@quartz coyote addscore command only work server side

#

that's why not working

quartz coyote
#

@little oxide but if I put it in InitServer it tells me "Player" in unrecognised !

little oxide
#

use addScore command instead bis_fnc_addscore

#

you need to keep your eventhandler client side, but use remoteexec to remote addscore in serverside

lone glade
#

nah, objects are side empty, dead stuff is civ

quartz coyote
#

@little oxide ok i'll test it

little eagle
#

side cursorObject
will tell. No point in arguing about it.

quartz coyote
#

but ... is a remoteexec of a priv var permitted ??

little oxide
#

Like : [_unit,-1] remoteExecCall ["addScore", 2]; inside your evh

#

don't forget to whitelist the command if you using cfgremoteexec

still forum
#

You don't pass variable names as arguments. You pass the values. That has nothing to do with the variable being private

quartz coyote
#

okay.
Why @little oxide in your command you put _unit, -1 ?

still forum
#

That are the arguments to addScope

#

_unit is the left argument and -1 is the right one

little oxide
#

because you made that inside your script 🤔

still forum
#

_unit addScore -1

quartz coyote
#

oh ... and what is 2 at the end then ???

little eagle
#

The 2 stands for "the wiki explains this all".

still forum
#

2 means server

#

Read that

quartz coyote
#

thanks @still forum

#

isn't that going to be fucking laggy if I have 20 players in the game ???

still forum
#

no

little oxide
#

Wiki is you friend, and when creating stuff in MP don't forget to look at Additional Information stuff, to see if it's need to run in server side only

quartz coyote
#

Ok

tough abyss
#
[] spawn {
    {
        if !((side _x isEqualTo west) or (side _x isEqualTo civilian)) then {
            (getAssignedCuratorLogic player) removeCuratorEditableObjects [[_x], true];
        };
    } forEach (allUnits + vehicles);
};
#

This works, But now the zeus can controll civillians

#

is there a way i can limit it to civilians that arent a man?

subtle ore
#

Global versus Local Effects @quartz coyote

still forum
#

_x isKindOf "Man" @tough abyss

tough abyss
#

so like this? ```
[] spawn {
{
if !((side _x isEqualTo west) or ((side _x isEqualTo civilian) && !(_x isKindOf "Man")) then {
(getAssignedCuratorLogic player) removeCuratorEditableObjects [[_x], true];
};
} forEach (allUnits + vehicles);
};

quartz coyote
#

@little oxide Am I right ?

class CfgRemoteExec
{
       // List of script commands allowed to be sent from client via remoteExec
       class Commands
       {
              class RemoveScoreCommand { [_unit,-1] remoteExecCall ["addScore", 2]; }
              class AddScoreCommand { [_killer,2] remoteExecCall ["addScore", 2]; }
    };
};```
still forum
#

I guess that might work.. try it out

#

@quartz coyote not even close

quartz coyote
#

but I followed the Wiki for once .............

still forum
#

Huh?

#

No you didn't

quartz coyote
#

......... Yes, thats what I'm readig

#

What did I do wrong for fuck sake !

still forum
#

Where does that paste a raw script into the class?

#

class YourCommand1 { allowedTargets=0; jip=0; }

#

You are trying to execute addScore.
So
class addScore { allowedTargets=0; jip=0; }

quartz coyote
#

HUUUUUUUUU ok... well I hadn't understood it like that

still forum
#

But you only need CfgRemoteExec if you enabled that you need it. If you didn't enable it then you don't even have to care about it

quartz coyote
#

ah well I havn't added a line anyware saying "I want remoteexec to work" if thats what youre talking about

still forum
#

It works by default

quartz coyote
#

ok -_-

#

thanks

#

ok so I have no error so thats a good sign but when I kill an AI, my score is still 1 and not 2

still forum
#

where do you test? local hosted MP?

quartz coyote
#

yes

still forum
#

In local hosted MP you are the server anyway

inland drift
#

trying to activate a trigger to end a mission when 3 out of 4 synced vehicles are destroyed, i currently have

this && {!alive "rhsgref_cdf_b_gaz66o_flat"} count thisList > 2

for condition but it obviously doesn't work and I'm not sure if I'm on the right track at all even

copper raven
#
this && {!alive _x && (typeOf _x)=="rhsgref_cdf_b_gaz66o_flat"} count thisList > 2
inland drift
#

thanks I'll give that a try

tough abyss
#

does anyone know about setting costs for zeus modules?

#

Im trying to jack up the prices for spawning in ordances and the lightning bolt, But i cant seem to do it with the vanilla modules

plush cargo
#

under costs you can see an event handler that fires when the logic object is registered (zeus ui is activated) you can set individual costs there

#

if you need to do a lot of objects i would suggest getting into the cost tables seen on the same page

plucky willow
#

I'm trying to do a vehicle auto-repair, but I want to delay this if the vehicle is damaged

#

would something like this work?

#
_counter = 6;

_this addEventHandler ["Dammaged", {_counter = 120}];

while{alive _this} do {
    if((getDammage _this)>0) then {
        _this setDamage (damage _this - 0.1);
    };
    sleep _counter;
    _counter = 6;
};
#

it doesnt work

eager root
#
_repairTime = time;
_this addEventHandler ["Dammaged", {_repairTime = time + 120}];

while {alive _this} do
{
    waitUntil {_repairTime <= time && damage _this > 0};
    _this setDamage (damage _this - 0.1);

    _repairTime = time + 6;
};

Somethings like that ? (I don't test it)

still forum
#

....

#

You set a local variable in a completly different script in a completly different place.
And expect it to magically change somewhere else? Ofcause that's not gonna work

eager root
#

Oopps yeah didn’t think about that 😶

still forum
#

You have a vehicle to store variables on. Just setVariable onto the vehicle.

plucky willow
#
_this setVariable ["counter", 6];

_this addEventHandler ["Dammaged", {_this setVariable ["counter", 120];}];

while{alive _this} do {
    if((getDammage _this)>0) then {
        _this setDamage (damage _this - 0.1);
    };
    sleep (_this getVariable "counter");
    _this setVariable ["counter", 6];
};
#

like that?

still forum
#

yeah

tough abyss
#
{_x addEventHandler [
    "CuratorGroupPlaced",
    {
    addSwitchableUnit (leader (_this select 1));
    }
];
} forEach allCurators;
``` This right here makes it so when you place a group, you are able to switch to the team leader, Well how would i go about adding an eventhandler where if the leader dies, it will go to the second guy in command
#

I would just stick on another eventhandler, But it gets confusing and messy, and i dont have a good understanding of params, so adding abunch of _this select 1 everywhere would be a terrible way of accomplishing that goal

rotund cypress
#

Anyone here knows what lnbValue will return if no value is set?

lone glade
#

afaik -1

rotund cypress
#

Would be optimal, but have a feeling it would only return 0

little eagle
#

inb4 it's nil

rotund cypress
#

^

#

BI

#

¯_(ツ)_/¯

little eagle
#

I just made a pr with 5 spawn.

rotund cypress
#

Is that not how it usually goes?

#

Pretty rare for Commy yes?

little eagle
#

Nah, that's like all the spawn I've used this year in one pr.

rotund cypress
#

Ye exactly 😄

tough abyss
#

i figured it out

#

Damn, i didnt think it would work, but i bet you could tell im new to scripting

#
    (leader (_this select 1)) addEventHandler ["Killed",{addSwitchableUnit ((units group (_this select 0)) select 1)}]; 
#

id hate for anyone to have to read my work on a completed project

potent depot
#

to clarify the script returns values in "eastGrps" when inputted into debug console. but when run as a separate script it returns "[]" when prompted through console

little eagle
#

I don't know why, but I know that the error is somewhere else.

potent depot
#

could it be caused if (group e_all) returns an error because there isnt a unit spawned?

#

as far as i'm aware the code shouldnt stop due to errors unless its critical. the code pasted was the start to the script. it should work before snything else stops the script but I have no idea at this point.

peak plover
#

Is that for a marker system?

potent depot
#

yep

peak plover
#

How about

#

You just setvariable for the group

#

and get all groups instead

#

More dynamic

potent depot
#

i assume you mean groupID?

peak plover
#

no

#

I jsut mean

#

not write out all eastgroups

#

but base allgroups on allgroups select {!isNil {_x getvariable ["nig_eastmark",nil]};

#

that way you won't get issues if a group does not exist

potent depot
#

how do you set a base variable fot he groups then?

peak plover
#

_group setVariable ["nig_eastMark","hq",true];

tough abyss
#

Hey so I have an event handler, where if you place a group as zeus, it makes the leader a playable unit. Whats the best way of making it so that when that leader dies, the guy second in command becomes playable, and so on?

#

Sorry if i interupted you tmzulu

potent depot
#

@peak plover do you do this via a separate script or within an init in the group

tough abyss
#

anyway, on my attempt, i managed to crash my arma 3 for the first time. lol loops are scary

peak plover
#

Whatever suits you best

#

I'd use a separate script

#

initPost

#

Local to player 😐

potent depot
#

@tough abyss you might be able the make that work with (leader "group variable")

tough abyss
#
 (leader (_this select 1)) addEventHandler ["Killed",{addSwitchableUnit ((units group (_this select 0)) select 1)}]; 
#

That worked But like, if the second guy died, then

#

it wouldnt carry over

potent depot
#

might need to make it redetect the leader

tough abyss
#

yup

potent depot
#

anyways @peak plover i can place the variable within the init of the group (it should make it a bit easier to reuse the scripts from mission to mission) and then be able to use getVariable in a forEach allGroups loop correct?

peak plover
#

init of thr grroupo?

#

In editor?

potent depot
#

yes

peak plover
#

That's confusing and requires to open it to see it

#

If you have 50 units

#

You ahve to open it 50 times

#

easier to write a function

potent depot
#

got an example somewhere?

peak plover
#

read this once

#

never used editor again

potent depot
#

how do you distinguish which group is which?

peak plover
#

set a variable name in the editor LOL 😄

#

I just name all units and groups and that's just about it

potent depot
#

oh i understand what you mean now

peak plover
#

The names are like b_0_1 b_0

#

somtin' simple

#

If you only have 5 units it's ok to use init box in editor, but in your case I assume ~50

potent depot
#

how does setvariable play into that?

peak plover
#

mAke a function with initPost

#

in there

potent depot
#

so an inline function correct?

peak plover
#
if (group player isEqualTo blu_0) exitWith {
    if (isNil {(group player) getvariable ["nig_eastMark",nil]}) then {
        (group player) setVariable ["nig_eastMark","HQ",true];
    };
};
```sqf
#

inline function

#

Im unfamiliar with this term

#
class PLUGIN {
    class init {
        file = QPLUGIN_PATHFILES;
        class postInit {postInit = 1;};
    };
    class dialogs {
        file = QPLUGIN_PATHFILE(dialogs);
        class keyDown {};
        class keyLoop {};
        class roster {};
        class rosterOn {};
        class rosterUpdate {};
    };
};
peak plover
#

similar to that

#

in functions library

#

I don't use "inline functions"

#

This one

#

organized and easy

potent depot
#

should theoretically be able to do the same as what your describing

#

im assuming you are ussing [] call "my function" to initiate and feed variables

peak plover
#

https://community.bistudio.com/wiki/Functions_Library_(Arma_3)#Adding_a_Function

Main benefits:

    Automatic compilation upon mission start into a global variable - no need to remember direct paths to files.
    Anti-hack protection using compileFinal (see Recompiling for more info)
    Listing in the Functions Viewer
    Advanced debugging options
    Optional immediate execution upon mission start, without need for manual call
    Potential performance improvements
#

no

#

For this situation I would use postInit

#

Only availaibele if u use the library

#

postInit automatically execute the function after objects/players/vehicles are initialzied

tough abyss
#

lol i crashed my arma 3 again

#
    fnc_findNewLeader = {
    _dead = _this select 0;
    _nldr = (units group _dead) select 1;
    addSwitchableUnit _nldr;
    _nldr addEventHandler ["Killed",{
    call fnc_findNewLeader;    
    }]; 
    };
#

So if you kill the last unit, It goes bezerk!

little eagle
#

You added a killed eventhandler that adds itself while iterating through the killed event handlers.

lone glade
#

aka
a = {call a}

little eagle
#
_a = {call _a}; call _a
#

dammit

lone glade
#

my favorite way of kicking someone

little eagle
#

You essentially appended an array with another element every time you handle one element.

tough abyss
#

do you guys know of a better way to make it so that when the leader dies, his second in command becomes playable?

little eagle
#

I don't think there is a way to tell which one is the second in command, is there?

tough abyss
#

units group select 1

#

my thing worked

#

untill it got down to the last unit

#

once you killed him

lone glade
#

add a check to avoid that?

tough abyss
#

would it be != nil or != null?

little eagle
#
addMissionEventHandler ["EntityKilled", {
    params ["_dead"];

    if (_dead in switchableUnits) then {
        addSwitchableUnit (units _dead param [1, objNull]);
    };
}];
tough abyss
#

so

#

where would that go? do i trash my original function?

little eagle
#

init.sqf

#

But I really don't like that units select 1 assumption.

tough abyss
#

Thanks

#

i probably will have to include you in the credits, i still have a lot of work to do on my mission, but i imagine you will still be around on discord.

#

Its a zeus rts, like a real RTS. Alive spawns all the enemies, and you cant edit them or do anything with them.

#

You have resources that allow you to spawn in units, eventually ima make it where you have to complete missions to get zeus points

#

anyway, remote control doesnt allow you to actually order the units around and stuff, So instead ive just made every placed group turn into a playable unit. You just go into your map and wala you get to control the group

kindred bane
still forum
#

That is not a custom dialog

#

that's just a custom background texture

#

You overwrite the config class of that UI with a mod

jade abyss
#

Just look how they did it and do it like the other life-mods, ale x ¯_(ツ)_/¯

meager heart
still forum
#

You really think lifer scum doesn't obfuscate their pbo's @jade abyss

jade abyss
#

¯_(ツ)_/¯

kindred bane
#

@jade abyss i dont even know which mod thats in lmao, allso i can make gui just dont know how i can edit that / can it be edited or only with picture like u said @still forum

#

any idea what the config class is named

still forum
#

You can edit everything theoretically.

#

It's probably something with "lobby" or "role"

kindred bane
#

thanks 😛

#

i found it its obfuscated though so the file names are all messed up

still forum
#

@jade abyss See!

jade abyss
#

¯_(ツ)_/¯

#

Thats life

kindred bane
still forum
#

If you use a horrible unpacker yes.
But I don't know any unpacker. Most just say "Dis pbo broke, cannot extract" and the others properly demangle the filenames so you can extract it

kindred bane
#

bankrev?

#

it demangles the names

still forum
#

I think that also denies to unpack obfuscated stuff

#

Atleast BI added that when Mikero said his obfuscation breaks the FS

kindred bane
#

you acn easily bypass that though ;P i guess imma try to find the config somewhere else then

nocturne iron
#

@tough abyss use a killed EH that uses _newleader = leader group _this select 1;

#

Or whatever the specific output array element that killed returns for the attached unit

kindred bane
#

@still forum any idea where i can find a list of classes? :/

still forum
#

Ingame config viewer. AIO config from BIF.

nocturne iron
#

If you're really serious, unpack all the pbos and grep your way through the configs

still forum
#

And if you are intelligent you just take a ready-made all in one config and use that.

nocturne iron
#

If you just need a list use the ingame

#

^

kindred bane
#

thanks, what you mean Dedman? The one i tried was obfuscated ;3

jade abyss
#

Or: Ditch life and do something more honorable =}

still forum
#

Arma all in one config. I won't help you how to google.

kindred bane
#

I found it.... But what you mean take a already made class?

still forum
#

I never said that

kindred bane
#

oh nvm ill try to look

nocturne iron
#

@jade abyss keep fighting the good fight

still forum
#

Kill all Lifers! Boycott them all!

nocturne iron
#

or make them follow the TOS

jade abyss
#

Common, be realistic

still forum
#

Ah yeah.. That would be a alternative.. But that's harder

kindred bane
#

what u mean

#

is it against tos to make lobby selection xd?

still forum
#

No ^^ But other stuff is

nocturne iron
#

because you know that one mod you made back in A2 has been badly ported, stolen and put on a life server

jade abyss
#

It's against LIFE-mods at all

nocturne iron
#

is it?

jade abyss
#

I like trains 🚆

still forum
#

TOS §3.1 Life mods == forbidden

jade abyss
#

^^

nocturne iron
#

Thought it was just written in a very unfavourable way

jade abyss
#

(Just to make sure: It was a joke)

nocturne iron
#

Went way over my head

meager heart
#
I like trains
(Just to make sure: It was a joke)
jade abyss
#

Yeah, i hate trains

meager heart
#

😄

jade abyss
#

(The sad thing is: You HAVE to mention that sometimes^^. Some ppl will take everything for "Uh, he said that, that's true")

kindred bane
#

xd

still forum
#

local variables are faster than script command calls :u

jade abyss
#

😂

#

quaksliver

tulip cloud
#

The argo dlc isn't usuable by vanilla. correct?

still forum
#

What you just said doesn't make sense

#

The argo dlc is part of vanilla

tulip cloud
#

I didnt knwo that. I completely ignored that release appearantly. I just noticed the folder in there the other day.

#

thanks

lone glade
#

argo is the codename for malden

jade abyss
#

Abel was the "Codename" for Malden

#

Abel -> Malden
Eden -> Everon
Cain -> Kolgujev
Together: AEC Islands \o/

meager heart
#

Victor Troska approved

lone glade
#

I meant in Arma 3

jade abyss
#

Still no

lone glade
#

O RLY?

class A3_Data_F_Argo
    {
        author="$STR_A3_Bohemia_Interactive";
        name="Arma 3 Malden - Main Configuration";
        url="https://www.arma3.com";
jade abyss
#

Malden = Used *with Argo

nocturne iron
#

functions are a morickyian conspiracy everyone should use execVM

rotund cypress
#

Hey guys, so I've heard that time gets inaccurate after a bit of the mission. Why is this?

nocturne iron
#

inconsistencies in simulation fps

#

depends if it's MP environment too

rotund cypress
#

What difference does MP do?

nocturne iron
#

time on the server is usually slower than clients because it's running the simulation, thus it's sim fps is slow whereas client fps is steady

#

time uses the local value of time

#

serverTime uses the server's time

rotund cypress
#

serverTime works on client as well?

nocturne iron
#

it should

#

I'd avoid using anything that does time checks etc though

rotund cypress
#

And serverTime is usually preferred in front of time then? I.e. more accurate?

#

Well sometimes you have to use things that are time based

nocturne iron
#

okay server time doesn't work in sp

#

Hm, can't use a sleep?

rotund cypress
#

Ew

#

That can also be unreliable when you need accurate things

nocturne iron
#

hm

#

if I may ask, what are you using it for?

rotund cypress
#

10000 things

#

not literally but roughly

nocturne iron
#

hm

#

the problem is inherent to how arma handles number, ie floating point errors

rotund cypress
#

Id avoid having 100000 threads with a lot of sleeps

nocturne iron
#

Yeah

rotund cypress
#

Less threads is better IMO

nocturne iron
#

ofc

#

how precise do you need it to be?

rotund cypress
#

I mean it doesnt have to be very very precise really, I will use it regardless cause its the most accurate ill ever get something in arma (unless using callExtension, but that means another command to give each time)

#

I was more curious

#

Does ArmA not have doubles btw?

#

I never researched that topic.

nocturne iron
#

1ms is about the best you can do in RV4

rotund cypress
#

For callextension?

nocturne iron
#

Not sure

#

I rarely use callextension

rotund cypress
#

Ye I rarely use it as well, but last time i tested the performance i could recall something along the lines of 1 - 4 ms

nocturne iron
#

Ohh

#

1ms is a hardcoded limit because it's the tick time

rotund cypress
#

I think when I tried it though it ran like 10000 times or something so

nocturne iron
#

Yeah that's the debug console's limit right?

rotund cypress
#

No idea. I don't use the default debug console. I have my own.

nocturne iron
#

ah fairo

stable wave
#

What is the best way to set up a MP testing environment?

tough abyss
#

cant you just run your editor in mp?

#

like go to play, run as mp

stable wave
#

but I need at least 2 clients

subtle ore
#

loopback on dedicated server

#

run two local clients

#

connect to the server

stable wave
#

How do I run two local clients with one steam account?

subtle ore
#

Click play twice 😛

stable wave
#

lol. I didn't know I could do that.

subtle ore
#

yep

stable wave
#

What do you mean by loopback?

subtle ore
#

in your server.cfg for your dedicated server type: loopback=true;

#

Adding this option will force server into LAN mode. This will allow multiple local instances of the game to connect to the server for testing purposes. At the same time it will prevent all non-local instances from connecting.

stable wave
#

OK. Thanks fot the tips.

subtle ore
#

Yep

warm gorge
#

How much of a performance impact would constant setVariable broadcasting be to a server?

nocturne iron
#

is there a way you can make it event based?

#

if so, make it event based

tough abyss
#

hey

#

so im attaching my units to a parachute, funny thing is, if i attach a bulky vehicle to a parachute, when it lands it causes the vehicle to collide with the ground.....

#

anyone have any solutions?

warm gorge
#

What do you mean it collides with the ground

tough abyss
#

like, It explodes

#

But not instantly

#

only after it feels the ground, really really hard

warm gorge
#

If you've attached the parachute properly and everything, it shouldnt blow up. You could disable damage to the vehicle until it reaches the ground?

tough abyss
#

define properly .....

#
    fnc_parachute = {
        params ["_unit"];
            chute = "NonSteerable_Parachute_F" createVehicle [0,0,0]; 
            chute setPos [getPos _unit select 0, getPos _unit select 1, 100];
            chute forceSpeed 1;
            (vehicle _unit) attachTo [chute, [0,0,0]]; 
    };
jade abyss
#

attachTo disables collision

tough abyss
#

not with the ground

jade abyss
#

Wasn't there a bis_fnc to attach a vehicle to a Parachute? 🤔

#

it disables it

tough abyss
#

but yeah what if i switched it

#

naw that wouldnt work

#

idk

jade abyss
#

What wouldn't work?

tough abyss
#

instead of (vehicle _unit) attachTo [chute, [0,0,0]]; i changed it to

#

(chute) attachTo [vehicle _unit, [0,0,0]];

jade abyss
#

Hu?

tough abyss
#

you think that would work?

jade abyss
#

No

warm gorge
#

could do a waituntil istouchingground for the vehicle, and then just delete the parachute

jade abyss
warm gorge
#

lol

jade abyss
#

There are alot Scripts already around, just check some, take a look at them, get the idea

warm gorge
#

Does anyone know where I can find all the GUI classes/scripts for the eden editor? Curious to see how some of these elements are done

#

Nevermind, found it

tough abyss
#

hey, so how can i emulate sleep in a non schedule enviroment?

warm gorge
#

You cant. Why cant you just spawn it?

tough abyss
#

true

#

ima try that

tulip cloud
#

What is the standard practice for using something like iGUIBack or other dialog elements to add to the players HUD? I'm looking for a template or direction on how to add something outside of a hint in which a player can move around. I was planning to cutRsc

meager heart
#

@tulip cloud Something outside from the hint:

0 spawn 
{
    disableSerialization;
    private _ctrlW = 5.5;  
    private _ctrlH = 0.27;  
    private _posX = (safeZoneX + (safeZoneWAbs / 2)) - (_ctrlW / 2);  
    private _posY = (safeZoneY + safeZoneH) - _ctrlH;  
    private _ctrl = (findDisplay 46) ctrlCreate ["RscStructuredText",-1]; 
    private _s_ID = 1 + (floor (random 3));

    _ctrl ctrlSetFade 1;
    _ctrl ctrlCommit 0;

    _ctrl ctrlSetPosition [_posX + 5, _posY - 0.75,_ctrlW,_ctrlH]; 
    _ctrl ctrlCommit 0; 

    _ctrl ctrlSetStructuredText parseText ("<t size='6.25' align='center' shadow='1' font='PuristaBold'>THE COOL TEXT</t>"); 
    _ctrl ctrlSetBackgroundColor [0,0,0,0.45]; 
    _ctrl ctrlSetPosition [_posX,_posY - 0.75,_ctrlW,_ctrlH]; 

    playSound ("Transition" + str _s_ID);

    _ctrl ctrlSetFade 0;
    _ctrl ctrlCommit 1;

    uiSleep 6;
    
    _ctrl ctrlSetFade 1;
    _ctrl ctrlCommit 1;
    ctrlDelete _ctrl;
};
tulip cloud
#

That's pretty slick!

velvet merlin
#

seems A3 no longer supports [key]ToggleWeapons???

#

(became nextWeapon ..)

candid jay
#

I'm back to this simple question, because everything I tried yesterday didn't work. I want to get the relPos of an object in relation to another, regardless of object's original rotation

#
    private _relPos = (_x modelToWorldVisual [0,0,0]) vectorDiff (_obj modelToWorldVisual [0,0,0]);
    private _pos = ATLToASL(_obj modelToWorldVisual _relPos);
    private _sign = "Sign_Sphere10cm_F" createVehicle _pos;
#

this works BUT if the object doesn't have a 0 heading, everything is rotated accordingly.

#

Instead,

    private _relPos = (getPosASL  _x) vectorDiff (getPosASL  _obj);
    private _pos = (getPosASL  _obj) vectorAdd _relPos;
    private _sign = "Sign_Sphere10cm_F" createVehicle _pos;

This works, but only if the object keeps the exact same rotation.

candid jay
#

Ok, but can't get how to apply it in a way that works

jade abyss
#

object getRelPos [distance, direction]

#

As described in getRelPos

candid jay
#

Maybe I should be more clear: I basically want to put kinda memPoint in an object that doesn't have one

#

Ok, let me do another try at this

jade abyss
#

modelToWorld

candid jay
#

...which is my first example

jade abyss
#

and to get the MTW pos as world Coords:
worldToModel

candid jay
#
    private _relPos = (_x modelToWorldVisual [0,0,0]) vectorDiff (_obj modelToWorldVisual [0,0,0]);
    private _pos = _obj worldToModel _relPos;
    private _sign = "Sign_Sphere10cm_F" createVehicle _pos;
#

not working

jade abyss
#

vectorDiff?

#

Why?

candid jay
#

Because it dependes on object rotation

#

I want to compute memPoints that work for any rotation of the object

jade abyss
#
_PosAboveHead = player modelToWorld [0,0,2];
_WorldPos = player worldToModel _PosAbovehead;
 private _sign = "Sign_Sphere10cm_F" createVehicle _WorldPos ;```
candid jay
#

I have two objects

#

I don't have a rel pos

jade abyss
#

I think you mix alot of stuff together, while trying to explain

candid jay
#

ok, so here it goes hopefully it'd be clear

jade abyss
#

So again:
You want what?

#

As simple as possible

candid jay
#

I want to have a memPoint on a model, SO I can do exactly that: _model worldToModel _relPos

#

To compute that, I use an object

jade abyss
#

What do you try to achieve, what is your goal

#

Don't try to explain the steps you wanna take

candid jay
#

I want a memPoint!!!

jade abyss
#

modelToWorld

candid jay
#

I don't know how else to say that

jade abyss
#

And again: FOR WHAT

#

What are you trying to do

#

Simply just answer that question.

candid jay
#

this.

#

To make cables from a tower to another tower, I need the start and end point on the towers.

jade abyss
#

modelToWorld

candid jay
#

This works perfectly for THAT model, it doesn't work for the smaller model.

#

the only difference is that the smaller tower is rotated 90 deg

#

So, I don't understand why.

#

For the big model, I do:

private _relPos = (_obj modelToWorldVisual [0,0,0]) vectorDiff (_x modelToWorldVisual [0,0,0]);
ATLToASL(_obj modelToWorldVisual _relPos );
#

where _x are my various memPoints, computed ONCE per model.

jade abyss
#

Same as above:

_PosLeftOfObj = _Obj modelToWorld [0,1,0];
_WorldPos = _Obj worldToModel _PosLeftOfObj;
 private _sign = "Sign_Sphere10cm_F" createVehicle _WorldPos ;```
#

that places the _sign left of the objects orientation

candid jay
#

Ok, how do you compute [0,1,0] is my question

jade abyss
#

those are the pos. relative to it's orientation

candid jay
#

given that I have the main object, and _x which is a sphere that I set up for visual reference

jade abyss
#

as i said... no clue how often

#

Do yourself a favor and test that

candid jay
#

I only have _obj and _x, how can I test that

jade abyss
#

dojfsngdsnfgdfsgndfs

candid jay
#

ok will do this

#

😃

#

thanks

jade abyss
#

place *several objects in the editor with different angles and execute that script with an _Obj = cursorObject; added before

candid jay
#

I very well know what that does

jade abyss
#

dfngdfsbngibfdsg

candid jay
#

I understand that code, thank you dscha

jade abyss
#

aaaaahhhhhh

candid jay
#

ok forget it

jade abyss
#

aaaaahhhhhh

candid jay
#

once I get to it I can post it here

jade abyss
#

kk

#

P.S.:
aaaaahhhhhh

candid jay
#

lol

#

The misunderstanding here is that I want to compute [0,1,0] given two objects.

#

I know how to position them relative once I have that

jade abyss
#

No clue what you mean with I want to compute [0,1,0] given two objects.

candid jay
#

yep I got that

#

I have object A in [1,2,3] and B in [3,4,5], then relPos is [2,1,2] and that's why I use vectorDiff

#

with that, I can use what you are suggesting

jade abyss
#

😕

candid jay
#

my issue is how to compute [2,1,2] regardless of object rotation

meager heart
#

@candid jay ```sqf
private _pos = eyePos _x;
_pos = _pos vectorAdd (_pos vectorFromTo getPosWorld _obj);
private _sign = "Sign_Sphere10cm_F" createVehicle ASLToAGL _pos;

#

No ?

candid jay
#

trying

#

nope

meager heart
#

😕

candid jay
#

but thanks

meager heart
#

You rotating object A against object B ? And what you trying to get ?

candid jay
#

Ok here again 😃 I'm building an automated system to put of catenary cables between tower lines. To do that, I need to have memPoints for a tower, so I can have start/end points on each tower.
This of course means that if I rotated the tower, it should just work.

So how do I do it? I set reference spheres for my visual reference on the tower to compute (and then use) their relative position to the tower like so:

private _points = [];
{
    private _relPos = (_tower modelToWorldVisual [0,0,0]) vectorDiff (_x modelToWorldVisual [0,0,0]);
    _points pushBack _relPos;
} forEach _spheres;

Then, I loop all towers and get all cable segments by getting the relative position like so:

private _posStart = ATLToASL(_previousTower modelToWorldVisual _posRelStart);
private _posEnd   = ATLToASL(_tower modelToWorldVisual _posRelEnd);

This works perfectly with the big tower model: https://cldup.com/9X9FMVoK5i.jpg
Hills, rotations, all works.

#

So, I'm trying to do the same for the small tower, however that tower is 90 rotated, i.e. heading is not at 0 but at 90 deg

#

which means that all of the mempoints computed in the first piece of code are 90 deg rotated for some F%&$ reason, which means that somehow that code does not work for that object

meager heart
#

Check class name ? Then just setDir -90

candid jay
#

ok nvm I guess it's hard to explain here. thanks for the efforts anyways

jade abyss
#

The solution was mentioned before

#

vectorFromTo with the positions take from modelToWorld and WorldToModel

#

(you seem to insinst in the Vector stuff)

candid jay
#

that's how I build the segments

#

hu? no...

#

ok really, thank you this is going nowhere except having you going "aaaaaaah"

#

really, I appreciated the efforts

#

(seriously)

jade abyss
candid jay
#

ok, thank you

jade abyss
#

¯_(ツ)_/¯

candid jay
#

but I solved in the least possible way for me to be proud of anything

meager heart
#

What was the problem ?

candid jay
#

as I said the unfortunate problem is that the model has a 90 deg rotation

#

i.e. the "front" of the model is actually the "side"

#

so my code works but I first have to... rotate the object 90 deg when I compute the points, then rotate it back. As I said, not proud.

#

The alternative would be to have a point rotated of 90 deg around the center of the model

meager heart
#

Is it your model ?

candid jay
#

of course no 😄 I would have rotated it

#

it's the BI powerline

#

the smaller one

meager heart
#

k

candid jay
#

see pic

#

@jade abyss didn't mean to make you scream and bang your head at the wall. It was probably hard to explain / understand without giving full code / context.

#

I thought I did, but obviously something didn't work there.

jade abyss
#

You could have said:
"I want to place objects, in a line, between 2 points"

#

Just describe it as easy and short as possible, ppl don't know what you think/see/already have.

#

Anyway, as long as it works now 👍

candid jay
#

lesson learned: if too complex stay out of here, or write a thread on BI

#

which makes sense, this is a chat after all

#

...Really?

#

Oh well 😃

#

Merry christmas to you too.

tough abyss
#

What he’s trying to say is pose your question in a better way. There is nothing wrong with asking a question here...

candid jay
#

I didn't say that

jade abyss
#

lesson learned: if too complex stay out of here, or write a thread on BIuhm

candid jay
#

I have explained that I'm making a self-generating script of catenary cables between memPoints in towers, regardless of their rotation.

#

it's not "I want to place objects, in a line, between 2 points"

#

I needed to find relative position between two objects

#

there was an issue with one model

jade abyss
#

I can't remember seeing that with the catenary cables somewhere

candid jay
#

all of this = complex, too long to write in a chat

#

that's all I said

jade abyss
#

You showed a Pic of it, but thats it

#

¯_(ツ)_/¯

#

Then you said something about an object that was turned 90°

candid jay
#

ok... this saddens me but as you put it, whatever

#

thanks anyway, again

jade abyss
#

okay ¯_(ツ)_/¯

#

btw. aaaaaahhhhhh

candid jay
#

you should put that as your avatar, you seem to like that a lot 😃

jade abyss
#

¯_(ツ)_/¯

candid jay
#

(both of them)

#

lol

jade abyss
#

😉

meager heart
#

I will retreat in stealth mode 😶 💨

candid jay
#

is... is that a fart?

meager heart
#

damn

#

then... just retreat

#

😄

candid jay
#

eheh

meager heart
#

👍

peak plover
#

hmm

#

How do I get player head from the srever_

#

direction

meager heart
#

_head_dir = getDir (_unit selectionPosition "head"); ?

peak plover
#

ooh

#

thanks abe

#

bae

#

That should work

#

heheh my master plan might still work

still forum
#

That doesn't work

#

getDir takes Object, not Array.

peak plover
#

🤔

still forum
#

Man... Just got a question from someone with the battleye kick problem if a specific script could be causing issues...
I don't know which brainless idiot of a dev wrote that shit... He is reading variables using (call compile "varname")

lone glade
#

you must be shitting me

still forum
#

Nope. Also Search "call compile format" (135 hits in 74 files)

lone glade
#

Burn it down, the whole thing

still forum
#

Yeah. Already requested the dev that wrote that to be shot or burned to death

#

It's life btw. So.. to be expected. And apparently a rather big life server too

lone glade
#

my fucking god

#

no fucking wonder their devs are paid peanuts, they write diarrhea

peak plover
#

HAHA

warm gorge
#

Would constant setVariable broadcasting cause much of a performance impact on a server with 100+ players on?

peak plover
#

Why would yo do that?

warm gorge
#

Just working on ways to optimize a mission file. And not sure how careful you should be with setVariable. For example, for a vehicle's item inventory, updating a global variable on it constantly when a player edits the virtual inventory

peak plover
#

Virtual inventory?

#

Whaa

delicate lotus
#

Is it possible to spawn a guided missile, like one from a titan launcher, and set its target? If yes, explain how pls.

warm gorge
#

Virtual inventory like a boot, on a roleplay server

peak plover
#

Hmm

#

So I assume

#

You have ~50 items in the boot

#

YOu take 1 out

#

It updates the whole array or whatever

#

That's a lot of data for 100 players

warm gorge
#

Yes, then broadcasts the updated array with setVariable

#

Yeah thats what im thinking, couldnt imagine it being very performance friendly. Not really a way to workaround it that I can think of though

lone glade
#

..... life and performance don't go together

#

avoid broadcasting / don't have large arrays?

peak plover
#

You can make it better 'tho

#

like only send the data to the client that opens the inventory and the only send the new data to the server

#

Even better

#

Put all the life shit onto a HC

#

leaving server more performance

lone glade
#

even better, don't do life shit

peak plover
#

and then HC talk to DB

warm gorge
#

Not just gonna drop a popular life server because of some performance issues @lone glade lol

#

I always considered trying out using a headless client, but wasnt sure if it was worth it

lone glade
#

with 100 players 3 would be better

peak plover
#

It is, there's tons of scripts running for life and spreading the load is good,

winter dune
#

is it possible to have more than one HC?

lone glade
#

ofc...

winter dune
#

and they will balance the load, right?

lone glade
#

no

#

they're not magical entities, they don't magically take off the load

peak plover
#

Build the whole life into blocks that will run based on amount of HC and then have a value per block.
So more expensive scripts take more value, so all code is running faster in the end

delicate lotus
#

Is it possible to spawn a guided missile, like one from a titan launcher, and set its guided target? If yes, explain how pls.

peak plover
#

probably possible

lone glade
#

yes, with vector maths

peak plover
#

Everyone's favourite ;D

lone glade
#

honestly it's fairly easy

#

it's what, high school level maths?

peak plover
#

high school
you went?

lone glade
#

you didn't? 🙀

#

why the hell are the discord emojis so shit compared to our blob overlords

delicate lotus
#

Well I didnt want to do vector stuff

peak plover
#

😨

#

Umm

delicate lotus
#

I meant if its possible to like. missile = createVehicle missle;
setMissileTarget(missile, target);

#

but I think Im gonna do vector stuff then

delicate lotus
#

thx

tough abyss
#

whats a good way to detect if something has an inventory

#

apparently this ```
(_entity isKindOf "ReammoBox")

still forum
#

every vehicle has an inventory afaik

tough abyss
#

isnt detecting the ammoboxes

still forum
#

I guess you could check how much space the vehicles inventory has

#

if that's >0 it probably has a inventory

tough abyss
#

its funny because reammobox seemed to add any weapon or item, Except the ammoboxes

#
(_entity isKindOf "AllVehicles") || (_entity isKindOf "ReammoBox")
#

Lol thank you config!

still forum
#

what?

#

Weapons can't be ammo boxes.

tough abyss
#

You can see all the parent functions

still forum
#

CfgWeapons can't have inventories

tough abyss
#

sorry parent configs

#

yeah its weird

#

anyway this works

lone glade
#

no it isn't

tough abyss
#
((_entity isKindOf "AllVehicles") || (_entity isKindOf "ReammoBox") || (_entity isKindOf "ReammoBox_F"))
lone glade
#

🤦 use the proper syntax for isKindOf

still forum
#

and lazyEval

tough abyss
#

thanks,

#

whats lazyeval?

lone glade
#

(bool && {bool})

tough abyss
#

no idea what to do with that

halcyon crypt
#

world's most useless explanation what lazy evaluation is 😁

lone glade
#
((_entity isKindOf "AllVehicles") || (_entity isKindOf "ReammoBox") || (_entity isKindOf "ReammoBox_F"))

vs

(_entity isKindOf "AllVehicles" || {_entity isKindOf "ReammoBox"} || {_entity isKindOf "ReammoBox_F"})
halcyon crypt
#

you're supposed to start at the what and why and then go to the how 😛

lone glade
#

yeah, no, not in sqf

halcyon crypt
#

lol

lone glade
#

especially when you consider that arma doesn't actually use proper lazy eval

tough abyss
#
_entity isKindOf "AllVehicles"
``` is this one suppose to be in curly brackets aswell?
#

sorry, but like code is still very forigne to me. Like guis and cfg looks like chinese to me

#

or well might as well be

lone glade
#

first condition no brackets or round ones if needed, next ones in code brackets

winter dune
#

If I have an array like this one:

[["Allen Walker"],["xAndreei"]];

How can I turn into an output array like this:

["Allen Walker","xAndreei"];
lone glade
#

new array + append each index

winter dune
#

The script im using is this:

private _var =  [["Allen Walker"],["xAndreei"]];
private _array = str (_var);
private _array = toArray (_array);
private _sel = "";

for "_i" from 0 to (count _array)-1 do {
    _sel = _array select _i;
    if ((_i != 0 && _i != ((count _array)-1))) then {
        if (_sel isEqualTo 91 || _sel isEqualTo 93) then {
            _array set[_i,32];
        };
    };
};
lone glade
#

why the hell are you using str then toArray?

#

jesus, that's overly complicated

winter dune
#

don't know man lol

still forum
#

@winter dune
_newArray = _oldArray select {_x select 0};

lone glade
#

hell, you don't even need a new array

#

use apply

winter dune
#

ok, thanks, trying it

lone glade
#

there's a ton of good solutions to your problem, and you kinda chose one of the worst 😄

still forum
#

I can't think of a worse one

lone glade
#

me neither, but you never know

#

i'm sure if you dig a bit in MCC you'll find one

still forum
#

I guess turning the array of characters back to string and then using call compile to get the array out would make that one a little bit worse

stable wave
#

Is it possible to see the server side hint on one of the client in my MP testing environment?

still forum
#

You can't see something serverside only on clientside unless you are the server

#

And a hint on server doesn't make sense anyway

lone glade
#

no interface no hint

stable wave
#

Then how do you check the value of a server-side variable?

still forum
#

I would use the CBA debug console ^^

lone glade
#

you use logging

#

because that's what it's for

stable wave
#

but that's not efficiency

lone glade
#

who cares?

#

logging is for debugging purposes, you don't keep it enabled

still forum
#

You are talking about a hint anyway.. That's also a kind of logging

#

Not really that different

lone glade
#

and probably the worst kind

stable wave
#

I meant I would have to alt-tab in and out frequently

lone glade
#

wait what?

still forum
#

fullscreen windowed. Or just windowed. And as I already said. CBA debug console.

stable wave
#

OK. Will have a look at it. Thanks

#

I was hoping there was a built-in feature.

still forum
#

Well remoteExec and tell the server to remoteExec the variable back to you

#

Which is basically what the CBA debug console does in the background

winter dune
#
private _finalarray = [];
{
    _finalarray pushBack (_x select 0);
} forEach _array;

Same as the apply?

#

I couldn't make that work lol

#

maybe im retarded

still forum
#

That is about the same as my select thing

#

What code did you use for apply that didn't work?

lone glade
#

you can fit the select and apply solutions in one line

still forum
#

oops. My select one doesn't even work ^^ I expected it to work like apply does 😄

winter dune
#

yeh lol

#
private _array =  [["Allen Walker"],["xAndreei"]];

private _newArray = _array apply { _x select 0 };

hint format ["%1",_newArray];
#

this works for me

still forum
#

yeah

winter dune
#

and let's suppose that I have that _array as a parameter

#

how can I declare in the params field?

#
params [
    ["_array", [[]], [[[]]]]
];
still forum
#

declare what in the params field?

#

what do you mean by declare. What you have there already looks correct

winter dune
#

the script that do the things above with apply, have an input parameter to the function

#

and the input its an array passed from the db

still forum
#

Yeah.... and?

winter dune
#

when im doing the params stuff

#

what is the default type?

#

for an array like this --> [["Allen Walker"],["xAndreei"]];

still forum
#

Array I'd say...

#

Ohhh

winter dune
#

so no bidimensional array?

still forum
#

if you call it like
[["Allen Walker"],["xAndreei"]] call func it won't work

#

params will take the first entry in the array

#

You have to
[[["Allen Walker"],["xAndreei"]]] call func and then the params you posted above is already correct

winter dune
#

yeah, the array stuff was the variable, for calling im just assigning [["Allen Walker"],["xAndreei"]] to a variable and the place the variable into the remoteExec

#

so it's a normal array

tough abyss
#

Hey so i dont wanna use alive, does anyone know a good way to generator random occupants and patrols? and possibly random tasks?

still forum
#

im just assigning [["Allen Walker"],["xAndreei"]] to a variable and the place the variable into the remoteExec I don't see why that would make any difference

tough abyss
#

I know there are tons of stuff online, but it gets real hard to sift through what you want

winter dune
#

@still forum think that both of us understand the wrong thing xD

#

@tough abyss for random task, i'll create a config file and declare all the possible tasks, description, units and coords

tough abyss
#

coords?

winter dune
#

coordinates where the patrol must take place

#

so you spawn all of your units there when the task is being generated

tough abyss
#

Id want that to be random, Like maybe prioritize villages and millitary fortifcations

#

Oh

#

i see

#

yeah, so like compositions?

winter dune
#

I was just assuming that you would like to have for each different task, different kind of units

#

and for the random stuff, just pick a random integer and then create the task where that random integer correspondes in the config file

tough abyss
#

ever worked with alive?

#

thhe mod?

winter dune
#

hmm no, never scripted with a mod

tough abyss
#

Well alive, is the best way to set up a massive enviroment thats fully dynamic, Its just, it isnt saveable. It places units randomy all over the map

#

anyway, Just you cant save i dont think

#

so i cant use it 😦