#arma3_scripting

1 messages Β· Page 274 of 1

meager granite
#

I remember back in Alpha\Beta clearItemCargoGlobal didn't work at all, then they sort of fixed it into current state of being unreliable

#

My only guess is that item cargo clear message arrives at wrong time thus doing nothing

tacit grove
#

Prowler just got supply dropped in. Whether it works in MP... TBD but either way huge thanks again you guys

meager granite
#

Where do you call these 4 lines from? @tacit grove

jade abyss
#

iirc the ClearItemCargoGlobal bug still existed about 5-6 Month ago.

meager granite
#

It existed since the moment they fixed it sometime during beta

jade abyss
#

Quiksilver, removing ANY Item from an Inventory.

tacit grove
#

I put if(isServer) then { _prowler = "B_LSV_01_armed_F" createVehicle [0,0,0]; _prowler setDir random 360; _prowler setPos [3946,13931,150]; _prowler call KK_fnc_paraDrop; }; in the activation section of a trigger

meager granite
#

Because of that I have to avoid any backpacks and crates that have default items in them since rarely players still get items

#

@tacit grove triggers execute globally on each client and server but since there is a check to make sure that script is executed only on server it should be MP-safe

tacit grove
#

I sure hope so. Brains been a knot from it the past couple days.

meager granite
#

You can replace these "hardcoded" coordinates with some invisible marker placed in editor, would be easier to adjust mission than to copy paste numbers

tacit grove
#

I tried but it kept giving me an error code

meager granite
#

if you post how you did it here we can help you

tacit grove
#

obvoiusly something I'm doing wrong of course lol. at the time it was easier to just grab those cords. I replaced the "_prowler setPos blah blah" with "_prowler getMarkerPos "markername";

#

I'm just a designer lmao i know squat about coding beyond baisc HTML haha

meager granite
#

you didn't have to remove setPos, only coordinates

#

_prowler setPos getMakerPos "blah"

tacit grove
#

Ah ok! makes sense now actually. like I said, KNOT ha

#

If I wanted a 2nd prowler dropped in with that first one would I just copy those 4 same lines and paste them below along with changing _prowler to _prowler2?

#

and change position of course

jade abyss
#

You mean like this:
_Unit = "Class" createVehicle [0,0,0];
_Unit moveIn* _Veh;
?

#

yeah, was just an example

meager granite
#

@tacit grove Yes but you don't really have to change variable name since you're not doing anything with these vehicles anyway, why more variables

#

I don't think you can put createVehicle'd units into vehicles, they lack ai brain that it required for such commands

jade abyss
#

oO of course

little eagle
#

extra variables to pad the script
("Class" createVehicle [0,0,0]) moveIn* _Veh;

tacit grove
#

variables, arrays, passes. Gibberish is gibberish haha.

meager granite
#

He meant @tacit grove 's question, @little eagle

little eagle
#

Sa-Matra is probably right, but I think we were talking about createUnit

#

Yes, it was an attempt at a joke

jade abyss
#

oh snap, right. CreateUnit

#

Yeah, just rechecked old files. CreateUnit was the right one. As Sa-Matra said, createVehicle shouldn't work.

little eagle
#

I think variable naming like _prowler, _prowler2, _prowler3 is dumb

jade abyss
#

commy2 - Today at 1:37 AM
I think variable naming like _prowler, _prowler2, _prowler3 is dumb

πŸ˜„

little eagle
#

Yo, I'm no variable

jade abyss
#

Yet

#

don't think so

#

Since its just a p3d, no uniform etc

meager granite
#

you can create headless unit with no animations with createSimpleObject

#

You probably could create head separately with createSimpleObject too

#

though sadly you can't animate simple objects

jade abyss
#

What about clothings?

#

Uniform etc

meager granite
#

uniform is unit model

jade abyss
#

?

jade abyss
#

createSimpleObject uses the .p3d, correct? If so -> It would spawn a StandardUnderwearUnit. Correct? So my guess is -> (since he mentioned prisoners) -> Prison clothing / Uniform / Banana -> Not usable for his purpose.

meager granite
#

Uniforms just reference unit from CfgVehicles

#

@tough abyss random props in towns were planned originally

#

Pic above is uniform model + head model through createSimpleObject @jade abyss

jade abyss
#

looks like Hicks without a Neck. Wich is... awfull

meager granite
#

Well you can create horror mission with 100s of these following you

jade abyss
#

+So it confirms -> Not rly usable for him, unless he wants to do a Jesus-Simulator.

#

one would be enough, tbh.

meager granite
#

Also we could really use a command to animate simple objects

#

Isn't there config branch which defines which animations should be issued on model when created or something?

jade abyss
#

animationSource etc?

meager granite
#

Does it work with simple objects? Not sure.

jade abyss
#

afaik not

#

Since it was the purpose of SO's to be.. erm.. just there, without wasting any network stuffthingybums

#

how? When it had no Informations about it? You load P3Ds, without a config.

#

You can animate the sources, true.

#

I remember

#

But afaik you can not animate Units for example (like walking etc).

meager granite
#

oh there is SimpleObject class in some CfgVehicles entries

#

I guess game reads them all during loading and associates list of animations to do with object's model

#

Is there a way to find land contact points of vehicle?

jade abyss
#

wasn't there a selectPosition command or something?

#

To get memoryPoints

#

prolly spawning vehicles on groundlevel, instead of 1m in the air Quik πŸ˜› ( i guess)

meager granite
#

To know where vehicle contacts land, some vehicles have unreasonable bounding boxes and you can't rely on that

jade abyss
#

BoundingBoxReal is also bad? (never had probs with the height in it. Just the Radius was sometimes awkward)

#

Yep

meager granite
#

So what is selection name for LandContact points? Is there any selections at all?

#

I guess not

jade abyss
#

Yep and to animate the Source.

#

Wheel LandContact Points = something like PPL,PPP iirc

frosty yew
#

how do I disable building destruction? I am using the liberation mod, and would like to disable building destruction

meager granite
#

checked some of A2SM models, no selections in LandContact lod

cerulean whale
#

allowDamage false in a foreach loop that checks object type from an array?

frosty yew
#

is there an array of all the buildings pre populated for a map?

tough abyss
#

No.

#

You can ask nearestObjects the entire radius of the map though

#

about every building from the ConfigFiles worldOrigin to the entire map

#
getAllMapBuildings = { 
private _worldCenter = getArray(configFile >> "CfgWorlds" >> worldName >> "centerPosition");
_allBuildings = nearestObjects [ _worldCenter,["Building"],20000];
_allBuildings;  }; 
frosty yew
#

@tough abyss Cool. THanks! so then I would loop in every object and set allowdamage to false. correct?

tough abyss
#

Yes.

#

Do it at mission start.

frosty yew
#

Got it. THanks a lot dude!

tough abyss
#

np

dusk sage
#

worldSize @tough abyss

jade abyss
#

@meager granite
MemoryLOD:
TrackFLL/BRR/FLR/ETC

tough abyss
#

Ah true. @dusk sage Didn't think that would work

dusk sage
#

allMissionObjects "Building"

#

Also πŸ˜›

#

Should work fine

tough abyss
#

Thats cool, didn't know about this sexy little script command

#

isTouchingGround.

#

Can use that in a paradrop script now.

tough abyss
#

@dusk sage You ever encounted this syntax before?

#

if (true) then [{hint "test"},{hint "false"}];

#

How to interrogate ArmA 3 for all scripting commands.

#
Answer:
Coutesy of KK: {diag_log _x} forEach supportInfo "";
#

Dumps all the scripting commands ArmA 3 supports to RPT

#

And all their valid syntaxes

dusk sage
#

Yeh, it's old and slow

#

Re the if syntax

little eagle
#

@tough abyss That is just what else command does

#

{1} else {2}
->
[{1},{2}]

meager granite
#

Hmm, I wonder would would be a quickiest way to check if entity is unit?

#

unit in allUnits?

#

Anything even quicker?

#

Single command preferably

vapid frigate
#

entity iskindof "camanbase" ?

#

should be quicker than searching the list

meager granite
#

No, entity can be man class but will not be a unit

vapid frigate
#

do you mean a player?

meager granite
#

No

#

