#arma3_scripting
1 messages · Page 516 of 1
player isEqualTo (roflocopter turretUnit [0])
@young current I pack it with Bohemia Interactive's Arma 3 Tools. I am making a build script that will use armake, but it's not working fully right now
I dont know what kind of error debug info Armake gives, but Addon Builder gives none and lets through just about anything, so you could try Mikeros PboProject
Armake only prints errors that make it unable to build the pbo
Right. In that case I may try Mikero to verify the files instead then
worth to try
Thanks for the suggestions
Is anyone having a problem getting addPublicVariableEventHandler to work correctly?
Haven't heard of that yet
This should run the systemChat, right?
"testVar" addPublicVariableEventHandler {systemChat "This is working"};
testVar = 5; publicVariable "testVar";
no
only if you do the publicVariable on a different client than where the eventhandler is added
publicVariable is not transmitted to yourself
`Please note:
- EH will not fire on the machine that executed broadcast command, only on the machines that receive the broadcast.`
Is it possible to re-run a script on every existing character during the scenario?
{_x call myscript} foreach allunits
hi all! i need to get a mission scripted. there is already an old script but its OFP old. so my questions are: who are willing to help me? what would it cost?
k thx
short question:how would i need to alter this addaction here sqf _openMenu = _unit addAction ['<t color="#3748E3">Open Menu</t>', "path\to\script.sqf", [], 100, false, false, "", "driver _target == _this"];to call a fnc instead of a script without loosing any of the passed values? sorry if this seems like a noob question.just trying to convert an old script to functions
"path\to\script.sqf" > {[params] execVM "path\to\script.sqf";} or {[params] call tag_fnc_func}
so i need to define the condition before the addaction instead?
the actual problem is this sqf _showList = _unit addAction [format ["use %1 (%2 left)", GET_ITEM_NAME(_itemIndex), _count], "bad\client\useItem.sqf", [_ItemIndex], _ItemIndex + 50, false, false, "", "vehicle player == player"];its an addaction in format and i am not sure how to edit this to be honest
wdym
the only thing that is being formatted there is the title.
title = [format ["use %1 (%2 left)", GET_ITEM_NAME(_itemIndex), _count]
script = "bad\client\useItem.sqf"
arguments = [_ItemIndex]
priority = _ItemIndex + 50
showWindow = false
hideOnUse = false
shortcut = ""
condition = "vehicle player == player"
Edit as such @sturdy cape
How can I get the velocity of a round being fired in arma? I'm trying to calculate the mortar bombs speed at different charges to properly build a rangetable for the RHS mortars. Does anyone know how gravity works or can I just go for ~9.8m/s?
yeah but i cant put [] call xxx_fnc_function inside of that addaction simply,no?
@wide hamlet
Hey, does anyone know what I need to put in my remoteexec.cfg? I'm getting this error: BattlEye Server: RemoteExec Log: #0 illu (fee0d6b062b1a61e2f6b67132d9dc954) - #0 "vcm_serverask ["Vcm_Settings"]"
{[params] call tag_fnc_func}@sturdy cape
just as simple as that?
afaik
@tough abyss I don't know for sure, but these seem to be solved forum topics.
https://forums.bohemia.net/forums/topic/189305-solved-get-bullet-speed-of-weaponmagazine/
https://forums.bohemia.net/forums/topic/217932-getting-mortar-projectile-speed-from-config-solved/
@warped moon in first line "vcm_serverask ["Vcm_Settings"]"
tbh i would have some misc clientside shit in a script and have that script also run the func. Up to you
@sturdy cape ok will try thank you
needs to be a server side addon unfortunately.for a plugin system
just try that line. Trial and error
@tough abyss
player addEventHandler["FiredMan",
{
_velocity = velocity(_this # 6);
hint format["The velocity blah %1",_velocity];
}];
@sturdy cape didnt work 😦
i think now it will
in descriptions.ext does indenting matter?
indenting is good coding practice no matter what file or script
imma go with yes just so you do it
it matters if you want to have people help you later when you run into problems and have to show them your code
alright
ty
trying to make an ace description.ext but its not working
I'll post in the correct channel if I cant figure it out.
WITH indenting
ACE slack is also a good place to ask ACE related things I've heard
@high marsh
@bronze basin
Thanks! Had to search through the configs for them I guess but it seems like all the charges use made up numbers. Would be a lot cooler if this (https://i.imgur.com/Vo8k2Zz.jpg) bad boy would've worked.
lol, no I think all the config values might be coefficients
Yeah
Can anybody link me to the biki for 3D markers? Like a cylinder object
wait what?
you mean trigger area?
there isn't 3d marker this is just engine drawing it in editor
I mean like a 3D object - shape of a 3D cylinder
the only cylinder you can use is object called safe area or something
which is visible ?
sorry forgot to mention that I am talking about a visible 3D marker/object in a cylinder shape
is it scalable? like having a scripted dynamic radius?
hmm bummer
I wanted some kind of debugging objects
making some cycle areas visible for me for testing
personally I think Eden should have had a bunch of them, cylinders of many sizes, cubes, pyramids and what not
cost nothing to make
but
is possible to run script on server not from game? Maybe console or something like that
I need that for use on server console app
what do you exactly mean not from the game
I want to run the script through an event in the MySQL table, when the value is updated - the server immediately sees it and loads a new one.
extDB3, or write an extension
as far as I know - extDB3 accepts requests only from the arma
Right, I wasn't sure. So probably write an extension.
What is the best practise to have a function handle array params the same regardless of the size of the array?
atm I have to wrap the param when calling the func with []
to be 100% safe it will not strip a ["value"] array differently to ["value1", "value2"]
yes that's how you do it
@frigid raven
because if you need to add one pore parameter you just add it to the array of parameters
mine_fnc_setDammageOnTheseUnitsPlease = {
params ["_arrayWithVehicles", "_dammage", "_alsoDammageHumans"];
};
[[player, vehicle player, thatOtherGuy, vehicle thatOtherGuy], 9000, true] call mine_fnc_setDammageOnTheseUnitsPlease;
@astral dawn ok thanks dude - sorry for the late reply but I fell in depres... sleep
It's fine 😄
Is there some command like canMove which doesn't get affected by the vehicle's isTouchingGround state?
The problem with canMove is that if the vehicle is not touching ground but healthy, it returns false.
@copper raven thank you but i can try ```sqf
_ctrl ctrlMapAnimAdd [0, 0.5, player];
ctrlMapAnimCommit _ctrl;
but its not working
@copper raven i don't understand i read still 😦 😦
(findDisplay 37 displayCtrl 51) ctrlmapAnimAdd [1, 0.05, markerPos "m_aaf_attack"];
ctrlmapAnimCommit (findDisplay 37 displayCtrl 51);
};```
this is how i do it
in the briefing code
this addAction["Firing position 1 Targets","popup.sqf",[[tar1,tar2,tar3,tar4,tar5,tar6], 0,1,true]];
how do i convert this into using remoteExec
so when you start the mission, the screen will focus on the marker named m_...
nevermind, missread 😄
@copper raven ? can u help me ?
@rancid pecan use mapAnimAdd https://community.bistudio.com/wiki/mapAnimAdd
@modest temple remoteExec is not something you must use or other kids will make fun of you. If you don’t understand wiki then you probably don’t need to use it.
hmm do hit and HandleDamage EHs not work on buildings?
ok, seems to work with bigger weapons
where in the config is the rate of fire for a weapn stated? its not reload time, thats always at 0.15
For anything config related you’re better off asking in #arma3_config
@west grove what weapon were you firing with at the building?
normal rifle
afaik it doesnt fire if no damage is inflicted
yeah, i figured it has something to do with penetration or such
addMissionEventHandler ["Draw3D",
{
if !(player == vehicle player) then
{
player exitWith {};
}
else
{
if (currentVisionMode player isEqualTo 2) then
{
if (isNil "A3W_thermalOffline") then
{
"A3W_thermalOffline" cutText ["THERMAL IMAGING OFFLINE", "BLACK", 0.001, false];
A3W_thermalOffline = true;
};
}
else
{
if (!isNil "A3W_thermalOffline") then
{
"A3W_thermalOffline" cutText ["", "PLAIN", 0.001, false];
A3W_thermalOffline = nil;
};
};
};
}];
Why I get an error ? Anyone can tell me?
player exitWith {}; thats not how exitWith works
!(this == that) wat? You know that there is a != operator?
Does setVectorDirAndUp work in render time or simulation time?
I guess if it doesn't have *Visual at the end of its name, it's not in visual time
even more, I don't think that there are commands to set any object property in visual time, you can only get properties in visual time
I've been wrestling with setvectordirandup in a Draw3D handler and the result always seems a frame delayed.
how does one use setvectordirandup with draw3D?
lean correction for pip scopes
(rotate the camera the opposite direction to negate the lean)
soo you setvectordir for the camera?
yep
I think you should use the actual camera commands for that
is the camera script created?
yes
i'm all ears (have put on he back burner because i wasn't happy with the result - got really close by predicting the frame delay but not quite perfect)
I was about to say 'maybe if you interpolate your data one frame ahead' 😄
but yeah PIP is always a little behind
i was inspired to mess with it because of this video;
at the time i've linked to it he demonstrates lean correction and i don't know if it's a YT thing but i see no sign of a delay
but damned if i can nail it despite using far more direct manipulation (i.e. a single setvectordirandup call where he appears to have used multiple bis_fnc calls to read and then set up)
@hasty frigate
😄 not bad idea to go to the source
I want to make AI play an animation when they get near an object that the player places, how would I attach the script to the object? Let's say its an "Weapon_arifle_MX_GL_F" for argument's sake
you would have to periodically poll the unit's position until he's close enough to your object
how do you make him move here in first place?
or you can order your unit to walk there, then poll this one
https://community.bistudio.com/wiki/moveToCompleted
I don't want it to rely on waypoints, I basically want players to drop distraction items like in Metal Gear
I've got the trigger working and all, just not sure how to spawn the trigger with a particular item that's dropped
well you'd have to spawn a script per every AI unit or per every group at least
which would search for such things around
or when you drop the distraction, you search for nearby AIs and notify their spawned script about the object
so that they all don't have to check for the same thing periodically...
Right now it's on a trigger area, I just need to create a trigger area whenever that item is dropped which I'm not sure how to do with an existing item
This is mostly doing what I want, but how can I terminate the script if the unit gets damaged during it?
_unit = _this select 0;
_object = _this select 1;
_occupied = false;
_pos = getPos _object;
if isPlayer _unit exitWith {};
if (behaviour _unit == "AWARE" or behaviour _unit == "COMBAT") exitWith {};
if ((behaviour _unit == "CARELESS" or behaviour _unit == "SAFE") && !(_occupied)) then {
_occupied = true;
doStop _unit;
_unit lookat _object;
_unit playAction "gestureFreeze";
sleep 2;
_unit lookat _object;
_unit forceWalk true;
_unit doMove _pos;
waitUntil {(getPos _unit) distance (_pos) <= 1};
if isPlayer _unit exitWith {};
_unit setDir (_unit getDir _pos);
[_unit, "SIT_LOW", "ASIS",_unit,true] call BIS_fnc_ambientAnim;
};
waitUntil {((behaviour _unit == "AWARE" or behaviour _unit == "COMBAT") && (_occupied))};
if isPlayer _unit exitWith {};
_unit playMove "AmovPercMstpSrasWrflDnon";
sleep 2.5;
_unit call BIS_fnc_ambientAnim__terminate;
_unit switchMove "";
_unit lookat objNull;
_unit forceWalk false;
sleep 5;
_occupied = false;
_unit = nil;
also having trouble activating a script with a trigger,
_distractionTrigger setTriggerStatements [this,_distractedMan = thisList select 0;
_distracter = [distractedMan,thisTrigger] execVM "distraction.sqf"; ];
that second array element needs to be a string doesnt it?
so I want to port my mission to be played strictly with ww2 assets. I have created various blacklists. I have been tooling with these commands, shuffling them around but I cannot stop default ArmA assets from showing in game.
if ((toLower _class) in _myWeaponBlackList) exitWith {};
if ((toLower _class) in _myAmmoBlackList) exitWith {};
if (_lowClass in _myVehBlackList) exitWith {};
if ((toLower (configName _class)) in _myGroupBlackList) exitWith {};
if ((toLower _fc) in _myFactionBlackList) exitWith {};
could someone steer me in the right direction?
why not just whitelist the ww2 assets u want instead?
I thought of that but many of the IFA3 assets classnames are hidden
or at least I don't know how to find them but according to kju I think they are hidden by design
what, classnames for the blacklists you listed above? it would all be listed in the config somewhere 🤔
When I go into Editor and find , lets a soldier, the soldier does not expand to allow me to view the config
thus the hidden feature by kju
Got it closer
_distractionObject = "ItemMap";
_player = _this select 0;
_objectPos = _this select 1;
typedropped = _this select 2;
if !(typedropped == _distractionObject) exitWith {};
_distractionTrigger = createTrigger ["EmptyDetector", _objectPos, true];
_distractionTrigger setTriggerArea [5,5,0.5,false];
_distractionTrigger setTriggerActivation ["ANY", "PRESENT", true];
_distractionTrigger setTriggerStatements ["this","[thisList select 0,_objectPos] execVM 'distraction.sqf';","" ];
hint format ["trigger created at pos %1", getPos _distractionTrigger];;
This is coming from the PUT eventhandler
@sage flume is it for specific units or any unit? i just tried it and it loaded fine 🤔
ya I'm wanting to stop all ArmA assets from showing in my mission
units weapon vehicles,..etc
no i mean this the soldier does not expand to allow me to view the config
I dont think its IFA3, im not having the issue ur describing.
take another look at it when u return to ur pc, afaik if the object has a classname itl be listed in the config somewhere.
Is this right? It doesn't seem to be passing the second variable to my other script
_distractionTrigger setTriggerStatements ["this","[thisList select 0,getPos _distractionTrigger] execVM 'distraction.sqf';","" ];
_distractionTrigger wont be defined in the string
So make a separate variable outside of the string for it then?
just use thisTrigger?
Worth a try
@robust hollow take another look at it when u return to ur pc, afaik if the object has a classname itl be listed in the config somewhere.
as in itl already be defined in the string for u, same as thisList is
Worked like a charm
How can I kill the script in the middle if the AI is injured while doing his little animations
if (condition) then {terminate _thisScript};
_thisScript will be defined automatically (assuming its a scheduled script)
what if he was injured before the script started though?
then have a condition at the start too to prevent the script running
The script can start with him injured, but if he's injured in the middle it should start. It's very stupid. I guess check if condition is same as it was at the beginning
I'm guessing I'm passing something wrong here
'... "x\cba\addons\settings\fnc_init.sqf"
|#|params [
["_setting","",[""]],
["sett...'
Error Params: Type code, expected Number, Bool
File x\cba\addons\settings\fnc_init.sqf, line12
here's my config.cpp
#include "BIS_AddonInfo.hpp"
class CfgPatches
{
class AB_Distraction_main
{
name = "Distraction";
author = "Axebeard";
requiredVersion = 0.1;
requiredAddons[]=
{
"cba_keybinding",
"cba_main",
"cba_main_a3",
"cba_settings",
"extended_eventhandlers"
};
units[] = {};
weapons[] = {};
};
};
class Extended_PreInit_EventHandlers
{
class AB_Distraction
{
init="call compile preprocessFileLineNumbers 'DistractionByAxebeard\XEH_PreInit.sqf'";
};
};
class cfgMods
{
author="";
};
and my XEH_preInit
[
"AB_Distraction",
"EDITBOX",
["Distractable items", "Separate items with a comma (,)"],
"Distraction",
'"ItemMap"',
{
params ["_value"];
[_value] execVM "initDistraction.sqf";
}
] call cba_settings_fnc_init;
What am I missing here?
https://github.com/CBATeam/CBA_A3/blob/master/addons/settings/fnc_init.sqf - Your code block is in the ["_isGlobal", false, [false, 0]], space
Hence, Error Params: Type code, expected Number, Bool
I thought I set it to true, I must have overwrote it
true needs to go after ItemMap then, right?
Okay, now it's saying my "initDistraction.sqf" script is not found. That just needs to be in addons right?
Or rather in the folder with everything else
Hello everyone! How i can enable ACE3 debug info logging in rpt file?
Info from code like that:
TRACE_5("ACE_DEBUG: HandleDamage Called",_unit, _selection, _damage, _shooter, _projectile);
add an eventHandler for Damage?
Hello. So how do I find the nearest objects in an array?
In concept, make the array, then sort by distance to object. In practice, I couldn't tell you a "good" or efficient way to do it but someone here can
yeah. been trying that but it doesn't accept my array. I am a complete noob at this
it doesn't accept my array what are you doing? paste example.
_PoToMo = nearestObject [leader _Newgroup1, AreasToLand];
what does AreasToLand look like?
assuming its a valid string, is the nearest object further than 50 meters away?
AreasToLand = [LZ1,LZ2,LZ3] each LZ is a "Sign_Arrow_Green_f"
yeah. about 10 times 50m
oh, yea ok what ur doing isnt how to use nearestObject.
Considering the array is small I would just go with @tough abyss 's suggestion.
private _landZones = [LZ1,LZ2,LZ3] apply {[leader _Newgroup1 distance _x,_x]};
_landZones sort true;
private _nearestLZ = _landZones#0#1;
I thank you for this.
how do you cancel out a unit's waypoints? Just delete them all I mean
Or pause them maybe?
How would I reference this parameter in a different script? param "AB_Distraction" select 0?
[
"AB_Distraction",
"EDITBOX",
["Distracting items", "Separate items with a comma (,)"],
"Distraction",
'"ItemMap"',
true,
{
params ["_value"];
//[_value] execVM "distractionSetup.sqf";
//_distractableItem = _this select 0;
{
_x removeEventHandler ["Put", 0]
_x addEventHandler ["Put", {[_value,_this select 0] execVM "DistractionByAxebeard\placeDistraction.sqf";}];
} forEach allPlayers;
}
] call cba_settings_fnc_init;
im no expert of CBA so wont help you there, though i am sure _value wont be defined in that event
_x addEventHandler ["Put", {[_value,_this select 0] execVM "DistractionByAxebeard\placeDistraction.sqf";}];```
reference the value I mean
Suprisingly it worked
the way I had it I mean. When I changed the value in game though, it sort of bugged out and got confused
So instead of passing the value in the eventHandler right there, I'd rather have the "placeDistraction" script just pull the value directly because it might change for whatever reason
I may be wrong, can't get it to work now. How do you think _value should be defined @robust hollow?
I was thinking something like this might work but it throws an error for the whole XEH_PreInit thing
[
"AB_Distraction",
"EDITBOX",
["Distracting items", "Separate items with a comma (,)"],
"Distraction",
'"ItemMap"',
true,
{
params ["_value"];
{
_x addEventHandler ["Put", {[params select 0, _this select 1, _this select 2] execVM "DistractionByAxebeard\placeDistraction.sqf";}];
} forEach allPlayers;
}
] call cba_settings_fnc_init;
params select 0 thats wrong...
Yeah, that's the change that broke it, I figured that much out. Not sure how to pass the var
the event code is executed in its own scope or instance (not sure of the right word), so _value wouldn't be defined in it.
anyway you could have something like this
_x addEventHandler ["Put", format["['%1',_this select 0] execVM 'DistractionByAxebeard\placeDistraction.sqf';",_value]];
im assuming value is a string 🤔
Yeah, the default value is "ItemMap"
ok good, ^ should work then
Okay, now the errors have moved onto other places, namely the placeDistraction script. Is my IF line screwy? It worked as a standalone script I thought
_distractionObject = _this select 0;
_objectPos = _this select 1;
_typedropped = _this select 2;
if !(_typedropped == _distractionObject) exitWith {};
you dont provide a third array element...
also why not use !=?
[
"AB_Distraction",
"EDITBOX",
["Distracting items", "Separate items with a comma (,)"],
"Distraction",
'"ItemMap"',
true,
{
params ["_value"];
{
//_x addEventHandler ["Put", {[params select 0, _this select 1, _this select 2] execVM "DistractionByAxebeard\placeDistraction.sqf";}];
_x addEventHandler ["Put", format["['%1',_this select 0,_this select 1, _this select 2] execVM 'DistractionByAxebeard\placeDistraction.sqf';",_value]];
} forEach allPlayers;
}
] call cba_settings_fnc_init;
_objectPos = _this select 1; is this meant to be an object or position (array)?
not entirely understanding ur placeDistraction variables when compared to the array ur giving it from the eventhandler
Well I'm using the Put eventHandler, and I need to pass the location of the object and the type of object
yea i still have no idea.
These are the arguments Put gives you, either im misunderstanding something or you havent got the order of these arguments right... 🤷
params ["_unit", "_container", "_item"];
unit: Object - Unit to which the event handler is assigned
container: Object - The container into which the item was placed (vehicle, box, etc.)
item: String - The class name of the moved item
it worked earlier with container as the position, I pulled the snippet off Armaholic
I think if the container is "world" or whatever, it just returns a position
anyway, I'm getting a generic error with this
if (_typedropped != _distractionObject) exitWith {};
as in dropping it on the ground? it creates a weapon holder and returns that object
yeah, I dunno
yea ur generic error is because the data types dont match
I'm open to suggestion
['%1',_this select 0,_this select 1, _this select 2] -> ['%1',getPos(_this#0), _this select 2]
Okay so select 0 and select 2 are not the same type of data?
yea. ur select 2 was the container object
I thought that was select 1?
in the Put arguments it is select 1 but your event puts the _value from the CBA script before it, pushing the Put arguments up an index
OhhhH I think I'm trackin
So typedropped should be select 3 then?
_distractionObject = _this select 0;
_objectPos = _this select 1;
_typedropped = _this select 2;
if ur still using ur argument array for execvm, yes
Ok
@cursive whale I've been wrestling with setvectordirandup in a Draw3D handler and the result always seems a frame delayed.
Draw3D is called at the end of the frame, after simulation, but before rendering. EachFrame handler fires before simulation.
@lost copper you need to build the ACE pbo's yourself and set the #define to enable debug mode.
Now it's telling me _typedropped is undefined
did u swap ur execvm argument array to the one i suggested?
Yeah I think so
_x addEventHandler ["Put", format["['%1',getPos(_this#0), _this select 2] execVM 'DistractionByAxebeard\placeDistraction.sqf';",_value]];
and
_distractionObject = _this select 0;
_objectPos = _this select 1;
_typedropped = _this select 3;
if (_typedropped != _distractionObject) exitWith {};
ConnorToday at 6:07 PM
if ur still using -->ur<-- argument array for execvm, yes
ur array -> ['%1',_this select 0,_this select 1, _this select 2]
🤦
huh?
Btw you really should not use execVM inside a eventhandler. That kills your performance because the script needs to be reloaded and re-preprocessed and re-compiled every time the eventhandler is executed. You should really use CfgFunctions but you can solve that one later.
@tough abyss
['%1',getPos(_this#0), _this select 2] -> [0, 1, 2]
You have 3 parameters. 0, 1 and 2.
_this select 3 won't work, the highest you have is 2
Oh MYYYYY argument array
well Connor's telling me I have 4 because Put has 3, plus I'm inserting 1
Also I'd recommend you use params. That's easier to use for you I guess.
params ["_distractionObject", "_objectPos", "_typedropped"] replace all your _xxx=_this select... stuff with that one line
so which is it? 3 or 4 arguments being passed?
look at ur array?? does it have 3 or 4 elements?
From what I got from you, I was inserting one before Put's args
which would mean 3 args being passed, but Put can pull it's own shit?
That's what I read anyway
@still forum Thanks man, good to know, will give it a whirl.
But I think I see what you're saying now actually
You are adding one argument yes. But you are also removing one argument from the Put values.
it should be
_x addEventHandler ["Put", format["['%1',getPos(_this#0), _this select 3] execVM 'DistractionByAxebeard\placeDistraction.sqf';",_value]];
``` and
```sqf
params ["_distractionObject", "_objectPos", "_typedropped"];
You only take 0 and 2 from Put. You removed 1.
_this select 3 no
Put has 3 arguments. That's 0, 1 and 2. There is no 3
Ok, I'm confusing myself I think I got it
Ok, so no errors, but it's also not doing anything. I suspect the object types are still mismatched data types
more like just not matching strings
well, distractionObject is still undefined
what type do you expect in _distractionObject? Variable name sounds like an object. But you are clearly putting a string with a number string inside in there
yeah missremembered your code
log the argument array in placeDistraction and see what it says?
how do I do that? I tried setting them to globals but that just wrecked everything
diag_log _this
diag_log _this in the first line
Aww me slow
no ";"?
it would be a good idea
where's it gonna log? the rpt?
yes
Is it adding a shitton of """?
1:36:15 Error Undefined variable in expression: distractionobject
1:36:15 File DistractionByAxebeard\placeDistraction.sqf, line 4
1:36:20 ["""ItemWatch""",[2053.62,4015.7,0.00143909],"ItemMap"]
1:36:20 Error in expression < "_typedropped"];
You have "ItemWatch" inside your string. Instead of ItemWatch
In your CBA setting
'"ItemMap"'
You have duplicate quotes
Ok
It looks like it wants ItemWatch to be the value from my parameter, which isn't right for one
1:44:07 ["""ItemWatch""",[2056.18,4013.78,0.00143909],"ItemRadio"]
1:44:11 ["""ItemWatch""",[2055.96,4012.67,0.00143909],"ItemMap"]
[
"AB_Distraction",
"EDITBOX",
["Distracting items", "Separate items with a comma (,)"],
"Distraction",
"ItemMap",
true,
{
params ["_value"];
{
//_x addEventHandler ["Put", {[params select 0, _this select 1, _this select 2] execVM "DistractionByAxebeard\placeDistraction.sqf";}];
_x addEventHandler ["Put", format["['%1',getPos(_this#0), _this select 2] execVM 'DistractionByAxebeard\placeDistraction.sqf';",_value]];
} forEach allPlayers;
}
] call cba_settings_fnc_init;
Good idea, but I never set it to watch I don't think
let's find out
Okay yeah, I had the setting as "ItemWatch", I took out the quotes and it worked as expected
I'm still a little vexed about what's going on with "_value" and _value here though
params ["_value"];
{
_x addEventHandler ["Put", format["['%1',getPos(_this#0), _this select 2] execVM 'DistractionByAxebeard\placeDistraction.sqf';",_value]];
} forEach allPlayers;
I want to add in a few more parameters
As well as get all the items the server inputs in "Distracting Items" into an array
I'm done for the night anyway, thanks lads
From commy, I think you'll find this interesting too. This code is executed in a init script of a unit.
this = 1;
0 = this spawn {
cutText [str _this, "PLAIN"];
};
What does this code print?
1 i guess? if it does not, it would be kinda worrysome
it doesn't. Maybe it helps if I say that this from a init script is a local variable
I think besides you noone here could solve that besides guessing. Too many internals
If you don't guess that right you might've something to fix on sqf vm :D
Although it shouldn't matter as there are no local variables called this in the vm
noooo ... nooooooooo .... noooooooooooooo
please do not tell me that arma actually checks the global variables on the local stack first
please
and that this only works, because this automatically (and correctly) assigns the global one
whilst the get operation of this checks first the private, then the global stack
please do not tell me that this wizard craft of spagetthi code is true
yeah they do. getter looks up locals first. Setter checks for starting _ and decides where to look based on that.
and that you actually try to fool around here and this is in fact: 1 as it should be
omfg 🤦
then it is whatever was in this first
and the glbal variable this then has a 1 inside of it
init box of a unit. So some Alpha: 1-1 unit name thingy
And I have another one for you
[1,2] params ["_args,_handle"];
isNil "_args,_handle"
should i really add that broken garbage into sqfvm? (the this thing, not that isNil crap)
You don't need to because you won't have local variables without _ in there.
that one though is easy ... they forgot to add checks for the whole string
this actually might "work" SQF-VM too
besides triggers and unit init boxes there are no locals without _
That works same as you can set a missionNS variable with name "_1%&78()"
Okey no.. I guess you have to do that this thing.
"lul" params ["this"];
this = 1;
0 = this spawn {
cutText [str _this, "PLAIN"];
};
wait ... that is actually working?
Well. I don't know. I assume params is not checking for starting _, can't try now
they do not check if the variable in params starts with an underscore?
wtf
WTF
should not share punches so early on though ...
guess who also forgot to add that check 🤦
Okey I got report back from commy. Params does check for _, although with a kinda obscure error Error local variable in global namespace
The error is the opposite. A global variable where only a local one is allowed
@still forum About debugging in ACE3. Did you mean this defines?
https://github.com/acemod/ACE3/blob/master/addons/main/script_debug.hpp
The script component ones. debug mode full
@still forum thx!
Hi, anyone could tell me please how to add launcher ammo direct into the launcher? I am trying to add missiles to the RHS USAF Javelin but it won't work. My search so far has indicated that maybe the normal addMagazine command requires storage space in the uniform, and with the Javelin that is a problem...
@ebon ridge addMagazine should be used before addWeapon ; if you already have the weapon try to remove/add it
But regarding the storage issue, idk
actually I think I found it: addSecondaryWeaponItem, didn't try it yet though
In a MP game, moving from "BRIEFING SHOWN" client state to "BRIEFING READ" aka pressing the continue button, will broadcast information to other clients. Can I emulate that behavior somehow? I want to broadcast that information (mainly about gear which is being set through 3den attribute expressions and is after the mission init) between clients. A hacky workaround has been to just wait til the continue button for non-admins is active then activating it, which works for all clients other than the admin. Is there 1) A better way to sync player gear set after mission init to be available before the "BRIEFING READ" client state? 2) A way to push clients in "BRIEFING READ" clientstate and broadcast their info without starting the mission? Thanks guys.
"_args,_handle" it is a string starting with _, nothing unusual, just won't pass parser but will work with set/getVariable
a kinda obscure error Guess what kind of error ```sqf
private ["this"];
produces? @still forum
It is just generic namespace error, why not just say wrong namespace? sqf localize "STR_EVAL_NAMESPACE"
I am wondering, if I am doing general data processing in SQF, what wastes my CPU cycles most? The VM itself? And can Intercept potentially hack around some statements to improve performance?
@tough abyss none
if not none then guys in ace slack told wrong stuff
@astral dawn the vm probably
The whole thing that reads bytecode, decodes operations, etc, so there's probably nothing to be done here? 🤔
stuff can be done intercept wise. That's what I once tried with fastscript.
not that much tho
SQF needs JIT compilation like Java :p
possible. Feel free to do it 😄 I certainly won't
if not none then guys in ace slack told wrong stuff you've been duped
So you're saying it's not impossible with intercept-level hacks?
yep. atleast I don't see anything stopping you from doing that. It's ALOT of work tho 😄
actually.. Depends on how deep you wanna go. If you wanna just inline the VM stuff and keep the SQF commands still as seperate calls, then not thaat much work.
parse, convert everything to Java, use Java compiler 😄
_reloadTime = (getNumber (configFile >> "Cfgweapons" >> _gun >> "FullAuto" >> "reloadTime"));
returns 0
idk why but it doesnt work. if i access the reloadTime in the main gun class it works.
is it possible to see all variables attached to a certain unit? like say ive done
_unit setvariable ["name","bob"];
_uint setvariable ["somethingElse",5];
without knowing the variable name can i display them all?
allVariables
oh okay thanks
What is the best way to implement something like a struct in sqf (if there is any way)? I want to make an array of structs that can be used as templates for instancing squads using content from different mods. e.g. If I want to generate an outpost using BAF I can look up templates["BAF"].basic_soldier_class_name, or templates["BAF"].mortar_class_name
Hey, quick question, having a bit of a brain fart lmao - How to get control width/height to string length. I am thinking ctrlTextWidth/ctrlTextHeight but am stuck really. Can use count to get the string length but example output from one is like 1051. I am using ControlsGroup container. Any ideas?
{
_message = _display ctrlCreate ["RscText", (100 + _forEachIndex), _logsContainer];
_message ctrlSetText _x;
_message ctrlSetPosition
[
0,
(0.04 * _forEachIndex),
???,
???
];
_message ctrlCommit 0;
} forEach messagesArr;
Each text's text height will vary depending on the string.
@ebon ridge no there is not a way
@obtuse cosmos I don't know sqf libraries at all, but it does appear the examples at https://community.bistudio.com/wiki/ctrlSetPosition do something like that? They appear to create the control, apply the text, then get the width of the controls text and resize the control
Okay thanks @still forum
I have seen in the code I look at people using const variables as lookups into multidimensional array to achieve the same effect, I guess that is the best I can do!
@ebon ridge Yeah but even if I do that, which I did try, I need to apply the default h value first?
RscText doesn't automatically adjust... Or am I missing something?
@ebon ridge you can make custom class in mission config and read it from mission, will be read only though
Okay thanks, that sounds promising
will magazinesAmmoFull return pylon ammo?
@still forum any ideas? 😄
nö
Don't know. Didn't read
Actually your problem isn't solvable Haz 😃
Although maybe I don't understand, you want to size the control to the predicted size of the string right?
Without wrapping?
It can go to next line, etc
but then next time after that needs to be after
if that makes sense, lol
Yeah it won't work like that, to get wrapping you need to constrain the control in the horizontal direction right?
It will be forced full width
Only want the h value to adjust dynamically based on text string length
My guess: you should enable wrapping (if it isn't enabled, looks like it needs ST_MULTI flag somewhere or something, I don't know), then set the control width to whatever your fixed max size is, set the control height to some large value so the text will definitely fit, then commit that, then use ctrlTextHeight to get the height of the text in the control and resize the control back to that height. Did you try this?
I even tried RscTextMulti
ah
so set huge value as default
I was trying to do it backwards 😄
by trying to get height first which was confusing me 😛
Just to confirm, I am getting ctrlTextHeight of _message? _height = ctrlTextHeight _message;
Just to clarify I have never written a line of sqf UI code in my life (lots of other UI), I am just guessing from reading the docs right now 😃
But yeah I guess the same as in the example in the link I gave but set the width to a fixed value instead of the height, and call ctrlTextHeight instead
At least someone on this discord reads docs
I did read the docs.
Even though I already knew the commands. I was just getting confused hehe.
Happens when switching between full stack and SQF
@ebon ridge RscTextMulti doesn't seem to use full width 😒
And RscText just goes all the way across.
As in RcsTextMulti control doesn't use full screen width?
Here is someone hackily doing what you want to do I think: https://forums.bohemia.net/forums/topic/159660-measure-the-on-screen-size-of-a-string/
Best way to do a waitUntil X happens OR a time has elapsed?
waitUntil {([X] call fnc_happens) || (time > time_has_elapsed)} ?
:DDD
why don't you like this?
Didn't know you could do time > time, I was only aware of sleep and for _i
well time returns a number (of seconds)
makes sense lol
so you decide the time threshold, like _timeThreshold = time + 10; // 10 seconds after now
Hello guys, quick question:
So, i've used:
tablerob setObjectTextureGlobal [0, "pics\tablero1.paa"];
on a Whiteboard, and the image does displays, yet it stretches out and the borders are cut out, any ideas as to why?
Resolution of pictures is n^2 (1024x512) and .paa format
(assuming its the vanilla whiteboard) the height and width should match (BI uses 2048x2048) and the top and bottom borders are blacked out. heres what i mean
https://i.imgur.com/a0sdenN.png
I'm getting this error on line 47 apparently:
14:48:44 Error in expression <aram [2, "ASIS", [""]];
_cond = _this param [3, {false}, ["",{}]];
here's the relevant code
_nearestunits = nearestObjects [getPos _unit,["Man"],200];
_nearestfriendlies = [];
if((side _unit) countSide _nearestunits > 0) then{
{
if ((side _x == side _unit) && !(isPlayer _x) && (behaviour _x != "COMBAT")) then {_nearestfriendlies = _nearestfriendlies + [_x]};
} foreach _nearestunits;
};
//turn to look at them and wave
_calledTroop = _nearestunits select 0;
_unit lookat (getPos _calledTroop);
_unit setDir (_unit getDir (getPos _calledTroop));
_unit playMove "Acts_PercMstpSlowWrflDnon_handup2"; //wave SOS, over here
//troop 2 approaches
_calledTroop forceWalk true;
_calledTroop doMove _objectPos;
//both turn to object
waitUntil {(_calledTroop) distance (_objectPos) <= 1};
_unit setDir (_unit getDir _objectPos);
_calledTroop setDir (_calledTroop getDir _objectPos);
//troop 1 points
_unit playMove "HubBriefing_pointAtTable";
[_calledTroop, "STAND", "ASIS",_calledTroop,true] call BIS_fnc_ambientAnimCombat;
what does it say after that error? there should be a reason why it errored
also side note, you dont need to use _this with param, it will work the same
_this param [3, {false}, ["",{}]]; -> param [3, {false}, ["",{}]];
Type object expected string, code
oh is the error coming from BIS_fnc_ambientAnimCombat?
apparently, but it says line 47 which doesn't line up
line 47 is if ((side _x == side _unit) && !(isPlayer _x) && (behaviour _x != "COMBAT")) then
[_calledTroop, "STAND", "ASIS",_calledTroop,true]
[object,string,string,object,bool]
[0,1,2,3,4]
index 3 is an object but it should be a string or code
I see what it's saying, but I don't understand why _calledTroop is NOT an object
now that you point it out anyway
it is an object, the script doesnt want an object in index 3 though
no?????
the error told you what it wants, and i just did too
a string or code. its a condition
_unit = _this param [0, objNull, [objNull]];
_animset = _this param [1, "STAND", [""]];
_gear = _this param [2, "ASIS", [""]];
_cond = _this param [3, {false}, ["",{}]];
_behaviour = _this param [4, "COMBAT", [""]];
Ohhhh
params :U
I copied this over from BIS_fnc_ambientAnim without checking the differences
is "COMBAT" a condition for param 3? because it's saying it's undefined
no it is not
the script converts the string to code, so "COMBAT" would turn into {COMBAT} and as COMBAT is not a defined variable, you get an error.
So string is useless in there then?
no?
if it gets converted to a not-string, then why put a string
because it is a condition
so it's a bool?
it needs to return one yes
however looking for combat is a waste of time because the function does that already
(behaviour _unit == "COMBAT")
so if I want the condition to be "unit is in COMBAT state"
if you have no additional conditions to add just put that element in the array as nil
the line you posted or literally just "nil"?
nil, no quotes
I don't understand how that's looking for the combat state, or is it because the behaviour param 4 is already defaulted to combat?
have you read the BIS_fnc_ambientAnimCombat file?
//wait for unlock condition evals to true
waitUntil
{
sleep 0.1;
(behaviour _unit == "COMBAT") || {(damage _unit > 0) || {(_unit call _cond) || {(_unit call BIS_fnc_enemyDetected)}}}
};
Nope just https://community.bistudio.com/wiki/BIS_fnc_ambientAnimCombat, where would I even find that?
in the game files
a3\functions_f\ambient\fn_ambientanimcombat.sqf
i think you should read it if the wiki alone isnt explaining the arguments well enough
How do you guys handle writing code with lots of SQF functions?
I can barely remember all their names and parameters and looking them up even in the NaturalDocs database is quite time consuming.
Maybe there is some Eclipse plugin which can parse my files for special tags that tell this plugin 'hey look this is a function definition over there' and then help my by completing what I type?
Any idea what this means?
15:19:06 [man1,38: <no shape>]
I'm guessing it's from my nearestunits thing, but that's they guy who's searching for the nearest friendly unit
@astral dawn idk exactly what ur saying, but for while writing the script i use vscode with SQF Language (Armitxes) and SQFLint (SkaceKachna) 👌
https://i.imgur.com/WRQXVGq.png
https://i.imgur.com/2RC8AaP.png
(click more info takes you to the wiki, does commands and functions)
Yes it helps you with built-in SQF functions, I think
However I need support for my functions
ohh, idk then. i just look in my function file if i forget.
@tough abyss im assuming its an array from this line?
_nearestunits = nearestObjects [getPos _unit,["Man"],200];
["Man"] will return ambient life like snakes too, so perhaps that is what 38: <no shape> is 🤷
Ok weird
That explains why the second half of the script isn't working at least
How do I make sure it's a man?
if((side _unit) countSide _nearestunits > 0) then{
{
if ((side _x == side _unit) && !(isPlayer _x) && (_x == CAManBase) && (behaviour _x != "COMBAT")) then {_nearestfriendlies = _nearestfriendlies + [_x]};
} foreach _nearestunits;
};
Something like that?
_nearestunits = nearestObjects [getPos _unit,["CAManBase"],200];
Gotcha
but wait, there aren't any snakes in VR
ok, well u want to use CAManBase anyway
15:45:36 Error in expression <((count _nearestunits) < 1) then {
_ _unit playMove "HubBriefing_think";
} el>
15:45:36 Error position: <_unit playMove "HubBriefing_think";
} el>
15:45:36 Error Missing ;
15:45:36 File DistractionByAxebeard\distraction.sqf, line 46
15:45:36 Error in expression <((count _nearestunits) < 1) then {
_ _unit playMove "HubBriefing_think";
} el>
15:45:36 Error position: <_unit playMove "HubBriefing_think";
} el>
15:45:36 Error Missing ;
15:45:36 File DistractionByAxebeard\distraction.sqf, line 46
15:45:36 [man1,35: <no shape>]
line 46 is _unit playMove
if((side _unit) countSide _nearestunits > 0) then{
{
if ((side _x == side _unit) && !(isPlayer _x) && (behaviour _x != "COMBAT")) then {_nearestfriendlies = _nearestfriendlies + [_x]};
} foreach _nearestunits;
};
if ((count _nearestunits) < 1) then {
_ _unit playMove "HubBriefing_think";
} else {
//turn to look at them and wave
_calledTroop = _nearestunits select 0;
_ _unit playMove "HubBriefing_think";
_ at the start of the line
shit, the stuff you see after you post this crap
_ _unit playMove "HubBriefing_think";
} el>
15:50:26 Error position: <_unit playMove "HubBriefing_think";
} el>
15:50:26 Error Missing ;```
Still giving me missing ; on 46, but it shows up by HubBriefing
ConnorToday at 8:46 AM
_ _unit playMove "HubBriefing_think";
_ at the start of the line
I deleted it, maybe I forgot to rebuild
Awesome, no errors, but the nearestunit never shows up
Is this adding into the array correctly?
_nearestunits = nearestObjects [getPos _unit,["CAManBase"],200];
_nearestfriendlies = [];
if((side _unit) countSide _nearestunits > 0) then {
{
if ((side _x == side _unit) && !(isPlayer _x) && !(behaviour _x == "COMBAT")) then {_nearestfriendlies = _nearestfriendlies + [_x]};
} foreach _nearestunits;
};
yea, though thats not how i would do it
hey if you want to pretty it up
Use nearentities
would I have to run nearEntitites, then nearestObjects from that array?
Instead of nearestObjects
like this?
_nearestunits = nearEntities ["CAManBase",200];
_nearestfriendlies = [];
if((side _unit) countSide _nearestunits > 0) then {
{
if ((side _x == side _unit) && !(isPlayer _x) && !(behaviour _x == "COMBAT")) then {_nearestfriendlies = _nearestfriendlies + [_x]};
} foreach _nearestunits;
};
_unit nearentities["CAManBase",200];
ahh
Come on man, you have all the info about the usage on wiki https://community.bistudio.com/wiki/nearEntities
Is it possible to point a helicopter doorgun using animations?
Neither of these seem to work
_heli animate ["MainTurret", 1];
_heli animateSource ["MainTurret", 1];
Is there any simple thing I could drop into an 3den placed unit's init that would add it to a named headless client?
Ah, I see. That makes sense. What about a long sleep and then it fires?
"named hc" you mean you've put the ownerID of the HC into a variable? or put a variable onto the hc module?
In an 3den placed headless client module, I typed "HC1" into the variable name line.
dunno if module changes ownership over to the HC machine. So don't know if that's of any use
you somehow have to get the ownerID of the HC. Or find out if certain script is executed on the HC
OwnerID of the HC? Like it's number identification thing? Is there something I could run that could grab that?
Okay, I see. Hmm... I've never had luck getting a headless client's ownerID. Been struggling with this on and off for a while.
Eh, oh, well. I guess I'll go with the old round robin headless client balancing script. I only don't like that script because it rebalances repeatedly on a timer, and for this specific case, that step is completely unnecessary. No AI are added throughout the mission.
this spawn {
sleep 60;
if (isDedicated && !isServer) then {
[(group _this), clientOwner] remoteExec ["setGroupOwner", 2];
};
}
that probably
should work if you only have a single HC. If you have more then this... will end up on a random one I gues
That LOOKS like exactly what I was hoping to get. I definitely will have multiple headless clients, but as long as the AI end up relatively evenly balanced across them, that should be enough.
I hate to ask for more, but would you know of a simple way to look at an AI and check their owner?
0 guarantee on balance. Basically the last HC to initialize will get all the units with that init script
Ah, interesting. Still better than having all these AI on the server!
objectOwner command. Or maybe just owner something like that. Though I think only works reliably on server?
Ah, bummer.
Has anyone had any accuracy issues using modelToWorld with worldToScreen?
I'm using these to draw the joint locations of soldiers on the screen
It generally works well...but when the soldiers start running around, the drawn points move off the soldiers
looks like it was a known issue: https://www.youtube.com/watch?v=NH-2uRq_VEg
nevermind! Apparently there's something called modelToWorldVisual that appears to resolve the issue!
whewwwwwwww
is there anything wrong with this while ?
while {alive player && _captureStatus != true} do
while {((alive player) && ( _captureStatus != true))} do``` but thats just my opinion 😅
Just try it out. Have all multiple conditions in whiles like that and they work
cant use != == operators to compare bool, and doing so like that doesnt make sense anyway
change _captureStatus != true to !_captureStatus.
this is assuming you redefine _captureStatus in ur loop tho, otherwise itl never change
yes. the wiki tells you this. and as i said in this case it doesnt make sense anyway.
true will never not be true so doing what u have is like this
_captureStatus != true
false != true
!false
true
if that makes sense
if you were comparing two bool variables that could both be modified then it makes sense, like _bool1 isEqualTo _bool2 but in this case it isnt soo
ok
so if _isCaptrued was set to true
and I did while {(!_isCaptrued)}
would that mean while its not false?
while it is false
ok
!false is true
so its the opposite of what its initialized to?
ye
Ok thanks lol
What are the differences between CBA_fnc_addPerFrameHandler and addMissionEventHandler ["Draw3D", . . . .?
CBA_fnc_addPerFrameHandler is an EachFrame event not Draw3D.
Draw3D will not fire if tabbed out of the game, EachFrame will.
here is a more noteworthy difference Dedmen posted not too long ago:
Draw3D is called at the end of the frame, after simulation, but before rendering. EachFrame handler fires before simulation.
OK, thanks. I'm trying to R2T a camera view from a moving object but the view from the camera jitters a lot. I'm wondering if my implementation of Draw3D is the problem and am trying to work out the CBA syntax.
Currently getting deep CBA errors because I think I formatted the CBA_fnc_addPerFrameHandler bit wrong
ST_Cam_Handler=
[
{
if (isNil "ST_cam") exitWith
{
[ST_Cam_Handler] call CBA_fnc_removePerFrameHandler;
};
_TGPPovPos = ST_v modelToWorldVisualWorld (ST_v selectionPosition "TGPPos");
_TGPDirPos = ST_v modelToWorldVisualWorld (ST_v selectionPosition "TGPDir");
_TGPDir = _TGPPovPos vectorFromTo _TGPDirPos;
_TGPDirFar = _TGPDir vectorMultiply 1000;
_TGPTarget = _TGPPovPos vectorAdd _TGPDirFar;
ST_cam camSetTarget (ASLtoAGL (_TGPTarget));
//ST_cam camSetTarget [4000,4000,0];
ST_cam cameraEffect ["internal", "BACK", "screen"];
ST_cam camCommit 0;
hintSilent str (ASLtoAGL (_TGPTarget));
},
0,
[ST_cam, ST_v]
]
call CBA_fnc_addPerFrameHandler;```
It complains about undefined variables
ST_cam is a camera created and attachTo'd a plane. screen is the surface of the MFD inside the cockpit.
well, if variables arent defined the easiest fix is to define them...
also i see you defining these as arguments [ST_cam, ST_v] but then using their global variable anyway (making them being in the argument array pointless).
not sure exactly what to say about that error, are you running ur code in the editor debug? i dont know if perframe would be running in editor 🤔
No it comes from the plane's config.cpp on init
it's called from the config.cpp I should say
does the script work when you load into the mission?
Yes, though the camera view still jitters so using the CBA handler instead of Draw3D didn't solve my problem
what, running CBA_fnc_addPerFrameHandler in a Draw3D event?
no no sorry
oh lol, misread that
instead of Draw3D
Basically I'm trying to put the turret view (not pilot camera) onto the cockpit MFDs and the view jitters at a very high frequency and it's been driving me nuts
Can't solve it
i wouldnt expect the perframe handler to work in editor, so you may need to work in some check to exit the script if the perframe init hasnt executed.
as for the jittery camera i dont know what to do about that.
Well, right now the CBA function has the same result as Draw3D but adds mod dependency so I'll just go back to Draw3D
it wont help the jittering at all but you would probably want to use EachFrame instead of Draw3D otherwise itl look a frame behind. that was an issue someone else was having earlier.
That indeed did not solve the jittering but I'll keep it with eachFrame for now
One solution would be to smooth the data, but I have no idea how to do that
I've been dealing with something similar (that was an issue someone else was having earlier) but EachFrame doesn't work as I need to set the camera position based on the current visual state. I would say though that I only get jitter when trying to correct for lean (with insufficient accuracy available for those inputs), otherwise I've found the RTT camera source rock solid. I'd look again at how you're setting the camera position/direction.
The camera position is set with attachTo, and in the feed the position appears rock solid. It's the orientation that jitters
Which is all controlled by the code I pasted above
Mmmm... not sure I understand the context, is this like a gun feed? Wouldn't attachTo negate any need to fiddle with the camera pos/dir via script?
I'm making a Super Tucano, which has a backseater (gunner) who controls a sensor ball (turret) under the fuselage. I have the gunner's turret view displayed on MFDs in the cockpit for both pilot and gunner.
I'd have thought it was one or the other; attachTo or per-frame positioning in script.
I create a camera and attach it to the turret pov position with attachTo, then update it's orientation with the above
attachTo doesn't keep it oriented with the turret
Same problem with setPos
well don't you want to just bin attachTo and set pos/dir purely in script? might be why you're getting jitter.
setPos has the same behavior
Camera SetPosATL _o;
Camera SetVectorDirAndUp [_v, [0,0,1]];
gives me no jitter, i only get it when I try to fix lean (up) with insufficiently accurate inputs
@mortal wigeon have you tried https://community.bistudio.com/wiki/vectorModelToWorldVisual for direction?
should add, i think you'd want setPosASL given you're getting the selection pos in world coords
asked that before but forgot the answer. I can't skip a forEach iteration with exitWith right?
aye
You can if you include inside of the loop in another scope like {call {if true exitwith {}}} foreach array
I solved it!!!!!!!!
It works if I do everything in modelspace until the last moment, then take that resulting point, convert it to worldspace, and point the camera at it
That seems reasonably steady and usable
I can do extreme zoom from high up and the camera doesn't give me a seizure
It doesn't point at exactly the right spot, but the MFD crosshairs and the actual turret view crosshairs are only about a meter apart when zoomed in like 30x from 10,000'
So good enough
I'll shift the MFD crosshairs over slightly if I have to lol
Question: private _x = 0; or private "_x"; _x = 0; Docs don't explain why I would need quotes to declare a private variable. It seems to imply you need quotes unless you are initializing the variable in the same statement. Is this the case?
yes (both are correct afaik, but the first is better for obvious reasons)
first private is keyword , second is command, does it not say that?
wait, it does https://community.bistudio.com/wiki/private
Yeah I missed the significance of the word "command" in the https://community.bistudio.com/wiki/Variables section. Because why would that be a thing when there is a keyword, and not be called out in more explicit terms. The docs aren't clear there. In fact it says you should use the private command. Then in a further section transitions to using the keyword without calling out the difference.
Anyway thanks for the answer
Ah, it is editable wiki!
Private keyword was introduced later (the biki says so BTW) and some of the references contain old usage examples
I might clarify it on that page
Actually the keyword existed for years, it was misleadingly called local and no one knew it existed
then it was renamed into private and made public
Looking for a script that in this case randomly sets damage of 1, to one of three units. If anyone could provide a finished example it would be appretiated. Variable Name of units are: P1, P2, P3
selectRandom [P1,P2,P3] setDamage 1;
👆 😆
Can somebody help me out here. I'm running a mission as Zeus for some friends, and I want to play some music in helicopters while they are getting ferried around. I've got some code that works for one person apparently, but not for the rest of the group.
this addEventHandler ["Engine", {
params ["_vehicle", "_isEngineOn"];
if !(player in _vehicle) exitWith {};
if (_isEngineOn) then {
5 fadeMusic 1;
playmusic "music2";
};
}];
this addEventHandler ["GetIn", {
params ["_vehicle", "", "_unit"];
if (_unit != player) exitWith {};
if (isEngineOn _vehicle) then {
5 fadeMusic 1;
playmusic "music2";
};
}];
this addEventHandler ["GetOut", {
params ["", "", "_unit"];
if (_unit != player) exitWith {};
playMusic ["", 0];
}];
Event handlers added with addEventHandler fire only on the machine this code was executed at
it says this. Thus init box of a vehicle. thus firing globally. thus eventhandlers added everywhere, thus eventhandlers fire everywhere
the accessories button doesn't work with modded guns?
I've been adding and editing it with zeus, but it seems to only work for one player at a time.
'one player' - you or some other guy?
Other people. Or the first one in the heli
Just to be sure, you execute this before everyone gets into the helicopter, right?
Yep
adding and editing it with zeus explain what that means?
Adding the code to the heli's init. And editing to change between 6 different songs. During gameplay that is.
@dim kernel what accessories button?
"during gameplay" how?
zeus has this init box if you click on unit like in the normal editor
but I couldn't find if it runs the code locally or globally in a reasonable amount of time on wiki... so 🤷
What he said @astral dawn
I guess if it runs on another guy's computer then it's global though
Yeah, but it only seems to work on the first player in the heli.
And I can change it while no one is in it, and that works. But again only for the first person in.
first player in makes the heli local to that player?
@tough abyss the weapon shop
what weapon shop?
altis
There is weapon shop on altis with accessories button?
ye?
Where?
What's Altis life?
can someone else help me?
Yes I'm here. What do you need help with?
the car script
@tough abyss I asked him, not you.
when u select modded guns in the weapon shop
what weapon shop?
which accs button?
@still forum And I'm not talking to you 😂
1 sec
i use this to check for attachments that work on guns
isArray (configFile >> "CfgWeapons" >> _item >> "WeaponSlotsInfo" >> "PointerSlot" >> "compatibleItems")
but doesnt work for cup
@tulip smelt try to get an array of all units in the vehicle and then play the music foreach of the passengers
@still forum ^^^
might be a workaround for music playing locally
don't see what that has to do with some accessories button on altis 🤔
i checked in cup cfgweapon its different from arma guns
It's probably using CBA jointrails
Yeah, that might be worth a try
@tulip smelt just make sure you dont have 20 songs playing at the same time lol
You bet 😄
dedmen can i speak to u in private so i can explain my self?
https://community.bistudio.com/wiki/crew @tulip smelt
@spark turret TY
@still forum can we talk in private?
nah
@tulip smelt looking at Zeus object placement dialog, where is the init you edit exactly?
double click on unit, paste to init @tough abyss
might be an ares / achilles thing idk
Achilles
Achilles?
Yeah
Right, so it is a modded init, that doesn't fire like normal init. Problem solved
Well @tulip smelt should have mentioned this at the beginning that it was a mod
No the code is fine
it would have worked for normal init
Didn't really know why it would make a huge difference
are we aware that the eventhandler starts a new song for every player getting in the heli?
I have it in the init of the heli in eden too. Still doesn't work as it ought to.
i dont see a remove eventhandler so i guess every new passenger restarts the song.
what same symptom, works for the first player only?
playMusic isn't global. @spark turret
^^^ this
alright thats okay. that means the music is executed for the heli not the player getting in tho
it is local so it is executed for the player
no it's not @spark turret
The music is only supposed to play after a player get in and the engine is turned on.
hm is that even possible if the music cant be global?
yes your code is kinda trying to do that and I dont see any problem with it
tho i admit i dont fully understand local/global differences
rabbits are local units are global
hm is that even possible if the music cant be global? yes you can play soundfile with playSound3d
thats all i know
So I need to use playSound in place of playMusic?
I don't know, the mod init is broken, I guess no one knows what is best
BTW you can make sure that person joining the heli later will have the song started from the same time as the rest
any suggestions about meaningful approach for bagpipe songs playlist (you can play when you have it as weapon in your hands)
like radio menu, comms menu, action menu, etc
GUI dialog
other means of interaction
Star Citizen interaction menu with the bagpipe :DD
lol
@astral dawn have a video?
trying to find it... but it was a joke really
it has a fancy interaction menu with 3D icons, you look at your gun and it shows a list of available actions you have to click on
@velvet merlin make them as weapons that play sound when you fire
then you can change muzzles with normal muzzle selection
@tough abyss its about the selection from different tunes
yeah make tunes as different magazines then
unless you want to add a bunch of soundfiles and let user press keys for notes @velvet merlin
Hey, I'm trying to use attachTo in order to attach an object to a vehicle interior.
When I'm outside of the vehicle the object is there, however when I get inside it disappears.
is there a way to execute code on arsenal close that does not require using the missionnamespace arsenalClosed method?
@vagrant urchin vehicle interior is rendered OVER the outside world
the attached object belongs to the outside world
So there's no way to make it show from the interior?
@vagrant urchin no
🤔 maybe if you use the vehicle-in-vehicle built in functionality? How does stuff get rendered with veh. in veh. things in arma? Or it it also broken?
I doubt viv stuff shows any better if you go to a cargo seat and look at them
But I also don't think there are such vehicles you could see the viv attached vehicles from cargo seat
@exotic tinsel Are you using this? https://community.bistudio.com/wiki/BIS_fnc_addScriptedEventHandler
@astral dawn yes
hmm and why don't you like it?
i have my reasons hence the request for help. dont want to write a whole doc on it. just doenst work for what i need to do.
any other ways you can think of?
I guess you could manually poll for creation/destruction of the arsenal display or something like that?
IDK how the arsenal is implemented, is it creating another display probably?
Maybe add ui event handler to the arsenal display and see if it fires on close
So... Preprocessor failed with error - Invalid file name (empty filename) Not sure how to solve this.
What is this caused by?
Obviously a preprocessor command was used, and a invalid file name was used
All of mine looks fine, The only thing I have added is #include "\A3\Functions_F_Exp_A\EGSpectatorCommonDefines.inc"
I just found a gem in my 5 year old script collection
if (isNil "dedmenfnc_execOnPlayerName") then {
dedmenfnc_execOnPlayerName = {
_index = round(random 50);
call compile format["dedmenfnc_execOnPlayerName_name%1 = _this select 0;publicVariable ""dedmenfnc_execOnPlayerName_name%1"" ", _index];
call compile format["dedmenfnc_execOnPlayerName_fnc%1 = _this select 1;publicVariable ""dedmenfnc_execOnPlayerName_fnc%1"" ", _index];
call compile format["[-1, {_result = [name player, dedmenfnc_execOnPlayerName_name%1] call CBA_fnc_find; if (_result != -1) then {call dedmenfnc_execOnPlayerName_fnc%1}}] call CBA_fnc_globalExecute;", _index];
};
};
publicVariable "dedmenfnc_execOnPlayerName";
["dedmen",{[player] join grpNull;}] call dedmenfnc_execOnPlayerName;
Isn't it beautiful?
I'm making a NFZ script that will toggle map color from Green to Red and opposite but after the GUI action it will not execute the script
_Action = ["Are you sure you would like to enforce a NFZ","Toggle NFZ in Kavala","Toggle NFZ",true] spawn BIS_fnc_guiMessage;
if (_Action) then {
if (markerColor "NFZ_Kavala" == "colorIndependent" && markerColor "NFZ_Border_Kavala" == "colorIndependent") then {
"NFZ_Kavala" setMarkerColor "ColorOpfor";
"NFZ_Border_Kavala" setMarkerColor "ColorOpfor";
}
else
{
"NFZ_Kavala" setMarkerColor "colorIndependent";
"NFZ_Border_Kavala" setMarkerColor "colorIndependent";
};
};
you need to call BIS_fnc_guiMessage so that whole script needs to be in a scheduled environment
to explain further: spawning BIS_fnc_guiMessage returns the script thread, calling it will return the true/false button click but that uses waituntil which is why you need to spawn that whole snippet
Ahh ok ty
_Action = ["Are you sure you would like to enforce a NFZ","Toggle NFZ in Kavala","Toggle NFZ",true] call BIS_fnc_guiMessage;
if (_Action) then {
if (markerColor "NFZ_Kavala" == "colorIndependent" && markerColor "NFZ_Border_Kavala" == "colorIndependent") then {
"NFZ_Kavala" setMarkerColor "ColorOpfor";
"NFZ_Border_Kavala" setMarkerColor "ColorOpfor";
}
else
{
"NFZ_Kavala" setMarkerColor "colorIndependent";
"NFZ_Border_Kavala" setMarkerColor "colorIndependent";
};
};
Now action isnt working
is there an error?
Fixed it had to put it in a [] Spawn { in here };
ahh, yea i did mention that 😦
Anyone know the actionKeys name for switching to secondary weapon?
SwitchSecondary
https://community.bistudio.com/wiki/inputAction/actions#Weapons
?
Thanks, will give that a go
is running a SetVariable public pretty much running a RemoteExec on all clients?
not really
depends on what you mean by "pretty much"
technically the answer is "No absolutely not"
Okay, sorry for not really specifying.
What im talking about is will if affect server performance as much?
itl have some kind of impact, its being sent across the network. a single call wouldnt be noticeable (depending on the size of the data) but spam the command and you will lag ur server out.
its more like using publicVariable(client|server).
The reason for my question is im trying to find out whats more efficient for a inventory, setting variables when the inv is edited and initialised and broadcasting to everyone(public) or grabbing from a database on demand
As currently when a player joins our server (rp) it loads houses then for each house it has crates, each crate has a inventory. For for example one person has 3 houses and each house has 3 crates thats 9 variable sets then at peak times we have 120-130 players so its a lot of variables for the server to keep track of and when someone edits that inventory it has to send the new variable to every player again
Also I think you can't remoteExec setVariable on missionNamespace publicly 🤔
in theory only sending the data when someone asks for it is better. you will just need to set it up properly otherwise itl end up sending more often than just using a public variable.
Also I think you can't remoteExec setVariable on missionNamespace publicly I don't know a reason why you couldn't
[missionnamespace,["test",4]] remoteexec ["setvariable"]
👌
Ideally server should always know what's the inventory state of each crate, to account for condition when player crashes while messing with his crate.
then you can broadcast it to clients with different frequency depending on how far they are from crate 🤔
So, maybe try it like this: always send to server, send to clients when they really need it?
I was meaning the serVariable[“var_name”,”value”, true];
i assume its a virtual inventory so you would only need to send it to those who open the container. issue is keeping it updated (say you edit it then leave, then i edit it then you come back). sending the full inventory over and over could be worse in the long run
Or serialize crate access, only one player can mess with a crate at once 😄 so you only transmit data when player leaves the crate
Thats how it is but like you said if they crash or something happens
The proposed idea was: When open a crate grab data from DB, when when store and retrieve set in the DB(account for crash)
How it currently works, the inventory is loaded into a variable set publicly on the crate when the player joins
when the player stores or retrieves it sets the variable publicly(SetVariable["Inv", "Contents", true]) thus broadcasting to all players, If i remember correctly it sends to db on close dialog
I just feel setting the variable globally is a bit pointless and can cause quite a bit of lag, especially when 120+ people online
How many items are there? You could estimate traffic 🤔
I meant, in every inventory, how big is the 'Contents' variable
So that you could estimate the average traffic on your server, in bytes per second, you know
and then you might see if it occupies too much bandwidth or not 🤔
Interesting, hard to say really it depends on the player. But that a solid point though, didnt think of it like that. So if say one player had a huge inventory sending that to everyone via SetVariable would be quite a bit more expensive than just retrieving from a database
So let's say you have 32 items in each inventory in average, one item is a 64-byte string, you have 32 players accessing the inventory at a time in average, and every player takes/adds an item once per second, how much traffic that would be 🤔
that's 64 kbytes a second
from server to all clients
I guess modern PCs can handle that?
although... yeah, that's quite enough of BW
Well
Only one player can access a crate at a time, however players can edit multiple crates at a time
But yeah it is quite a lot, but 64Kb just for that, not to mention everything else going on
I think its fairly safe to say that its more efficient to pull and send to the database rather than setting public variables
im thinking so too, though you may still want to use some global method of marking the last time the crate was edited so you dont fetch the inventory if you already have the most up to date version of it.
how do i check if my inventory is full
i want to make a function that if my inventory is full it hints me
a possible quick way would be to do player canAdd "someItemWith1Mass", longer way would be to add up the mass of all items on u and see if it is equal to the max capacity of ur clothing.
Is anything known about the locality of uniformItems? (https://community.bistudio.com/wiki/uniformItems doesn't state if the unit needs to be local or not)
If you want to get how loaded are you, you should use loadBackpack|loadVest|loadUniform which is 0..1 coeff value of total load. So if three of them are close to 1 - you are loaded to top. To determine this in mass values to make exact calculation you can use getContainerMaxLoad, multiply this value over stated coeff to get actual mass loaded and then count if mass of next item will fit into it. Also you might want to determine if there are equipment slots left, like headgear if its headgear you adding, etc.
Mostly this is easier just by canAdd and canAddItemToBackpack etc.
@oblique vale uniformItems appears to take a global argument
his paste is a .bat tho 🤔
Oh sorry then, this is SQF channel, not PS
Sorry, moved it now
pulling data from DB or broadcasting it I fail to see how this even comparable, 2 completely different operations
@tough abyss I wasn't trying to explicitly compare pulling data from DB and broadcasting, I was trying to compare what would be more heavy on the server, interacting with a database via getting and setting public variables OR interacting with ExtDB and modifying the database on each action.
Sorry what you are asking makes no sense to me
This is a topic for both #arma3_scripting and #arma3_scenario actually. I'm working on a small mission where i want to use the restrict zone module. Although I can't get it to work at all. I opened the zone restriction fsm function to search for the way it triggers that the player is out of the 'zone' and it shows that it interacts with synced triggers.
The issue is that no mather how i sync a trigger, the player is always out of the "zone" and gets punished.
Anyone got this module working?
@vale halo how about a normal Trigger zone detecting players, placing it at the Border and make it hint "youre leaving, Return or die" and then kill if triggered for 30 seconds
would give more dynamic fields anyways as the form is not restricted
Yeah that would be a work around but I don't see why a module BI made is not working :P. The module actually gives quite a lot of freedom.
I might get it tho
it sais restricted area, might need to inverse it
😛
With the inversed value set to true it doesn't trigger at all 😦
Anyway, the script behind the module:
fn_moduleZoneRestriction.fsm
So it seems to me that there needs to be a trigger set up in some way.
Does anyone know why this script, when ejecting me from my heli, is setting my altitude to 450m in the air
I'm looking around line 53, but changing that 450 doesn't change anything.
player setpos [(getPosASL _heli select 0),(getPosASL _heli select 1),(getPosASL _heli select 2)+4]; setPos is AGL not ASL
use https://community.bistudio.com/wiki/getPos instead 😃
ahh, ok. It's an old script snagged from the forums 😛
this will put player 4 meters above heli is that what you want?
you could also write
player setPosWorld (getPosWorld heli vectorAdd [0,0,4]);
Why actually not use getPos? I get its better to define the type of position you want to get/set but are there any other reasons?
Its broken
@tough abyss Do i need to change line 61?
it gets really confused when there is a surface underneath and not the ground
waitUntil {isTouchingGround player or time > _startTime or ((getPosASLW player) select 2) < 1};
change the ASLW to ASL?
That script is FUBAR
I dont really want to look at it feels dirty
and yeah this line is bad
you better write your own
ok, because at the moment, it all works as planned.
until I hit the ground and then im put into the ACE3 incapcitated screen
doesnt mean it will always work
which is what I'm trying to avoid, my scripting knowledge is shit.. so it's tricky for me
at least is has failsafe time > _startTime
ok, well. it's not working anymore XD
isTouchingGround player is unreliable, getPosASLW is for when you land on water, if you land on water, so in the worst case you will be waiting for 10 seconds
Hey some question regarding tasks and completing them.
I just created a task for a sniper team. Just eliminate a fireteam sized enemy unit.
How does one actually make this task completed?
I thought about like having onKilled handler on those to-eliminate units and if all are killed I resolve the task as complete.
Is this the way to do it? Or is there some "framework" way?
You can check the members of the enemygroup for being alive. If all are dead = task complete
yea gonna try that
I have a problem with Task namespace.
When creating a task with BIS_fnc_taskCreate and having that taskID it does not seem that I can access a namespace through this ID.
Does this has something to do with the "new" Task framework?
Do only tasks created by createSimpleTask own this Task namespace?
Got the module working what I was talking about earlier, Put down a trigger with Any Player Present, Repeatable as condition and sync the module to the trigger. Although there is a bug that does not reset the punishment when you go back in the zone after a warning. Posted the bugreport in the feedback tracker - https://feedback.bistudio.com/T137065.
@frigid raven idk about you, but i dont like task that tell me automatically if i killed the enemys nearby. how about a condition that sets to true only if you "confirmed your kills" by giving each enemy of the group a parameter "hasBeenConfirmedDead" and setting it to true when "if (!alive _enemyUnit && player canSee _enemyUnit)
so that the player must actually find and look at all the killed enemys to confirm the group has been killed
just an idea
@spark turret yea I rethought the idea as well. I don't want my mod to be too arcade. I decided to actually just track if the squad left the base, entered the task area, left it and reentered the base. That's all that should be tracked somehow to prevent exploiting a mission goal somehow
i dont understand what that has to do with the enemy squad being killed being announced automatically
i dont think you could exploit my idea anyways, it actually keeps up tension bc the game doesnt tell you "area clear"
Wondering if someone can help currently get an error when a script completes. it states that there is an undefined variable in the expression, however it still triggers what its supposed to, can anyone see what I have done wrong?
pistolIns sideRadio "nice";
["TaskSucceeded",["","Qualify on the Pistol Range"]] call BIS_fnc_showNotification;
_obj2 setTaskState "SUCCEEDED";}
else {pistolIns sideRadio "testfail"; hint "You must requalify. See the Pistol Range Master";};
nopop=FALSE;```
Task Variable Name: obj2
Task ID: obj2
Error on Line 49 - Undefined Variable ``` Line 49 - _obj2 setTaskState "SUCCEEDED";}```
obj2 != _obj2 and the error msg already tells you what the problem is
For someone who cant quite see it can you dumb it down?
you reference _obj2, and i'm pretty sure your script at this point doesn't know what that is
anyone around who can tell me the most efficient way of checking if (and what) the player is dropping from his inventory?
ok, found it just now. "put" EH is what i'm lookig for
I see, but even when I just leave it at obj2 It still fires the same error
where is obj2 supposed to be coming from? your code doesn't show where that variable is set
That would be because I havent set it
but you need to, otherwise the game doesn't know what it should set the task state to
'''myNewTask = player createSimpleTask ["NewTask"];
myNewTask setTaskState "SUCCEEDED";}
though, to be honest, i havent used these commands in ages. i'm only working with BI functions 😄
anyone can tell me the most efficient way to delete all dropped items from a mission?
like, everything a player might have dropped anywhere
is there a way to make a display blocking (like a dialog), or use ctrlCreate with createDialog by some means?
I really want to know how EG spectator makes its camera move (wasd)? Can anyone help me out on this one. Been looking for a while
@velvet merlin blocking on what way
_display = findDisplay 46 createDisplay "RscDisplayEmpty";
_listBox = _display ctrlCreate ["RscListBox",4711];
with this mouse wheel for example still activates action menu
@spark turret Ah alright then we just miscommunicated here. No offense
@velvet merlin looks like you need to create it with createDialog to block action menu
ok was rather simple
createDialog "RscDisplayIntro";_display = findDisplay 47;
_listBox = _display ctrlCreate ["RscListBox",4711];
are respawn event handlers stackable?
all addEH's are stackable
If you pass position as last statement, only position from the last one will be considered probably, otherwise you can have tonnes of them
cool thanks
is there a way I can check if a mission has ended on dedicated server? such as I would use isNull (findDisplay 46)
for a client
There is a MissionEnded eventhandler
Question regarding the GUI editor, why on earth, even after I have set my layers up correctly can the RscText not be above the RscPicture that I have set from a paa
not that i know much about gui editing, but probably wrong layer order.
:>
i think the one created last is always above the others, no?
that wouldn't matter as I have redone my layers
GIF showing what i mean https://gyazo.com/35dbf31701b3bbf4383824d4f2d6af6d
the test should be above the card right
Or does the image have to be slightly transparent?
nah, then it'll just shine through
mmm
I tried it with transparency and it still doesn't allow text to show through it lol
Taking my words back, indeed it's possible to remoteExec a setVariable on missionNamespace with [missionnamespace,["test",4]] remoteexec ["setvariable"], just tested it
It failed on me once and I thought that missionNamespace is non-serializable 🤔
@burnt cobalt try https://community.bistudio.com/wiki/getClientState
#include "\a3\editor_f\Data\Scripts\dikCodes.h"
if(canSuspend) then
{
waitUntil{!isNull (findDisplay 46)};
(findDisplay 46) displayAddEventHandler["KeyUp",
{
params["_display","_key","_shift","_ctrl","_alt"];
if(_shift || _ctrl) then
{
if(_key == DIK_MINUS) then
{
if(player call maas_fnc_isDragging) then
{
_obj = attachedObjects player # 0;
_obj setDir (getDir _obj) + 1;
};
};
};
}];
};
Why exactly does this rotate the object in an insane amount? Nearly in intervals of 100
I thought it might reduce this effect with just leaving the rotation to happen when the key is released. But it keeps rotating an insane amount as if it's being constantly executed.
The code is fine, the problems is elsewhere
Like what? change the direction by one in the debug console on a object, and it's smooth and perfect.
Nearly the same code, just no UI EH
When I log the old and new number, it's fine. The only thing that stops it from getting on spot is when it actually sets the direction
Old Dir: 310,
New Dir: 311
Oh I see, attached object, you get dir of attached object
Wait.
and set it in relative coordinates
Yes.
You see the problem?
Not clearly so no, what's the issue?
when you setdir 0 it will be 0 relative to the object you attached to, but not necessarily facing north
How does that explain the direction going from 170 to like 330?
when you getdir you get the global value where 0 is facing north
So it's not really relative to the object?
if player is facing north then it works fine
isnt setDir an absolute direction, 0 = north etc?
if player is not then you get crazy offset
not if object is attached @spark turret
crazy shit is that if you face west you get negative rotation
Okay, just to made sure I set the direction to zero after attaching. Still no dice
You dont get it do you? you read global direction then set it relative to the player
so it is direction player + your global direction
turn player to look at the north and voilà, problem solved
this is doing the trick for me.
_obj setdir (getdir _obj - getdir player + 1);
direction player will be 0 so set dir will be global dir + 0
Wow. I'm dumb, thanks for the explanation. Makes a lot more sense considering the attached object is now moving and rotating relative to whatever it's attached to (the player)
Thanks for the example Connor, got something similar now.
Another question, is it possible to override player controller keybinds like Q and E with UI EH? Seems like it'll still work, but just won't override.
unbind controller from Q and E maybe
I meant the anim controller for soldierd
What is the exact syntax for an AND condition then an OR on the same line? if (thing && (thing2 || thing3))
that would work ^
Alright, so I am in a bit of the same situation as my above problem except that it's with setting the position
getting relative model position to world space with modelToWorld doesn't yield any results
Ex:
_box = (attachedObjects player) # 0;
_pos = player modelToWorld (getPos _box);
_box setPos[
_pos # 0,
_pos # 1,
(_pos # 2) + 10;
];
not entirely sure what ur trying to achieve there, are you looking for something like this?
_box = (attachedObjects player) # 0;
_pos = getPosASL player vectorAdd(getPosASL _box vectorDiff getPosASL player);
_box setPosASL (_pos vectorAdd [0,0,10]);
edit:
i assume this isnt it cause it just elevates the box 10m above its original position, which can obviously be done just using the box position...
That's just it! When attached to the player, it has zero effect.
yey 👏
r u trying to adjust its elevation while attached?
Yes.
tried reattaching it with a new offset?