#arma3_scripting
1 messages Β· Page 482 of 1
if i set my file to ```sqf
#include "
[Error]
"
It works, when the game loads i get the error
So the function is working
then the file path for your file is wrong
your function probably doesnt exist, did you actually confirm the uiNamespace vs missionNamespace thing
with (uiNamespace) do { wtf?
no missionNamespace in 3den, unless you have already previewed a mission
In my main menu there is a mission being loaded
and it exist i can check the contente in debug console
then you might have it, but if you load with -world=Empty you wont
missionNamespace recreation in eden is a little weird
I'm loading with mission path
my file contains this [] call compile preprocessFile "\pop_codigo\x.sqf";
And its not executing in game loading or mission loading
even in debug console it does nothing
only if I put it on variable watcher or whatever name it have it closes my game
no missionNamespace in 3den wut?
missionNamespace always exists
you can't just delete it
if you load into 3den with what was before -world=Empty you won't have functions available in missionNamespace
it'll exist, but functions won't exist in it
Im gonna try some more or i'll just delete the whole 3den dialogs functions and EVERYTHING KFHNWUJIAEGEFDEAofd
Its working o variable watcher
@still forum
Im executing this shit ```diag_log time;
Its only being called when I press Play
uh
Isn't time existent only in active mission? 3DEN is not a mission AFAIK.
is copyToClipboard limited to a certain amount of characters? trying to generate a config from ingame sqf but it cuts off at line 561
nvm. format was limiting it i think. got rid of that and all good now
@unborn ether It was just a test, The script does only execute when the mission is started
I need to execute When 2den is loaded
3den
i'm struggling to ctrlcreate CT_OBJECT_CONTAINER in displays... doesn't work for me. other ctrl types are no problem.
i dont want to predefine dialogs, its not dynamic enough.
what can lead to getIn EH only have one parameter (the unit)
like first time launch in 2d editor
["FLAK - getIn",[B Alpha 1-1:1 (test),"driver",B Alpha 1-1:3,[]]]
["FLAK - getIn",[B Alpha 1-1:1 (test),"commander",B Alpha 1-1:1 (test),[0]]]
["FLAK - getIn",[B Alpha 1-1:1 (test),"gunner",B Alpha 1-1:2,[1]]]
restart mission (back to editor and start again)
["FLAK - getIn",[B Alpha 1-1:1 (test)]]
i think this is from/started with 1.84 as we should not have changed anything with the config EH definition
if isServer then {[group this, getPos this, 200] call bis_fnc_taskPatrol;};
I copied this from a mission where it works just fine, and added it on a number of Group Leaders or Move-waypoints. now I'm getting errors that it's expecting an object, not a group ... why?
If you put it in the group init instead of the group leaders init, this is the group.
Thanks. It had indeed crept into a single group init
@velvet merlin 2D editor? Does it work ok in 3Den?
seems not limited to 2d editor as others reported that too and pretty sure they didnt use 2d editor
So the unit starts in vehicle?
I know that PlayerViewChanged was also not firing when unit was in vehicle in editor, perhaps a bug, worth notifying @lavish ocean ?
Probably just doing a dumb, but what have a I done wrong here? Trying to make it so that a player can only access this action at a specific distance
this addAction ["Exec the file", "scriptFile.sqf","_this distance _target < 1"];
Plus, you have your parameter order all messed up. the condition does not come after code or script.
right* after, at least
^ My english without coffee >:)
Thanks
https://gyazo.com/372056b07d719697a08b76302c34a71f thoughts ? its a chat room system with full persistance
@wary vine That's pretty cool, what do you plan on doing with it further? Or is it pretty much finalized?
Weren't you working on that phone as well?
pretty much finalized
the phone is done π
just finished the tfar calling module for it
will be making a vanilla arma one soon too
Suhweeet. I like this though, you might want to stylize it in some areas and make it colorful or at least cool to look at
Oh wow, okay. How does it work with TFAR?
prettying up the dialog will be the last thing i do
I want to try and make the chat system standalone the only problem is the database side
π
Yeah, functionality should always come firstm
its just a single dialog with ctrlCreate and delete
0______0
the only way I could really do it, was with a standalone db structure
i.e its own connection to extdb
ty
took like 2 months to finish, and still finding little bugs here and there, but its expected
can anyone tell me why the LRR & Lynx aren't showing in the shop with this config?
class black {
name = "Black Market Weapon Shop";
side = "civ";
conditions = "";
items[] = {
{ "NVGoggles_OPFOR", "", 5000, 75, ""},//Black NightVision
{ "Binocular", "", 150, 75, "" }, //Binocular
{ "Rangefinder", "", 50000, 50, "" },//Rangefinders
{ "ItemGPS", "", 100, 50, "" },//GPS
{ "MMG_01_tan_F", "", 2250000, 50, "mav_ttm_var_rebel >= 5" }, //Navid
{ "MMG_02_sand_F", "", 2500000, 50, "mav_ttm_var_rebel >= 5" }, //SPMG
{ "srifle_LRR_F", "", 3500000, 50, "mav_ttm_var_rebel >= 5" }, //LRR
{ "srifle_GM6_F", "", 15000000, 50, "mav_ttm_var_rebel >= 5" }, //Lynx
{ "launch_RPG7_F", "", 1500000, 50, "mav_ttm_var_rebel >= 5" }, //RPG-7
{ "muzzle_snds_H", "", 3500, 375, "" }, //Suppressor
{ "muzzle_snds_L", "", 3500, 375, "" }, //Suppressor
{ "muzzle_snds_M", "", 3500, 375, "" }, //Suppressor
{ "muzzle_snds_B", "", 3500, 375, "" }, //Suppressor
{ "muzzle_snds_H_MG", "", 3500, 375, "" }, //Suppressor
{ "muzzle_snds_338_sand", "", 3500, 375, "" }, //Suppressor
{ "muzzle_snds_58_blk_F", "", 3500, 375, "" }, //Suppressor
{ "muzzle_snds_65_TI_blk_F", "", 3500, 375, "" }, //Suppressor
{ "muzzle_snds_93mmg_tan", "", 3500, 375, "" } //Suppressor
};
Doesn't look like there's any reason they shouldn't if the LMGs are
yeh the LMGs are but the 2 i mentioned dont
Not much we can tell you without knowing how the shop is pulling the items. But the elements are the same data types and the same format as the other weapons in there
its the default altis life shop, but the 2 new weapons wont show in the shop
have you checked for errors ?
if there was a script error during a loop it might have broke the loop
no errors
try to put debug messages in the script
what do you mean mate?
it doesn't show up in the shop right ?
so find out why it doesn't
yourmissionpbo/core/shops/fn_weaponShopFilter.sqf is the file you want to look at
line 85 - 106
case 0: {
_config = M_CONFIG(getArray,"WeaponShops",_shop,"items");
diag_log _config;
{
_bool = [_x] call life_fnc_levelCheck;
diag_log _bool;
if (_bool) then {
_itemInfo = [_x select 0] call life_fnc_fetchCfgDetails;
diag_log _itemInfo;
_itemList lbAdd format ["%1",if (!((_x select 1) isEqualTo "")) then {_x select 1} else {_itemInfo select 1}];
_itemList lbSetData[(lbSize _itemList)-1,_itemInfo select 0];
_itemList lbSetPicture[(lbSize _itemList)-1,_itemInfo select 2];
_itemList lbSetValue[(lbSize _itemList)-1,_x select 2];
};
true
} count _config;
((findDisplay 38400) displayCtrl 38405) ctrlSetText localize "STR_Global_Buy";
((findDisplay 38400) displayCtrl 38406) ctrlSetText localize "STR_Global_Mags";
((findDisplay 38400) displayCtrl 38407) ctrlSetText localize "STR_Global_Accs";
ctrlShow [38402,true];
ctrlShow [38406,true];
ctrlShow [38407,true];
};
``` if you change that to what i just sent, then restart and open the shop in question , then check client logs there should be 3 outputs per weapon if they meet conditions
righty ok
have you tried debugging this yourself first ?
yeh
have been for 6 hours
oops, thats the wrong script
case (_item isEqualTo "blastingcharge"): {
if (cursorObject == fed_armory) then {
player reveal fed_armory;
(group player) reveal fed_armory;
[cursorObject] spawn life_fnc_blastingChargeArmory;
closeDialog 0;
};
};
what steps have you taken to debug this ?
checked all the files it calls, read it over like 50 times, ran arma with show script errors
cursorObject == fed_armory put that in your watch list and look at the object
ok
it should return true / false
if it returns any , there is no object with the name fed_armory
well then diag_log the _item at the beginning of the script
to see if it isEqualTo blastingcharge
ok will try that
@tough abyss for now i added a parameter count check
getIn EH to trigger when starting in a vehicle sounds fishy to me in the first place (but might have been the case since always)
how do i make the csat forces become RHS Russian forces without using zues?
params [
"_pos"
];
_pos params ["_xPos", "_yPos", ""];
//--is the position inside the map
if (_xPos < 0 || _xPos > worldSize || _yPos < 0 || _yPos > worldSize) then {
_pos = [];
};
//--Check if our pos is in one of the blacklisted areas.
if !(_pos isEqualTo []) then {
{
if (_pos inArea _x) exitWith {
_pos = [];
};
} forEach (getArray (missionconfigfile >> "Lega_RandomDealers_Config" >> "BlacklistedAreas"));
};
//--or within the minimum distance of another dealer
if !(_pos isEqualTo []) then {
if ((count Lega_dealerPositions) > 0) then {
{
if ((_pos distance _x) < Lega_DistanceBetween) exitWith {
_pos = [];
}
} forEach Lega_dealerPositions;
};
};
_pos;
``` anyone have any ideas of a better way ?
I'd optimize it even outside of this function and instead of empty array returned a nil, I assume you then do count _pos == 0 check.
params ["_pos"];
_pos params ["_xPos", "_yPos"];
if(_xPos < 0) exitWith {nil};
if(_yPos < 0) exitWith {nil};
if(_xPos > worldSize) exitWith {nil};
if(_yPos > worldSize) exitWith {nil};
if({
if(_pos inArea _x) exitWith {1};
} count getArray(missionconfigfile >> "Lega_RandomDealers_Config" >> "BlacklistedAreas") > 0) exitWith {nil};
if({
if(_pos distance2d _x < Lega_DistanceBetween) exitWith {1};
} count Lega_dealerPositions) exitWith {nil};
_pos;
@wary vine
Change nil to [] if you need empty array specifically
ill take a look thanks
Lega_fnc_getDealerMarkers = {
private _maxDealers = 5;
for "_i" from 0 to _maxDealers do {
while {true} do {
private _postoCheck = [[(worldSize / 2), (worldSize / 2)], 0, (worldSize / 2), 10, 0, 0, 0] call BIS_fnc_findSafePos;
private _pos = [_postoCheck] call Lega_fnc_checkPosition;
if !(isNil _pos) exitWith {};
};
Lega_dealerPositions pushBack _pos;
};
};
Lega_fnc_checkPosition = {
params ["_pos"];
_pos params ["_xPos", "_yPos"];
if(_xPos < 0) exitWith {nil};
if(_yPos < 0) exitWith {nil};
if(_xPos > worldSize) exitWith {nil};
if(_yPos > worldSize) exitWith {nil};
if({
if(_pos inArea _x) exitWith {1};
} count getArray(missionconfigfile >> "Lega_RandomDealers_Config" >> "BlacklistedAreas") > 0) exitWith {nil};
if({
if(_pos distance2d _x < Lega_DistanceBetween) exitWith {1};
} count Lega_dealerPositions) exitWith {nil};
_pos;
};
``` is what i have so far with what you gave me
Should be !(isNil"_pos")
Also why [_posotCheck] and not just send the position itself? Needless array layer.
Do you need this on each frame or something?
Also wasn't BIS_fnc_findSafePos returning empty arrays?
that why i check for empty arrays
diag_codePerformance has number of cycles param in it
Its what this benchmark button does but I guess it always tries to do 10k cycles
BIS_fnc_findSafePos is heaviest part of your script, it does 3000 random position checks
How long is server run time, I assume its some persistent mission? What is this period you mentioned?
every x minutes , then a pause for x minutes on a loopp
it should be ok
Lega_dealerPositions will be reset on each loop
Well if you'll run it in scheduled environment it should be okay (might take some time depending on how clogged your scheduled is)
[] spawn {
for "_i" from 0 to 1 step 0 do {
[] call Lega_fnc_getDealerPositions;
private _timeSpawned = diag_tickTime;
systemChat "spawning dealers";
waitUntil {
uiSleep 1;
((diag_tickTime - _timeSpawned) >= StayTimer);
};
private _timeRemoved = diag_tickTime;
systemChat "dealers removed";
waitUntil {
uiSleep 1;
((diag_tickTime - _timeRemoved) >= SpawnTimer);
};
};
};
``` something like that is what it will be
What are these stay\spawn timers? Seconds, minutes, hours?
it will be in seconds
Hm
Well if you want to improve script performance more, learn what findSafePos does and have your own implementation that does exactly what you want with less overhead.
ill take a look now
If you want extreme performance improvement, I suggest to parse entire map on server start and then simply select positions from pre-parsed array. You may even cache these parsed values in server's profileNamespace or through extension to avoid re-calculating same thing each restart, only do that on worldName change.
i could litteraly just do [(worldSize /2), (worldSize / 2] with some object checks
Try and see if your check is suitable for you and quicker than BI function.
Did they change createVehicle? It seems it just creates a shallow object instead of AI. Example:
private _driver = _driverClassName createVehicle _startingPosition;
AI is created but it's frozen.
i don't think so... if they had changed it then 99% of scripts and missions would be broken by now...
You never could create proper units with createVehicle
How to disable collision for a vehicle (scripting wise)?
like that > disableCollisionWith
Thanks.
@wary vine https://discordapp.com/channels/105462288051380224/105462984087728128/485300277562310666
if ((count Lega_dealerPositions) > 0) then { is useless. Giving an empty array to forEach just does nothing. You don't need to check.
if (_pos inArea _x) exitWith { That sounds like it could be a findIf?
if ((_pos distance _x) < Lega_DistanceBetween) exitWith { same here. findIf
Caching stuff to profile sounds nice
so i fixed the rest of my script last night but now it spawns the vehicle after i rob the area but doesnt give me keys to it and when i check the registration it says the name of the server owns it heres the script, i've been looking for ages but cant find anything wrong with it
_spawnVehicle = (_vehicleArray call BIS_fnc_selectRandom) createVehicle _vehicleSpawn;
_spawnVehicle setDir _vehicleDir;
_spawnVehicle setPos _vehicleSpawn;
_spawnVehicle setVectorUp (surfaceNormal _vehicleSpawn);
life_vehicles pushBack _spawnVehicle;
[_spawnVehicle,"trunk_in_use",false,true] remoteExecCall ["TON_fnc_setObjVar",2];
[_spawnVehicle,"vehicle_info_owners",[[getPlayerUID player,profileName]],true] remoteExecCall ["TON_fnc_setObjVar",2];
life_vehicles pushBack _spawnVehicle;
[getPlayerUID player,playerSide,_spawnVehicle ,1] remoteExecCall ["TON_fnc_keyManagement",2];
[(getPlayerUID player),playerSide,_spawnVehicle ,0] remoteExecCall ["TON_fnc_vehicleCreate",0];
Does anyone know how the vanilla IR pointers work ?
@still forum I JUST found that out. NVM disregard my silliness. zD
What does it use
@still forum Basically I do not like Drawline and want to uses what vanilla uses.
Afaik it's just part of the model
The engine renders the line internally.
it doesn't use any script
@still forum thanks , do you think I could post this into the modeling section and get a better response?
well if you are willing to make a model for it then sure
I think the Arma 3 Samples also have a laser pointer example
thanks , Iβll go check it out
@still forum all variables are defined in the script
{if ((typeOf _x == 'b_g_survivor_F') && (!isPlayer _x)) then {deleteVehicle _x}} forEach allUnits;``` This script only deletes alive units. How would I allow it to include dead peeps?
(allUnits + allDead)
How else would you want to do that?
What do you mean?
Is there any way to optimize the following? It's extemely slow...
params ["_unit"];
private _curator = createGroup sideLogic createUnit ["ModuleCurator_F", [0, 0, 0], [], 0, "CAN_COLLIDE"];
_curator setVariable ["Addons", 3, true];
_curator addCuratorEditableObjects [allMissionObjects "", true];
_curator setCuratorWaypointCost 0;
{
_curator setCuratorCoef [_x, 0];
} forEach ["Place", "Edit", "Delete", "Destroy", "Group", "Synchronize"];
_unit assignCurator _curator;
"[Debug Menu] Registered as Curator." remoteExec ["systemChat", _unit];
Line 3 and 6 take ~700ms each to complete...
{
if ( (typeOf _x == 'b_survivor_F' || typeOf _x == 'b_g_survivor_F') && (!isPlayer _x) && !(alive (typeOf _x == 'b_survivor_F' || typeOf _x == 'b_g_survivor_F') )) then {
deleteVehicle _x; hint 'Patient has DIED and been deleted from the Medical Tent.';
};
} forEach (allUnits + allDead);``` How is `!(alive (typeOf _x == 'b_survivor_F' || typeOf _x == 'b_g_survivor_F') )` wrong?
@tough abyss Do you have anything else scheduled while testing this script?
oh shit yeah..
@tough abyss no. Can't optimize that
I think i'm going to assign the patient(s) a variable and check to see if it's !alive
private ["_group","_pat","_damPart","_damType","_damAmount"];
//{if ((typeOf _x == 'b_g_survivor_F') && (!isPlayer _x)) then {deleteVehicle _x}} forEach (allUnits + allDead);
if !(alive Patient1) then {
deleteVehicle Patient1;
hint "Patient has Died! We've cleaned up from the Medical Tent.";
} else {
{
if ((typeOf _x == 'b_g_survivor_F') && (!isPlayer _x)) then {deleteVehicle _x}
} forEach (allUnits + allDead);
};
[deviceMedical1,3] call BIS_fnc_dataTerminalAnimate;
sleep 5;
_group = createGroup west;
Patient1 = 'b_g_survivor_F' createUnit [getmarkerPos 'Patient1Spawn', _group];
//[Patient1, selectRandom[0.3,0.5,0.7,0.9], "leg_r", selectrandom ["stab","bullet","falling"]] call ace_medical_fnc_addDamageToUnit;
//[Patient1, selectRandom[0.3,0.5,0.7,0.9], "leg_l", selectrandom ["stab","bullet","falling"]] call ace_medical_fnc_addDamageToUnit;
//[Patient1, selectRandom[0.3,0.5,0.7,0.9], "body", selectrandom ["stab","bullet","falling"]] call ace_medical_fnc_addDamageToUnit;
//[Patient1, selectRandom[0.3,0.5,0.7,0.9], "head", selectrandom ["stab","bullet","falling"]] call ace_medical_fnc_addDamageToUnit;
//[Patient1, selectRandom[0.3,0.5,0.7,0.9], "hand_r", selectrandom ["stab","bullet","falling"]] call ace_medical_fnc_addDamageToUnit;
//[Patient1, selectRandom[0.3,0.5,0.7,0.9], "hand_l", selectrandom ["stab","bullet","falling"]] call ace_medical_fnc_addDamageToUnit;
_pat = Patient1;
_damPart = [
"leg_r",
"leg_l",
"hand_r",
"hand_l",
"head",
"body"
];
_damType = [
"stab",
"bullet",
"falling"
];
_damAmount = [0.3,0.5,0.7,0.9];
{
[_pat, selectRandom _damAmount, _x, selectRandom _damType] call ace_medical_fnc_addDamageToUnit;
}forEach _damPart;
[Patient1] call ace_medical_fnc_handleDamage_advancedSetDamage;
[deviceMedical1,0] call BIS_fnc_dataTerminalAnimate;
hint 'Your patient is ready';```
"condition for variables" uhhh what?
nvm
Is the if statement a good replacement for the commented?
@still forum What do you think about the above improved script?
use private keyword instead of private ARRAY
at each of the points I define the _'s?
@drowsy axle - nope.
@still forum - alright, thanks anyway.
Is there any way to optimize the following? It's extemely slow...
probably the slowest part there isallMissionObjects ""π€
(Neviothr's curator thingy ^)
Is there a way to use the command faction (https://community.bistudio.com/wiki/faction) to check a vehicle's faction and then kick out players that don't belong to that faction?
Got this at the moment and getting only error missing )
if (_vehicle = faction east) then {moveOut _unit;};
maybe you can try > https://community.bistudio.com/wiki/BIS_fnc_objectSide
Returns object side as defined in config (i.e. not affected by dynamic changing like rating)
probably the slowest part there is yes it is.. And that's why I said you can't optimize it
thanks for pointing me towards BIS_fnc_objectSide @meager heart
Additional search brought me to this https://forums.bohemia.net/forums/topic/192179-need-help-with-side-select-in-event-handler/?tab=comments#comment-3055293 and then eventually to this
_vehSide = [getNumber (configfile >> "CfgVehicles" >> typeOf _vehicle >> "side")] call BIS_fnc_sideType;
_diffSide = side _unit isEqualTo _vehSide;
if !(_diffSide) then {moveOut _unit;};}];```
Which translates to "if the unit entering a vehicle is not of the side the vehicle is, the unit will get thrown out of the vehicle"
quick question: any shorter way I can ensure a variable type than using param ? as in _var = _var param [0, "default value", ""];
isEqualType isEqualTypeAll isEqualTypeAny...etc ? π€
_something isEqualType objNull
nah. i dont want to check for it, i want to type cast.
param it is. or I convince Golias to give us type hinting in sqflint π€
There is no type casting in SQF
You can't typecast so there, you can check for it and abort like they said.
if(! (_x isEqualType objNull) exitWith {}
i just dont get what i'm doing wrong. RPT tells me "missing ;" but i cant find it nor any bracket issue or whatever else can cause that in that code section
https://pastebin.com/5FrbxTd0
last line is what spits out the error
lol... call... wow
^^
dude. this happened to me twice the other day. but never happened before
typeName _g_armor != "SCALAR" > !(_g_armor isEqualType 0) π€
you are missing the ! part
fixed* π
is there a benefit to that?
Faster
ok cool
for a string would that be also faster ? e.g. (_mystring isEqualType "a") than typeName?
yes
guess i have some mass replacement to do then
You can write whatever you want into the string. But I think empty string would require one less memory allocation
ok even better
mass change completed in 30min ... not sure if the execution time safed in total over its lifetime by this will ever amount to the time i spent on it but...
now clean up private ARRAY to private keyword π
do you maybe also want to tell me that writing a=_this select 0 is faster than params["a"] ... ?
afaik Lou did the tests...
but for your question probably params and param will be better option
params ["_a", "_b"];
//--- vs
private _a = _this select 0;
private _b = _this select 1;
```if you mean this ^
If I save a unit in a variable like so:
currentUnit = player;
in the event that the player dies, how long does it take for currentUnit to become null? It's definitely not immediately null, and sometimes it takes longer than other times
anyone?
The variable stores the unit, player or not. It becomes null when that body gets deleted.
Instead of null check do isPlayer currentUnit
after all that cocking about last night with the position script i think i got it, 0.001 seconds to find the position per loop
https://gyazo.com/76750b20c6a024acc9ce4a5719220295
and they are all pretty random
it will also create upto a set amount of markers, if it cant find a safe position for the rest of them
@austere hawk for a single param... yes it is.
Why my _spawnSAM has the same value of center position of findEmptyPosition?, not always but roughly 1~2 of 5.
_spawnSAM = (getPosAtl _veh) findEmptyPosition[30,60,"O_SAM_SYSTEM_04_F"];
//where (getPosAtl _veh):[27226.4,22957,0.000459671], _spawnSAM:[27226.4,22957,0]
it tries to find a empty position
it tries the position you give it first
and if it's empty... It returns that
but I think the search starts at min dist.=30, not center. right? and there's a vehicle at center, getPosAtl _veh.
Thatβs what it says https://community.bistudio.com/wiki/findEmptyPosition
the search starts at min distance and stop at max distance, center is not searching range. am I right?
Looks pretty vertical to me already
the text X D
just "structured text" with tiny width and huge height will looks like that (if that was the question) π
was hoping for sideways text, but had to do an alterative
https://i.imgur.com/pTgj8Vf.png
If i want to profile my own CBA pfh is there any easy way to identify which one of those is mine or should I use brofiler and create my own profling scopes?
with brofiler you can right click > show source, @hollow thistle
https://gyazo.com/3e750c59992a8b6fc8e77f337b5db034 i just did this
add some sounds there... bip boop... boop bip π
xD
got bored the other day
Lega_fnc_fadeDisplay = {
params [
["_displayIdent", "", ["", 0]],
["_fadeTime", 0.5, [0]]
];
private _display = displayNull;
if (_displayIdent isEqualType "") then {
waitUntil {!(isNull uiNamespace getVariable [_displayIdent, displayNull])};
_display = uiNamespace getVariable [_displayIdent, displayNull]
} else {
waitUntil {!(isNull (findDisplay _displayIdent))};
_display = findDisplay _displayIdent;
};
private _allControls = allControls _display;
{
_x setVariable ["originalposition", (ctrlPosition _x)];
_x ctrlSetPosition [safezoneX + (safeZoneW / 2),safeZoneY + (safeZoneH / 2),0,0];
_x ctrlCommit 0;
_x ctrlSetFade 1;
_x ctrlCommit 0;
_x ctrlSetFade 0;
_x ctrlSetPosition (_x getVariable ["originalposition", []]);
_x ctrlCommit _fadeTime;
} forEach _allControls;
};
player addEventHandler ["InventoryOpened", {
[602,0.5] spawn Lega_fnc_fadeDisplay;
}];
ummmm
Classes are defined in bin\Config.bin\CfgLocationTypes
where can i find the bin
directory?
ctrlSetAngle works with pictures only, thought it was quite clear from the description on wiki @meager heart
Should I use extDB3 or iniDB?
for persistent saving of data?
@tough abyss [spoiler] https://gyazo.com/eb1d51979e61a6ab91feebcb12e87284 π
@tough abyss @meager heart setBehaviour tests have been done, and it taks either unit or group, but all units in the group will have their behaviour changed
#define GETSTR(STRING) ([STRING, (localize STRING)] select (isLocalized STRING)) cuz lazy
localize STRING will always be executed.. Does that throw an error if you try to localize a non localized string?
will try now
rip
will have to go back to the old method then #define GETSTR(STRING) (if (isLocalized STRING) then {localize STRING} else {STRING})
doesn't localize aString already return aString if it is not localised? π€
not according to biki
is that ^ macro the same as > https://community.bistudio.com/wiki/BIS_fnc_localize π€
/*
Author: Karel Moricky, optimised by Killzone_Kid
Description:
Checks if text is localization key and if so, return the localized text.
Parameter(s):
_this: STRING
Returns:
STRING
*/
/// --- validate general input
#include "..\paramsCheck.inc"
paramsCheck(_this,isEqualType,"")
if (isLocalized _this) then {localize _this} else {_this};
#define paramsCheck(input,method,template) if !(input method template) exitWith {[input, #method, template] call (missionNamespace getVariable "BIS_fnc_errorParamsType")};
π€
k
that paramsCheck magic probably was in b4 params...
Anyway to remove smoke particles locally?
Hiding the smoke grenade before it pops still shows particles unfortunetely.
enableSimulation false on smoke grenade?
@still forum you've been reviewing Tonic Framework pull requests? 0_o
Hi, @tough abyss was so friendly to send me some targeting code for a guided missile/bomb. I want to adjust it for the Unsung GBU-8 glidebomb, but run into problem with moving from CBA per frame eventhandler to OnEachFrame of BI. With the OnEachFrame handler I get script errors as some stuff doesn't seem to be properly initialized. With CBA per frame this didn't happen and the bomb homed in on the target. The calling code is at https://pastebin.ubuntu.com/p/kGM7jv4xyQ/ and the OnEachFrame handler is at https://pastebin.ubuntu.com/p/NQQ8GwT3cV/ Any ideas what breaks it are welcome!
I am having problem with particle sources to staying in air. I do want to show a particle effect in the sky and it keeps emitting them on the ground instead. The weird thing it, it sometimes works just fine and the particles are visible when looking up.
I am attaching the particlesource to an object in the sky which has no physics.
private _pos = getPosATL device;
_pos set [2, _pos#2 + 500];
private _stupidObjectInSky = "Land_HelipadEmpty_F" createVehicleLocal _pos;
_stupidObjectInSky setposatl _pos;
private _skyEffect = "#particlesource" createVehicleLocal _pos;
_skyEffect setParticleParams [["\A3\data_f\VolumeLight", 1, 0, 1], "", "SpaceObject", 1,90,[0,0,0],[0,0,0],0,9.996,7.84,0,[20,30,20],[[0,0,0,0],[1,1,0.25,1],[0.5,1,0.5,0]],[0.08],1,0,"","", _stupidObjectInSky];
anyone has an idea why the particle source just gives up and is on the surface?
maybe you can try attach it
nah using attachTo with a particle source does not work. If you do that no particles will even show up, you have to attach it through setParticleParams
How different is a mod from a script inside a mission?
How different is a sandwich from a cat inside a fridge?
player spawn {
private _smoke = "#particlesource" createVehicleLocal [0, 0, 0];
_smoke setParticleClass "VehExpSmoke";
_smoke attachTo [_this, [0, 10, 0]];
};
@digital jacinth
maybe it is because of the setParticleClass, tho i do not use a class.
Β―_(γ)_/Β―
idk man
particles are weird
iirc there was topic on bif about particles weirdness
probably recreatee the effect and just use drop
problem has been solved, the lastFrameTime needed to be set in the parameter list directly: _this set [2, time];
could anyone tell me why this is erroring?
life_vehicles pushBack _spawnVehicle;
this is the error:
Error in expression <VectorUp (surfaceNormal _vehicleSpawn);
life_vehicles pushBack _spawnVehicle;
[>
Error position: <life_vehicles pushBack _spawnVehicle;
[>
Error Undefined variable in expression: life_vehicles
File \life_server\Functions\Systems\fn_handleBlastingChargeArmory.sqf [TON_fnc_handleBlastingChargeArmory], line 50
i dont understand how the variable is undefined.
because it's literally undefined
it has no idea what life_vehicles is
post your entire script
we're missing context
life_vehicles is a global variable i thought, ok one sec
it's a waste
im new to scripting, but the script is susposed to add keys when the player robs the vault but it only spawns vehicle and doesnt give keys
it has worked on my previous server and i cant figure out why it wont work now
first, use the new private syntax.
instead of private ARRAY
use private var = var declaration
private _blah = "BlahBlah";
oh ok
that script there... so much script...
bulli
π hides
which has a bigger performance impact
nearentities tank at 1000 meters
or neartargets at 1000 meters and then checking if it's a tank...
assuming same sleep in loop
I'm working on CCRP for ITC Air, but I'm horrible at physics can't really get the accuracy I want out of the current code I'm using(example https://gfycat.com/UnfitInformalGraywolf )
Can anyone help out with this? Does anyone already have an accurate script for this, or does anyone have any good resources on how shotMissile physics work in arma, or alternatively, if it's possible to somehow access the ccip solution that's used for the vanilla HUD?
i just realized that forcespeed and limitspeed absolutely wrecks performance...
Any command can wreck performance
nevermind
i was running a forcespeed on all tanks in a map and my fps went very low everytime a tank moved
but it was related to physx and the grid cell of the map i think, not to forcespeed...
I've got a question about using worldToScreen together with modelToWorldVisual.
https://gfycat.com/AncientRealisticBaboon
In the example here, the green X in the top left of the HUD is drawn with drawIcon3D on the HUD pos, the white + next to it is drawn on a control, on the worldToScreen of the exact same position
somehow once I get worldToScreen involved, the velocity of the aircraft completely throws off the position, does anyone know how to fix this?
ran into an issue with my phone im using safezones yet small res scale looks fine, yet normal https://gyazo.com/ebfc641a779f3324c9a77743ea2e9cf3 yet thats the only things thats like this xD
aaah... that safezone system, solution is : kick the player if they didnt chose the right res scale
i wanna hang myself right now
its the only thing that wont play nice right now
everything else works fine on all res scales,
i thought it was the issue of creating a ctrlGroup inside another, it seems to have calmed the issue down, but not fixed it
https://media.discordapp.net/attachments/482979016983183360/485881510722011137/image0.jpg?width=507&height=676 this is what it looked like before
you are using safezones with absolutes ?
nah
it was all built with just safezone
https://hastebin.com/bokeceyupu.cpp here are all the controls
with the positions preset for the first one
which took me fecking ages
moving them around till they were in the right place
you're working with UI arma's editor ?
yup
you got my respect
maybe just safeZoneWAbs safeZoneXAbs will helps π€
you must have spent infinity hours on it lol
and troubles with interface size or screen resolution ?
@wary vine maybe getResolution then
the weird thing is it doesnt happen on the other dialog which is created basically the same
controls groups weirdness
each of those messages are 3 images
https://gyazo.com/3aee76f9ee2cd0402f61c8f7ef05961f in order to resize them properly and this is on very large and their are no issues whatsoever xD
they are structured texts with pictures ?
just pictures
right, I might be able to do a work around
[
position , uiscale,
position, uiscale
]``` sorta thing
getResolution last param is the ui scale
_position = [
[[x,y,w,h], 0.55]
] select {_x select 1 isEqualTo (getResolution select 5)};
Dirty, but should work
as a temp solution until i find a fix
gl π
just means i have to find all the positions manually -.-
before i do this are all uiscales the same on all pcs ?
i.e small being 0.55
What exactly is the problem?
ill show
this is normal res scale
but this is the only menu in my phone that does this.
And probably the only one where you played around with
Cannot remember the right fiel, but what you see there is the shadow of the Button
Gimme few Minutes till I am at home or search for yourself π
After disabling shadow, you should be fine
Wait... Are you using Text above Buttons?
?
i have changed the invisible buttons to normal buttons whilst im trying to fix it
the buttons should like up with the buttons on the image underneath
on small resoultion they line up perfect
but when the uiscale is changed they go haywire
_position = [
[
[x,y,w,h]// ctrl1
[x,y,w,h]// ctrl2
[x,y,w,h]// ctrl3
[x,y,w,h]// ctrl4
[x,y,w,h]// ctrl5
[x,y,w,h]// ctrl6
[x,y,w,h]// ctrl7
, 0.55],
[
[x,y,w,h]// ctrl1
[x,y,w,h]// ctrl2
[x,y,w,h]// ctrl3
[x,y,w,h]// ctrl4
[x,y,w,h]// ctrl5
[x,y,w,h]// ctrl6
[x,y,w,h]// ctrl7
, 0.7]
] select {_x select 1 isEqualTo (getResolution select 5)};
``` so my idea for now is to do something like this with hardcoded positions for each uiscale
how are you hiding those buttons?
how are you hiding those buttons? did not answerred my question
text = "";
w = 0.02475 * safezoneW;
h = 0.044 * safezoneH;
animTextureNormal = "#(argb,8,8,3)color(0,0,0,0)";
animTextureDisabled = "#(argb,8,8,3)color(0,0,0,0)";
animTextureOver = "#(argb,8,8,3)color(0,0,0,0)";
animTextureFocused = "#(argb,8,8,3)color(0,0,0,0)";
animTexturePressed = "#(argb,8,8,3)color(0,0,0,0)";
animTextureDefault = "#(argb,8,8,3)color(0,0,0,0)";
colorBackground[] = {0,0,0,0};
colorBackgroundFocused[] = {0,0,0,0};
colorBackground2[] = {0,0,0,0};
color[] = {0,0,0,0};
colorFocused[] = {0,0,0,0};
color2[] = {0,0,0,0};
colorText[] = {0,0,0,0};
colorDisabled[] = {0,0,0,0};
add this: colorShadow[] = {0, 0, 0, 0}; or alt. add offsetX = 0; offsetY = 0;
should fix that problem
i don't think you are 100% understanding the issue, the buttons are perfect when on small resolution scale
and its not just the buttons that are moving
i do understand
and either you fucked up your button positioning, or .. not
the scrolling happening with SQF? or is it all config based?
chances are that you fucked up there then
{
_x params ["_to", "_from", "_name", "_message", "_pos", "_timeSent"];
//Creating The Controls.
private _0 = XPHONEUI ctrlCreate ["EmerMessage_Background", _baseIDC, _controlsGroup];_baseIDC = _baseIDC + 1;
private _1 = XPHONEUI ctrlCreate ["EmerMessage_TitleText", _baseIDC, _controlsGroup];_baseIDC = _baseIDC + 1;
private _2 = XPHONEUI ctrlCreate ["EmerMessage_MessageText", _baseIDC, _controlsGroup];_baseIDC = _baseIDC + 1;
private _3 = XPHONEUI ctrlCreate ["EmerMessage_SentText", _baseIDC, _controlsGroup];_baseIDC = _baseIDC + 1;
private _4 = XPHONEUI ctrlCreate ["EmerMessage_ReplyBtn", _baseIDC, _controlsGroup];_baseIDC = _baseIDC + 1;
private _5 = XPHONEUI ctrlCreate ["EmerMessage_ShowPosBtn", _baseIDC, _controlsGroup];_baseIDC = _baseIDC + 1;
private _6 = XPHONEUI ctrlCreate ["EmerMessage_DeleteBtn", _baseIDC, _controlsGroup];_baseIDC = _baseIDC + 1;
} forEach Lega_EMS_MESSAGE_controls;```
if ((count Lega_EMS_MESSAGE_controls) > 0) then {
private _lastArr = (Lega_EMS_MESSAGE_controls select (count Lega_EMS_MESSAGE_controls - 1));
(ctrlPosition (_lastArr select 0)) params ["","","","_backgroundHeight"];
{
private _lastPos = (ctrlPosition (_lastArr select _forEachIndex));
_lastPos set [1, ((_lastPos select 1) + _backgroundHeight)];
_x ctrlSetPosition _lastPos;
_x ctrlCommit 0;
} forEach [_0, _1, _2, _3, _4, _5, _6];
};
i only ever touch the Y position, there is no need to touch the x
weird
should be fine
unless you made some mistake somewhere else π€·
the only thing that possibly could be that is .. as said: the shadows
but that would only affect the buttons
someone said it could be to do with using safezones inside a controlsGroup
class EmerMessage_Background: Life_RscPicture
{
text = "Lega\Lega_xPhone\Images\dialogImages\emermessagebackground.paa";
x = (-0.019606 * (safezoneW + safezoneX)); // 0.428656
y = 0;
w = 0.179811 * safezoneW;
h = 0.1568 * safezoneH;
};
class EmerMessage_TitleText: Life_RscStructuredText
{
x = (0.001782 * (safezoneW + safezoneX)); // 0.423874
y = (0.00313 * (safezoneH + safezoneY));
w = 0.148309 * safezoneW;
h = 0.0168 * safezoneH;
};
class EmerMessage_MessageText: Life_RscStructuredText
{
x = (0.001782 * (safezoneW + safezoneX)); // 0.423874
y = (0.0285 * (safezoneH + safezoneY));
w = 0.090558 * safezoneW;
h = 0.126 * safezoneH;
};
class EmerMessage_SentText: Life_RscStructuredText
{
x = (0.132 * (safezoneW + safezoneX));
y = (0.0285 * (safezoneH + safezoneY));
w = 0.056433 * safezoneW;
h = 0.0336 * safezoneH;
};
class EmerMessage_ReplyBtn: Life_RscButtonMenu
{
x = (0.132 * (safezoneW + safezoneX));
y = (0.07525 * (safezoneH + safezoneY));
w = 0.056433 * safezoneW;
h = 0.0252 * safezoneH;
};
class EmerMessage_ShowPosBtn: Life_RscButtonMenu
{
x = (0.132 * (safezoneW + safezoneX));
y = (0.1175 * (safezoneH + safezoneY));
w = 0.056433 * safezoneW;
h = 0.0252 * safezoneH;
};
class EmerMessage_DeleteBtn: Life_RscButtonMenu
{
x = (0.132 * (safezoneW + safezoneX));
y = (0.1575 * (safezoneH + safezoneY));
w = 0.056433 * safezoneW;
h = 0.0252 * safezoneH;
};
there are the controls
have you tried to add some decimals to theses controls ?
like x = 0.012 --> x = 0.01200
it probably wont change anything ..
i havent, but i don't think that would change it, can always give it a go
nothing xD
Is it possible to set custom variables via setVariable ?
i.e. sectorModule1 setVariable ["was_already_captured", true]; ?
Hello All, I would like to count the number of magazines depending on a specific type inside a box
_countOfMagsGlobal = getMagazineCargo AmmoBox_TeamBlue;
_countOfMags = {typeOf _x == "7Rnd_408_Mag"} count _countOfMagsGlobal;
The answer is in there
You handle it like it would return an array of objects.. it doesn't though
I see. this is what I get :
[["SmokeShell","7Rnd_408_Mag","1Rnd_HE_Grenade_shell","30Rnd_65x39_caseless_mag","RPG32_HE_F"],[10,50,10,70,1]]
_countOfMagsGlobal = getMagazineCargo AmmoBox_TeamBlue;
_countOfMags = {typeOf _x == "7Rnd_408_Mag"} count _countOfMagsGlobal select 0;```
maybe ?
I have no clue
Syntax:
condition count array```
it does say I can put an Array ...
oh .
that's an array of strings I even said it's an array
typeOf is used to get the classname of an object
And "get the classname" and "an object" both don't make sense
for one you already have the classnames there. Second you don't have objects there.. because they are the classnames
You'll need find or findIf to find the index of the magazine type you want
and then use select on the second array to get the number at that index
holy fuck
I might as well throw myself through the window.
if that's the simple way, what's the difficult way ... pfff
difficult way would be to iterate through the classnames randomly using a custom SQF random number generator using a case-sensitive comparison and also use random upper/lowercase variants of the classname to search for till you find it someday
sorry I got blood dripping from my nose when I read you, brb
is there a good way of determing which sorta road type a segment is?
Basically i want to get nearby asphalt roads, as opposed to dirt paths or so
white/yellow lines on the map
Okay so no I find 1
_countOfMagsGlobal = getMagazineCargo AmmoBox_TeamBlue;
(_countOfMagsGlobal select 0) find "7Rnd_408_Mag"
but thats not what I'm trying to find so ...
I don't think i'm thinking this right ...
how do I
"and then use select on the second array to get the number at that index" ???
I don't get it
yes
So??
the position in the Array
You used (_countOfMagsGlobal select 0) right there
what's the problem with using it again?
None, that what i'm trying to do, but can't figure out the correct way
@formal vigil what type of variable ?
if you want a global you can setvariable on missionNamespace
I can't understand how to select the equal position of two values in two different indexes without knowing it's original positon
isn't it returning 1 because it found it ?
yes
You'll need find or findIf to find the index of the magazine type you want
That's what I wrote
you just used find to find the index
just as I said.
what I meant is : isn't 1 a boolean ?
Can you please just read the wiki pages yourself? Quite annoying to always have to link them to you
No?
1 is a number
I mean.. look at it
That's like.. Primary school first grade
Well...
okey brb
I thought it was returning 1 is if it said "YES I FOUND IT"
but you're right it should return true then it that was the case
so 1 is the index .....
then ....
_arrayOfMagsInBox = getMagazineCargo AmmoBox_TeamBlue;
_magsIndex = (_arrayOfMagsInBox select 0) find "7Rnd_408_Mag";
_magsCount = (_arrayOfMagsInBox select 1) select _magsIndex ;```
1 is not boolean, it's a number
boolean values are true or false
what are you trying to do here
that's what I just understood here.
right, but what are you trying to do here
get the amount of mag of a specific type of mag
inside a ammobox
okay it is working
don't bother
I managed
mk
_arrayOfMagsInBox = getMagazineCargo AmmoBox_TeamBlue;
_magsIndex = (_arrayOfMagsInBox select 0) find "7Rnd_408_Mag";
_magsCount = (_arrayOfMagsInBox select 1) select _magsIndex ;```
you forgot a close parenthesis
no thats not working ...
no i'll go with my frist try
_arrayOfMagsInBox = getMagazineCargo AmmoBox_TeamBlue;
_magsIndex = (_arrayOfMagsInBox select 0) find "7Rnd_408_Mag";
_magsCount = (_arrayOfMagsInBox select 1) select _magsIndex ;```
@cobalt pine what do you mean?
could just spawn an explosion on top of an object if you're lookng to be basic
basically to get a custom model to act as C4 or sachel
That is #arma3_config not #arma3_scripting and it has nothing to do with #arma3_scripting
this is the model I mad https://gyazo.com/9af558a9ec781465e4a852ca39845e11
thank you
probably because of hq entity... which is logic and hidden ai lol
ambientAnim (which is absolutely attrocious code also uses logics) and thats where i had it from
@still forum I remember you've already explained this to my but I can't remember :
_magsCount = 0;
Why is that not possible ?
why wouldn't t hat be possible
well when I do that, the next step error's and it tells me Undefined Variable _magsCount
mmh
along with error message
_arrayOfMagsInBox = getMagazineCargo _box;
_magsIndex = (_arrayOfMagsInBox select 0) find "RPG32_HE_F";
if (_magsIndex == -1) then
{
_magsCount = 0;
}
else
{
_magsCount = (_arrayOfMagsInBox select 1) select _magsIndex;
};
_missingMags = 1 - _magsCount;
_box AddMagazineCargoGlobal ["RPG32_HE_F",_missingMags];
_box AddWeaponcargoGlobal ["launch_RPG32_F",1];
Thats probably not working
if (_magsIndex == -1) then
you are setting a local variable
what do you think _magsIndex returns
local variables are set in their own scope or below
you leave that scope right at the } where the variable disappears
what you are trying to do can be done nicely with param
Just
_magsCount = (_arrayOfMagsInBox select 1) param [_magsIndex, 0];
Oh
indices start at 0
This way ???
_arrayOfMagsInBox = getMagazineCargo _box;
_magsIndex = (_arrayOfMagsInBox select 0) find "RPG32_HE_F";
_magsCount = (_arrayOfMagsInBox select 1) param [_magsIndex, 0];
_missingMags = 1 - _magsCount;
_box AddMagazineCargoGlobal ["RPG32_HE_F",_missingMags];
_box AddWeaponcargoGlobal ["launch_RPG32_F",1];
what exactly are you trying to accomplish with this script
too long to re-explain man... is this going to work or not ?
I don't understand how param works
i don't know, i don't know what you're trying to do
param works exactly like select just with a defaultValue in case anything goes wrong
param passes variables and the values they represent into a different scope wat?
no it doesn't
https://community.bistudio.com/wiki/params alternatively just read the biki because i can't put my thoughts into coherent words
@still forum is this going to work the way I wrote it above ?
I don't see anything wrong with it
@tough abyss param != params
and no params also doesn't put "stuff into a different scope"
hello, do you use headless client to use server functions like database sync, old objects cleanup.. ?
i try'ed, but HC working wrong, code just like on server... no errors in log, but is getting wrong data
Hey, kind of an extention of another question I asked. In the MFD config reference there's the impactPoint source you can use for HUDs, is it somehow possible to read out the value of that impactPoint?
how would you monitor a corpse to check if a action has been executed on it by a player?
@woven oak depends on action
eventhandler, probably
unless you're looking to do something weird
i'm going to wager a guess and assume you want to prevent people from looting bodies?
@dusky pier From the scripting point I would tell you that HC is a client, not a server. He can't perform SE commands, such as owner. Otherwise #headless_client
@still forum wanted to ask how TFAR handles the push-to-talk keys. Does it respect inputAction or just plain DIK? Thanks.
@unborn ether thank you!
I have a script with one local function assigned to _someFunction without private keyword. However that private variable is not available in the [something] spawn { code goes here } started within the same script and it's a bit confusing. Isn't _someFunction available throughout the entire script or does spawn create it's own context?
spawn is a new script with it's own context
as it runs asynchronously it has to be
That's also the reason why you can pass parameters into it
in case you want to pass anything
Im trying to setup the ASOR VS for spawning vics on carriers, but something im doing is causing certain "car" vehicles engines to break (HUD icon turns on for half a second) example being the engines for the Apex jeep, LoW Van and the RHS MRZR dont work, but the quadbike, SUV, and BAF Coyote work fine, and all armoured/air vics work fine. Carrier script > https://pastebin.com/NR20kH04 . Normal Land scrip (works fine) > https://pastebin.com/PZXEiNNZ
PS: seems to be a dedi issue. Got another client on, they could turn on the vics i spawned, they could turn on vics they spawned and i could turn on vics they spawned but only after they had turned it on and off. π
what is the code for showing uavs on a screen π
π€ x2
?
cheers
@fossil yew Some tip with spawn to ease what you want.
// Some function begin
params ['_blah','_blah2','_blah3'];
_this spawn {
params ['_blah','_blah2','_blah3'];
};
Is it at all possible to have "virtual" inventory items, using vanilla UI? Just wondering if someone tried lbAdd and so to the UI elements and have things still work
@austere granite No, vanilla LB are not exactly LB.
@austere granite You can add them to that LB, but they will react with errors, depending they are scripted for real inventory items, so its not the best idea.
is there a way to identify if a magazine class is pylon compatible?
BIS mags all seem to start with PylonRack_ PylonMissile_ but i need to get mods too
like parse configFile >> "CfgMagazines" >> ?? into array of classnames?
Create your own LB and switch them as a tabs or smthn.
Guess i'll just add a little subsection to the inventry UI instead then, with the virtual stuff.
merci
the vanilla inv should be LNbox btw.
at least they should be π€
but normal inv is also, iirc, highly modified in the actual code backend and not scripted
if one wants to try, corresponding commands for listnbox is https://community.bistudio.com/wiki/lnbAddRow
not really have the inventory in front of me ... so could be wrong entirely
I know how i into UI, it was more a case if someone tried it and you get stuck at random points due to hardcoded backend behavior like the usual BIS UI things
yup
wanted to write that
most likely some non-sqf code will update your virtual stuff away
though, adding a separate list ontop should be fairly simple
replacing the inventory could also be an option for some
though ... fairly tuff task
eh, some inventory stuff is messed up
i know
even the ability to handle specific magazines will be missing
never said it would have been a 1:1 replacement π
@queen cargo
class GroundContainer: RscListBox
{
class DLCTemplate: RscDisplayInventory_DLCTemplate
{
class Controls;
};
idc=632;
sizeEx="0.8 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
sizeEx2="0.8 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
rowHeight="2 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
canDrag=1;
colorText[]={1,1,1,1};
colorBackground[]={0,0,0,0};
itemBackground[]={1,1,1,0.1};
itemSpacing=0.001;
x="1.5 * ( ((safezoneW / safezoneH) min 1.2) / 40) + (safezoneX + (safezoneW - ((safezoneW / safezoneH) min 1.2))/2)";
y="3.7 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25) + (safezoneY + (safezoneH - ( ((safezoneW / safezoneH) min 1.2) / 1.2))/2)";
w="11 * ( ((safezoneW / safezoneH) min 1.2) / 40)";
h="18.4 * ( ( ((safezoneW / safezoneH) min 1.2) / 1.2) / 25)";
};
GroundContainer is inherited by any other lists in Display 602.
So is a RscListBox but it's different from default one. It's handled by engine internally and has some additional data to it, like itemBackground[]={1,1,1,0.1}; which is not a listbox family attribute.
That listbox is actually acting like an Active Text over listbox entries.
{ _x createUnit [getMarkerPos "spawnunit", _groupS, 1]} forEach _soldiers; why not working?
Because not detail
ok thank
You maybe want read https://community.bistudio.com/wiki/createUnit
I am read english so slow)
Yes I expect
Does _soldiers contain a array of types or groups? The parameter required after position is an array, not a number.
markers:Β Array- Placement markers
do we need a translator or something?
I can translate english and I no have any problems when using bohemia's wiki
I just didn't finish the syntax)
@austere granite I hve already made something like that xD
google translate?
yandex translator) Yandex is russian google analog)
~~check this maybe > https://community.bistudio.com/wiki/ctrlMapScale~~
@meager heart dont mind the "Map_scale" name , it is just the name of section in model. I have a config with defined few AnimationSources and all of them when used with animationSourcePhase return 0
well.. that's not really #arma3_scripting, but to get the animation sources phases values, probably you will need define those "phases values" in the config like minValue/maxValue or angle0/angle1...etc
maybe there #arma3_config guys can/will help
ok will do
What would be the easiest method to figure out what's causing a load screen hang for people not on local during a mission start up?
Preloading assets in the mission
sounds like a script in your mission
not on local?
It's a postInit script not finishing
easiest method is to use my debugger to dump all currently running scheduled scripts.. Although my debugger can't do that. But it makes it easy to write the code to do it π
Next easiest.. Use that script command to dump all running scheduled scripts. But it will probably not give you a correct name if you didn't use scriptName properly
Next easiest.. Go through all your postInit scripts and check each of them for a sleep or waitUntil
I'd start by removing/commenting scripts
lol just saw a thread on reddit about you @still forum
thats rude xD, his thread name almost killed me "Threatened by a BI community manager", a netflix serie
And how is this scripting related?
shoulda rename to Scriptmen then, smh
ok
@tough abyss #arma3_scripting is drama + scripting + everythingrelatedtomoddingsomehow + drama
drama + scripting = dripting π
multi-editor dripting
Im tryna make an intro script but dont know how to start
I only want that when the host starts the map a text saying a location and an hour is shown
Or something like that
https://community.bistudio.com/wiki/BIS_fnc_EXP_camp_SITREP (or similar. Lot of ways to potentially do that)
thinking right now if i should ask here for command suggestions for sqf-vm or if this would end up in a horrible sheet π€ (sqf-vm is a custom standalone SQF implementation, suggestion would be commands to port)
What is the end goal? I can see I might get some use out of it if I could utilise it for unit test purposes but that would require at least some amount of simulation of the game and the side effects of the various methods. I might get some use out of it if it did better syntactical and semantic checking than my current vscode plugin stack. These are the two use cases I can see for it as a user of dev tools
@tough abyss you can already try it nowadays: https://discord.gg/vpdwJtG
there is a bot and a standalone variant
the reason is either to unit test or to just run SQF while not having arma available
or without the need to test it ongoing all the time in arma itself
@ruby breach thanks mate
hmmm does anyone know what the locality of https://community.bistudio.com/wiki/enableVehicleSensor is supposed to be?
when run inside if (isServer) then {} or if (local this) then {}, then it doesn't work on dedicated
but it does work on local host
i'm running this from the init field of an empty vehicle
When you say it doesnβt work on dedicated, how do you expect it should work on dedicated?
also maybe you entered that vehicle before you tried the commands on dedicated ? π€
(aka vehicle locality changed and on the local host you are always server so it works there...)
When you say it doesnβt work on dedicated, how do you expect it should work on dedicated?
Expected outcome: radar should be disabled on the kajman
Observed on local: radar is disabled
observed on dedicated: radar is not disabled
also maybe you entered that vehicle before you tried the commands on dedicated ?
I start outside the vehicle in both cases
can someone give me an infoText script?
and it gets run from the init box, so it should execute way before i get in
i didn't try running it from console after I've gotten in, though
i cant get one to blackin when the map is started, with text appearing and disappearing
There is no UI on dedicated, I donβt understand how can you observe it there, hence the question
what?
i mean when i join the dedicated server
and slot in
and then get in the vehicle
and check the radar
I see, great misunderstanding in terminology π
funnily enough i may not be the only one misunderstanding things...
try it with cursorTarget from the console and local exec π€
on dedicated ^
i mean... if will works then use it on the clients/players
also maybe just RE it with jip's true flag
yeah
it's funny because even on local, i still get the "radar on" option
it just doesn't do anything
so that makes me feel like it's something that all clients need to have run
but yeah i'll test a bit more
right now i'm dealing with waypoints inexplicably breaking on DS
editor placed ?
yeah...
in a mission that was working before..
oh joy, it's even broken on local now, because i moved a waypoint by 20m
sigh
the truck just stands in front of the waypoint without completing it π
and i moved it in zeus, so it moved again, but didn't complete it
actually i think i know why, could be with the way i synced it
anyway, this isn't #arma3_scripting anymore, just #enginelimitations
π€·
whats the fastest way to get an array of pylon compatible magazines? go through each vehicle with
_veh getCompatiblePylonMagazines 0
https://community.bistudio.com/wiki/getCompatiblePylonMagazines
or do i go through all magazines looking for pylonWeapon cfg property??
or is there a more efficient way to identify if a mag is pylonable?
@meager heart huh it's global arg, local effect.
When i'm on the server, It's false on the server, true on local, true on global.
If i execute it locally then it works.
I have an array of sectors (markers), I want to check single random sector every frame for enemy presence.
For now it does not affect server FPS in any way but maybe there is something worth optimization.
// Init function, executed every time whole list of sectors was iterated
private _initFunction = {
// Get inactive sectors
_sectors = (KPLIB_sectors_all - KPLIB_sectors_blufor - KPLIB_sectors_active); // Array of Marker names
_startTime = time; // DEBUG
{_x setMarkerColor KPLIB_preset_colorEnemy;} forEach _sectors; // DEBUG
};
// Create PFH for sectors activation check
private _pfhID = [
{
// If we checked whole list, reinitialize the list
if (_sectors isEqualTo []) then {
systemChat format["Exec time: %1", (time - _startTime)]; // DEBUG
[] call (_this getVariable "start");
};
// Extract current sector from array
private _currentSector = _sectors deleteAt (random count _sectors);
_currentSector setMarkerColor "ColorYellow"; // DEBUG
// CHECK SECTOR ACTIVATION CONDITONS HERE
}, // Handler
0, // Delay
[], // Args
_initFunction, // Start func
{}, // End func
{KPLIB_campaignRunning}, // Run condition
{}, // End condition
["_sectors", "_startTime"] // Privates to serialize between calls
] call CBA_fnc_createPerFrameHandlerObject;
Do you see anything worth optimization here?
not sure... I'm thinking about pushing selectRandom in there but that'll make deleting harder and will probably be slower in the end
Did not know about selectRandom. Looks nice but I would have to keep track of already checked elements.
deleteAtRandom when? π
yeah that's the problem.. I think this is already optimal
Learning SQF like a boss. :D
Thanks for the input!
Make markers triggers and make them trigger on enemy presence maybe
I don't think ~150 triggers are an good idea.
You can freeze them and unfreeze random trigger to check for enemies
how can i find the client ID of headless client?
i'm doing owner F3_HC but that seems to be returning 2, which is the server π€
where F3_HC is the name of the client logic
Missioneh playerconnected
HC is just like another player will have all the data including owner
hmm thanks will see
also filter __SERVER__ with meh π (meh aka mission eh)
huh nevermind owner F3_HC, is working now π€ π€
well... maybe you can try this >https://community.bistudio.com/wiki/clientOwner
also check there KK's comment
haha it seems waypoints etc still don't get transfered
welp that was a useless bit of effort...
what was the task ?
If I create an agent on the server and attachto a local only object, can I transfer that agent to a headless client and it stay attached to the object?
well, i had an old mission that i was updating
i decided to add HC
and move all AAF units to HC
eariler i was trying to verify that
but now i know
because i read that upon transfering to HC, waypoints don't get transfered, and now the units aren't moving π
I transfer troops to my headless client and the waypoints go with them
i was hoping that the waypoints would transfer too with setGroupOwner
editor placed waypoints?
Mine are script created. I rarely use the editor for anything.
hmm
although on second thoughts... i think some of the vehicles moved π€
let me....not be lazy and actually check ownership π
also better remove those editor placed wp's
too much effort, i'd rather not use HC π
okay, they're not being transfered, so time to do other stuff..
π
groan
adding a sleep 1 seems to have worked
but... now the waypoint activations are broken
that said, waypoints do work
although one vehicle dismounted its troops (or simply didn't wait for them to get in) (troops were in the same group as vehicle)
boo
no HC for me
please stop this voice inside my head suggesting i script the waypoints...
Anyone know the best way to get if a entity is heading to you, away, or flanking in different directions?
Been messing with
https://community.bistudio.com/wiki/getPos
https://community.bistudio.com/wiki/getDirVisual
https://community.bistudio.com/wiki/BIS_fnc_dirTo
and the bearings i get arent the type of data im looking for. If enemy is approaching me directly the bearing should be 0, instead i get his actual facing which is like 270.
what about distance?
As far as im aware distance is just for well distance. Not tell me its heading
yeah, but if it's coming towards you, the distance will decrease...
True however this doesnt tell me from what direction
@short vine https://community.bistudio.com/wiki/getRelDir
..im an idiot, thank you
You could use getRelDir on the other object instead then you get 0 if it is headed straight for you
vectorFromTo π€
Howβs this better then just getting azimuth with direction
π
Guys, does moveTo can be used only in FSMs? Seems to do nothing in refular script
@solar coyote >> https://community.bistudio.com/wiki/doMove
I'm asking specificly about moveTo. And actualy would like to know whats the diference between the two
the BIKI says that moveTo can/should only be used in FSMs
doMove is for SQF
they both do the same thing
I would like AI just to move to given position. With doMove it seems to return fire and maybe oher AI soecific things. Thats not what i desire. I assumed moveTo would just find a path fron a to b and make AI walk there
You probably want to use doMove along with https://community.bistudio.com/wiki/setBehaviour
Wiki doesnβt say it should be used in FSM only, some user comment says so =/= wiki
moveTo low level command
low level is bullshit probably in that context
guys! π
is there a way to open and check target(other player) inventory?
not only backpack, all inventory
@solar coyote check this http://killzonekid.com/arma-scripting-tutorials-agents-how-to/
@meager heart tjx, seems like a good read
np, better just use move/doMove...
you can delete messages instead of editing them out
hhhm,mmm
i'm using that
_items = backpackItems player;
{
if (_x isKindOf ["Rifle", configFile >> "CfgWeapons"]) then {
hintSilent str getText (configFile >> "CfgWeapons" >> _x >> "DisplayName")
};
} forEach _items;
and it shows the MX perfectly
but what about pistol + magazines + grenades?
you want to hint them too ?
(backpackItems player) apply {_x call BIS_fnc_itemType select 1 == "Handgun"}
```something in that direction, maybe ^ π€
_items = backpackItems player;
{
_type = _x call BIS_fnc_itemType;
hint str _type;
} forEach _items;
i think it will work like that
now i want to force drop all the weapons to the floor
Mission w/ weapon restrictions?
ah, nice, good luck
private _type; is wasted there
https://community.bistudio.com/wiki/removeMagazine and https://community.bistudio.com/wiki/removeMagazines got this weirdo note below: Note: You may create invalid combinations with this function. When doing so, application behaviour is undefined.
anybody can enlighten me what they mean?
Not sure if either of these would be faster or not ```sqf
private _weapons = _playerItems select {(_x call BIS_fnc_itemType select 0) isEqualTo "Weapon"};
private _magazines = _playerItems select {(_x call BIS_fnc_itemType select 0) isEqualTo "Magazine"};
Well for starters, _playerItems is an array of arrays
not an array of classnames
Well, it's actually a mixed array. But it's still not correct for what you're trying to do.
private _type; is wasted there not wasted. Error. private keyword is a keyword for the = operator
there is no equals there
If you have script errors on, this should definitely be popping a few
private _type; should error, you should be getting errors in BIS_fnc_itemType for Type Array, expected String
Why do you even try to put the private thing up there? You never use it outside of the forEach.
if (count(_magazines) > 0) that and if (count(_weapons) > 0) are completely useless. forEach does nothing if you pass an empty array
reworked
[] spawn {
private _playerItems = [];
_playerItems pushBack (backpackItems player);
_playerItems pushBack (vestItems player);
_playerItems pushBack (uniformItems player);
_playerItems pushBack (primaryWeapon player);
_playerItems pushBack (secondaryWeapon player);
_playerItems pushBack (handgunWeapon player);
private _magazines = [];
private _weapons = [];
{
_type = _x call BIS_fnc_itemType;
_type = _type select 0;
switch (_type) do {
case "Magazine" : { _magazines pushBack _x };
case "Weapon" : { _weapons pushBack _x };
};
} forEach (_playerItems select 0);
{
player removeMagazineGlobal _x;
} forEach _magazines;
{
player removeWeaponGlobal _x;
} forEach _weapons;
};
magazines are gone, but weapons stay
@queen cargo that note is from 2006. I'd say it probably doesn't apply anymore
@late gull debug the contents of _weapons and see if it's what you expect
You still haven't fixed your issue with _playerItems not being exclusively classnames
One thing that comes to mind is that BIS_fnc_itemType doesn't rezurn Weapon at all.. ever.
So that can't work at all
it's working, i'm doing hint before the last foreach with hintSilent str _weapons
and it show the 2 weapons that i have
but the remove part it's not working
It shouldn't work though
also i did hint the _x in the last foreach, has the class of the weapon
type return 2 entries
You'll also probably need to make use of removeItemFromUniform, removeItemFromVest, and removeItemFromBackpack to get rid of weapons and magazines from within containers. I think (but am not sure) that removeWeaponGlobal only removes equipped weapons.
an array of 2
iex: with a magazine returns ["Magazine", "Bullet"]
ok worked with remove item from backpack
that's only for weapons huh?
_playerItems should currently be returning in the format [[],[],[],"","",""], which doesn't work with the rest of your script
i did take the 0 (_playerItems select 0)
_playerItems select 0 is just an array of items in the unit's backpack
hmm ok
so bacpack,. uniform and vest?
nope, backpack, vest,. uniform, primary, secondary, handgun
i can split them all in it's own var
check each var and push into magazines or weapons
Just found an 99% accurate arma mass penguins to real kg formula coeff, who's interested in that:
(loadAbs player) * 0.04545 // Full unit loadout mass -> kg
(getNumber (configFile >> "CfgVehicles" >> backpack player >> "mass")) * 0.04545 // Your backpack mass
(getContainerMaxLoad (backpack player)) * 0.04545 // Your backpack maximum carry weight.
((getContainerMaxLoad (backpack player)) * 0.04545) * (loadBackpack player) // Your backpack current items weight
Use this along with toFixed 2 to get 0.00 format
Oh, and @still forum dear scriptman, getContainerMaxLoad seems to be missing in Discord syntax π
btw. what is getContainerMaxLoad checking exactly in the config?
Im not sure. Since backpack has exactly maxLoad parameter, while vest and uniform doesn't
Arma weight is just decipounds
So that's not actually a penguins π
So it should be something like 0.04535 AFAIR.
Might as well have been :). Yeah, I use 0.04536.
Is that wikied somewhere, like that mass is actually 0.1 pound
@unborn ether I already made a PR for everything missing in discord syntax. But the highlighting library isn't maintained anymore
@still forum sad trombone
a way to make the player drop the weapons?
or a way to move weapons from inventory to the floor
can somebody else please test that this configNull select 10 really is not throwing any errors and returning nil?
because i cannot believe that this is expected behavior π±
but started with show script errors ..
CONFIG select NUMBER checks if config exists and if it's a class. If not it returns configNull yes.
because there is no error message
for me that is unexpected simply because i personally did not expected no error
With Arma always expect the unexpected
anyways ... added a warning to sqf-vm now
@late gull Had something similar for containers:
private _wh = "groundweaponholder" createVehicle position player;
_wh setPosASL (getPosASL player);
_wh addBackpackCargoGlobal [(backpack player),1];
_wh = everyBackpack _wh select 0;
{_wh addItemCargoGlobal [_x,1]} forEach (backpackItems player);
removeBackpack player;
You can use action tho, but it's interruptible AFAIK.
and addItemCargoGlobal is not a perfect way of storing items, since it doesn't count ammo etc. So in your opportunity to script it better.
@meager heart i realised today that i could transfer BLUFOR groups to headless, since only one of them had waypoints that were synced to anything. So i excluded that group and transferred the rest to hc. Saved all that effort in the laziest way possible lol
lol
Does ACE3 has a discord channel?
no
quick config question: what value determines if an entry in Cfgweapons is a weapon or headgear or uniform, etc?
type
thanks π followup though, is there a list anywhere that shows what each integer means? i don't see it in https://community.bistudio.com/wiki/CfgWeapons_Config_Reference#T
BIS_fnc_itemType
thankyou again. Long story short, im working on a custom shop system, and instead of going through each individual uniform/vest/etc and picking a price, I wanna auto sort them all at mission Init and im sure that will help
@late gull Looks hilarious, like an old games lootdrop π
haha
@tame lion lol I was just asking if there is a mod that kinda allows unit purchasing in a customizable way
If there a way to get the first 3 characters of a function name? I just want to check the tag
You have to be more specific
I think he wants to check whether the function has BIS_ part (?)
Yes I understood that but this is pretty vague
absolutely no idea what he means... So I'd say "no" ?
Some concrete example would do
string select [start, length]
hint "y wot m8";
Hey Sldt1ck, you're russian man. Don't do anything that doesn't feed stereotypes. Including using the tea drinker slang.
btw russians kinda "tea drinkers" too...
Well, everyone drinks a little tea. But you can tell by the stains on their teeth that it's more of an extreme :^)
k... thanks for the info π
Yw :)
I speak from the bottom of my heart: I drink vodka with tea.
So you start your mornings pretty sober then yes? /s
who knows
The fact that you don't know yourself is concerning, but we're all here for a good time not a long time right? Kidneys are for suckers.
(nonsense, this is #arma3_scripting π )
Hope I am allowed for this question here. I would like to have ACE Arsenal Loadout in the respawn menu. Is this possible somehow by ACE3 ?
You'd need to find someway to extract the data and make it readable for the respawn configuration. I don't think you can change respawn inventories on the fly though.
The vanilla respawn menu isn't designed to load your saved arsenal loarouts. It either shows the loadout used with that unit in configuration or a custom respawn loadout config defined in description.ext
When using addAction I can add a condition script. Since I was able to have the action handling script referencing to a .sqf file - it seems it is not possible for the condition parameter. Am I right here or just bad luck kinda?
You can but this will be huge overkill and impact on performance, the idea is to keep condition as simple and as light as possible, besides many checks that usually used in condition like distance check were moved to optional params already.
Are you wondering if you can specify more than one condition for an addAction?
nah I want to add a commandChat msg after before the condition returns true/false
after -> before*
_target commandChat 'Gonna check first'; 'ACE_key_west' in items _this;
Since the condition is evaled within aprox 50m the player is in range of the action holder I thought that might work
Its still hard to wrap my head around "after -> before"
was a typo
What you want end result to be?