Dead unit is not unit anymore (moveOut and lots of associated commands wouldn't work on it), createVehicle will not be unit

vapid frigate
#

yeah ok, not sure then

meager granite
#

Actually, even unit in allUnits will not work all the time too, when unit dies they remain as "unit" for some time (so you can move out dead unit moments after they die)

vapid frigate
#

maybe you could use the logic from groups

#

something like (entity in units group entity)

#

createvehicles / dead units would return a blank array i think

meager granite
#

hm

#

Actually I think when unit gets removed from group is good indication that it stopped being unit

vapid frigate
#

yeah just (isnull group entity) might be enough even

meager granite
#

No, not really, moveOut still doesn't work on dead unit even if they're still in the group

#

I so wish we'd get moveOut working with dead units or dedicated command just to move out dead units

#

At the moment I have to use hacky approach and fill entire vehicle with invisible units to move dead units out, with moveInAny command which unlike other moveIn* command lets you move into dead vehicles

#

I'm afraid to run it on larger transport helicopters

vapid frigate
#

haven't tried, but looks like he just uses 'crew' and checks if they're alive

#

then use 'setpos' to move them out

meager granite
#

setPos doesn't seem to work on dead units in vehicles for me

#

So, my moveInAny approach doesnt work, it skips seats occupied by dead units

#

I guess then its impossible to move out dead units from dead vehicle

#

I guess it worked back in 2015?

#

Checking all possible combinations, units never move out with setPos

vapid frigate
#

don't know if he mentions dead vehicles

meager granite
#

Alive units do move out with setPos

#

Also I remember there used to be a bug where you could move out remote unit with setPos, it appeared outside for you while where it was local it was still inside vehicle

#

No even alive, setPos doesn't move out units anymore @vapid frigate

#

Dead units out of alive vehicle

vapid frigate
#

yeh ok.. i haven't tried it, but it looks like he implied it worked in 2015

meager granite
#

Probably, it works with alive units

#

LOL you can moveInAny dead unit into alive vehicle and it multiplies it

#

I guess it multiplies unit proxy or something

vapid frigate
#

yeh maybe dead vehicles can never delete stuff from proxies

#

even if the script tells it to

meager granite
#

Hmm

#

Maybe I can use this

#

Move dead unit from dead vehicle into alive vehicle, then move it out of alive

#

Lemme try

#

Dead clones

vapid frigate
#

you tried hideObjectGlobal or hideBody ?

#

or you trying to move it out so you can access the body?

meager granite
#

You know what, it works

vapid frigate
#

moving to an alive vehicle first works?

meager granite
#

The steps are following:

  1. Move dead unit from dead vehicle into alive vehicle with moveInAny
  2. Move alive invisible dummy unit into alive vehicle onto dead unit's seat
  3. Dead unit appears outside of alive vehicle
#

Though dead vehicle's crew still has that dead unit when you run "crew" command

#

objectParent on dead unit return null

#

Hm, dead unit just disappeared though you still can loot its invisible body

#

I guess if dead vehicle displays crew proxies you will still see dead unit inside dead vehicle along with real unit outside

#

So the whole thing is buggy AF

tough abyss
#

Oh wow

#

BI allowed me to do away with the details

#

Now I don't need to worry about finding mathematically if a position is inside a marker.

#

Nice.

#

Still, I might just write the algorithm for it.

#

For the sake of learning.

tough abyss
#

@dusk sage is using

PublicVariable "GlobalVar";

Equivlent to

 MissionNameSpace setVariable ["GlobalVar",someValue,true] 
#

@meager granite Would have been happy if you answered πŸ˜ƒ just someone that knows the answer.

#

@cloud thunder Are you alive?

meager granite
#

Sort of, there are some differences

#

Including exploit I wouldn't want to share right now

dim owl
#

Hey guys! Is there a way to check if a player is talking in direct without a while loop ?

tough abyss
#

@meager granite they can't exploit it if you utilise params

#

You can atleast lock down the data types you pass then.

tough abyss
#

how is the select 1 thing works with the addAction?
Can I do something like action select 1 = activatedPlayer

tough abyss
#

Elaborate?

muted oyster
#

Does anyone know, if you can make popup targets stay down without using "nopop". I tried:

_object animate ["terc",1];
_object setDamage 1;

And get strange results. Sometimes it works and sometimes it doesnt have any effect. Are there any other ways?

tough abyss
#

antimateSource

#

Don't use animate anymore

muted oyster
#

Thanks, i will try that

tough abyss
#

**Arma 3 logo black.png It is recommended that animateSource command is used instead of animate whenever is possible, as it is more efficient and optimized for MP **

muted oyster
#

No effect 😦

tough abyss
#

odd.

#

Wait.

#

Stop using set-damage on it.

muted oyster
#

It just pops back up

#
{
    _x animate ["terc", 1];
    _x setDamage 1;
}forEach Range_Random_Targets;

This worked. All targets will stay down and i can activate them

#

But it didnt work after it got hit

#

I guess I'll have to use nopop

indigo snow
#

@dim owl iirc KillzoneKid had a thing with a UI EH that detects the microphone icon showing up, that might help you.

dim owl
#

do you have a link ?

dim owl
#

thx πŸ˜ƒ

dim owl
#

@tough abyss I dont want a while loop for a whole mission(roleplay life)

tough abyss
#

What am I doing wrong? I typed the line dist=Pilot distance player; in the init.sqf file and typed dist <=6 in a trigger condition so it will work only if the play is 6 meters or less to the pilot. But the trigger doesn't work.

digital pulsar
#

Dist gets evaluated once so whatever distance there was at the beginning of the mission will stay in that variable

tough abyss
#

so I need a loop?

digital pulsar
#

Type pilot distance player <= 6 into condition

#

Trigger will keep checking

median iris
#

^^

tough abyss
#

The pilot unit is going to be controlled by a player will the game be like "The pilot is a player so the pilot is close enough to himself so lets execute the code"?

digital pulsar
#

Yes

#

Unless its multiplayer then locality matters

thin pine
#

Player distance player in SP is generally <= 6 unless you're spaced out on LSD

tough abyss
#

It is a dedicated server

#

so I guess locality matters

digital pulsar
#

Player doesnt really work if executed on dedi

#

U need to specify which player

indigo snow
#

also triggers are typically evaluated on every connected client plus the server so keep that in mind as well

digital pulsar
#

Aye

#

Rule number one of scripting in mp: locality is a b....

manic sigil
#

I can't believe it, but I think I need math help, and it's specifically of the scripting variety.

#

I need to turn distance between player and target into a curve, where being too close and too far zeroes it out, but optimum angle maxes out at like 5 or so.

#

So if you're 100 meters away, it returns 0, but as you approach 70 meters, it rises to 5, before dropping again to 0 as you reach 40 meters.

indigo snow
#

make a parabolic curve and use min to put an upper bound on the distance

#

let x be the distance,
f(x) = -a(x+b)^2 + c, with x = x min 100 to put an upper bound of 100 on x

#

then play around with a,b and c to fit your curve

manic sigil
#

Does that work in Arma's scripting language?

indigo snow
#

youd use a variable instead of typing f(x)

#

d = ...;

#

c is the y offset of the curve, b the x offset, and a a scaling factor

manic sigil
#

Thanks. Been way too long since I've taken a math course >_<

indigo snow
#

wolfram alpha is cool for playing with curves in that regard, try fiddling with the values and see if it helps, maybe use a sine curve instead of a quadratic... or just make something that works and be done with it πŸ˜›

manic sigil
#

Damn, can't think straight... how do I get it to accept the math as actual math and not a string? Got it to my hint popup as lovely "-(5/2500)(range-70)^2+5"

indigo snow
#

use format to put values into strings

manic sigil
#

Got it, forgot Arma doesn't recognize (x)(y) as (x)*(y), you have to add the asterisk.

#

Alright, got it worked out, thanks! Now to mutilate basic mathematics further.

manic sigil
#

Why would the line >> _Complete = _Complete+_rate << get an undefined variable error on the second _Complete?

#

Wow. Durr. Apparently I got it entirely backwards, thought _ made the variable universal.

#

^Is some kind of genius

#

... Not that that solved my problem of an error popping up. I know I've done x = x+y before for a rolling counter, darn it.

meager granite
#

post exact line

manic sigil
#

Complete = Complete+rate;

#

with rate being the complex math formula discussed prior, going from 0-5

meager granite
#

and the error?

manic sigil
#

Just an undefined variable in expression error, pointed at the start of the second Complete.

meager granite
#

Well you didn't initialize it then

manic sigil
#

Entirely likely... it is in an SQF, my prior experience was using it in a trigger in-editor.

manic sigil
#

To clarify; How would I initialize it? Setting up a "Complete = 0" line at mission start?

meager granite
#

in init.sqf

tough abyss
#

Is this possible to make a unit spawn with an unloaded weapon?

meager granite
#

AI will reload it right away though

tough abyss
#

thanks!

manic sigil
#

So, a bit of research (but afk so I cant test it), itd be Complete = 0; in the init file, correct? Just to create the variable as the mission loads?

native hemlock
#

That's one way to do it, yes

tough abyss
#

Program sometimes must be equal to solve a differential equation. You create something that have not a begin, a midle and a end, but something like a ring without start and end. Where to begin? You can begin anywere, but the ring must be closed at the end.

manic sigil
#

@native hemlock Out of curiosity, what are the alternatives? Last I tried x=x+y, it was in a repeating trigger in game, and seemed to work fine. Making an SQF for m current project is more a matter of ease of export and experimenting with the medium, so this is some key learning material.

meager granite
#

if(isNil "Complete") then {Complete = 0;};

#

before the + line

#

or: Complete = (currentNamespace getVariable ["Complete", 0]) + rate;

atomic charm
#

Hi folks, is there anyway to reference the unit/vehicle that is being remote controlled by zeus?
I have a simple script that requires an object reference (unitCapture specifically).
If it was a static unit with editor I can reference it by a given variable name, is there any easy way to get the reference to the remote controlled vehicle. (in a sp environment)

#

Since zeus remote control doesn't do a playerSwitch using vehicle player will not work in this case

atomic charm
#

This worked for my needs! ```SQF
this addEventHandler ["CuratorObjectPlaced",{
_arg1 = _this select 1;
if(_arg1 isKindOf "Helicopter") then{remoteVehicle = _arg1};
}];

#

^in GameMaster module's init field

native hemlock
#

Nice, my suggestion was going to be a bit of a ghetto work around by checking the bis_fnc_moduleRemoteControl_owner variable on a unit

#

I think if you only have one Zeus this should work and give you the unit they are controlling

_curatorUnit = getAssignedCuratorUnit (allCurators select 0);
_zeusUnit = objNull;
{
    if ((_x getVariable ["bis_fnc_moduleRemoteControl_owner", objNull]) isEqualTo _curatorUnit) exitWith {
        _zeusUnit = _x;
    };
} forEach allUnits;
turbid coral
#

Hey guys, if I wanted to execute a song in console for all clients on the server via console, how woudl I do it?

#

Its for New Years

#

Song is stored in mission.

tough abyss
#

someone sent me his GUI but it's in EXT format instead of HPP will it still work with the GUI Editor?

#

Also is there an alternative from the GUI Editor in arma 3?

turbid coral
#

I'm just going to cross post to Mission makers as I know my question isn't quite scripting, Ill comment if I find a solution.

turbid coral
#

Cheers, it seems it was easier than I thought. Just define your sound in description.ext and the playsound yoursound, execute it globally

weary turret
#

Any good way to play an .ogv file on a television? I've seen a few from killzone.

tough abyss
#

Is there anything against refactoring a mission?

#

Say BMR insurgency ?

rotund cypress
#

Is it possible to use more than one variable with lbAdd?

#

So like _listBox lbAdd [_name, _number];?

tough abyss
#

forEach an array?

#

and use the _x ?

#

@rotund cypress

rotund cypress
#

its doing foreach

#

but has nothing to do with _x

#

I just want to show two texts for every item in the listbox

#

so _listbox lbAdd [_alkshd, _aljkdhasd]

#

now i have _listbox lbadd _variable;

#

but obviously doing lbadd with array wont work

tough abyss
#

If anyone can helpme to save one or two hours: when a unit in a group of 5 living soldiers dies, they still appears in units _group? When all units of a group die, the group turn into a null group?

#

I know what the WIKI says, but it may be wrong.

#

purge the group

#

_group = nil;

#

or _group = [];

#
{ 
    _listbox lbAdd [_controlID,_x];
}
forEach _items; 
#

@rotund cypress

#

Or better yet.

rotund cypress
#

oh I see what you mean now

#
_1 = getNumber (whatever);
_2 = getText (whatever);
_items = [_1, _2];
{
    _listbox lbAdd _x;
} foreach _items;```
tough abyss
#

{ 
    _listbox lbAdd _x;
}
forEach _itemsAndControlIDs; 

make the

_itemsAndControlIDS = [controlID,_itemName]; 
rotund cypress
#

So will that what I wrote above then work?

tough abyss
#

yes

rotund cypress
#

what do you mean by
_itemsAndControlIDS = [controlID,_itemName]; ?

tough abyss
#

the controlID also known as the IDC

#

stands for the control ID within the dialog.hpp file classes

#

idc = #####;

rotund cypress
#

I know

#

But I dont have to do that

#

If i do _listbox = _display displayctrl idc

tough abyss
#

heres another solution

#
_listBoxIDC = _display displayCtrl idc;
_items = [1000,_listBoxIDC]; 
{
   ( _x select 0) lbAdd (_x select 1);
} foreach _items;
#

_x select 0 is an interesting design pattern that allows you to loop using forEach or count

#

and completely ignore the need for numbers.

#

no you can't use _forEachIndex in this instance unfortunately.

#

Well not entirely true but I am sure you don't want to do this.

#

quadrupal nesting of arrays yuck.

rotund cypress
#
private "_populateLB";
            _populateLB = [ _displayName, _price ];

            {
                
                _listbox lbAdd _x;
                
            } forEach _populateLB;```
tough abyss
#

this syntax

#

_listBox lbAdd _x;

#

requires an IDC.

#

in this form.

rotund cypress
#

oh

tough abyss
#

Number = lbAdd [idc, text]

rotund cypress
#

so normally it wouldnt require but in this case it does?

tough abyss
#

control lbAdd text

#

You'd have to use my method..

#

It's all really down to taste.

rotund cypress
#
private "_populateLB";
            _populateLB = [ _displayName, _price ];
            private _listbox = _display displayCtrl 9871;
            {

                _listbox lbAdd _x;

            } forEach _populateLB;```
tough abyss
#
private "_populateLB";
            _populateLB = [ _displayName, _price ];
            private _listbox = _display displayCtrl 9871;
            {

                _listbox lbAdd _x;

            } forEach _populateLB;
is the _displayName a string?
rotund cypress
#

yes

#

_price isnt

tough abyss
#

okay.

#

Inorder to create a conversion you need to convert it to strings.

rotund cypress
#

so str (_price)

tough abyss
#

both price and displayname need to be strings.

#

You'd need both if you wish to display both.

#

say.

rotund cypress
#

displayname is a string already

tough abyss
#

So concatonate them together.

rotund cypress
#

ok I know a simpler method now

tough abyss
#
(_displayName + str(_price) )?
#
private "_populateLB";
            _populateLB = [ _displayName, _price ];
            private _listbox = _display displayCtrl 9871;
            {

                _listbox lbAdd (_x select 0) + " " +  str((_x select 1)) ;
            } forEach _populateLB;
rotund cypress
#

            _listbox lbAdd _listBoxItem;```
tough abyss
#

You have to format price...

#

doing that ^

#

Doesn't work.

#
private _listBoxItem = format [ "%1 %2", _displayName, _price ];

            _listbox lbAdd _listBoxItem;
rotund cypress
#

oh yeah

tough abyss
#

That will work.

#

format is your friend.

#

str is actually faster

#
private _listBoxItem = str(_displayName + " " + _price); 

            _listbox lbAdd _listBoxItem;
rotund cypress
#

private _licenseEntry = [ "%1 (%2)", _displayName, toString ( _price ) ];?

tough abyss
#

No.

#

toString converts UTF-8 encoded numbers to a string

rotund cypress
#

oh ok

tough abyss
#

str() converts a type to a string

rotund cypress
#

btw, what is the two "" in your entry above?

tough abyss
#

so your price if it was a number.

rotund cypress
#

private _licenseEntry = [ "%1 (%2)", _displayName, str ( _price ) ]; That then?

tough abyss
#

toString would take the UTF-8 representation.

#

No...

#

facepalm && facedesk

rotund cypress
#

ok so this str(_displayName + " " + _price);

tough abyss
#

yes...

rotund cypress
#

But what is the + " " +?

tough abyss
#

string concatonation.

#
  • " " +
#

Adds a blank space between your two values

#

Aka readability?

rotund cypress
#

ah ok

#

So this? ``` private _licenseEntry = str ( _displayName + " " + (_price) );

        _listbox lbAdd _licenseEntry;```
#

Does that work?

#

So it will be name (price)

#

actually private _licenseEntry = str ( _displayName + " " + "(€" + _price + ")" );

tough abyss
#

Test it?

rotund cypress
#

Yeah Ill do that, but just if you knew already

tough abyss
#

Won't learn anything without testing.

rotund cypress
#

It's complaining about this line @tough abyss

#

_licenseEntry = str ( _displayName + " " + "(€" + _price + ")" );

#

Error Generic error in expression

#

I dont see any problem personally

jade abyss
#

_licenseEntry = str ( _displayName + " " + "(€" + _price + ")" ); <-- ffs is that?

#

Do it that way:

_licenseEntry  = format["%1 (€ %2 )", _displayName , _price  ];
rotund cypress
#

What I would do but GeekyGuy told me that doing str is faster

jade abyss
#

If, then its about 0,0000001s

#

+In your case... ffs... 4x +
That can't be faster than format

#

And another reason:
For the sake of readability

rotund cypress
#

yeah

tough abyss
#

@jade abyss Yeah it's dependent on the count strings

#

format ["%1"] etc.

#

< 3 strings.

#

use str()

#

3 strings

#

use format

#

But if you want readability as Dscha said @rotund cypress format is more readable.

jade abyss
#

diff 1ms? = Not worth the effort

tough abyss
#

With minor performance sacrifice.

thin pine
#

It's every programmer's own choice. But sometimes better readability > minor performance increase

jade abyss
#

"readability > minor performance increase" = pretty often, if you ask me.

thin pine
#

If this code is being used once upon executing an addAction then you should probably prioritize readability. If there's relatively-heavy code that is executed onEachFrame then any performance increase would be appreciated.

jade abyss
#

true true

tough abyss
#

All BMR's mod compatability is a pain.

#

:/

tough abyss
#

Wow.

#

Thats a significant performance improvement moving everything into the cfgFunctions.hpp

tough abyss
#

Is there a way to check a name of a player and compare it with another checked name and if they are the same run a script?
Something like, this ofcourse doesn't work.

if (activatedPlayer isEqualTo name activatedPlayer) then{```
cerulean whale
#

Hey, what is the background colour for invisible buttons in the GUI editor?

jade abyss
#

[0,0,0,0]

#

or [1,1,1,0]

#

or [0.1,0.1,0.1,0]

#

or [0.2,0.2,0.2,0]

#

etc. blablub

tough abyss
#

the general encoding pattern is this

#

[r,g,b,a] or [red,green,blue,alpha (transparency)];

#

@cerulean whale

cerulean whale
#

Thanks @jade abyss @tough abyss

tough abyss
#

all if not everything in arma uses that syntax.

#

Hm.

#

can create structs in SQF.

modern sand
#

Not to be a bother, but does anyone have a defines.hpp that has everything configured?

tough abyss
#

What common types ?

#

and their respective variables?

modern sand
#

what do you mean?

tough abyss
#

Something like this?

modern sand
#

Let me have a check

tough abyss
#

Getting the base classes

#

is pretty easy.

#

Just use the GUI editor.

#

and export them copy / paste

modern sand
#

oh is that how you do it?

tough abyss
#

Yes.

#

This is the root classes

#

Mind unhighlighting

#

Can't see anything.

modern sand
#

There

#

that's it

#

πŸ˜ƒ

#

thanks

tough abyss
#

Yep thats all the base classes

#

The one in codeShare now.

#

Try to make your objects

#

inherit from those as base classes

#

so MyRscText : RscText

modern sand
#

Ahh

#

ok

#

πŸ˜ƒ

tough abyss
#

A lot of people say NNOOOO DO IT your own way.

#

Bad things happen.

cerulean whale
#

I did the [0,0,0,0] and it is hovering in and out (transparent, then black) even though this is in the dialog: ```SQF
colorText[] = {0,0,0,0};
colorBackground[] = {0,0,0,0};
colorActive[] = {0,0,0,0};

#

Anyone got an idea?

jade abyss
#

Cause its active

cerulean whale
#

How do I make it not get assigned as active when you first open the dialog?

jade abyss
#

I know there was something in the config, but its too long ago, can't remember

cerulean whale
#

Thanks for trying to help anyway man. I just thought the 'colour active' thing would fix it xD

#

I've fixed it

#

just a ton of extra stuff

jade abyss
#

What about: Write it down here quick?

cerulean whale
#

I reasoned! It must be something to do with colors! xD

#
colorText[] = {0,0,0,0};
            colorBackground[] = {0,0,0,0};
            colorActive[] = {0,0,0,0};
            colorBackgroundActive[] = {0,0,0,0};
            colorBackgroundDisabled[] = {0,0,0,0};
            colorDisabled[] = {0,0,0,0};
            colorFocused[] = {0,0,0,0};
              colorShadow[] = {0,0,0,0};
               colorBorder[] = {0,0,0,0};
#

I just found all the colour options and did that

#

haha

jade abyss
#

colorFocused[] =

cerulean whale
#

xD

#

^^

#

I saw something here about it the other day but can't remember it, how do I make an RscEdit multiline? I know it is something like 'ST_MULTI', but I don't know where to declare.

modern sand
#

Anyone know why my picture that I'm trying to add to my dialog is grey instead of it's actual colour? (blue & white)

jade abyss
#

no Color assigned?

modern sand
#

How do I do that?

modern sand
#

Wait, Nevermind, it's only that colour in the gui editor, and not when you actually open the dialog.

wary musk
#

hi guys i need some help in scripting. i want to create an ai taxi service in altis life can someone assist me please

meager granite
#

No one will write it for you, you need to do it yourself and ask how to solve specific problems

wary musk
#

then where can i find some tutorials to assist. im a freshy when it comes to scripting

tough abyss
#

@meager granite exactly.

tough abyss
#
_newObject = createVehicle ['Intel_File1_F', [4972.57,2999.52,2.71797e-005], [], 0, 'CAN_COLLIDE'];
_newObject setPosASL [4972.58,2999.51,2.58749];
 
_newObject setVectorDirAndUp [[0,0.999988,0.00497941], [-0.00248975,-0.0049794,0.999985]];
 

_newObject enableSimulation false;
 

_newObject = createVehicle ['Land_Map_F', [4972.75,2999.56,0.0118964], [], 0, 'CAN_COLLIDE'];

_newObject setPosASL [4972.75,2999.56,2.60002];
 
_newObject setVectorDirAndUp [[0,1,0], [0,0,1]];
 
_newObject enableSimulation false;


_newObject = createVehicle ['Land_Document_01_F', [4972.9,2999.43,-0.000119925], [], 0, 'CAN_COLLIDE'];
_newObject setPosASL [4972.9,2999.43,2.58774];
 
_newObject setVectorDirAndUp [[0.441818,0.897088,0.00556706], [-0.00248975,-0.0049794,0.999985]];
_newObject enableSimulation false;


hint "Intel is given to the HQ"
}else{
hint "Move back and let the person who took the intel to place it"
};```it works but weird .-.
I took the intel and it gives me the else
anybody knows why?
digital pulsar
#

What is activatedPlayer

tough abyss
#

@Foley#1330 ```if ((typeOf player) isEqualTo 'uns_US_1ID_PL' || (typeOf player) isEqualTo 'uns_US_1ID_RTO' || (typeOf player) isEqualTo 'uns_US_1ID_SL') then{

deleteVehicle intel1; deleteVehicle intel2; deleteVehicle intel3;

table addAction ["Place Intel", "mission_scripts\intel\placeIntel.sqf"];
activatedPlayer = _this select 1;
hint format ["%1 took the intel",name activatedPlayer];

}else{

hint "Only commanders or radio operators can take the intel!"
};```

tough abyss
#

O_O

#

Monolithic code...

#

@tough abyss what does that mean?

#

Code thats a big slab I can't determine what is what

#

@tough abyss better now?

austere hawk
#

I have a problem with

                        if (!(_unit==objNull)) then {
                            diag_log ["Fire: crew found:",_unit,"for Hitpoint",_x,"receives fire damage"];
                        };
#

i get as result when the function doesnt return the correct value ["Fire: crew found:",<NULL-object>,"for Hitpoint","hitcrewgunner02","receives fire damage"] so the check does seem to be wrong... How would i have to write the check to recognize the <NULL-object> as non valid?

tough abyss
#

@austere hawk

_unit = [_vehicle,_affectedHitClass] call k40_fnc_damage_findcrew;
                 if (!(_unit==objNull)) then {
                 diag_log ["Fire: crew found:",_unit,"for Hitpoint",_x,"receives fire damage"];
                        };
#

_x is undefined this is why

#

you need to loop through _x

austere hawk
#

this is not the issue (as you can see from the output, it is defined ), i loop through it - i just pasted the section that contains the error

#

i just didnt want to paste the whole clump of script

thin pine
#

Use isNull check

austere hawk
#

thanks

dim owl
#

hey how can i disable this screen ? i own all dlcs

thin pine
#

@dim owl pitchforks and torches marching to bohemia HQ would be an option

quiet bluff
#

can i check if someone have marksman DLC and if "true" it will give spcific loadout

tough abyss
#

@quiet bluff if (332350 in (getDLCs 1)) then { hint "You own the Markman DLC!" }else{ hint"You don't own the Marksman DLC!" };

quiet bluff
#

in the init of the role?

little eagle
chilly surge
#

Hello, so I was wondering if there is a script/mod where you can here a warning sound in a jet or helicopter when you are getting locked? The Vanilla warning sound is too short, when flying low and sometimes to quiet. I was thinking about a warning sound, when a Anti-Air is getting locked on your ass. Any suggetions?

little eagle
#

Doubt it. If you make a mod you can replace the sounds though.

#

You could script a sound when a missile locked on you is fired though.

nocturne bluff
#

Dear god commy

chilly surge
#

@little eagle there is already a warning sound for a missile which is in the air. I would like to have a sound which is being played when a AI is locking on to you.

little eagle
#

Yes, but there is no way to script that.

#

What's up, Putinhead?

tacit grove
#

Anyone think they could help me geting a Supply Drop crate to have what I want in it? I've got all the classnames and stuff but of course somewhere along the line i have something wrong so it's not working.

tough abyss
#

@tacit grove if you post the script here (pastebin or something) im sure someone here can help

tacit grove
#

What I have is here. http://pastebin.com/rjC9Cq9R Beyond that I'm lost. I made a resupply.sqf so I could just execute the script in the "Crate Init" line of the supply drop but like I said, totally lost. 😦

#

Oh and it needs to work in MP. JIP doesn't matter as everyone will be in at the start

#

if it's easier to just have the Virtual Arsenal in the box I'm TOTALLY fine with that too. But that's something I couldn't get to work for anyone else but myself, the host.

indigo snow
#

what is this

tacit grove
#

idk man. All I know is what google tells me and that's where it's taken me and why i'm here asking for help now lol

indigo snow
#

what im saying is that this is likely undefined in the scope where you execute the script

#

you need to pass a reference to the actual box/crate object

tacit grove
#

And how would I do that

#

literally don't know what I'm doing here other than i want a supply drop crate with that stuff in it

digital pulsar
#

Paste that into init line of tge crate

#

Then this is the crate

#

Also u missed a bunch of ; u need it at the end of each line

tacit grove
#

It's a supply drop provider module which has it's own init field along with a "cate init" field. I assumed i put it in the "Crate init" part it hasn't been working for me

digital pulsar
#

Logically that should be the right field

tacit grove
#

I'll add those in. must've missed them while copy pasting all that over and over again.

digital pulsar
#

Any errors?

tacit grove
#

yea it was always something about |#|

digital pulsar
#

What exactly

tacit grove
#

Let me do it right quicka nd ill screenshot that

digital pulsar
#

And also what ends up being in the crate

tacit grove
#

Just the default stuff. Couple MX rifles, PCML, FAKs, nades. etc

#

it's never even shown up emptied

digital pulsar
#

That indicates the script wasnt run at all

tacit grove
#

right that's when I decided to try and make the resupply.sqf and then just put [[this] exec "scripts\resupply.sqf" but that didn't give me any luck either although that was a LONG shot from something I saw online

indigo snow
#

thats actually somewhat going in the right direction

digital pulsar
#

Try without execvm just paste it

tacit grove
#

Going to paste in raw code now and see what the exact error message is

indigo snow
#

[this] > this , exec > execVM, and then change all the this in the script to _this would be the general fix

digital pulsar
#

Myeah better not bother with that and just paste

#

Remember about ;

indigo snow
#

hah didnt even notice that

tacit grove
#

Undefined variable in expression: this

digital pulsar
#

Show that module in editor too

#

Mb it doesnt work like we would assume

tacit grove
digital pulsar
#

Looks pretty logical to me but thats the thing with custom modded modules, better check the documentation of that addon

#

Or is it vanilla plz say no

tacit grove
#

that's a vanilla module

#

0 mods being used

#

Bout as vanilla of a mission as you can get haha. no other scripts or anything

digital pulsar
#

Add _ in front of this so u get _this and see what happens

#

Im on mobile so i cant check if there is any useful tooltip they usually mention local vars there

tacit grove
#

add it infront of every single this i'm guessing?

digital pulsar
#

Try a few first occurences see what eror u get

indigo snow
#

your syntax is all wrong it seems

#

but check the tooltip if it mentions local variables first

digital pulsar
#

Nah dont bother with exec for now

indigo snow
#

bother with it never

#

exec is SQS

digital pulsar
#

I said that 1 min ago man :D

tacit grove
#

as in my sqf needs to be a sqs? yall making me feel dumb at this piont haha

indigo snow
#

youre in over your head a bit, you have small mistakes everywhere. but i get two people trying to help is confusing so ill shut up for a bit

digital pulsar
#

Thats whyvu shouldnt bother with exec now coz u create 2 problems instead of 1

#

Im half drunk and without access to pc nick dont leave me aloneee

tacit grove
#

oh praise jesus it worked after adding _ before this. I did that last night but since I was missin gthose ; it still wasn't working. Now the question of will everyone else see that gear in the supply drop too?

digital pulsar
#

I think so coz u used global commands

tacit grove
#

That's what I was hoping global meant

digital pulsar
#

U gotta make sure that gets executed on server only or u may end up with duplicates

tacit grove
#

how do I go about that

digital pulsar
#

And this is where @cptnnick takes over coz i havent used modles since arrowhead

#

If (isserver) then {your code}; i guess

tacit grove
#

you sure? Bohemia surely doesn't change any back end stuff every few months to where things you used to know is outdated right?!?! πŸ˜‚

digital pulsar
#

Thats extra challenge scripting cant be easy

#

Thing is un arrowhead i didnt know what locality is

indigo snow
#

if !isServer exithWith {} at the top of your script file

digital pulsar
#

Parentgesis around condition optional these days nick?

indigo snow
#

always were

digital pulsar
#

Cool

#

Then too?

tacit grove
#

nick you lost me with that 😦 It worked while just pasting the code in the crate init field so I dont have a actual script file

digital pulsar
#

Ah wait its exitwith

indigo snow
#

you gotta wrap it then

#

if isServer then { ... YOUR CODE ... };

digital pulsar
#

Trust my method im totakky sober

#

Ye that one

tacit grove
#

awesome I'll throw that in there right now and hope nothing breaks :p

#

Do you guys have any idea why whenever I have a vehicle with my own list of gear in them that me and my guys can never put things INTO the vehicle? Is it just a matter of me putting too much in it to where it's not allowing any more gear to be added?

#

not too important just another odd thing i've always ran into

indigo snow
#

its probably too full

digital pulsar
#

+1

tacit grove
#

Alright yea i sorta figured :p I have no limits when I start adding stuf fin there ha

indigo snow
#

arma can be really shitty with moving items around in MP too, so cant say for sure

#

youre in good luck since the cargo variety of commands allow for overfilling

digital pulsar
#

U loading enough weapons for the entire platoon?

tacit grove
#

I do add quite a bit yea lol

digital pulsar
#

Mb virtual arsenal is the sokution

tacit grove
#

certainly not EVERYTHING, i'm not a fan of any weapons outside of what they added with apex

digital pulsar
#

Solutiob

#

Solution

#

Damn android tiny keyboard

tacit grove
#

Yea VAS would be nice but i couldn't get it to work for everyone. but maybe i just need to add the code within the code you and nick just gave me

digital pulsar
#

U can limit which classes players can pick up in arsenal but not the quantity

#

I had a script with presets somewhere..

#

Vas is gotta be executed everywhere locally if i remember correctly

tacit grove
#

Yea locallity stuff has put out my fire quite a few times before trust me 😦

#

Ruined a nice HALO jump start to the mission because it wouldn't put backpacks back onto people's backs once they hit the ground. Only would work for me

digital pulsar
#

Aye rule number one of scripting multiplayer: locality is a bit..

tacit grove
#

Yea i just try to avoid it anymore. Just end up spending hours on it just to end up throwing it out anyway

digital pulsar
#

Shove stuff into vests thats more authentic

tacit grove
#

LOL yea my sweet HALO jump start turned into just starting on the beach. Then this supply drop issue had me to the point of ok we're starting on the beach with boats parked on the beach full of gear haha

#

by that point it pulls me out of the immersion and just screams hey, this is a game

digital pulsar
#

Myeah u gotta strike the balance but thats a tad off topic of scripting :)

tacit grove
#

For sure, well if you and nick ever need some help with design let me know. I owe you two for the help! If I find out things broke in MP i will surelly come knocking πŸ˜„

digital pulsar
#

Glad to help, mate

manic sigil
#

Im trying to get a hintbox to update with a looping script, for a percentile completion counter and such. My issue is, it works, but only with a While-Do loop and sleep 1;, leading to very static changes - if you're adjustinfmg too fast, you can overshoot. However, reducing the sleep or removing it makes it add up the completion counter as fast as it possibly can, with bad visual effects.

#

Im not sure exactly what Im asking, but for perhaps some way to have a less than 1 sleep scale, or have part of a while-do loop run at real time while another part has a sleep function.

manic sigil
#

Like, embedding a for "_i" from 1 to 1000000 step 100 inside a while loop... does that even work?

halcyon crypt
#

the only way to make the process "smooth" (smooth as in ACE's bandaging progress bar thing) is to know how long it takes beforehand

tough abyss
#

@tacit grove [player] call BIS_fnc_halo;

#

then.

#

iconIdle = "A3\Ui_f\data\IGUI\Cfg\HoldActions\idle\idle_0_ca.paa";
iconProgress = "a3\ui_f\data\map\vehicleicons\iconparachute_ca.paa";
dropString = "Halo drop";
dropStringVeh = "Initiate Halo jump";
actionID = [_object,
    dropString,
    iconIdle,
    iconProgress,
    "true",
    "true",
    {},
    {},
    {
        [(_this select 0)] call BIS_fnc_halo;
    },
    {},
    [player],
    4,
    5,
    false,
    false] call BIS_fnc_holdActionAdd;
#

Yes that is the endgame addAction.

#

@tacit grove

#

O_o

#

STHUD is being intergrated into arma 3...

digital pulsar
#

@manic sigil show us the code and specify what kind of "bad visual effects" you want to avoid

#

maybe all u need is rounding, I'm guessing

tough abyss
#

@manic sigil Sounds computationally expensive and infeasible.

tough abyss
#

How can I can I retrive the FPS from a client add it to an array then push that FPS message back to the server?

#

from allPlayers?

#

Only waiting diag_fps to run on a single client at a time.

#

then add the data to an array

#

thats sent back to the server.

dusk sage
#

I think you half answered your own question

#

And you trying to work out how to send data from the client to server? @tough abyss

tough abyss
#

Yes

#

It's for mission framework diagnostics

#

So I can see everyone who's connected frame-rate.

#

So I can better identify problems

dusk sage
#

The quickest method may be using a PVEH

#

For minimal overhead

tough abyss
#

Whats the likely hood I run a script on the client

#

that sends to the server and the order of that data I got from the client?

#

Is different ?

dusk sage
#

I'm slightly confused by the question

#

that sends to the server and the order of that data I got from the client?

#

πŸ€” ?

tough abyss
#

With multiple clients and remoteExec'ing

#

what order will my Client name / Client FPS list come through in?

dusk sage
#

Oh I see so

#
Client 1 RE
Client 2 RE
#

You're asking if it is received in the same order?

tough abyss
#

Yes and their names

dusk sage
#

By time

tough abyss
#
params ["_player"];
while {true} do {
    _msg = format ["Player: %1 FPS: %2",name (player),round(diag_fps)];
    _msg remoteExec ["Svnth_fn_logClientFPS",2,false]; 
    sleep 1; 
    };
#

Runs on the clients checking every so often

#

sends a message to the server

#

containing 1 client

#

server then pushBack on a client array

#

and the server displays client FPS to diag_log

#

with a format of Players Name, Players : FPS

dusk sage
#

So then what are you asking about order?

#

If two clients RE'd, would they be received in order by the server?

tough abyss
#

Ah right.

dusk sage
#

If two clients RE'd 1 second apart

#

There is still no guarantee client 1's data would be received first

tough abyss
#

All I need is clients name and FPS added to the server in he format of this.

#

[Player: Mr.Bob, FPS: 40];

#

For all connected clients every certain seconds to the server.

dusk sage
#

Then keep an array server side like so:

[[name, fps], [name, fps], ..., [name, fps]]
#

Update as needed

tough abyss
#

Needs to be global?

#

The array?

dusk sage
#

Just serverside

tough abyss
#

which is global.

#

MissionNameSpace ?

#
params ["_msg"];
clientFPS = [];
clientFPS pushBack _msg;
diag_log format ["%1",clientFPS];
dusk sage
#

Oh, indeed, you could keep it global if you wished

tough abyss
#

Thats the function.

#

That recieves the message server-side

dusk sage
#

Hm, it doesn't seem wise to diag_log it every time

tough abyss
#

What would be better?

dusk sage
#

log it every X seconds

#

Or you're going to get a log every single player update, which could be say, 50 in a second

tough abyss
#
params ["_player"];
while {true} do {
    _msg = format ["Player: %1 FPS: %2",name (player),round(diag_fps)];
    _msg remoteExec ["Svnth_fn_logClientFPS",2,false]; 
    sleep 1; 
    };
#

So should I keep that?

dusk sage
#

I would use a PVEH instead

#

Less overhead

tough abyss
#

Thought PVEH were obsolete?

dusk sage
#

Since when πŸ˜„ ?

tough abyss
#

since remoteExec ?

dusk sage
#

BIS_fnc_mp is

jade abyss
#

yep

dusk sage
#

PVEH and RE are two totally different things

tough abyss
#

?

#

Explain?

dusk sage
#

Is a totally different thing to remoteExec

tough abyss
#

so use PublicVariableServer ?

#

and an publicVariableEH on the server-side?

dusk sage
jade abyss
#

BoGuu, not 100% true.
You can achieve the same result with RE(C).

dusk sage
#

so use PublicVariableServer ? and an publicVariableEH on the server-side?
yes

#

Of course you can

jade abyss
#

+advantage of REC -> Instant

#

Instead of PVS/PVC, that can cause a delay on heavy serverload

dusk sage
#

But that doesn't take away from the fact they are quite the opposites in nature

#

Then you introduce things like whitelisting

#

And RE starts to become not so favourable

jade abyss
#

Why?
I never had probs with it oO

dusk sage
#

Can't remember exactly who did the calculations on it

#

But when introducing white listing w/ RE, there was a massive overhead

jade abyss
#

Would be good to have, cause everything i hear constantly is complaining about RE(C) and that its slow/crap/whatever, but no proof of it^^

tough abyss
#

O_O

dusk sage
#

I love RE, but I just feel for something like updating a variable, PVEH is the way to go

jade abyss
#

Yep, true

dusk sage
#

But hey, like with anything ARMA, who knows. Might be best to run some tests @tough abyss

tough abyss
#

Does A PVEH?

#

Fire on a listen server?

#

with PublicVariableServer ?

jade abyss
#

Should

tough abyss
#

@dusk sage Any particular reason this floods the scheduler ?

 params ["_msg"];
"Clientmsg" addPublicVariableEventHandler {
hndle = [] spawn {
    clientFPS pushBack (_this select 1);
    diag_log format ["%1",clientFPS];
    waitUntil {sleep 60};
    };
};
#

even with the sleep it floods the scheduler.

#

why?

dusk sage
#

Well it's opening a pseudo-thread for 60 seconds everytime it fires

tough abyss
#
params ["_player"];
handle = [] spawn {
while {true} do {
    Clientmsg = format ["Player: %1 FPS: %2",name (player),round(diag_fps)];
    publicVariableServer "Clientmsg";
        };    
        sleep 10;
    };
#

But I slow it down ?

dusk sage
#

So you're opening a thread every 10 seconds

#

and only disposing of it every 60

#

So you'll -> inf

tough abyss
#

How could I fix it?

dusk sage
#

Well, don't use spawn, or the waitUntil

#

I'm not sure why you are

#

Also

#

waitUntil {sleep 60};

tough abyss
#

on the client component?

#

or server?

dusk sage
#

Server

jade abyss
#

the whole script makes no sense

#

What you do is:
You add every 60s a new entry to the clientFPS array, every 60s you print the whole Array to the logfiles, then you do a waituntil with a sleep inside it confused

tough abyss
#

My assumption was the sleep would make the script suspend.

#

for x seconds

dusk sage
#

Well, no need for the waitUntil for that

#

But why are you suspending it

#

You are creating a new 'thread' every time it fires

tough abyss
#

To output it to the rpt on the server-side

dusk sage
#

So you're suspending something that no longer does anything πŸ˜›

jade abyss
#

☝

#

+again:

What you do is:
You add every 60s a new entry to the clientFPS array, every 60s you print the whole Array to the logfiles, then you do a waituntil with a sleep inside it confused```
dusk sage
#
handle = [] spawn {
    while {true} do {
        sleep 60;
        diag_log clientFPS;
    };
};
"Clientmsg" addPublicVariableEventHandler {
    //replace clients fps in clientFPS array
};
#

