#arma3_scripting
1 messages Β· Page 274 of 1
My only guess is that item cargo clear message arrives at wrong time thus doing nothing
Prowler just got supply dropped in. Whether it works in MP... TBD but either way huge thanks again you guys
Where do you call these 4 lines from? @tacit grove
iirc the ClearItemCargoGlobal bug still existed about 5-6 Month ago.
It existed since the moment they fixed it sometime during beta
Quiksilver, removing ANY Item from an Inventory.
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
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
I sure hope so. Brains been a knot from it the past couple days.
You can replace these "hardcoded" coordinates with some invisible marker placed in editor, would be easier to adjust mission than to copy paste numbers
I tried but it kept giving me an error code
if you post how you did it here we can help you
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
you didn't have to remove setPos, only coordinates
_prowler setPos getMakerPos "blah"
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
You mean like this:
_Unit = "Class" createVehicle [0,0,0];
_Unit moveIn* _Veh;
?
yeah, was just an example
@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
oO of course
extra variables to pad the script
("Class" createVehicle [0,0,0]) moveIn* _Veh;
variables, arrays, passes. Gibberish is gibberish haha.
He meant @tacit grove 's question, @little eagle
Sa-Matra is probably right, but I think we were talking about createUnit
Yes, it was an attempt at a joke
oh snap, right. CreateUnit
Yeah, just rechecked old files. CreateUnit was the right one. As Sa-Matra said, createVehicle shouldn't work.
I think variable naming like _prowler, _prowler2, _prowler3 is dumb
commy2 - Today at 1:37 AM
I think variable naming like _prowler, _prowler2, _prowler3 is dumb
π
Yo, I'm no variable
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
uniform is unit model
?
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.
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
looks like Hicks without a Neck. Wich is... awfull
Well you can create horror mission with 100s of these following you
+So it confirms -> Not rly usable for him, unless he wants to do a Jesus-Simulator.
one would be enough, tbh.
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?
animationSource etc?
Does it work with simple objects? Not sure.
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).
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?
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)
To know where vehicle contacts land, some vehicles have unreasonable bounding boxes and you can't rely on that
BoundingBoxReal is also bad? (never had probs with the height in it. Just the Radius was sometimes awkward)
Yep
So what is selection name for LandContact points? Is there any selections at all?
I guess not
Oh there is a way to hide selections: https://community.bistudio.com/wiki/hideSelection
Yep and to animate the Source.
Wheel LandContact Points = something like PPL,PPP iirc
how do I disable building destruction? I am using the liberation mod, and would like to disable building destruction
checked some of A2SM models, no selections in LandContact lod
allowDamage false in a foreach loop that checks object type from an array?
is there an array of all the buildings pre populated for a map?
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; };
@tough abyss Cool. THanks! so then I would loop in every object and set allowdamage to false. correct?
Got it. THanks a lot dude!
np
worldSize @tough abyss
@meager granite
MemoryLOD:
TrackFLL/BRR/FLR/ETC
Ah true. @dusk sage Didn't think that would work
Thats cool, didn't know about this sexy little script command
isTouchingGround.
Can use that in a paradrop script now.
@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
@tough abyss Look what I found: https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3
Hmm, I wonder would would be a quickiest way to check if entity is unit?
unit in allUnits?
Anything even quicker?
Single command preferably
No, entity can be man class but will not be a unit
do you mean a player?
No
Dead unit is not unit anymore (moveOut and lots of associated commands wouldn't work on it), createVehicle will not be unit
yeah ok, not sure then
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)
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
hm
Actually I think when unit gets removed from group is good indication that it stopped being unit
yeah just (isnull group entity) might be enough even
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
haven't tried, but looks like he just uses 'crew' and checks if they're alive
then use 'setpos' to move them out
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
don't know if he mentions dead vehicles
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
yeh ok.. i haven't tried it, but it looks like he implied it worked in 2015
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
yeh maybe dead vehicles can never delete stuff from proxies
even if the script tells it to
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
you tried hideObjectGlobal or hideBody ?
or you trying to move it out so you can access the body?
You know what, it works
moving to an alive vehicle first works?
The steps are following:
- Move dead unit from dead vehicle into alive vehicle with moveInAny
- Move alive invisible dummy unit into alive vehicle onto dead unit's seat
- 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
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.
@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?
Sort of, there are some differences
Including exploit I wouldn't want to share right now
Hey guys! Is there a way to check if a player is talking in direct without a while loop ?
@meager granite they can't exploit it if you utilise params
You can atleast lock down the data types you pass then.
how is the select 1 thing works with the addAction?
Can I do something like action select 1 = activatedPlayer
Elaborate?
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?
Thanks, i will try that
**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 **
No effect π¦
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
@dim owl iirc KillzoneKid had a thing with a UI EH that detects the microphone icon showing up, that might help you.
do you have a link ?
thx π
@tough abyss I dont want a while loop for a whole mission(roleplay life)
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.
Dist gets evaluated once so whatever distance there was at the beginning of the mission will stay in that variable
so I need a loop?
^^
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"?
Player distance player in SP is generally <= 6 unless you're spaced out on LSD
also triggers are typically evaluated on every connected client plus the server so keep that in mind as well
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.
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
Does that work in Arma's scripting language?
youd use a variable instead of typing f(x)
d = ...;
this is the quadratic function i think youre looking for
https://www.wolframalpha.com/input/?i=-(5%2F2500)(x-50)^2+%2B+5
c is the y offset of the curve, b the x offset, and a a scaling factor
Thanks. Been way too long since I've taken a math course >_<
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 π
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"
use format to put values into strings
btw heres a sample with a power 6 if you want it to flatten out: https://www.wolframalpha.com/input/?i=-(5%2F(15624999995))(x-50)%5E6+%2B+5,+with+x+from+0+to+100
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.
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.
post exact line
Complete = Complete+rate;
with rate being the complex math formula discussed prior, going from 0-5
and the error?
Just an undefined variable in expression error, pointed at the start of the second Complete.
Well you didn't initialize it then
Entirely likely... it is in an SQF, my prior experience was using it in a trigger in-editor.
To clarify; How would I initialize it? Setting up a "Complete = 0" line at mission start?
in init.sqf
Is this possible to make a unit spawn with an unloaded weapon?
thanks!
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?
That's one way to do it, yes
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.
@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.
if(isNil "Complete") then {Complete = 0;};
before the + line
or: Complete = (currentNamespace getVariable ["Complete", 0]) + rate;
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
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
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;
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.
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?
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.
Cheers, it seems it was easier than I thought. Just define your sound in description.ext and the playsound yoursound, execute it globally
Any good way to play an .ogv file on a television? I've seen a few from killzone.
Is it possible to use more than one variable with lbAdd?
So like _listBox lbAdd [_name, _number];?
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
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.
oh I see what you mean now
_1 = getNumber (whatever);
_2 = getText (whatever);
_items = [_1, _2];
{
_listbox lbAdd _x;
} foreach _items;```
{
_listbox lbAdd _x;
}
forEach _itemsAndControlIDs;
make the
_itemsAndControlIDS = [controlID,_itemName];
So will that what I wrote above then work?
yes
what do you mean by
_itemsAndControlIDS = [controlID,_itemName]; ?
the controlID also known as the IDC
stands for the control ID within the dialog.hpp file classes
idc = #####;
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.
private "_populateLB";
_populateLB = [ _displayName, _price ];
{
_listbox lbAdd _x;
} forEach _populateLB;```
oh
Number = lbAdd [idc, text]
so normally it wouldnt require but in this case it does?
private "_populateLB";
_populateLB = [ _displayName, _price ];
private _listbox = _display displayCtrl 9871;
{
_listbox lbAdd _x;
} forEach _populateLB;```
private "_populateLB";
_populateLB = [ _displayName, _price ];
private _listbox = _display displayCtrl 9871;
{
_listbox lbAdd _x;
} forEach _populateLB;
is the _displayName a string?
so str (_price)
both price and displayname need to be strings.
You'd need both if you wish to display both.
say.
displayname is a string already
So concatonate them together.
ok I know a simpler method now
(_displayName + str(_price) )?
private "_populateLB";
_populateLB = [ _displayName, _price ];
private _listbox = _display displayCtrl 9871;
{
_listbox lbAdd (_x select 0) + " " + str((_x select 1)) ;
} forEach _populateLB;
_listbox lbAdd _listBoxItem;```
You have to format price...
doing that ^
Doesn't work.
private _listBoxItem = format [ "%1 %2", _displayName, _price ];
_listbox lbAdd _listBoxItem;
oh yeah
That will work.
format is your friend.
str is actually faster
private _listBoxItem = str(_displayName + " " + _price);
_listbox lbAdd _listBoxItem;
private _licenseEntry = [ "%1 (%2)", _displayName, toString ( _price ) ];?
oh ok
str() converts a type to a string
btw, what is the two "" in your entry above?
so your price if it was a number.
private _licenseEntry = [ "%1 (%2)", _displayName, str ( _price ) ]; That then?
ok so this str(_displayName + " " + _price);
yes...
But what is the + " " +?
string concatonation.
- " " +
Adds a blank space between your two values
Aka readability?
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 + ")" );
Test it?
Yeah Ill do that, but just if you knew already
Won't learn anything without testing.
It's complaining about this line @tough abyss
_licenseEntry = str ( _displayName + " " + "(β¬" + _price + ")" );
Error Generic error in expression
I dont see any problem personally
_licenseEntry = str ( _displayName + " " + "(β¬" + _price + ")" ); <-- ffs is that?
Do it that way:
_licenseEntry = format["%1 (β¬ %2 )", _displayName , _price ];
What I would do but GeekyGuy told me that doing str is faster
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
yeah
@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.
diff 1ms? = Not worth the effort
With minor performance sacrifice.
It's every programmer's own choice. But sometimes better readability > minor performance increase
"readability > minor performance increase" = pretty often, if you ask me.
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.
true true
Wow.
Thats a significant performance improvement moving everything into the cfgFunctions.hpp
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{```
Hey, what is the background colour for invisible buttons in the GUI editor?
the general encoding pattern is this
[r,g,b,a] or [red,green,blue,alpha (transparency)];
@cerulean whale
Thanks @jade abyss @tough abyss
Not to be a bother, but does anyone have a defines.hpp that has everything configured?
what do you mean?
Let me have a check
Getting the base classes
is pretty easy.
Just use the GUI editor.
and export them copy / paste
oh is that how you do it?
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
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?
Cause its active
How do I make it not get assigned as active when you first open the dialog?
I know there was something in the config, but its too long ago, can't remember
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
What about: Write it down here quick?
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
colorFocused[] =
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.
Anyone know why my picture that I'm trying to add to my dialog is grey instead of it's actual colour? (blue & white)
no Color assigned?
How do I do that?
Wait, Nevermind, it's only that colour in the gui editor, and not when you actually open the dialog.
hi guys i need some help in scripting. i want to create an ai taxi service in altis life can someone assist me please
No one will write it for you, you need to do it yourself and ask how to solve specific problems
then where can i find some tutorials to assist. im a freshy when it comes to scripting
@meager granite exactly.
_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?
What is activatedPlayer
@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!"
};```
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?
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?
@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
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
Use isNull check
thanks
@dim owl pitchforks and torches marching to bohemia HQ would be an option
can i check if someone have marksman DLC and if "true" it will give spcific loadout
@quiet bluff if (332350 in (getDLCs 1)) then { hint "You own the Markman DLC!" }else{ hint"You don't own the Marksman DLC!" };
in the init of the role?
Hadouken
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?
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.
Dear god commy
@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.
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.
@tacit grove if you post the script here (pastebin or something) im sure someone here can help
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.
what is this
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
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
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
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
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
Logically that should be the right field
I'll add those in. must've missed them while copy pasting all that over and over again.
Any errors?
yea it was always something about |#|
What exactly
Let me do it right quicka nd ill screenshot that
And also what ends up being in the crate
Just the default stuff. Couple MX rifles, PCML, FAKs, nades. etc
it's never even shown up emptied
That indicates the script wasnt run at all
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
thats actually somewhat going in the right direction
Try without execvm just paste it
Going to paste in raw code now and see what the exact error message is
[this] > this , exec > execVM, and then change all the this in the script to _this would be the general fix
hah didnt even notice that
This is the module http://prntscr.com/dqbohs
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
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
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
add it infront of every single this i'm guessing?
@indigo snow this is the error when i try the scripting route http://prntscr.com/dqbr75
Try a few first occurences see what eror u get
your syntax is all wrong it seems
but check the tooltip if it mentions local variables first
Nah dont bother with exec for now
I said that 1 min ago man :D
as in my sqf needs to be a sqs? yall making me feel dumb at this piont haha
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
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
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?
I think so coz u used global commands
That's what I was hoping global meant
U gotta make sure that gets executed on server only or u may end up with duplicates
how do I go about that
And this is where @cptnnick takes over coz i havent used modles since arrowhead
If (isserver) then {your code}; i guess
you sure? Bohemia surely doesn't change any back end stuff every few months to where things you used to know is outdated right?!?! π
Thats extra challenge scripting cant be easy
Thing is un arrowhead i didnt know what locality is
if !isServer exithWith {} at the top of your script file
Parentgesis around condition optional these days nick?
always were
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
Ah wait its exitwith
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
its probably too full
+1
Alright yea i sorta figured :p I have no limits when I start adding stuf fin there ha
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
U loading enough weapons for the entire platoon?
I do add quite a bit yea lol
Mb virtual arsenal is the sokution
certainly not EVERYTHING, i'm not a fan of any weapons outside of what they added with apex
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
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
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
Aye rule number one of scripting multiplayer: locality is a bit..
Yea i just try to avoid it anymore. Just end up spending hours on it just to end up throwing it out anyway
Shove stuff into vests thats more authentic
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
Myeah u gotta strike the balance but thats a tad off topic of scripting :)
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 π
Glad to help, mate
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.
Like, embedding a for "_i" from 1 to 1000000 step 100 inside a while loop... does that even work?
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
@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...
@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
@manic sigil Sounds computationally expensive and infeasible.
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.
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
Yes
It's for mission framework diagnostics
So I can see everyone who's connected frame-rate.
So I can better identify problems
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 ?
I'm slightly confused by the question
that sends to the server and the order of that data I got from the client?
π€ ?
With multiple clients and remoteExec'ing
what order will my Client name / Client FPS list come through in?
Oh I see so
Client 1 RE
Client 2 RE
You're asking if it is received in the same order?
Yes and their names
By time
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
So then what are you asking about order?
If two clients RE'd, would they be received in order by the server?
Ah right.
If two clients RE'd 1 second apart
There is still no guarantee client 1's data would be received first
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.
Then keep an array server side like so:
[[name, fps], [name, fps], ..., [name, fps]]
Update as needed
Just serverside
which is global.
MissionNameSpace ?
params ["_msg"];
clientFPS = [];
clientFPS pushBack _msg;
diag_log format ["%1",clientFPS];
Oh, indeed, you could keep it global if you wished
Hm, it doesn't seem wise to diag_log it every time
What would be better?
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
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?
Thought PVEH were obsolete?
Since when π ?
since remoteExec ?
BIS_fnc_mp is
yep
PVEH and RE are two totally different things
However https://community.bistudio.com/wiki/BIS_fnc_MP is now obselete
BoGuu, not 100% true.
You can achieve the same result with RE(C).
so use PublicVariableServer ? and an publicVariableEH on the server-side?
yes
Of course you can
+advantage of REC -> Instant
Instead of PVS/PVC, that can cause a delay on heavy serverload
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
Why?
I never had probs with it oO
Can't remember exactly who did the calculations on it
But when introducing white listing w/ RE, there was a massive overhead
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^^
O_O
I love RE, but I just feel for something like updating a variable, PVEH is the way to go
Yep, true
But hey, like with anything ARMA, who knows. Might be best to run some tests @tough abyss
Should
@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?
Well it's opening a pseudo-thread for 60 seconds everytime it fires
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 ?
So you're opening a thread every 10 seconds
and only disposing of it every 60
So you'll -> inf
How could I fix it?
Well, don't use spawn, or the waitUntil
I'm not sure why you are
Also
waitUntil {sleep 60};
Server
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
Well, no need for the waitUntil for that
But why are you suspending it
You are creating a new 'thread' every time it fires
To output it to the rpt on the server-side
So you're suspending something that no longer does anything π
β
+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```
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
str not needed with diag_log
clientFPS is an array
Yerp
or does diag_log do anything
iirc yeah
neat
systemchat and hint was str
at least... thats what i remember, can you test it? π
I am not 100% sure anymore^^
No str π
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.
why pushback?!
To display a big array of data?
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
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.
@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
pushback = add a new entry after the l ast one
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!
π
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.
It checks whether they are already present in the array, and if not, add them
Obviously if you had 100 people leave and join, they'd all still be present, but you can sort something out for that
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
Why?
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
How to get all the doors of a house?
Filtering this probably https://community.bistudio.com/wiki/selectionNames
Hey guys how would I go about creating local 3D markers?
@native hemlock thanks, what is the difference of "Door_1" and "Door_Handle_1"?
I as about to use this function https://community.bistudio.com/wiki/animationNames but remembered it give some Czech door names.
Velk something...
Since i need to do that for CUP maps also.
One is a door, the other is the handle π
Thanks.
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.
forEach? Something like this:
select 0 isEqualTo _Data select 0
->
clientFPS set[_forEachIndex,_Data select 1];
yeah
problem is I need to store the previous value
and compare it to the new one.
Not sure how to do that.
Take the one a compare it to eachother?! At the same moment?
I won't write the whole code for you, just 4 info
Then learn it
Arrays being bread and butter.
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.
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.
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 π
Only objects can be null?
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 π
Only thing I can think of
From the top of my head, would be using https://community.bistudio.com/wiki/selectionPosition
That will give you the relative position to the model
Nice! this helps a lot.
Then maybe use something like https://community.bistudio.com/wiki/boundingBoxReal
To check
Now i can, may be, check the door distance to the bounding box.
yep
Thanks a lot!
Welcome. I'm sure there is a better way, but I've never played around with that stuff too much π
@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.
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 Bad variable names. No explaining comments
It makes it a headache for you.
Hey guys, what functions do you use to select the closest object from a _pos?
Closest specific object?
array with 100 objects. pick closest to player.
specific objects yes*
obviously theres nearestObjects
nearestObject ?
code ?
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 π
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.
it helps with very big foreach loops or foreach loops within foreach loops iirc
forEaches within forEaches
they're not advised much in SQF
they are performance hogs
Are you talking about https://community.bistudio.com/wiki/Code_Optimisation#Avoid_O.28n.5E2.29.21.21 ?
yes
In that case I agree yeah.
How would I go on making local 3DMarkers?
Editor would be a good start.
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)
there's the drawIcon3D command for you
okay thank you very much π
That optimization tip is a bit wonky.
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.
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
because you add a subaction to "ACE_MainActions"
of course it will be inside that point
try [] instead of ["ACE_MainActions"]
omg, i am too stupid.... THANKS @little eagle, youre awesome! works fine!
is this possible to sync two objects via a script
define synch
like in the editor when you right click an object and select "connect" and then "sync to"
Animation viewer?
like if i use switchMove is there a way to see what animation is currently being player?
Another thing, (findDisplay 46) displayAddEventHandler ["KeyUp", {hint "test";}]; seems not to be executing the hint
KeyDown however is executing
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.
createDialog
@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
Yes, thank you, that would be great @tough abyss
There are any problem related to setGroupOwner like lag, unit freeze, strange behaviour, temporary blindness? π
Anyone available to help a sec?
i only help minutes
RIP
xD
Can you plese check over this for me, im fairly new so dont dis, everyone has to start somewhere eyy, http://pastebin.com/zz4wGXS6
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
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
but they get defined before those lines ?
RPF_selectionTime = call compile lbData[1500, _index];
are you sure that doesnt return nil?
Shouldent do, because i was told its because i use lbsetData?
you're not sure, so you should check
Im completly mindFucked right now........
can i upload the test mission for it, and could you then have a look for me ?
no
Rip
Does anyone know how to disable the cheat menu in ArmA?
Actually instead of that, does anyone know the keycode for '-' on the numpad?
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.
@manic sigil if (A && B) then { ... };
Would that work for if (_vector>270 && _vector<20) then... ?
if _vector is a number and not an array, sure
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.
Should that be an OR
^
Or inverted greater than/lesser than signs
A value cant both be smaller than 20 AND larger than 270
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.
don't just guess it's better, you should actually understand why.. π
Well AND will plain not work :P
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>---]";
The second one would always be true. Any number larger than 270 would also be larger than 160