#arma3_scripting
1 messages · Page 398 of 1
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
so I need vectorDiff
yep
so... (A modelToWorldVisual [0,0,0]) vectorDiff (B modelToWorldVisual [0,0,0])?
yep
Maybe swap A and B.. dunno. Just try it out ^^
getRelPos ?
that is with distance
getRelDir?
the above works
ObjA getDir ObjB
Direction != relative pos 😄
Mr Banandscha
Dschalala?
DschaDschaDscha 💃
Better
That looks like you wanna use caternary ropes
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
@candid jay Want to try the build of cba with the modules? They should be ready to use for this task.
What's the meaning of the code following then in ```sqf
if (a != b) then [{"true"},{"false"}]
lol. I thought it was an array. Are there any explanations for such usage?
Which is just the same as:
str (a != b)
It is an array
And yes.. There are explanations.
https://community.bistudio.com/wiki/else
CODE else CODE
just returns [CODE,CODE]
And https://community.bistudio.com/wiki/then takes either CODE where it is normal if/then or ARRAY where it acts like if/then/else
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
measurement error
What do I see here?
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;
_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?
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.
Hmm.
@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
hmmm
@peak plover Need to know if a client is admin, 2 is server so that's moot.
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
A serverside script wants to know if a curator is logged in as admin, basically.
jus do that an avoid the trouble
Mm, good idea. Thanks.
@earnest ore https://community.bistudio.com/wiki/admin
???
... Right. The more you know!
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.
Works like a charm, thanks.
Can anyone explain why for "_i" from 5 to 93 step 7 do {hint str _i}; would hint 96 instead of 89?
Because Arma.
I can check and explain.. But do you really wanna know why something in the backend is going wrong?
lol. If it is the backend's fault, I think I'll have to forgive it.
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
The tutorial is out of date. The bug is now corrected. Just tested it in game.
Couldn't you think of an easier repro. This math is hurting my brain.
lol
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
squint wat
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.
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
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
yes dedmen, it basically rotates the results 90 deg
let me try getpos then
nope, still rotated
craziest script?
https://www.reddit.com/r/arma/comments/6dy7vg/lua_scripting_in_arma/ That maybe? Running a Lua script in Arma does sound crazy I guess...
How do you turn rel pos back into world pos?
using modelToWorld?
@still forum it is not giving me the position. But the name...
private _pos = ATLToASL(_obj modelToWorld _relPos);
private _sign = "Sign_Sphere10cm_F" createVehicle _pos;
I ment the position in the Array
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?
I'm just trying to make it work
I can't seem to get coordinates of spheres in relation to an object
just use getPos obj + relPos
?
A-B=C
So B+C=A
shhhh, modelToWorldWorldRealWorld
@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
it's being PVAR'd somwhere else / not using private
ok
Btw @quartz coyote your isMultiplayer doesn't even make sense. because getPlayerScores doesn't even work in non MP
@candid jay Use getdir and getpos can do what you want too
@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.
@still forum well it is giving me correct values so dunno what your talking about
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;
yes that's what I'm doing now, unfortunately height are off now. will dig.
use getPosASL instead of getPos
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.
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.
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
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?
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
Why won't hint image "\a3\Ui_f\data\GUI\Cfg\CommunicationMenu\transport_ca.paa"; work? The image didn't show up.
@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]]
Looks correct to me? You did a kill and now have one point and are the first in the array
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
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.
I don't think there is another way
Me too
But you can't move A?
How do helicopters sling-load then? A and B can both move there.
No no
If i create a rope between A-B
I can attach A to myself and move B
But not in reverse order
Ah yeah.. No. That's how attachTo works. The object you attach completly looses their free will so to say
Because i´m creating a hose system so i need to pickup both ends on a rope
So you won't get around un-attaching it
I know but it´s not because of attachTo command, it´s because how the ropes work
What happens when you try to move the thing that you cannot move?
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
What happens if you drag the rope away? Does it just disconnect/break ?
mmm it increases its length
Until it break
Let me record a video showing it
It would be more clear
I can already see what happens
https://community.bistudio.com/wiki/ropeCreate a comment talks about that both ways apparently work to drag the other end. But one is yanky
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
would this work ?? if !((side _x) isEqualTo (west or empty)) then
wait is in another word for equal?
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
a isEqualTo b is essentially a weaker version of a in [b], where [...] has only one element.
if !(side group _x in [west, sideEmpty]) then so this would execute aslong as the unit wasnt west or empty?
Yes.
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
It would be easier to read and edit if you formatted it correctly.
sorry, im new to this. Is there a guide?
Well to begin with, don't tab it to death
[] spawn {
{
if !(side _x isEqualTo west) then {
(getAssignedCuratorLogic player) removeCuratorEditableObjects [[_x], true];
};
} forEach (allUnits + vehicles);
};
@lone glade or 4 spaces into a tab
What's the spawn for?
Its tied to a description.ext
class Extended_Init_EventHandlers {
class Man {
init = "_this call (compile preprocessFileLineNumbers 'classes\unitInit.sqf')";
};
};
Are CBA EH's supposed to be in the description.ext?
When alive places units, It will take away the zeuses ability to edit them
They can be, Midnight.
Hmmm, neat.
config.cpp or description.ext
Okay, makes sense.
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 ?
I'd do
params ["_unit", "_killer"];
instead of the _this select N lines
so commy, how would i go about adding an (or 'empty')?
I'm still parsing "When alive places units, It will take away the zeuses ability to edit them"
Who's alive? ALiVE mod?
yup
When alive or an arma 3 module places units, the zeus can automatically fuck with them
Alive spawned units should not be editable by zeus. Is what I'm getting.
well, Honestily i wish that were the case.
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.
Well cant we just detect if its either west or empty?
it already works with west units
alive probably has units arrays, it has to.
I don't know what being west or sideEmpty has to do with ALiVE.
accross the board, it disables the curator from being able to edit anything that isnt west
One problem with removeCuratorEditableObjects is, that it's hard coded to only work when executed on the server. Because reasons.
the code already works, for all units except west, i just wanna add all units except west & empty.
I always thought no objects were curator editable, except when placed as curator. And you had to make them editable first.
Then why would east units for example suddenly be editable when they are spawned with ALiVE?
go figure
......
Trying °_°'
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
Then there is probably a script in the mission responsible for this. And that script would have to be edited.
hey Alganthe, is that arsenal of yours final product in terms of visual representation? It feels almost too spread out
[] 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*
You lost me.
you can edit your last message by pressing Up arrow button
thanks
yup
Maybe sideEmpty isn't actually what bling0 needs.
I don't know what objects are sideEmpty.
Aren't those civilian side?
arent those purple instead of yellow?
side cursorTarget
will know the answer.
ill try it
sideEmpty does not mean the side of empty stuff. It's essentially sideNull.
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 ?
what is the side of empty stuff then?
civilian ?
@little oxide but if I put it in InitServer it tells me "Player" in unrecognised !
use addScore command instead bis_fnc_addscore
you need to keep your eventhandler client side, but use remoteexec to remote addscore in serverside
nah, objects are side empty, dead stuff is civ
@little oxide ok i'll test it
side cursorObject
will tell. No point in arguing about it.
but ... is a remoteexec of a priv var permitted ??
Like : [_unit,-1] remoteExecCall ["addScore", 2]; inside your evh
don't forget to whitelist the command if you using cfgremoteexec
You don't pass variable names as arguments. You pass the values. That has nothing to do with the variable being private
okay.
Why @little oxide in your command you put _unit, -1 ?
That are the arguments to addScope
_unit is the left argument and -1 is the right one
because you made that inside your script 🤔
_unit addScore -1
oh ... and what is 2 at the end then ???
The 2 stands for "the wiki explains this all".
thanks @still forum
isn't that going to be fucking laggy if I have 20 players in the game ???
no
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
Ok
[] 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?
Global versus Local Effects @quartz coyote
_x isKindOf "Man" @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);
};
@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]; }
};
};```
but I followed the Wiki for once .............
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; }
HUUUUUUUUU ok... well I hadn't understood it like that
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
ah well I havn't added a line anyware saying "I want remoteexec to work" if thats what youre talking about
It works by default
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
where do you test? local hosted MP?
yes
In local hosted MP you are the server anyway
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
this && {!alive _x && (typeOf _x)=="rhsgref_cdf_b_gaz66o_flat"} count thisList > 2
thanks I'll give that a try
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
@tough abyss https://community.bistudio.com/wiki/Curator
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
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
_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)
....
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
Oopps yeah didn’t think about that 😶
You have a vehicle to store variables on. Just setVariable onto the vehicle.
_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?
yeah
{_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
Anyone here knows what lnbValue will return if no value is set?
afaik -1
Would be optimal, but have a feeling it would only return 0
inb4 it's nil
I just made a pr with 5 spawn.
Nah, that's like all the spawn I've used this year in one pr.
Ye exactly 😄
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
anyone able to help me figure why these arrays dont want to merge? "eastGrps" always returns "[]". Code: https://pastebin.com/KqW2zkWP
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
I don't know why, but I know that the error is somewhere else.
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.
Is that for a marker system?
yep
How about
You just setvariable for the group
and get all groups instead
More dynamic
i assume you mean groupID?
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
how do you set a base variable fot he groups then?
_group setVariable ["nig_eastMark","hq",true];
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
@peak plover do you do this via a separate script or within an init in the group
anyway, on my attempt, i managed to crash my arma 3 for the first time. lol loops are scary
(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
might need to make it redetect the leader
yup
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?
yes
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
got an example somewhere?
how do you distinguish which group is which?
set a variable name in the editor LOL 😄
I just name all units and groups and that's just about it
oh i understand what you mean now
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
how does setvariable play into that?
so an inline function correct?
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 {};
};
};
similar to that
in functions library
I don't use "inline functions"
This one
organized and easy
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
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
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!
You added a killed eventhandler that adds itself while iterating through the killed event handlers.
aka
a = {call a}
my favorite way of kicking someone
You essentially appended an array with another element every time you handle one element.
do you guys know of a better way to make it so that when the leader dies, his second in command becomes playable?
units group select 1
my thing worked
untill it got down to the last unit
once you killed him
add a check to avoid that?
would it be != nil or != null?
addMissionEventHandler ["EntityKilled", {
params ["_dead"];
if (_dead in switchableUnits) then {
addSwitchableUnit (units _dead param [1, objNull]);
};
}];
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
How do you make custom dialog for role selection? http://steamcommunity.com/sharedfiles/filedetails/?id=774789135 like that
That is not a custom dialog
that's just a custom background texture
You overwrite the config class of that UI with a mod
Just look how they did it and do it like the other life-mods, ale x ¯_(ツ)_/¯
Also check this http://steamcommunity.com/sharedfiles/filedetails/?id=287378519
you will get an idea how dialogs works @kindred bane
You really think lifer scum doesn't obfuscate their pbo's @jade abyss
¯_(ツ)_/¯
@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
You can edit everything theoretically.
It's probably something with "lobby" or "role"
@jade abyss See!
can it actually damage my file system though :p just wondering https://i.imgur.com/3MTpcmr.png
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
I think that also denies to unpack obfuscated stuff
Atleast BI added that when Mikero said his obfuscation breaks the FS
you acn easily bypass that though ;P i guess imma try to find the config somewhere else then
@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
@still forum any idea where i can find a list of classes? :/
Ingame config viewer. AIO config from BIF.
If you're really serious, unpack all the pbos and grep your way through the configs
And if you are intelligent you just take a ready-made all in one config and use that.
thanks, what you mean Dedman? The one i tried was obfuscated ;3
Or: Ditch life and do something more honorable =}
Arma all in one config. I won't help you how to google.
I found it.... But what you mean take a already made class?
I never said that
oh nvm ill try to look
@jade abyss keep fighting the good fight
Kill all Lifers! Boycott them all!
or make them follow the TOS
Common, be realistic
Ah yeah.. That would be a alternative.. But that's harder
No ^^ But other stuff is
because you know that one mod you made back in A2 has been badly ported, stolen and put on a life server
It's against LIFE-mods at all
is it?
I like trains 🚆
TOS §3.1 Life mods == forbidden
^^
Thought it was just written in a very unfavourable way
(Just to make sure: It was a joke)
Went way over my head
I like trains
(Just to make sure: It was a joke)
Yeah, i hate trains
😄
(The sad thing is: You HAVE to mention that sometimes^^. Some ppl will take everything for "Uh, he said that, that's true")
xd
local variables are faster than script command calls :u
The argo dlc isn't usuable by vanilla. correct?
I didnt knwo that. I completely ignored that release appearantly. I just noticed the folder in there the other day.
thanks
argo is the codename for malden
Abel was the "Codename" for Malden
Abel -> Malden
Eden -> Everon
Cain -> Kolgujev
Together: AEC Islands \o/
Victor Troska approved
I meant in Arma 3
Still no
O RLY?
class A3_Data_F_Argo
{
author="$STR_A3_Bohemia_Interactive";
name="Arma 3 Malden - Main Configuration";
url="https://www.arma3.com";
Malden = Used *with Argo
functions are a morickyian conspiracy everyone should use execVM
Hey guys, so I've heard that time gets inaccurate after a bit of the mission. Why is this?
What difference does MP do?
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
serverTime works on client as well?
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
Id avoid having 100000 threads with a lot of sleeps
Yeah
Less threads is better IMO
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.
1ms is about the best you can do in RV4
For callextension?
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
I think when I tried it though it ran like 10000 times or something so
Yeah that's the debug console's limit right?
No idea. I don't use the default debug console. I have my own.
ah fairo
What is the best way to set up a MP testing environment?
but I need at least 2 clients
How do I run two local clients with one steam account?
Click play twice 😛
lol. I didn't know I could do that.
yep
What do you mean by loopback?
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.
OK. Thanks fot the tips.
Yep
How much of a performance impact would constant setVariable broadcasting be to a server?
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?
What do you mean it collides with the ground
like, It explodes
But not instantly
only after it feels the ground, really really hard
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?
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]];
};
attachTo disables collision
not with the ground
What wouldn't work?
instead of (vehicle _unit) attachTo [chute, [0,0,0]]; i changed it to
(chute) attachTo [vehicle _unit, [0,0,0]];
Hu?
you think that would work?
No
could do a waituntil istouchingground for the vehicle, and then just delete the parachute
lol
There are alot Scripts already around, just check some, take a look at them, get the idea
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
hey, so how can i emulate sleep in a non schedule enviroment?
You cant. Why cant you just spawn it?
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
@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;
};
That's pretty slick!
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.
https://community.bistudio.com/wiki/getDir (Alt Syntax)
https://community.bistudio.com/wiki/distance
https://community.bistudio.com/wiki/getRelPos
As i said yesterday.
Ok, but can't get how to apply it in a way that works
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
modelToWorld
...which is my first example
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
Because it dependes on object rotation
I want to compute memPoints that work for any rotation of the object
_PosAboveHead = player modelToWorld [0,0,2];
_WorldPos = player worldToModel _PosAbovehead;
private _sign = "Sign_Sphere10cm_F" createVehicle _WorldPos ;```
I think you mix alot of stuff together, while trying to explain
ok, so here it goes hopefully it'd be clear
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
What do you try to achieve, what is your goal
Don't try to explain the steps you wanna take
I want a memPoint!!!
modelToWorld
I don't know how else to say that
this.
To make cables from a tower to another tower, I need the start and end point on the towers.
modelToWorld
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.
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
Ok, how do you compute [0,1,0] is my question
those are the pos. relative to it's orientation
given that I have the main object, and _x which is a sphere that I set up for visual reference
I only have _obj and _x, how can I test that
dojfsngdsnfgdfsgndfs
place *several objects in the editor with different angles and execute that script with an _Obj = cursorObject; added before
I very well know what that does
dfngdfsbngibfdsg
I understand that code, thank you dscha
aaaaahhhhhh
ok forget it
aaaaahhhhhh
once I get to it I can post it here
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
No clue what you mean with I want to compute [0,1,0] given two objects.
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
😕
my issue is how to compute [2,1,2] regardless of object rotation
@candid jay ```sqf
private _pos = eyePos _x;
_pos = _pos vectorAdd (_pos vectorFromTo getPosWorld _obj);
private _sign = "Sign_Sphere10cm_F" createVehicle ASLToAGL _pos;
No ?
😕
but thanks
You rotating object A against object B ? And what you trying to get ?
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
Check class name ? Then just setDir -90
and I get this https://cldup.com/viK_naYnMd.jpg
ok nvm I guess it's hard to explain here. thanks for the efforts anyways
The solution was mentioned before
vectorFromTo with the positions take from modelToWorld and WorldToModel
(you seem to insinst in the Vector stuff)
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)
To get the Start and End Pos on both Objects:
https://community.bistudio.com/wiki/modelToWorld
https://community.bistudio.com/wiki/worldToModel
Get the stuff for getRelPos
https://community.bistudio.com/wiki/getDir (Alt Syntax)
https://community.bistudio.com/wiki/distance
https://community.bistudio.com/wiki/getRelPos
Divide the distance by 10,9,8, etc. to get certain steps
As i said yesterday.
ok, thank you
¯_(ツ)_/¯
ok... FINALLY https://cldup.com/m_uunWsno8.jpg
but I solved in the least possible way for me to be proud of anything
What was the problem ?
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
Is it your model ?
k
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.
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 👍
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.
What he’s trying to say is pose your question in a better way. There is nothing wrong with asking a question here...
I didn't say that
lesson learned: if too complex stay out of here, or write a thread on BIuhm
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
I can't remember seeing that with the catenary cables somewhere
You showed a Pic of it, but thats it
¯_(ツ)_/¯
Then you said something about an object that was turned 90°
you should put that as your avatar, you seem to like that a lot 😃
¯_(ツ)_/¯
😉
I will retreat in stealth mode 😶 💨
is... is that a fart?
👍
_head_dir = getDir (_unit selectionPosition "head"); ?
🤔
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")
you must be shitting me
Nope. Also Search "call compile format" (135 hits in 74 files)
Burn it down, the whole thing
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
HAHA
Would constant setVariable broadcasting cause much of a performance impact on a server with 100+ players on?
Why would yo do that?
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
Is it possible to spawn a guided missile, like one from a titan launcher, and set its target? If yes, explain how pls.
Virtual inventory like a boot, on a roleplay server
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
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
..... life and performance don't go together
avoid broadcasting / don't have large arrays?
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
even better, don't do life shit
and then HC talk to DB
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
with 100 players 3 would be better
It is, there's tons of scripts running for life and spreading the load is good,
is it possible to have more than one HC?
ofc...
and they will balance the load, right?
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
Is it possible to spawn a guided missile, like one from a titan launcher, and set its guided target? If yes, explain how pls.
probably possible
yes, with vector maths
Everyone's favourite ;D
high school
you went?
you didn't? 🙀
why the hell are the discord emojis so shit compared to our blob overlords
Well I didnt want to do vector stuff
I meant if its possible to like. missile = createVehicle missle;
setMissileTarget(missile, target);
but I think Im gonna do vector stuff then
thx
whats a good way to detect if something has an inventory
apparently this ```
(_entity isKindOf "ReammoBox")
every vehicle has an inventory afaik
isnt detecting the ammoboxes
I guess you could check how much space the vehicles inventory has
if that's >0 it probably has a inventory
its funny because reammobox seemed to add any weapon or item, Except the ammoboxes
(_entity isKindOf "AllVehicles") || (_entity isKindOf "ReammoBox")
Lol thank you config!
You can see all the parent functions
CfgWeapons can't have inventories
no it isn't
((_entity isKindOf "AllVehicles") || (_entity isKindOf "ReammoBox") || (_entity isKindOf "ReammoBox_F"))
🤦 use the proper syntax for isKindOf
typeName1 isKindOf [typeName2, targetConfig]
https://community.bistudio.com/wiki/isKindOf
and lazyEval
(bool && {bool})
no idea what to do with that
world's most useless explanation what lazy evaluation is 😁
@tough abyss https://en.wikipedia.org/wiki/Lazy_evaluation
((_entity isKindOf "AllVehicles") || (_entity isKindOf "ReammoBox") || (_entity isKindOf "ReammoBox_F"))
vs
(_entity isKindOf "AllVehicles" || {_entity isKindOf "ReammoBox"} || {_entity isKindOf "ReammoBox_F"})
you're supposed to start at the what and why and then go to the how 😛
yeah, no, not in sqf
lol
especially when you consider that arma doesn't actually use proper lazy eval
_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
first condition no brackets or round ones if needed, next ones in code brackets
If I have an array like this one:
[["Allen Walker"],["xAndreei"]];
How can I turn into an output array like this:
["Allen Walker","xAndreei"];
new array + append each index
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];
};
};
};
don't know man lol
@winter dune
_newArray = _oldArray select {_x select 0};
ok, thanks, trying it
there's a ton of good solutions to your problem, and you kinda chose one of the worst 😄
I can't think of a worse one
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
Is it possible to see the server side hint on one of the client in my MP testing environment?
You can't see something serverside only on clientside unless you are the server
And a hint on server doesn't make sense anyway
no interface no hint
Then how do you check the value of a server-side variable?
I would use the CBA debug console ^^
but that's not efficiency
You are talking about a hint anyway.. That's also a kind of logging
Not really that different
and probably the worst kind
I meant I would have to alt-tab in and out frequently
wait what?
fullscreen windowed. Or just windowed. And as I already said. CBA debug console.
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
private _finalarray = [];
{
_finalarray pushBack (_x select 0);
} forEach _array;
Same as the apply?
I couldn't make that work lol
maybe im retarded
That is about the same as my select thing
What code did you use for apply that didn't work?
you can fit the select and apply solutions in one line
oops. My select one doesn't even work ^^ I expected it to work like apply does 😄
yeh lol
private _array = [["Allen Walker"],["xAndreei"]];
private _newArray = _array apply { _x select 0 };
hint format ["%1",_newArray];
this works for me
yeah
and let's suppose that I have that _array as a parameter
how can I declare in the params field?
params [
["_array", [[]], [[[]]]]
];
declare what in the params field?
what do you mean by declare. What you have there already looks correct
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
Yeah.... and?
when im doing the params stuff
what is the default type?
for an array like this --> [["Allen Walker"],["xAndreei"]];
so no bidimensional array?
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
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
Hey so i dont wanna use alive, does anyone know a good way to generator random occupants and patrols? and possibly random tasks?
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
I know there are tons of stuff online, but it gets real hard to sift through what you want
@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
coords?
coordinates where the patrol must take place
so you spawn all of your units there when the task is being generated
Id want that to be random, Like maybe prioritize villages and millitary fortifcations
Oh
i see
yeah, so like compositions?
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
hmm no, never scripted with a mod