Is more what you're looking for

jade abyss
#

str not needed with diag_log

dusk sage
#

clientFPS is an array

jade abyss
#

Yerp

dusk sage
#

or does diag_log do anything

jade abyss
#

iirc yeah

dusk sage
#

neat

jade abyss
#

systemchat and hint was str

#

at least... thats what i remember, can you test it? πŸ˜„

#

I am not 100% sure anymore^^

dusk sage
#

anything: Anything -

#

πŸ‘

jade abyss
#

No str πŸ˜„

tough abyss
#

Yeah I was assuming something did something else

#

I got any back.

dusk sage
#

I would do something like this

tough abyss
#

See I was assuming certain things about how the PublicVariableEH worked

#

and assumed I needed to sleep on the server-side as well as the client.

jade abyss
#

why pushback?!

tough abyss
#

To display a big array of data?

jade abyss
#

clientFPS will endup like [_name, _fps],[_name, _fps],[_name, _fps],[_name, _fps],[_name, _fps],[_name, _fps],[_name, _fps],[_name, _fps],[_name, _fps],[_name, _fps],[_name, _fps],[_name, _fps],[_name, _fps]

#

after 2min

#

*1000

tough abyss
#

Thats what I thought.

#

But how can I build a single array

#

with all the players name.

#

and fps then dump it to the rpt.

dusk sage
#

@jade abyss Depends how many players join

#

I'd imagine he's not going for 100 player missions

#

But either way, would be easy to implement something to clear out offline people

jade abyss
#

pushback = add a new entry after the l ast one

dusk sage
#

Indeed, pushBack if they aren't already in the array @jade abyss

#

Which is only logical

#

UID would be a good thing yeah

#

Them DND

#

There is lots you could do, but that is the basic implementation he wanted

#

But how can I build a single array with all the players name. and fps then dump it to the rpt.
That's what it'll do @tough abyss

#

Then the people with crappy PCs will ruin the fun!

#

πŸ‘Ž

tough abyss
#

It's not crappy computers I want.

#

It's general client fps across each client.

#

Thats just a padding check isn't it @dusk sage
Filtering task.

dusk sage
#

It checks whether they are already present in the array, and if not, add them

tough abyss
#

Yeah filtering task

#

can use BIS_fnc_findDeep;

dusk sage
#

Obviously if you had 100 people leave and join, they'd all still be present, but you can sort something out for that

tough abyss
#

Just add a handle disconnect

#

so when they leave removes the index

dusk sage
#

More than likely, but the BIS functions usually have unneeded overhead

#

Indeed, yeh

#

You need to be careful with race conditions though

#

deleting an index will cause the behaviour of the PVEH to be undefined

tough abyss
#

Why?

dusk sage
#

If you delete an element between finding the index and using set, you'd run into a race condition

#

Then again, I haven't considered the linear nature of the execution

tough abyss
#

How to get all the doors of a house?

native hemlock
modern sand
#

Hey guys how would I go about creating local 3D markers?

tough abyss
#

@native hemlock thanks, what is the difference of "Door_1" and "Door_Handle_1"?

#

Velk something...

#

Since i need to do that for CUP maps also.

dusk sage
#

One is a door, the other is the handle πŸ˜„

tough abyss
#

Thanks.

tough abyss
#

Now I need to write a script that picks up duplicated entries.

#

removes them then replaces them.

#

Success the array data now works

#

Now to have code that looks for the first element of the nested array if it matches replace it.

jade abyss
#

forEach? Something like this:
select 0 isEqualTo _Data select 0
->
clientFPS set[_forEachIndex,_Data select 1];

tough abyss
#

yeah

#

problem is I need to store the previous value

#

and compare it to the new one.

#

Not sure how to do that.

jade abyss
#

Take the one a compare it to eachother?! At the same moment?

#

I won't write the whole code for you, just 4 info

tough abyss
#

I know.

#

I haven't done a lot of work with data-structures

jade abyss
#

Then learn it

tough abyss
#

Arrays being bread and butter.

jade abyss
#

Play around in the editor

#

console, done. Thats how i learned it.

tough abyss
#

Yeah. True.

#

I'll look up all the array commands

#

So find also doesn't work the way I thought it did.

#

Thats why the findDeep exists.

#

find can't nested search.

dusk sage
#

I gave you the code already @tough abyss

#

That will search nested arrays

#

πŸ˜›

tough abyss
#

Any way to know if a house door is internal or not?

#

@dusk sage I don't like to copy paste.

#

I like to understand it.

dusk sage
#

You should take a look at the function and build on it

#

It's one of the only ways to do such a thing

#

So best to learn πŸ‘

tough abyss
#

Only objects can be null?

dusk sage
#

There are lots of kinds of null

tough abyss
#

Ah thanks.

#

I'm working on zombies spawn, and one of the things you can do to avoid zombies is enter in a house and close all doors.

#

Internal doors are not really needed to be closed in my concept, but sadlly i can't find a way to detect if a door is internal or not.

#

So right now a player need to close all house doors, including internal doors, to be protected from zombies.

#

Any help in detecting internal doors (even not performance wise ones!) is apreciated.

#

Even to create a catalog of all internal and external doors of each house is hard, i have no clue other than look my self at each building and make the catalog.

#

@dusk sage can you help me πŸ˜›

dusk sage
#

Only thing I can think of

#

That will give you the relative position to the model

tough abyss
#

Nice! this helps a lot.

dusk sage
#

To check

tough abyss
#

Now i can, may be, check the door distance to the bounding box.

dusk sage
#

yep

tough abyss
#

Thanks a lot!

dusk sage
#

Welcome. I'm sure there is a better way, but I've never played around with that stuff too much πŸ˜‰

tough abyss
#

@dusk sage here the code: ```_selectionPos = _house selectionPosition _doorSelection;
_sPX = _selectionPos select 0;
_sPY = _selectionPos select 1;

_bbox = boundingBoxReal _house;
_x1 = _bbox select 0 select 0;
_x2 = _bbox select 1 select 0;
_y1 = _bbox select 0 select 1;
_y2 = _bbox select 1 select 1;

_dist = abs(_sPX - _x1) min abs(_sPX - _x2) min abs(_sPY - _y1) min abs(_sPY - _y2);

#

It get the door distance to the real bounding box.

#

The only bad are the stairs that extend the bounding box on its side.

tough abyss
#

HELP: is there any way to get the selection of a animation?

#

For example, there is a door i can animate with _house animate ['Door_1_rot',1]How can i get the selection of "Door_1_rot" so i can get its position with selectionPosition?

tough abyss
#

@tough abyss Bad variable names. No explaining comments

#

It makes it a headache for you.

thin pine
#

Hey guys, what functions do you use to select the closest object from a _pos?

tough abyss
#

Closest specific object?

thin pine
#

array with 100 objects. pick closest to player.

#

specific objects yes*

#

obviously theres nearestObjects

tough abyss
#

nearestObject ?

thin pine
#

a custom array of objects

#

that have a variable set for instance

tough abyss
#

code ?

thin pine
#

1 sec

#

My reasoning for asking is because I wrote a function a few minutes ago that I found takes almost half the speed of other functions I found so I just wanted to share it

#

in case anyone has a better function i'd love to see it

#
_closestIdx = (_distArray find (selectMin _distArray));
_closestObject = ArrayOfObjects select _closestIdx;
#

if anyone finds it useful anyway. I hope it is πŸ˜ƒ

tough abyss
#

on a side note

#

I can give

{ 
_eachItem = _x;
hint format ["%1",_eachItem];
} forEach allPlayers;
{ 
hint format ["%1",_x];
} forEach allPlayers;

magic variable more meaningful name

#

minuet difference with forEach _x on it's own

#

0.0009 seconds difference

#

eh commenting the code might be easier.

thin pine
#

it helps with very big foreach loops or foreach loops within foreach loops iirc

tough abyss
#

forEaches within forEaches

#

they're not advised much in SQF

#

they are performance hogs

thin pine
tough abyss
#

yes

thin pine
#

In that case I agree yeah.

tough abyss
#

Debugging loops in ArmA 3 are annoying.

#

Really annoying.

modern sand
#

How would I go on making local 3DMarkers?

jade abyss
#

Editor would be a good start.

modern sand
#

Sorry I was stupid asking that, I ment to ask how would I make a script that made local 3DMarkers?

#

That was actually visible when running around and not in the map (m)

indigo snow
#

there's the drawIcon3D command for you

modern sand
#

okay thank you very much πŸ˜ƒ

nocturne bluff
#

That optimization tip is a bit wonky.

little eagle
#

Not nesting forEach?

#

I always thought that is a weird tip. It's something they told me in my one programming class too and I always thought it was stupid.

loud sorrel
#

hey, is there somebody around who scripted withe ace3 already? I'd like to add some actions to a object and want to place the interactionpoints relative to the object. should not that be able with :

#

_action = ["build","build","",{hint "raise"},{true},{},[_obj,_raise,0.2],[0,0,1],3] call ace_interact_menu_fnc_createAction;
[_obj,0,["ACE_MainActions"],_action] call ace_interact_menu_fnc_addActionToObject;

#

[0,0,1], 3 in the first function should set the interactionpoint 1m higher then normal and "3" should allow you to stand 3m away, but it doesnt change anything

little eagle
#

because you add a subaction to "ACE_MainActions"

#

of course it will be inside that point

#

try [] instead of ["ACE_MainActions"]

loud sorrel
#

omg, i am too stupid.... THANKS @little eagle, youre awesome! works fine!

little eagle
#

thanks

#

yw

tough abyss
#

is this possible to sync two objects via a script

little eagle
#

define synch

tough abyss
#

like in the editor when you right click an object and select "connect" and then "sync to"

tough abyss
#

Is there a way to see what the current animation is?

#

for a unit\

open vigil
#

Animation viewer?

tough abyss
#

like if i use switchMove is there a way to see what animation is currently being player?

tough abyss
#

Another thing, (findDisplay 46) displayAddEventHandler ["KeyUp", {hint "test";}]; seems not to be executing the hint

#

KeyDown however is executing

sharp jay
#

How would i go about opening up a GUI i made in the GUI Editor. I saved it and put it into dialogs.hpp but i dont know how to open it in game.

tough abyss
#

createDialog

sharp jay
#

yes, but what is the name i need to put in?

#

createDialog dialogName

tough abyss
#

@GeekyGuy5401#9206 from the wiki: "Animation is defined in CfgModels Animations class of model.cfg or another model config". And this is the definition of an animation: class Animations { class Door_1_rot { type = rotation; source = Door_1_source; selection = Door_1; axis = Door_1_axis; memory = 1; minValue = 0.1; maxValue = 1; angle0 = 0; angle1 = (rad 110); }; you see selection = Door_1

#

If i could access this, i can get the selection name of any animation, but i cant.

#

@sharp jay depends on the class. So createDialog class; i can send you my example if you want

sharp jay
#

Yes, thank you, that would be great @tough abyss

tough abyss
#

There are any problem related to setGroupOwner like lag, unit freeze, strange behaviour, temporary blindness? πŸ˜„

compact current
#

Anyone available to help a sec?

indigo snow
#

i only help minutes

compact current
#

RIP

#

xD

#

It says i have not defined the variables, A3PR_totalTime, and A3PR_selectionTime

#

its somthing to do with lines 118 and 121?

#

Wrong prefixes sorry _RPF

#

not _ rip

indigo snow
#

it means you havent given those variables a value by the time the script gets executed

#

they dont exist in the engine at that point

compact current
#

but they get defined before those lines ?

indigo snow
#

RPF_selectionTime = call compile lbData[1500, _index];

#

are you sure that doesnt return nil?

compact current
#

Shouldent do, because i was told its because i use lbsetData?

indigo snow
#

you're not sure, so you should check

compact current
#

Im completly mindFucked right now........

#

can i upload the test mission for it, and could you then have a look for me ?

indigo snow
#

no

compact current
#

Rip

cerulean whale
#

Does anyone know how to disable the cheat menu in ArmA?

#

Actually instead of that, does anyone know the keycode for '-' on the numpad?

tough abyss
#

@cerulean whale

manic sigil
#

Is it possible to do an if-AND-then statement? I'm trying to get a rolling counter based on direction, but can only get a basic idea down using two if-then statements outlining the outer limits.

rotund cypress
#

Is it possible to set a background of a RscActiveText?

#

With Style = ST_PICTURE

indigo snow
#

@manic sigil if (A && B) then { ... };

manic sigil
#

Would that work for if (_vector>270 && _vector<20) then... ?

indigo snow
#

if _vector is a number and not an array, sure

manic sigil
#

Alright, not that I didn't trust you, but wanted to ask before I cycled my map and tried the script again.

#

Okay, it didn't NOT work, but not working as expected.

#

if (_vector<20 && _vector>270) then
{
joy = "[<<<------]";
}
else
{
Complete = Complete+(rateadd/20);
joy = "[---<o>---]";
};

#

The idea being the hintbox displaying 'ANGLE' with a marker to turn towards, and the else/default being centered.

#

I tried using Switch do, but couldn't get it to work with (<20), etc.

halcyon crypt
#

so what isn't working as expected then?

#

oh lol

indigo snow
#

Should that be an OR

halcyon crypt
#

^

indigo snow
#

Or inverted greater than/lesser than signs

#

A value cant both be smaller than 20 AND larger than 270

manic sigil
#

Yeah, that's what I'm trying to wrap my head around - since it's using getdirrel, it's 0-359, rotating.

#

So it's supposed to be 'anywhere from front to left', while the other If statement is 'back to left' (160-270)

#

But yeah... or is probably better.

halcyon crypt
#

don't just guess it's better, you should actually understand why.. πŸ˜›

indigo snow
#

Well AND will plain not work :P

manic sigil
#

Eh, if I actually put THOUGHT into this, I'd probably abandon the project and do something else πŸ˜›

#

OR locked it into the second statement, so that's something at least.

#

if (_vector<20 || _vector>270) then
{
joy = "[<<<------]";
}
else
{
Complete = Complete+(rateadd/20);
joy = "[---<o>---]";
};

if (_vector>160 || _vector<270) then
{
joy = "[------>>>]";
}
else
{
Complete = Complete+(rateadd/20);
joy = "[---<o>---]";

indigo snow
#

The second one would always be true. Any number larger than 270 would also be larger than 160