#arma3_scripting
1 messages · Page 491 of 1
_memeTimer = time + [amount of time to wait]
waitUntil { time > _memeTimer};```
i find it more reliable
cool
[[],{
_currentTime = daytime;
_wantedTime = 24 - _currentTime;
skiptime _wantedTime;
}] remoteExec [ "spawn", 2 ];``` I done this for a SkipTime script. I needed.
Could someone be kind and review my coded attempt at functions / parameters? ```sqf
private param ["_actionObject","_actionMarkerWheel","_actionMarkerTrack"];
private _infostand = "Land_InfoStand_V1_F" createVehicle (getMarkerPos (str _actionObject));
missionNamespace setVariable ["_actionObject", _infostand];
_actionObject addAction ["<t color='#0097e6'>Spawn: <t color='#718093'>ACE Track", {
private _pos = getPos _actionMarkerTrack;
private _item = "ACE_Track" createVehicle [0,0,5];
_item setPos _pos;
},nil,1.5,true,false,"","true",5,false,"",""];
_actionObject addAction ["<t color='#0097e6'>Spawn: <t color='#718093'>ACE Wheel", {
private _pos = getPos _actionMarkerWheel;
private _item = "ACE_Wheel" createVehicle [0,0,5];
_item setPos _pos;
},nil,1.5,true,false,"","true",5,false,"",""];```
@tough abyss https://discordapp.com/channels/105462288051380224/105462984087728128/498554035230605334 why is that relevant in clientside only code?
https://discordapp.com/channels/105462288051380224/105462984087728128/498554149214879745 And what would you want to waitUntil if you want to wait for 5 seconds?
private param makes no sense
remove that private
missionNamespace setVariable ["_actionObject", _infostand]; are you sure you want to do what you are doing there?
MissionNamespace variable usually don't have underscores at the start
It is possible to render an own GUI instead of the map/briefing isn't it?
is it kinda trivial?
Trivial? Nothing about Arma GUI is trivial
Fuck sorry I said the forbidden
Christ I have a showDialog Script that runs at the very beginning when a player joins. I hooked it to the PlayerConnected event. Sadly the Dialog is not able to open right on time when testing on the deticated server... Even my script to spawn at a specific spot right after joining the mission fails some times.
Is there an event that triggers exactly when the player asset is being spawned on the map? Because that is the exact time I need to run it. Respawn does not work for the initial Player spawn.
If you don't mind waiting for the player to get control, you can opt to poll for their display with
waitUntil { !(isNull(findDisplay 46)) }
am actually doing this waitUntil {!isNull findDisplay 1101};
ah well wait a sec
what is display 46 again?
The options menu?
polling for the clientState "Briefing_read" now
works fine
ffs why doesn the friggin dialog appear on the dedicated machine !!!!
This is the script in my initPlayerLocal.sqf:
[] spawn {
waitUntil { getClientState == "BRIEFING READ" };
call X11_fnc_spawnInLobby;
[] spawn X11_fnc_showLoginDialog;
};
It just does not render the friggin dialog. I gonna try @earnest ore approach... GAH!
Was there any way to execute code remotely in Arma 2 (OA)?
I'm confused because I thought there was
But can't find any reference to it
Hey can someone help me with a JIP compatible set face?
Basically what I need is for the script not to be called until the player is loaded in
As in on the ground
Ah, thanks @winter rose
👍
@tough abyss could you say more please? I am not sure to get what you mean
Basically I'm making an African mission and I want them to be black
I am trying to script them black, but the script cannot be triggered until they load in or else they will not be able to load in
🤔
it's so annoying
if you haven't seen it yet (example 2) > https://community.bistudio.com/wiki/setFace
setFace has local effect...
Yes I'm aware of that
The issue is making the script not fire until they've loaded into the mission
I think I figured it out though
i'm not sure if i asked here, but is there an eventhandler or something similar that returns true when the player can see the world?
nevermind, i rtfm
https://community.bistudio.com/wiki/onPreloadFinished for posterity
@tough abyss does this work for you? Because I try something similar. Having the player spawned on a specific location when in game and a dialog should show up. All works fine in preview but not on the dedicated. I'm running all this in initPlayerLoca.sqf and tried to hook on the PreloadFinished event, the ClientState "Briefing Read" and so many other phases... it never worked yet
some times the player spawned properly (without any equipped at all) but almost always there is no Dialog showing up. Today gonna try the solution with
waitUntil { !(isNull(findDisplay 46)) }
But it feels like a hack to me
I'm not too familiar with scripting but I installed a recruitment bot to recruit team ai and for some reason no matter where I am on the map, I can still recruit AI.
anyone know the function to check if a entity has been hit/shot?
trying to get a hint to show up on a object being shot
thanks
@marble basalt I rather still use HandleDamage as Hit has some issues, what's the purpose exactly?
trying to get a message to pop up when a player is shot
I rather still use HandleDamage as Hit has some issues
HandleDamagehas even more issues 😃
so how would i use it to display a hint?
@meager heart Well at least it triggers everytime, not like when it wants to. 😄
Does anyone know how to make a setFace script that is JIP and custom face compatible?
Hi all, when iterating on code that I test on a dedicated server, my workflow is this:
- Make the code change
- Open Eden Editor
- Export -> Multiplayer
- Copy .pib file from {game-path}/mpmissions to {server-path}/mpmissions
- start up dedicated server
- join dedicated server, test features
All in all, it takes around 3 minutes to test a new iteration, not including time spent coding.
Is there a quicker workflow with a faster turnaround time?
cheers 😃
Is possible to check if addon pbo is enabled?
i find this method, but idk if is right
isClass(configFile >> "CfgPatches" >> "A3_plants_f"
@iron osprey if you put the part of the mission you're testing into script, you can test it in the debug console on-server.
@digital hollow woa!
@digital hollow, I think you just replied to my thread on reddit, too
=p
Haha thanks for all of the help. I do web dev in my day job, do you also program outside of ArmA?
I dabble.
{
if !(isClass(configFile >> "CfgPatches" >> _x)) exitWith {
hint "У вас нехватает аддонов.";
endMission "END1";
};
} forEach [
"A3_plants_f",
"A3_structures_f",
"A3_functions_f"
];
This works^^
Is there a way to draw an line in the world, but in such way the line behaves like the 3D icon, ie, it stays the same size no matter the distance its drawn at.
ones you created yourself sure.
Ones hardcoded into the terrain data, probably not. But I never tried
Is there any command that returns the position of the currentWeapon muzzle position on the model? In a way so it works with pylon weapons
read config for what the muzzle selection points are and then get the position of that selection
thats for normal weapons. For pylons... hm. Not sure if theres an easy way - not sure if selections in proxies can be accessed via the selection position command
Ok, seems that just getting the plane pos is enough to get my custom CCIP to work. Now I want to draw a line that goes from the impact point to the center of the screen. I think I may need to use the worldToScreen and then draw a line between the screen pos of the impact point to the center.
drawLine3D is actual line in the world with objects drawing in front of it, if that's what you need
Otherwise use RscLine
@meager granite And how do I do that? I want to draw a line between the screen position of the impact point to the center of the screen.
I got the impact point world position
please can someone send me a working link to a place where i can get all the start files for my arma server including a random misson maker?
Well if you want drawLine3d then draw it between your impact point and positionCameraToWorld [0,0,1]
The problem is it would need to be drawn close to the screen otherwise it will be going toward the impact point. I want it to look like the line on the MFD HUD. However from what I read in the rscLine I would need to create a whole dialog system just for that, with is something I don't feel like tackling.
Alteratibly i could draw 3d line like this: _impactScreenPos = _impactPos worldToScreen > ???? > drawLine3D [_ImpactDrawPos, (positionCameraToWorld [0,0,1])]
The question in such case is: how do I get _ImpactDrawPos so its close to the screen.
Not really, just ctrlCreate it on findDisplay 46
(Make sure to delete it afterwards)
am I doing something wrong here:
Clearly, otherwise I wouldn't be here, I should say what am I doing wrong here: waitUntil {(("Primary_Capture_Pep" call bis_fnc_taskState) == "SUCCEEDED") and (("Primary_Capture_Kraft" call bis_fnc_taskState) == "SUCCEEDED")};
I am trying to wait until both tasks are completed
Is it not delaying, or is it delaying infinitely? Is the function this is being called in scheduled or unscheduled? (Also, making your waitUntil condition a single boolean instead of two might be preferable)
How could I create simple , invisible vehicle?
@neon snow hideObject?
Hmm, wont there be any issues with this on MP? Also what would be the simplest vehicle with one crew to fire a weapon?
Hmm actually nothing now ;d I wanted to bypass the thing that I cant assign a target to player but turns out I can so I am idiot
hi guys. Can I pass my action id to the script Im running in the action?
actionId = _player addAction ["Jump", {
_this execVM "\WHobjects\air\jumppacks\scripts\jump.sqf";
};
I'd like to be able to delete the same action inside the jump.sqf script
@nocturne basalt if you check addAction's biki page, you can find some parameters passed to the script; _this select 2 being the action's id 😉
:+1:
@ruby breach unscheduled environment, error is generic error in expression
https://community.bistudio.com/wiki/waitUntil If the very first execution of the code returns true the command will exit immediately, therefore it will not produce any "Suspending not allowed in this context" error when used inside non-scheduled script. For all other uses it must be executed in environment that allows suspension (canSuspend), such as spawned or execVMed code.
does anyone know of any good Dev scripts that they use from the console to diagnose loops on the server? we are having memory leak issues with our server over about 6-8hr game spans. we think some of our scipts are just running cont or not ending properly. we need to find out which ones and its been pretty difficult to tell what is causing this.
Is the use of params correct in this instance of carrying info over. ```sqf
param [_actionObjectLoadout,_actionObjectItem];
// Ranks
private _private = _actionObjectLoadout addAction ["<t color='#273c75'>Rank: <t color='#44bd32'>Private",{
[] call CAP_fnc_private;
},nil,1.5,true,false,"","true",5,false,"",""];
_actionObjectLoadout setUserActionText [_private , "Private", "<img size='2' image='\a3\ui_f\data\GUI\Cfg\Ranks\private_pr.paa'/>"];
private _corporal = _actionObjectLoadout addAction ["<t color='#273c75'>Rank: <t color='#44bd32'>Corporal",{
[] call CAP_fnc_corporal;
},nil,1.5,true,false,"","true",5,false,"",""];
_actionObjectLoadout setUserActionText [_corporal , "Corporal", "<img size='2' image='\a3\ui_f\data\GUI\Cfg\Ranks\corporal_pr.paa'/>"];
//
private _sergeant = _actionObjectLoadout addAction ["<t color='#273c75'>Rank: <t color='#44bd32'>Sergeant",{
[] call CAP_fnc_sergeant;
},nil,1.5,true,false,"","true",5,false,"",""];
_actionObjectLoadout setUserActionText [_sergeant , "Sergeant", "<img size='2' image='\a3\ui_f\data\GUI\Cfg\Ranks\sergeant_pr.paa'/>"];
//
private _staffSergeant = _actionObjectLoadout addAction ["<t color='#273c75'>Rank: <t color='#44bd32'>Staff Sergeant",{
[] call CAP_fnc_staff_sergeant;
},nil,1.5,true,false,"","true",5,false,"",""];
_actionObjectLoadout setUserActionText [_staffSergeant , "Staff Sergeant", "<img size='2' image='\a3\ui_f\data\GUI\Cfg\Ranks\sergeant_pr.paa'/>"];
@glass zinc you could put an iteration counter.
is _actionObjectLoadout an index and _actionObjectItem a default value?
@glass zinc ```sqf
_number = CAP_stand_i + 1;
private _var = infostand + _number;
CAP_stand_i = _number;
// for your thing Apollo
diag_log format ["Iteration: %1, Time: %2", CAP_stand_i, time]; sqf
init.sqf:
CAP_stand_i = 0;```
They aren't.. I forgot about that.
param [_actionObjectLoadout,nil,_actionObjectItem,nil];``` Would that work?
no
Read the wiki, look at the examples
also, param isn't params
You're using it like it's params
private _val = param [0];```It would fetch `_actionObjectLoadout`
oh nvm
I get it. I meant params. My bad... ffs I now have to change 100 files.. 😦
You also have to convert all of your local variables into strings.
params ["_var"] not params [_var]
I done that. It threw an error saying that addAction required an object... because it was a string.. Would I have to "unstring" it?
[1,"1"] call {
params ["_var1","_var2"];
typename _var1; //SCALAR
typename _var2; //STRING
};
oh wait. I was using param and not params, so using params shouldn't throw that error.
Thanks for that.
Yay! all my shit works... one fucking s
@ruby breach ```sqf
if (debug) then { hq globalChat "fn_teleportBase"; };
params ["_actionObject","_teleportObject","_terminal","_teleportName"];
/*
Example:
[c_freedom_tel,c_liberty_obj,freedomTerm,"Teleport: USS Liberty"] call CAP_fnc_teleportBase;
*/
_actionObject addAction [_teleportName, {
params ["_actionObject","_teleportObject","_terminal","_teleportName"];
hq sideChat format["%1, please await for transportation..",name player];
_sound = selectRandom ["Orange_Choice_FadeIn_01","Orange_Choice_FadeIn_02","Orange_Choice_FadeIn_03","Orange_Choice_FadeIn_04","Orange_Choice_FadeIn_05"];
playSound _sound;
private _pos = getPos _teleportObject;
player setPos _pos;
}];``` _teleportObject isn't passed through/saved/changed when I come to do the addAction.
of course two times
your callstack for the ```sqf
{
hq sideChat format["%1, please await for transportation..",name player];
_sound = selectRandom ["Orange_Choice_FadeIn_01","Orange_Choice_FadeIn_02","Orange_Choice_FadeIn_03","Orange_Choice_FadeIn_04","Orange_Choice_FadeIn_05"];
playSound _sound;
private _pos = getPos _teleportObject;
player setPos _pos;
}``` part is literally:
Root
\- AddAction-Code
and not as you expect
Root
\- Script-File
\- AddAction```
ah right. how can I change that?
you cant
addAction is not executed from within your scope
Okay
essentially, what is not executed immediate always will not have access to upper variables
you could use a global variable though
I've done it here correctly: ```sqf
// [loadoutStand_0,itemStand_0] call CAP_fnc_controlLoadout;
params ["_actionObjectLoadout","_actionObjectItem"];
// Ranks
private _private = _actionObjectLoadout addAction ["<t color='#273c75'>Rank: <t color='#44bd32'>Private",{
[] call CAP_fnc_private;
},nil,1.5,true,false,"","true",5,false,"",""];
_actionObjectLoadout setUserActionText [_private , "Private", "<img size='2' image='\a3\ui_f\data\GUI\Cfg\Ranks\private_pr.paa'/>"];```
Before a came here.
// [] call CAP_fnc_private;
[] call CAP_fnc_removeAllGear;
player forceAddUniform "VSM_M81_Crye_tan_shirt_Camo";
for "_i" from 1 to 19 do {player addItemToUniform "ACE_fieldDressing";};
for "_i" from 1 to 2 do {player addItemToUniform "ACE_EarPlugs";};
for "_i" from 1 to 5 do {player addItemToUniform "ACE_CableTie";};
player addItemToUniform "ACE_Flashlight_XL50";
player addItemToUniform "ACE_MapTools";
for "_i" from 1 to 4 do {player addItemToUniform "ACE_morphine";};
... etc```
ooo quick question @queen cargo
Would it be more efficient to do: ```sqf
// [loadoutStand_0,itemStand_0] call CAP_fnc_controlLoadout;
params ["_actionObjectLoadout","_actionObjectItem"];
// Ranks
private _private = _actionObjectLoadout addAction ["<t color='#273c75'>Rank: <t color='#44bd32'>Private",{
[] call CAP_fnc_removeAllGear;
[] call CAP_fnc_private;
},nil,1.5,true,false,"","true",5,false,"",""];
_actionObjectLoadout setUserActionText [_private , "Private", "<img size='2' image='\a3\ui_f\data\GUI\Cfg\Ranks\private_pr.paa'/>"];``` OR the above way with the function inside a function?
Would this work? ```sqf
params ["_actionObject","_teleportObject","_terminal","_teleportName"];
CAP_terminal = _terminal;
CAP_teleportObject = _teleportObject;
_actionObject addAction [_teleportName, {
hq sideChat format["%1, please await for transportation..",name player];
[CAP_terminal,3] call BIS_fnc_dataTerminalAnimate;
[CAP_terminal,0] call BIS_fnc_dataTerminalAnimate;
private _pos = getPos CAP_teleportObject;
player setPos _pos;
}];
CAP_terminal = nil;
CAP_teleportObject = nil;```
😃
👋
duh harro
What you smiling for dumbo?
idk why you don't like wiki so much... 😃
I do. It's just not straight forward for me to understand and learn from
I do use it. Believe it or not.
_terminal isEqualTo CAP_terminal;
_teleportObject isEqualTo CAP_teleportObject;``` How are `CAP_terminal/CAP_teleportObject` undefined?
fuck this bullshit man. How the fuck can I pass from a local variable to a global variable?
= doesn't work == doesn't work isEqualTo doesn't work... hmm
CAP_terminal = _terminal;
CAP_teleportObject = _teleportObject;
//--- bla bla
CAP_terminal = nil;
CAP_teleportObject = nil;
```🤔
How are CAP_terminal/CAP_teleportObject undefined?
that's really strange.........
In the init.sqf file on a dedicated server, shouldn't this give every player (even JIPs) an action?
player addAction ["test", "hint 'test'"];
I'm at a total loss right now, the only way I'm able to attach an action to a player on a dedicated server is this:
player addMPEventHandler ["MPRespawn", {
_player = _this select 0;
_player addAction ["test", "hint 'test'"];
}];
@drowsy axle thanks for you help!
Not even this works:
AttachAction = {
player addAction ["test", "hint 'test'"];
};
remoteExec ["AttachAction", -2, true];
neither does this:
[[player, ["Test: BIS_fnc_MP", "hint 'test'"]], "addAction", true, true] call BIS_fnc_MP;
[player, ["Test: remoteExec", "hint 'woo'"]] remoteExec ["addAction", 0, true];
All I am trying to do is to add an action to every player in a dedicated server. I must have a major misunderstanding at the moment
this ended up being the solution. I put this at the beginning of my file:
waitUntil {time > 15};
Is there a more elegant way? Not even remoteExec or BIS_fnc_MP worked when allowing for JIP
Was that sarcasm @meager heart ?
noooo /s
@drowsy axle you are setting the variables to nil and wonder why they are nil....
The addAction code is executed once the player uses the action
which might be hours or days after your script finished running and has set the variables to nil
https://community.bistudio.com/wiki/addAction just pass arguments to addAction and get them out of _this again
Not like I told you that a dozen times already
@iron osprey Make sure your remoteExec functions are defined on all clients
Since you're dealing with JIP they need to be defined very early on
deployWeaponAuto I guess
Is there a script that I can global on every client that forces a players "Shift Click on map" waypoint to a specific position?
🤔
how do you add 2D vector arrays? like [x, y] + [w, z]
BIS_fnc_vectorAdd apparently supports 2D and 3D
yeah, but vectorAdd does not, only 3 values, but its allright I figured it out
BI Forum needs more scripters to help out the people who don't want to get into Discord.. And also to push out the idiots who give bad advice.
"My script is lagging when I run it locally while I'm hosting a local MP server"
First guys answer: Use !isServer to not run the script on the server.
Yeah.. Not running the script at all will fix it lagging.. sure.
Second guy: Try replacing your execVM by call compileFinal "<script code here>"
Yeah genius.. As if replacing execVM by multiple other commands that will produce equivalent results will help anything.
Then I take a look at the script.
//--- Separate letters
_textArrayLines = [];
for "_i" from 0 to (count _textArrayUnicode - 1) do {
_line = _textArrayUnicode select _i;
_textArrayTemp = [];
{_textArrayTemp = _textArrayTemp + [tostring [_x]]} foreach _line;
_textArrayLines set [_i,_textArrayTemp];
};
//--- Merge arrays
_textArray = [];
_emptyArray = [];
_nArrayTemp = [];
_n = 0;
{
_line = _x;
_textArray = _textArray + _line + ["\n"];
{
_emptyArray = _emptyArray + [" "]; //--- Space
_nArrayTemp = _nArrayTemp + [_n];
_n = _n + 1;
} foreach _x;
_n = _n + 1;
_emptyArray = _emptyArray + ["\n"];
} foreach _textArrayLines;
_finalArray = _emptyArray;
Yeah gee.. I wonder why that might be lagging a bit
It's apparently copied from a BIS function. Something infoText
original > https://pastebin.com/0xSsM3P6 😃
Okey yeah.. Really a straight copy-paste.. Ugh.. Why doesn't BI just let the community fix their crap scripts
Is that the intro text at bottom right when you start a mission? I still remember it horribly lagging back from DayZ mod times 😄
Why doesn't BI just let the community fix their crap scripts Because that would be too easy, wouldn't it?
that part of the script should even run in sqfvm 🤔
What’s wrong with infoText?
The code is.
It's from early Arma2 and has never been updated with the new script commands
and thus it's lagging AF
Well you can update pushback append and all that
exactly.
But I don’t think you can avoid toString toArray
Nope you can't. Atleast I didn't try to get rid of that in the optimizations I recommended
But in that code. Every ARRAY + ARRAY is a complete copy of both arrays. Which.. If you do that for every single char in a piece of text.. Get's quite extreme.
I had troubles with that one, JIP players create and get notificated of a task that was already done.
bis_fnc_setTask has param for that ^
isGlobal?
and
showNotification (Optional): Boolean - true to show notification (default), false to disable it
well, I want the player to get notificated of the task, is just anoying to JIP that join in my persistent mission and get flooded by the task notification.
never had those issues
also you can make local tasks and just check states before...
(i mean...to fix any possible troubles with jip'ed players)
bis_fnc_playVideo is stopping itself about 2-3 seconds in. Not sure what the cause is, I use this code: ["Curious's Framework\media\intro_video.ogv"] call BIS_fnc_playVideo;
stops aka just goes black/disappears and the sound stops?
does the video play fine in VLC Player?
Disappears and sound stops
Yes
In the eden editor, if I place it in the debug console, it runs fine there too, it's at a weird aspect ratio, I think 4:3 but it runs
Maybe some other script running that kills it
private _dur = 3;
private _end = time + _dur;
// Smoothly fade out the fake black screen
while {time <= _end} do {
BIS_fakeAlpha = (_end - time) / _dur;
sleep 0.01;
};
// Remove the fake black screen entirely
if (!(isNil {BIS_fakeBlackScreen})) then {removeMissionEventHandler ["Draw3D", BIS_fakeBlackScreen]};
(uiNamespace getVariable "BIS_layerBlackScreen") cutText ["", "PLAIN"];
above is a sleep for how long the video is, it will disppear and no sound, wait the remianing time, then this happens
*note: I'm using a modifed version of bis_fnc_m01_intro
If you are using call BIS_fnc_playVideo like you said you are. You don't need to sleep. The call will only return when the video is done
https://community.bistudio.com/wiki/BIS_fnc_playVideo
oh
Also your "dur" is 3? 3 seconds?
And the symptom you are seeing is the video ending after 3 seconds? These times match up.
Didn't spot that one
ha
then after it clears rscs
perhaps thats why
i'll give it a look
I can't figure out what's causing this, can someone take a look? Here's the code: https://pastebin.com/PptGVZj6
Anyone knows how to use this function? https://community.bistudio.com/wiki/BIS_fnc_moduleEffectsEmitterCreator
An example would be helpful since the wiki doesn't have any.
[] spawn {["Curious's Framework\media\intro_video.ogv"] call BIS_fnc_playVideo;}; wtf is that
either spawn or call.. don't try to jumble both together
@meager granite Thank you for the response :)
All functions are globally defined (ex: CreatePlayzone = { //... };) and are imported in the very beginning of init.sqf.
_scripts = [
execVM "Util.sqf",
execVM "Playzone.sqf",
execVM "Base.sqf",
execVM "Inventory.sqf",
execVM "FoodSupply.sqf",
execVM "WeaponSupply.sqf",
execVM "ServerLoops.sqf"
];
{waitUntil {scriptDone _x;}} forEach _scripts;
Does that make the functions-to-be-remoteExec'ed available? Cheers!
Would using CBA_fnc_addPerFrameHandler make any difference in the following snippet?
params ["_display"];
private _control = _display displayCtrl IDC_aiCounterText;
[_control] spawn {
waitUntil {(_this select 0) ctrlSetText format ["AI %1", str count (allUnits - allPlayers)]; false};
};
@meager granite, also, do I need to define every function (even nested funtions) that are remoteExec'ed in definitions.ext?
Can't recall exactly, but I think JIP RE function execution happens BEFORE init.sqf
Yeah you need to define RE functions in CfgRemoteExec
Yeah init.sqf is pretty much the last thing that executes
So you either need to have your function in CfgFunctions on init your functions in scripts from some object init field
on init your functions in scripts from some object init field
What does that mean?
@iron osprey Why not make functions that return true when they've executed rather than constantly compiling normal scripts?
@tough abyss are you saying to have the last line of each .sqf file be true, and then amend the init.sqf file to be:
_scripts = [
execVM "Util.sqf",
execVM "Playzone.sqf",
execVM "Base.sqf",
execVM "Inventory.sqf",
execVM "FoodSupply.sqf",
execVM "WeaponSupply.sqf",
execVM "ServerLoops.sqf"
];
{waitUntil {_x == true;}} forEach _scripts;
Functionalize all of those files
What does that mean?
Currently, all of the files are structured like this:
// Util.sqf
HintPlayer = { //...};
AddLiteAction = { //...};
//...etc
to clarify, the files are only composed of functions. The only file to include code outside of a function is init.sqf
is that what you mean?
Sounds like you should be using CfgFunctions instead
oooo
god damn I have a work meeting in 15 minutes that I should be preparing for but this is too exciting
@tough abyss, is this what you mean?
_scripts = [
"Util.sqf",
"Playzone.sqf",
"Base.sqf",
"Inventory.sqf",
"FoodSupply.sqf",
"WeaponSupply.sqf",
"ServerLoops.sqf"
];
{
_func = compile PreProcessFileLineNumbers _x;
[] spawn func;
} forEach _scripts;
excuse me?
VauunToday at 1:51 PM
Have you never made a function before?
https://community.bistudio.com/wiki/Functions_Library_(Arma_3)
thanks for trying to help, but I'll ask others
I literally just gave you the biki article that has everything you need in it. Why would anyone waste time explaining everything to you when it's already written? If you have questions about things within that article that's when you come here to ask.
In short: RTFM
you know, I hope that when you are running in to issues after ~8 hours of debugging, that someone shows you more patience
So I tried from the wiki and it doesnt work, anyone could help?
vehicle player setWeaponReloadingTime [gunner (vehicle player), currentMuzzle (gunner (vehicle player)), 0];```
How you tried? Should be called after each shot
What vehicle?
Heli with missile launcher added with addWeapon
Which heli
Mh6
There is gunner turret in it?
Nevermind, the order was incorrect. Thank you, but it shouldnt require turrect,correct?
Who knows what gunner command will return
Ghosthawk has 2 guns but gunner returns a single unit, go figure
lol ;d
is it possible to get the position of terrain vertices?
@tough abyss @neon snow If you want to dig deep use fullCrew. The gunner of a vehicle might not be an actual gunner of a specific turret of the same vehicle. Simple example is Hummingbird, where pilot is a driver and also a gunner, but actually occupies exactly a driver role and the turret is controlled remotely.
Oh it might be Pawnee not Hummingbird.
@runic surge if you know the cell size you can just create a grid with getposASL
I actually don't necessarily need to get the positions of terrain vertices but I could to get an evenly spaced grid of positions around a certain point
that's what I was thinking actually
how do you create a grid?
move even spaces in x, y directions
0,1 0,2 0,3 etc
best way to get help would be just coming out with what you are trying to do
Right now I am trying to select positions based on 'steepness'
I already have that part mostly figured out I think, but for some reason I got stuck on the simple part lol
Is there a was to check words in a string? like ("String" in "Its a string") // true
@astral tendon yup
https://community.bistudio.com/wiki/BIS_fnc_inString
find works too! case-sensitive though 😉
yep, even with 2× toLower I think it is faster than the inString function
Nice, thanks.
@winter rose have you seen the source for it? It is basically that
params [_actionObjectTeleport,_teleportObject,_terminal,_teleportName];
/*
Example:
[c_freedom_tel,c_liberty_obj,freedomTerm,"Teleport: USS Freedom"] call CAP_fnc_teleportBase;
*/
_actionObjectTeleport addAction [_teleportName, {
hq sideChat format["%1, please await for transportation..",name player];
[(_this select 3 select 0),3] call BIS_fnc_dataTerminalAnimate;
sleep 5;
[(_this select 3 select 0),0] call BIS_fnc_dataTerminalAnimate;
sleep 2.5;
private _pos = getPosATL (_this select 3 select 1);
player setPosATL _pos;
},[_terminal,_teleportObject],2,true,false,"","true",5,false,"",""];``` How is `_actionObjectTeleport` undefined?
I told him that yesterday
wiki is "not straight forward for him to understand and learn from" © 🤷
@drowsy axle parameters need to be strings, much like how Skullfox pointed out.
But the addAction has an error with saying it's a string that is being passed through.
How do I remove the _actionObjectTeleport from a string to a normal variable? Because was it's returning is "c_freedom_tel" when c_freedom_tel is an object. Which is what the addAction needs.
wiki examples are not clear > https://prnt.sc/l49209
also "copy paste" example on the addAction page not clear too > http://prntscr.com/l495rr
Hi all, is it possible to run a .sqf file on a dedicated server via the debug console? the following command is not working:
[] execVM "C:\Users\{user name}\Documents\Arma 3\missions\{mission name}\init.sqf"
I am trying to do quick iteration of testing a .sqf file without having to restart the dedicated server
Note: dedicated server is at C:\Arma3, and ini file is at a completely different path. This means that a relative path to the dedicated server is incapable of reaching my main Arma 3 directory
pretty sure you cannot execVM scripts outside your current missions folder. On top of that the paths needs to be relative from mission root. If you want to rapidly test your scripts I suggest using the debug console to overwrite your functions
Thanks for the response @digital jacinth. I tried placing the scripts in the mission folder on the dedicated server folder and in the client folder to no avail. Cheers
@iron osprey why dont you just use call ?
@compact maple, thanks for the response. I don't understand, can you please post an example? Cheers 😃
@iron osprey related:
http://killzonekid.com/arma-scripting-tutorials-mission-root/
@compact maple, can you explain the context of your statement "why dont you just use call ?"? I use call to invoke a function, but I do not see the correlation of how it can invoke a script file
@cosmic kettle thank you for the link, I am reading it now
Well, afaik, and what I read here before is : you should use execVM on the client side if you're going to use the script only once.
But if you're going to use that script often you must use call or spawn.
functions are script, all of your script are defined in your functions.hpp, right ?
Nice, thanks for the elaboration!
all of your script are defined in your functions.hpp, right ?
All of my scripts are written in separated .sqf files and then are "execVM"ed in the beginning of init to make all functions available. This is before I learned aboutfunctions.hppearlier today 😃
The goal is to rapidly iterate on code in a dedicated server without having to do these steps:
- edit the code
- open up eden editor
- export for multiplayer
- copy the pbo file to my dedicated server folder
- restart server
I am wondering if there is a process to edit the sqf file and load it without restarting the dedicated server
well in the description.ext, you can write
class CfgFunctions {
#include "Functions.hpp"
};
then create your functions.hpp file which look like that :
class Core
{
tag = "mytag";
class Master
{
file = "core";
class initPlayer {};
};
};
From my understanding, that makes the function "initPlayer" available to be used with "remoteExec", correct?
no
ooooo
with that functions.hpp you can do
call mytag_initPlayer;
call mytag_initPlayer in init.sqf?
Mhmm, and if I updated the contents of initPlayer, can I do call mytag_initPlayer in the debug menu to get the new contents of without restarting the server?
No you have to restart your server
I see, thank you! That is what I was asking. I appreciate your time and effort
But can't you work in 3den editor directly to debug your code instead to work on your server
so you just have to reload your mission
From my understanding, some code behaves differently in a dedicated server environment compared to the eden editor
I am running into tons of bugs due to it being my first time coding for a dedicated server, so I have been in a debugging process spanning multiple days and many hours 😃
and am looking to quicken my iterative process
What kind of server are you running ?
more what kind of mission style ?
and about the remoteExec, if you want to be able to remoteExec a file you must allow it in CfgRemoteExec.hpp
I might not be understanding your question, I am running a server that runs a custom mission that I am writing
and about the remoteExec, if you want to be able to remoteExec a file you must allow it in CfgRemoteExec.hpp
cheers mate, thank you
Oh okay, I was wondering if it was Exile, or Life, etc...
@iron osprey, run it locally and fill missing data using local variables... If not, you're losing precious time each restart.
run it locally
This means in the eden editor?
fill missing data using local variables
What does this mean?
If not, you're losing precious time each restart.
Damn right 😎
well if you have something like
_myNumber = _this select 0;
you can just do
_myNumber = 0;
for debugging
Also, are you actually dedi hosting or launching host through A3? the latter can also be an option that allows for quick and easy manipulation of code.
@cosmic kettle Dedi hosting. This is because I noticed that other clients that connect to the server experience bugs that the server host does not (ex: actions are correctly assigned to server host, but not to clients)
and I needed to be able to trouble shoot their issues without taking up their time for helping test
Well, you can also do that using your A3 game installation. Requires some router setup etc for others to be able to connect, but way faster.
https://discordapp.com/channels/105462288051380224/105462984087728128/499490403456647172
- Yes, means 3DEN
- what @compact maple said (https://discordapp.com/channels/105462288051380224/105462984087728128/499490580615921684)
- Fix your workflow, don't work with iteration restarts...
Cheers @cosmic kettle, I appreciate your help and time 😃
No problem, try starting with a blank mission and host it on your dev. environment using the integrated dedi (MP) game hosting in A3.
From there, you should be able to figure it out. Good luck!
the integrated dedi (MP) game hosting in A3.
I am not aware of an integrated dedicated MP game host. I am only aware of the separate server file that is downloaded outside of the Arma game client
As far as hosting a MP game that is integrated in the ArmA client, I am not aware of any dedicated options
you can just go in 3den and click "play as multiplayer" or something like this, or in the multiplayer tab you have a host option
Enjoy your free time for actual life
lmao
alright, thank you @compact maple and @cosmic kettle, I'm gonna hit the hay, take care
@iron osprey https://discordapp.com/channels/105462288051380224/105462984087728128/499439332256382977 -filePatching startparameter. And then
[] execVM "\missions\{mission name}\init.sqf" Maybe without the leading backslash
you might need to have a pbo with a file at same path tho. So that the game knows it exists
Hi guys, I have a little question about the "setPlateNumber" commands, When i use it on a modded plate (we added the SPZ on the plate) it display the text like if it was transluscent. Do you have any idea of how i can fix it ?
here a link to a screen of the car
https://i.imgur.com/7XfBWWx.jpg
Did you ask the "author" of that car if he knows why?
hi dedmen, it seem that my "polite first "hi"" didn't worked. To answer to your question this model is in free use
That doesn't answer my question in any way
Did you ask the guy who "ported" that totally legit car model into Arma, if he knows why the number is transparent
Ho , i see my bad. i thought you wanted to ask if it was a totally legit car. My apologies. So to answer correctly this time yesn i asked him and he said "this command was pretty new and he didn't knew" it for him i came here because he said you are very good with arma 3.
it seem there are some parameters it can be added to the command like
classe PlateInfos {
name = "spz" ;
couleur [] = { 0 , 0 , 0 , 0,75 }; };
so if it work it will fix my problem.
These are config entries. Not script command stuff
I am trying to create script which will return the object I am looking at now, I made one but I want to give it some margin error so I can detect it when I am not looking directly at it?
removeAllmissioneventhandlers "Draw3d";
eh = addmissioneventhandler ["Draw3d",
{
private _maxLockDistance=2000;
_obj=lineIntersectsWith [eyePos player, (eyePos player) vectorAdd(positionCameraToWorld [0,0,_maxLockDistance] vectorDiff positionCameraToWorld [0,0,0]), objNull, objNull, true];
hint str (_obj select 0);
}];
positionCameraToWorld [0,0, Just do multiple lineIntersects but with non 0 in there
like.. 1 left and 1 up. And 1 right and 1 down
also maybe BIS_fnc_inAngleSector 🤔
@meager heart I think it will only work in 2d
what about cursotObject ?
It works but like one above, it only detects when I am looking directly at it
Also doesnt work in freelook
This is going to sound stupid, and I feel stupid for asking it...but can someone ELI5 how the getPlayerScores function works? I'm working on a small TvT league in arma and I'm wanting to track those scores for stats
@meager heart / @still forum Would this pass the stuff? ```sqf
_this select 0 = _actionObjectTeleport;
_this select 1 = _teleportObject;
_this select 2 = _terminal;
_this select 3 = _teleportName;
/*
Example:
[c_freedom_tel,c_liberty_obj,freedomTerm,"Teleport: USS Freedom"] call CAP_fnc_teleportBase;
*/
_actionObjectTeleport addAction [_teleportName, {
hq sideChat format["%1, please await for transportation..",name player];
[(_this select 3 select 0),3] call BIS_fnc_dataTerminalAnimate;
sleep 5;
[(_this select 3 select 0),0] call BIS_fnc_dataTerminalAnimate;
sleep 2.5;
private _pos = getPosATL (_this select 3 select 1);
player setPosATL _pos;
},[_terminal,_teleportObject],2,true,false,"","true",5,false,"",""];```
[_this select 0,_this select 1,_this select 2,_this select 3,] params ["_actionObjectTeleport","_teleportObject","_terminal","_teleportName"]; wtf?
for one it wouldn't work because you have a syntax error in there
second.. WTF are you trying to do there?
I can't see anything like that on
@neon snow think about it like... a "cone shape object" with the center at first position points at the second position
also it will return true even if there some objects on the way...
Someone can link him a sqf starter guide ?
@meager heart thats exactly what I am trying to do. However it needs to work with freelook and I would like it to be fast so many lineintersects might be problematic and I cant really create a shape like that(or I dont know how to)
Ded, he can't figure out how to properly use params
Even though like... 3 of us have told him how, linked him the wiki page, and even taken screenshots with big red circles (well, rectangles really, but still)
I will try with positionCameraToWorld as the func work only in 2d
Hola, I'm currently struggeling with ropes, maybe someone could help me?
So, I made a model, it's a structure, now I want to attach a rope from one memory point to another within the structure. Didn't work.
So I placed 2 of those and tried to attach a rope between them. Didn't work with memory points nor coordinates.
Then I tried making it a car, instead of a structure, just to see if that makes a difference (inheritted from Car_F instead of House_f).... nothing.
That's the code I'm using: myRope = ropeCreate [x2, [0, 0, 0], x1, [0, 0, 0], 10];
x1 = Structure 1, x2 = Structure2.
Any idea?
wtf dude
@drowsy axle literally just choose one of the examples
@ruby breach 3 of us have told him how you forget about the dozens of other times days/weeks back where we already did
Can someone add to the ropes wiki that the model needs a Geo Phys LOD?
Can't register rn for whatever reason
(Also fixed my issue 👆 )
Well, somewhat fixed my issue, still not working as it is supposed to.
myRope = ropeCreate [pump, "rope_main_high", pump, "rope_main_low", 10];
(Attaching a rope from one mem point to another) = Doesn't work.
myRope = ropeCreate [x1, [0,0,0], pump, "rope_main_high", 10];
(attaching x1 to pump works) (x1 is a Quadbike)
myRope = ropeCreate [pump, "rope_main_high", x1, [0,0,0], 10];
(attaching pump to x1 doesn't work)
Conclusion, my structure can't be fromObject it only works when it is toObject but why?
Syntax ropeCreate [fromObject, fromPoint, toObject, toPoint, segments, length]
because simulation probably
Nope fixed it, fromObject can only be a Car, not a Structure
possibly it needs to be a physx simulated object
Nope, I solved it by using a simulated object instead of a non simulated.
Why nope? That's exactly what I said
Lol, may have read it wrong.
It is jumping in the air now. And attach coordinate to coordinate works but when attaching mem point to mem point, game crashes
yep
as big as the rope segments are. I think it was never intended to connect between the same object.
Game crash should go to #arma3_feedback_tracker so that BI can fix it in 5 years
Yea...
If you use BIS_fnc_addStackedEventHandler over the same handler name will it override it removing previous stack, or just overwrite the name?
it should overwrite the name and maybe remove the old handler
Apparently attaching 2 mem points within the same object works for the quad bike, but not my structure...
I'll just quit Arma modding
I gave up
@still forum I've done it the hard way, because I couldn't get my head around the params, even though I was, at first, doing it correctly. ```sqf
// USS Freedom to: X
c_freedom_tel addAction ["Teleport: USS Liberty", {
hq sideChat format["%1, please await for transportation..",name player];
[freedomTerm,3] call BIS_fnc_dataTerminalAnimate;
sleep 5;
[freedomTerm,0] call BIS_fnc_dataTerminalAnimate;
sleep 2.5;
private _pos = getPosATL c_liberty_obj;
player setPosATL _pos;
},nil,2,true,false,"","true",5,false,"",""];
c_freedom_tel addAction ["Teleport: Outpost Charlie", {
hq sideChat format["%1, please await for transportation..",name player];
[freedomTerm,3] call BIS_fnc_dataTerminalAnimate;
sleep 5;
[freedomTerm,0] call BIS_fnc_dataTerminalAnimate;
sleep 2.5;
private _pos = getPosATL c_outpost_obj;
player setPosATL _pos;
},nil,2,true,false,"","true",5,false,"",""];
c_freedom_tel addAction ["Teleport: Airfield", {
hq sideChat format["%1, please await for transportation..",name player];
[freedomTerm,3] call BIS_fnc_dataTerminalAnimate;
sleep 5;
[freedomTerm,0] call BIS_fnc_dataTerminalAnimate;
sleep 2.5;
private _pos = getPosATL c_fob_obj;
player setPosATL _pos;
},nil,2,true,false,"","true",5,false,"",""];
You were doing it correctly and then changed over to wrong?
your code itself was correct
just the params was wrong
@queen cargo nah I'm good. Maybe I'll start on Minecraft modding or something
I couldn't un-string the first variable.
Because addAction needed an object, what it was, before being put into the function.
well according to your params' your first variable was always nil
even though I was, at first, doing it correctly. Considering you started off with param [_var1,_var2];, not really
you can't "unstring" a nil.
you can use getVariable to get an object from a variable
expecting that your string is the variable name of an object
I don;t mean the fucking var = nil bullshit. I knew that it made it nil/not working
but then.. Why do you pass the variable name of the object as string? instead of passing the variable
What do you mean? instead of passing the variable
I was passing the variable.
[c_freedom_tel,c_liberty_obj,freedomTerm,"Teleport: USS Liberty"] call CAP_fnc_teleportBase;```
c_freedom_tel is a variable / object.
All are apart from the actual string.
I don't see how you got a string then
Because I was told. To put "" around _actionObjectshittyfuckingbulshitarsehole in the param
it does for the addAction, for some fucking reason.
Mind the language, lest FM yell at you later
next time. If you have a problem please say what the problem is and post the error message if possible
but tbh it works the "hard" way. Yes, it's not perfect or efficient. but I cannot be arsed waiting to figure it out.
Back to your "it makes it a string" argument - https://discordapp.com/channels/105462288051380224/105462984087728128/499000504764858397
https://discordapp.com/channels/105462288051380224/105462984087728128/499359000455020604 you said nothing about something being a string. You said it's undefined. Which is correct. As you don't use params correctly
Yes, because it was throwing that error.
But it was later down to the fact that _actionObject was being a string, for some reason.
I didn't change anything, I fixed the param to params and then it said the above error.
https://discordapp.com/channels/105462288051380224/105462984087728128/499396095202426882 that doesn't make sense. Arma doesn't just randomly turn things into strings
Only possibility is that you did.
But just removing the quotes from the params and breaking it doesn't change that
The other time you were using an addAction here - https://discordapp.com/channels/105462288051380224/105462984087728128/499008297337225256, the issue had nothing to do with your use of Params. It was the fact that by the time you used the addAction, you had undefined variables needed in it.
init.sqf:
[loadoutStand_0,itemStand_0] call CAP_fnc_controlLoadout; // _0 Loadouts and Items on Maintenance
[loadoutStand_1,itemStand_1] call CAP_fnc_controlLoadout; // _1 Loadouts and Items on USS Liberty
[loadoutStand_2,itemStand_2] call CAP_fnc_controlLoadout; // _2 Loadouts and Items on Breifing``` ```sqf
params ["_actionObjectLoadout","_actionObjectItem"];
// Ranks
private _private = _actionObjectLoadout addAction ["<t color='#273c75'>Rank: <t color='#44bd32'>Private",{
[] call CAP_fnc_private;
},nil,1.5,true,false,"","true",5,false,"",""];
_actionObjectLoadout setUserActionText [_private , "Private", "<img size='2' image='\a3\ui_f\data\GUI\Cfg\Ranks\private_pr.paa'/>"];``` This works.
@ruby breach I got around that, supposedly through },nil,1.5,true,false,"","true",5,false,"",""]; to },[_var1,_var2],1.5,true,false,"","true",5,false,"",""];.
https://discordapp.com/channels/105462288051380224/105462984087728128/499359000455020604
params ["_actionObjectTeleport", "_teleportObject", "_terminal", "_teleportName"];
/*
Example:
[c_freedom_tel,c_liberty_obj,freedomTerm,"Teleport: USS Freedom"] call CAP_fnc_teleportBase;
*/
_actionObjectTeleport addAction [_teleportName, {
(_this select 3) params ["_terminal", "_teleportObject"];
hq sideChat format["%1, please await for transportation..",name player];
[_terminal,3] call BIS_fnc_dataTerminalAnimate;
sleep 5;
[_terminal,0] call BIS_fnc_dataTerminalAnimate;
sleep 2.5;
private _pos = getPosATL _teleportObject;
player setPosATL _pos;
},[_terminal,_teleportObject],2,true,false,"","true",5];
huh?
This is how you use params
ohhhhh
fuck that xD
I thought it was because I already defined the params
I needed to do it again..
lol
I just don't see how a variable would magically turn into a string in there
me neither
Reproduce now, post exact error
Let me try one more time. With your edit of the params inside the dowha
And there again the.. Post your actual error message. Are you 100% sure that _actionObjectTeleport turned string? Or did maybe addAction complain about some other argument being string
Okay. I'll let you guys know.
init.sqf
// USS Freedom to: X
[c_freedom_tel,c_liberty_obj,freedomTerm,"Teleport: USS Liberty"] call CAP_fnc_teleportBase;
[c_freedom_tel,c_outpost_obj,freedomTerm,"Teleport: Outpost Charlie"] call CAP_fnc_teleportBase;
[c_freedom_tel,c_fob_obj,freedomTerm,"Teleport: Airfield"] call CAP_fnc_teleportBase;
// USS Liberty to: X
[c_liberty_tel,c_freedom_obj,libertyTerm,"Teleport: USS Freedom"] call CAP_fnc_teleportBase;
[c_liberty_tel,c_outpost_obj,libertyTerm,"Teleport: Outpost Charlie"] call CAP_fnc_teleportBase;
[c_liberty_tel,c_fob_obj,libertyTerm,"Teleport: Airfield"] call CAP_fnc_teleportBase;
// Airfield to: X
[c_fob_tel,c_liberty_obj,fobTerm,"Teleport: USS Liberty"] call CAP_fnc_teleportBase;
[c_fob_tel,c_freedom_obj,fobTerm,"Teleport: USS Freedom"] call CAP_fnc_teleportBase;
[c_fob_tel,c_outpost_obj,fobTerm,"Teleport: Outpost Charlie"] call CAP_fnc_teleportBase;
// Outpost Charlie to: X
[c_outpost_tel,c_liberty_obj,outpostTerm,"Teleport: USS Liberty"] call CAP_fnc_teleportBase;
[c_outpost_tel,c_freedom_obj,outpostTerm,"Teleport: USS Freedom"] call CAP_fnc_teleportBase;
[c_outpost_tel,c_fob_obj,outpostTerm,"Teleport: Airfield"] call CAP_fnc_teleportBase;``` Just booting arma.
fn_teleportBase.sqf
params ["_actionObjectTeleport", "_teleportObject", "_terminal", "_teleportName"];
/*
Example:
[c_freedom_tel,c_liberty_obj,freedomTerm,"Teleport: USS Freedom"] call CAP_fnc_teleportBase;
*/
_actionObjectTeleport addAction [_teleportName, {
(_this select 3) params ["_terminal", "_teleportObject"];
hq sideChat format["%1, please await for transportation..",name player];
[_terminal,3] call BIS_fnc_dataTerminalAnimate;
sleep 5;
[_terminal,0] call BIS_fnc_dataTerminalAnimate;
sleep 2.5;
private _pos = getPosATL _teleportObject;
player setPosATL _pos;
},[_terminal,_teleportObject],2,true,false,"","true",5];```
I guess these are variable names assigned via the edit box when you doubleclick a object in editor?
Yes.
wtf
It works...
😢 Thanks @still forum & @ruby breach
I was on the right track with [_this select 3, etc] params ["_terminal", "_teleportObject"]; just needs to be inside the addAction and ()'s.
you previous _this select 3 select 0 code was just fine and should've worked. It was just ugly so I changed it
arguments aren't ()
oh
that's just to make it more readable and group them together
Like in simple math equations when you use ()
1+5*3 = 16
but (1+5)*3 = 18
with the params it's the same
Okay
(_this select 3) params ["_terminal", "_teleportObject"]; is what you want to do. First _this select 3, and then the params.
If you leave the () away and don't group the _this select. Arma will try to do the grouping. And Arma might try to do
_this select (3 params ["_terminal", "_teleportObject"]);
which would be wrong.
Arma can't read your mind. So you gotta tell it exactly what you want
init.sqf
[itemsACEStand_0,itemsACEStandPad_0,itemsACEWheel_0,itemsACETrack_0] call CAP_fnc_itemsACE;
[itemsACEStand_1,itemsACEStandPad_1,itemsACEWheel_1,itemsACETrack_1] call CAP_fnc_itemsACE;``` ```sqf
fn_itemsACE.sqf
params ["_actionObjectACE","_ObjectPad","_itemsACETrack","_itemsACEWheel"];
_actionObjectACE = createVehicle ["Land_InfoStand_V1_F", (getPosATL _ObjectPad), [], 0, "CAN_COLLIDE"];
_dir = getDir _ObjectPad;
_actionObjectACE setDir _dir;
_actionObjectACE addAction ["<t color='#0097e6'>Spawn: <t color='#718093'>ACE Track", {
(_this select 3) params ["_itemsACETrack"];
private _pos = getPosATL _itemsACETrack;
private _item = "ACE_Track" createVehicle [0,0,5];
_item setPosATL _pos;
},[_itemsACETrack],1.5,true,false,"","true",5,false,"",""];
_actionObjectACE addAction ["<t color='#0097e6'>Spawn: <t color='#718093'>ACE Wheel", {
(_this select 3) params ["_itemsACEWheel"];
private _pos = getPosATL _itemsACEWheel;
private _item = "ACE_Wheel" createVehicle [0,0,5];
_item setPosATL _pos;
},[_itemsACEWheel],1.5,true,false,"","true",5,false,"",""];```
Boom.
This makes sense now..
omg
wait a second...
Wut?
private _pos = getPosATL _itemsACETrack; that won't work.
_itemsACETrack is "itemsACEWheel_0" a string
getPosATL doesn't take a string I think?
oh wait. I needed to delete the ""'s in init.sqf my bad
Sorted
AxeriusNetwork
[EC:master] 1 new commit
a640cd6 Finally fixed it all. Everything works. - AxeriusNetwork```
I shall put you and @ruby breach in the credits.
/*
CREDIT to:
@Dedmen and @Gnashes on the ArmA 3 Discord for helping me fix and figure out params, addAction and passing it through. Making it all work.
*/```
helping me fix*
addAction*
@still forum, thanks for the message with -filePatching. Would I put that in the target parameter for both my dedicated server and the client? Cheers
Thanks
@drowsy axle I read over your trials and tribulations this morning. Congrats on making it to the other side. If you have questions on understanding some of the basics (params, assigning variables), shoot me a DM
Thanks
Atleast I can pass stuff through functions. Never used functions, so I haven't gone through the trials with them like most things.
Hell yeah dude good job
is it possible making a man immune to fall damage?
hey there.ive got a problem with a plugin ive created.i´m having apluginaction with condition _cursor in vehicles inside of the config.cpp,call a function with [_cursor] call fuctionname blabla (the usual stuff) but i get undefined variable in expression _cursor errors.what could that be?
_cursor is defined as cursorobject from a pluginmanager the system provides
"what could that be?" I'm guessing something in your script is making that variable be undefined
cursorObject is not always defined.
the system i am using is apms and razer told me the pluginmanager of this system defines _cursor as cursorobject to start with
i can call the functions without param no problem
Could trigger EH when free fall animation plays and allowDamage false @nocturne basalt
Or check Anim in HandleDamage and cancel the damage maybe
will give an example: ```sqf
class CfgPluginActions {
class Vehicles {
text = "Unlock";
Condition = "(_cursor in vehicles)";
class Actions {
class ResetLock {
text = "Claim Vehicle";
condition = "(_cursor getVariable ['oOwner',''] == '')";
action = "createDialog 'DS_Padlock';[_cursor] call PVE_fnc_initReset;";
};
class Lock {
text = "Lock Vehicle";
condition = "(locked _cursor == 1) && (_cursor distance player < 5)";
action = "createDialog 'DS_Padlock'; [_cursor] call PVE_fnc_initLock;";
};
class Unlock {
text = "Unlock Vehicle";
condition = "(locked _cursor == 2) && (_cursor distance player < 5)";
action = "createDialog 'DS_Padlock'; [_cursor] call PVE_fnc_initUnlock;";
};
class Unclaim {
text = "Give up Vehicle";
condition = "!(_cursor getVariable ['apms_unlockcode', []] isEqualto []) && (locked _cursor < 2) && ((_player getVariable ['pUUID','do not']) isEqualTo (_cursor getVariable ['oOwner','']))";
action = "createDialog 'DS_Padlock';[_cursor] call PVE_fnc_initUnclaim;";
};
};
};
};
thats where i call the init of the script
_cursor = _this select 0;
disableSerialization;
_display = findDisplay 4003;
_ctrl = _display displayCtrl 2400;
_ctrl buttonSetAction "[_cursor ]call PVE_fnc_unlockVehicle";
_ctrl ctrlSetText "Unlock";```thats the init
Yeah... Well
inside of the script that comes after that i grab the param with _this select 0; again
It is undefined in the button action
The variable is defined in your script yes. But you are not executing the button action code
that button action code might be executed arbitrary time later when the _cursor variable is looong gone
@tough abyss yeah I can try to make a fancy script that uses allowdamage when in the air, or right before impact
What you can do is setVariable onto the control. And you can probably get it back inside the button action code with getVariable
Falling animation starts with afal...
I have a script that deletes projectile in Fired eventhandler, fires next one using fireattarget command, and returns one missile to the vehicle so it looks like it fired once. The issue I have is with weapons which magazine has 1 ammo :/
vehicle player setVariable ["MissileFired", false, true];
vehicle player addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
private _ammoName = getText(configFile >> "CfgMagazines" >>_magazine>> "ammo");
private _OneMissileException = getNumber(configFile >> "CfgMagazines" >>_magazine>> "count");
private _airLock = getNumber(configFile >> "CfgAmmo" >> _ammoName >> "airLock");
private _ir = getNumber(configfile >> "CfgAmmo" >> _ammoName >> "Components" >> "SensorsManagerComponent" >> "Components" >> "IRSensorComponent" >> "AirTarget" >> "minRange");
if(_airLock==2&&_ir>100)then{
vehicle player setWeaponReloadingTime [player, _muzzle, 0];
if(vehicle player getVariable "MissileFired")then
{
vehicle player setVariable ["MissileFired", false, true];
}else{
deleteVehicle _projectile;
vehicle player setVariable ["MissileFired", true, true];
vehicle player setAmmo [_weapon,(vehicle player ammo _weapon)+1];
if(_OneMissileException==1) then{
vehicle player addMagazine _magazine;
};
vehicle player fireAtTarget [h1, _muzzle];
};
};
}];
You can only use setVar with public arg on missionNamespace vars, never on control
so not false but nothing?
yes
alright will test this
Fire normal, delete missile, create another one, set dir and velocity from original
you can just setpos set dir on the fired missile
Yes however I need it to react to flares and movement of vehicle
So I wanted it to be engine handled
So maybe there is a way to either detect which pylon missile was fired of or somehow block missile from firing at all?
turns out _Cursor being undefined inside the config.despite me having a line in there that says "_cursor = cursorobject;"
I think you might not be understanding local variables and scopes
@neon snow you mean like it was locked?
well yeah i guess i got something wrong there
@young current I just want one missile to disappear but not decrease ammo this time, and fire another and decrease ammo this time
yes but fire it as it was locked on to something? or just fly dumb?
and why fire another when you can just alter anything on the one just fired?
Yeah I want to lock this missle to a jet for example
however I didnt find any command to do that
I dont think there is a command like that
fireatTarget handled everything for me
oh ok so it fires as if thing was locked?
good to know
so you want to alter what is locked?
Yep
soo like extend AA lock range and stuff like that?
I am creating something like JHMCS from F18, that you lock something you look at, no key presses or anything
Everything was good until I fired a missile that has ammo count of 1 ;d
it instantly changes to other pylon and setAmmo doesnt work
How do I make an interactive static object (an object that doesn't fall if in the air)?
setMass 0 maaaaybe? Will never be perfect though I guess
EnableSimulation false
I still want to have an addAction on it @tough abyss
I could make it cursorObject.
Based around a trigger thisList
Not surprised tbh
Why?
You tell me
@still forum i think my problem is sqf action = "createDialog 'DS_Padlock'; call PVE_fnc_initUnlock;"; i am not able to call the function with param in an action it seems.any hint on how i can get the param to the next file?
action = "createDialog 'DS_Padlock';`[_cursor] call PVE_fnc_initUnlock;";```wont work,the condition seems to be able to get _cursor but i cant send it to the next script
that are the moments where i see my abilities are limited as F
What is _cursor in condition?
@meager granite _cursor is defined as cursorobject by a pluginmanager.will have a look how it passes this to the config.
_text = getText(_action >> "text");
_condition = "[player,vehicle player,cursorObject] call {params['_player','_vehiclePlayer','_cursor'];" + getText(_action >> "condition") + "};";
_aCode = getText(_action >> "action");
tbh i got no clue where _cursor comes from but its used in the condition that works to make a cursorobject the object thats lockable when looking at it
condition = (_cursor in vehicles); is the condition which makes them all happen
What horrible thing are you using where that Code is used @sturdy cape
Just got Cuisine Royale ready for multiplayer
- 3 teams equidistant to a central helicopter landing
- helicopter lands every 90 seconds in center to drop off 15 food
- player can steal a special ingredient from an enemy player's fridge
- winning condition is 30 food + 1 stolen special ingredient
- retrieving food from helicopter gets you a husband
- husband can heal and rearm you by showing him basic affection
- the husband can be turned in to an armed Helicopter Husband and escort you for 60 seconds before leaving
- You can use 15 food to call in a jeep escort. Be ware! If the driver is killed, the jeep will explode.
Sounds exactly like milsim everyone wants to play
@iron osprey Im struggling to understand is that a The Sims or Arma 3 mod description?
At least he's creative?
😄
is there an engine command or function to close a canopy and raise gear?
https://i.imgur.com/XUEZnLP.jpg
https://i.imgur.com/ZfvQA2I.jpg
I am slowly making progress
Impressive.
@runic surge is it open source by chance? 😃
No but I plan on releasing it as a part of my own set of functions that I use eventually
it needs a lot of work right now though
is there an engine command or function to close a canopy and raise gear?
gear > https://community.bistudio.com/wiki/Arma_3_Actions#LandGear
canopy > 🤷
@tough abyss
maybe just animateDoor/animate for the canopy 🤔
did that in alpha > https://gyazo.com/a2d24552de3a1dafb67d23143df17a56 that was just animate...
@queen cargo i have written some Plugins for APMS.its the arms plugin management system the DesolationRedux mod uses
hello
@iron osprey #rules no crossposting.
yeah. You can definitely animate the canopy or maaaaaybe animateSource
When you shoot a weapon in game, does the fired bullets flying in the air are objects ? can they be moved or teleported while flying ?
If fired EH returns object for projectile, they are objects
basically with the FiredMan EH I could teleport the bullet some where else, right ?
but do I need to set the velocity afterward ?
Velocity won't change if you teleport the bullet
SetPos sets velocity to 0,0,0
Or is it SetDir I can’t remember
setDir will change the object heading, but dedmen said velocity dont change after teleporting something so thats all good
Atleast I don't know why it would.. Wouldn't really make sense I guess?
I'll give it a test
position, velocity and direction are 3 different entries. I wouldn't set velocity to 0 everytime I move the object
Do this bullet setPos (bullet getRelPos [2, 180] vectorAdd [0,0,1.6]); if you die then velocity stays
oh alright
This will work only with me, imagine if I want to that with a bot, which has a different azimut than me
Unit velocity is set to 0 when teleported.
But projectiles really shouldn't
I hope so, anyway I could save the past velocity and apply it ?
sure
bullet setPos (bot1 getRealPos [1, ((getDir bot1) - 180)] vectorAdd [0,0,1.6])
hm but what if the bot is aiming at 10 azimut
player addEventHandler ["Fired", {
private _projectile = param [6];
private _cock = "Cock_random_F" createVehicle [0, 0, 0];
_cock attachTo [_projectile, [0, 0, 0]];
_projectile setVelocity (eyeDirection player vectorMultiply 20);
}];
```into the console ^ @compact maple
lol will I see chicken fly
I dont get this : _projectile setVelocity (eyeDirection player vectorMultiply 20);
why ? 😃
what does it do exactly ?
sets the velocity ?
but as the cock is attached to the bullet
do we need to set the velocity?
uh
you're setting the velocity to the projectile
also I dont get this vectorMultiply 20, why would you change that position
because you want a velocity not a direction
direction would be 1 length
or 1m/s velocity
so if you multiply by 20. You get 20m/s velocity
aka slowdown it ^, also when you will fire, look around and fire
I think I got it, but need to try, thanks for the explanations
i have a stupid glitch that i cant explain. can someone help me with this?
_side = civilian;
if ((random 100) <= 50) then {_side = east;} else {_side = west;};
theside = _side;
thefaction = selectrandom (FEZ_OPS_usedfactions select {([_x] call FEZ_Ops_fnc_FactGetSide) == theside });
diag_log format ["FEZ INIT Setup filling with %1 - %2", theside,thefaction];
crap... how do i get the syntax highlight again?
anyhow... the code is part of a script that i launch from the init box in editor on an object
why are you setting your _side to civilian at the beginning ?
there are a few other stupidities in this
crap... how do i get the syntax highlight again? remove the newline before your sqf
if ((random 100) <= 50) then {_side = east;} else {_side = west;}; you want a 50-50 chance?
private _side = selectRandom [east, west]
Why are you putting it into a global variable when you could just use the local one?
i want to set the chance different. th eproblem is: why do i set the local variable global
theside = _side;
thefaction = selectrandom (FEZ_OPS_usedfactions select
this i usually wouldnt do, but for some reason the dieag log returns me always WEST when i stay on the local variable
when i do it as i do itthere, it works
but it doesnt make sense
it doesnt at all, you must have did something wrong
wat?
private _side = if ((random 100) <= 50) then {east} else {west};
private _faction= selectRandom (FEZ_OPS_usedfactions select {([_x] call FEZ_Ops_fnc_FactGetSide) == _side });
diag_log format ["FEZ INIT Setup filling with %1 - %2", _side ,_faction];
thats pretty much what i had before and it fucked around
_side would always return me WEST
bad luck maybe?
😃
i dont know... this is strangeness. have tried all evening yesterday. saw no reason why it would fuck around. will try again
this is what i had
_side = civilian;
if ((random 100) <= 50) then {_side = east;} else {_side = west;};
_faction = selectrandom (FEZ_OPS_usedfactions select {([_x] call FEZ_Ops_fnc_FactGetSide) == _side });
diag_log format ["FEZ INIT Setup filling with %1 - %2", _side,_faction];```
It is not getREALpos it is getRELpos, where REL stands for RELATIVE, so you don’t have to do additional calculations based on current direction of the unit
btw why do people use the 'private' before local variables?
ye mb its getRelPos
but if I want the bullet to go straight to the bot
I still want to do some calculations ?
I mean, i'm firing.
teleporting the bullet
adjusting his direction
let it go
No, just put it behind like I showed you
bullet setPos (bot1 getRelPos [2, 180] vectorAdd [0,0,1.6]);
fuck I got it
my brain's shaking
private makes sure the variable is created in your local scope. That you are not accidentally overwriting the variable in a higher scope
And it also increases performance as Arma doesn't need to search that far to find your variable
hmmm ok. guess ill have to do some cleaning work in my scripts at one point
@still forum & you said once that people should never use that
private ["_bla","_lol"];
but use
private _blah = something;
private _lol = somthing;
yes
no
the second is wrong
private is a modifier for the = operator
without = you try to call private ARRAY/STRING with a nil variable
happening again....
ye ofc
im using your code now
"FEZ INIT Setup filling with WEST - LOP_ISTS_OPF"
this is what it returns
so the _side there always is west in 250 cases
the faction changes
makes no sense
if i do it woth global vars it works
Well I can't see that in your code. unless random 100 is doing something really weird that I don't know about
well as i said, with global vars it does work. so the functions themselves are ok. i use them in similar ways elsewhere
do this before _faction =...
diag_log format [" %1 ", _side];
so we can see whats going on before
also maybe change that if then else to [] select bool 🤔
Would be a prime example as to why you should use private everywhere
lol
it receives factions and returns a side for it
the return variable in the function is _side
so that fucks me up?
hmmm
yea i see now that the variable changes after i call that function
holy crap thats going to be a lot of cleaning work
i mean thats the first time i get an error from this stuff. but ill probably go through all y stuff again
i can do that with an array in the beginning of the file with all the local vars in it, right?
you could
but that variant is not free
the private keyword is free though. It's resolved at compiletime
hm alright. so a private in front of every local var at the point where i create it ...
fine
thanks for the lesson
Also adds to readability because you can immediately see where a new variables comes into play
it works flawless now. thanks again!
that little fucker has cost me a few hours sleep yesterday
Is it possible to make the AI Co-pilot take controls?
maybe with action, I don't know for sure
Hey, I need an advice, how can I prevent a script called in the "init" field to run on all client ?
I told you that yesterday
I tried this at the begining of my init field :
if !(local this) exitWith {};
But it seems not to work on dedicated
Nothing, like if the !(local this) condition was false.
But once again, it works on my test server.
If this is local to dedicated then it should work
I try something else.
Shouldn't the ! be inside the parenthesis?
no
It doesn't matter. if doesn't need parenthesis
but if you put the ! inside you can sometimes get precedence problems. So you would have to (!(condition)) and as if doesn't need parenthesis you can just remove the outer parens
gotcha.
I had inquired about this yesterday but it was swept up by a multitude of people telling another person (apparently repeatedly) how to do a couple queries....so I'll ask again in kind. Could I get an ELI5 of how the getPlayerScores function works or tracks?
I read that. Butdidn't answer because I didn't know.
https://community.bistudio.com/wiki/getPlayerScores
What kinda answer do you expect? The engine just tracks when you make a kill. Like on the scoreboard
As I mentioned I"m wanting to track the info for a league and so far it looks like I'll just be pulling it from the log....so if I put...
grumbles at discord for not letting him type code
_playerUID = getPlayerUID _player;
_score = getPlayerScores _player;
if (isServer) then {diag_log format ["UID: %1 - %2, _playerUID,_score];};```
that should work right? except it would output the whole PlayerScores table?
I have that in an onPlayerKilled.sqf file
if I wanted to track for the entire game though, I would put that in what...onPlayerDisconnect?
onPlayerDisconnect should already be too late I think
You could just periodically print all players scores
well that will cause a problem then
So, if that runs on the clients what would I need to add to pass it to the server so the server can log it?
hmm... remoteExec ?
thanks, i'll look into that
so people say its better to spawn groups via creatunit/createvehicle? why is that?
i use bis spawngroups now. works fine for flying stuff, ground units, uavs and vehicles
if i do the other route id have to write me a function to do that tight. is it worth the effort?
i do realise it takes a good while for units to spawn with bis function. faster would be better in some ways
Anyone here with good knowledge of ACRE, I would ask dedmen, buuuuut, you know.
Thing is. I have a playable unit which does not support any kind of inventory (it is based on dog_base_f) and long story short I want dogs to use radios when they talk while not even having a radio anywhere.
That and also be able to receive radio calls
Are you sure that dogs don't support inventory?
pretty sure
any object you can control should.
Or if you have config access you could add inventory
Yeah. Dogs definitely have inventory
i don't sadly
Just remembered. Last time I used a dog I could put a gun into it's paw
but I think not really shoot.
dunno, mabye the controll is not there, pressing the inventory button does nothing
@warped thicket we need ur help here. U know the acre stuff. Add radio to a controllable object that doesn't have inventory. Without config.
Ah yeah. That's true.
But the addWeapon/addItem commands might work
hm i did that, but obviously after not being able to open the inventory i thought it had none
it is fine for the """radio""" to just send to one frequency, I already dabbled into how custom signal works and such.
acre does flag the radio slot with "acre_radio_flagged" or so
it just takes a look into the inventory if an acre radio item is in it
https://community.bistudio.com/wiki/linkItem try that with radio
Oh wait
Duh.. Would work for TFAR but not for ACRE. As the ACRE Radios are not in the radio slot
^
they need a inventory container like uniform/vest/backpack
yep
I mean.. you could try adding a uniform to a dog. But I can understand quite well that, that wouldn't work
I will also take a look after work at the cba events, i know there is one for pushing the radio button, but maybe there is one for ust simple speaking. Maybe I can hook into that.
What do you mean with simple speaking? Speaking is handled on the Teamspeak side I think. But there might be a even that tells you when you have started/stopped to speak
yes that is what i meant
ace is definitely using something like that, as the "bars" on top of their heads are moving when people talk.
it is kinda funny how i always default back to looking into ace code to fix my problems
https://github.com/acemod/ACE3/blob/master/addons/nametags/functions/fnc_initIsSpeaking.sqf#L43 there it is. ACE isn't using the event for that tho
oh man, does that mean I need an pfeh for this which always checks if you are speaking?
https://github.com/IDI-Systems/acre2/blob/c748d10ac11afe0aac9e71a28ef5df81795bf2f6/addons/api/fnc_isSpeaking.sqf#L20 Meh
https://github.com/IDI-Systems/acre2/blob/c748d10ac11afe0aac9e71a28ef5df81795bf2f6/addons/sys_core/fnc_remoteStartSpeaking.sqf getting warmer.
https://github.com/IDI-Systems/acre2/blob/c748d10ac11afe0aac9e71a28ef5df81795bf2f6/addons/sys_core/fnc_localStartSpeaking.sqf waaaarmer.
i it writes a function and it will be called in the draw3d function so far
["acre_startedSpeaking", [acre_player, _onRadio, _radioId]] call CBA_fnc_localEvent;
but what are you gonna use that for? Someone fake a radio when player starts speaking?
that is what i am trying to do. knowing how signal calucation works in acre is pretty much "send frequency, sender radio, receiver radio, power, pos" along the way. I can just hook into that and go
if frequency = 1337 && player iskindof dog
return [0,0]
the array is basically if you can hear them and what the distortion is
normally it asks the player unit first if they have a radio
buuut I can skip that for dogs
Ah reimplement acre internals to just remove the "hasRadio" check then?
ye
That's complicated 😄
i am already doing that how ever :v
I made some scripts in order to boost or jam acre signals, hence why I know the receiving end part already, just the sending part is unkonw to me
but yeah, having the is speaking eh is a nice start, just gotta find out how to force a radio transmission with it with fake radio ids
but i will do that after I drive home from work
@still forum I can't follow the chat here
if someone wants ACRE help, get on ACRE Slack
Any way to play sound in loop in vehicle first person view that wont be so quiet?
From cfgMusic or cfgSounds ?
@radiant egret cfgSounds , I can do whatever I just want to play a sound in loop which I can stop aswell
https://community.bistudio.com/wiki/setObjectTextureGlobal
I did not confirm that yet, but seems like this command does not work if is called by a player and not the server, I need to confirm that, but can some one give some insight about it?
@astral tendon did you try to set default material?
No, was trying to use it raw in a Apex monitor, it works on local playing as the hoster, but inside of a deticated server this command does nothing if is called by a player
In one of my older missions to get around that I remoteexec the setObjectTexture
is it possible to slow down bullet projectiles witohut editing configs? So far I tried setVelocityModelSpace and it only does something if you set it to straight [0,0,0]
i am completely fine that they lose all their velocity
@neon snow I'm working on a 3d sound car radio and faced the same problem, the only solution was to define the music twice. Theres also a bug with say3d if u using 3person in the vehicle.
@radiant egret but if you change the camera to 3rd view, the sound will be much louder right?
Yep
Wiki:For some unknown reason if at the moment of command execution the player is in first person view and is inside a vehicle, the sound created is greatly attenuated
Damn :/
Without redefining u won't hear it, I used volume 30 for the music
But ppl outside will start crying turn it off x)
yeah exactly ;d
playSound3D works kinda nice, but I havent found a way to actually stop the loop and audio instantly
Create a dummy object and delete it to stop the music
Yeah tried it, it doesnt work with that command
Even teleporting sound source doesnt help
I used say3d
Yeah I use that too, I was just testing now every command and it seem that none is good enough
Oh , another thing to note then
@astral tendon setObjectTextureGlobal works if executed by a player, yes
Some weirdness with local (e.g mission) texture filepathing, however
Im using a mod filepathing
Hi, i just though about creating an scripted controls setting interface and got these questions:
Is there way to change control buttons assignments by in game script?,If no then how .Arma3Profile assignment codes are generated?(ex.: keyAdjustUp[]={957546513}; ;)
;, would appreciate any help with finding the answers.
how .Arma3Profile assignment codes are generated engine does that
can't do that via script
Is there way to change control buttons assignments by in game script not really. There is always some hacky weird way to do things. But for this I don't think so. You cannot emulate real button presses with sqf
My head hurts, how could I run function once in Draw3d eventhandler? And if condition changes run it again?
Just remove your eventhandler at the end of the Draw3D script
your Draw3D handler get's the eventhandler ID as arugment
@still forum You cannot emulate real button presses with sqf its more about just changing the game controls by script
yeah.
That's what I'm talking about
The key config dialog is engine side. And the engine tells you "press a button now"
But you can't press a button now with SQF
even if you could press all the other buttons in the control. You cannot choose a button
Yeah thats something what I wanted earlier too, to for example emulate activate radar button but no luck there and there is no script for that either(but you can detect it with inputAction)
you can detect it with inputAction as long as the key doesn't use too many modifiers
modifiers use by setting bits in the internal 32bit int.. But.. You can only use floats in sqf
Some keys are just impossible to detect because float cannot store the value
Exactly that
@still forum Got it, thanks
@still forum Oh, and about how .Arma3Profile assignment codes are generated engine does that [11:11 PM] Dedmen: can't do that via script, i meant does anyone know the algorithm for i could write external app which'll modify the .Arma3Profile file directly, without the game running?
DIK key codes
plus modifiers
it's just binary AND
There is a header file in the Arma pbo's with all the dik codes
Where can I see the selection order for artillery ammunition?
Like select 0 = 32Rnd_155mm_Mo_shells, select 1 = 32Rnd_155mm_Mo_smoke, etc.
i am going nuts abou this plugin.is there no possibility to send params from a condition inside of a config to a function?
I think I discorver why
Hello Guys I have a question regarding getUnitLoadout.
Basically if i store a backpack inside of a backpack it adds it to the items array with the syntax: ["B_AssaultPack_khk", true]
My question is, does anyone know what the true is for/stands for?
Thanks
@ruby breach @neon snow
I found my problem, the object I was trying to set the texture was set as a simple object in the editor and it was not returning the editor variable I placed before, though in SP that works and the variable returns with CursorObject It did not return the variable instead returns a NOID and the model name, does that wort a note in
https://community.bistudio.com/wiki/Variables
or
https://community.bistudio.com/wiki/Arma_3_Simple_Objects
?
Ladies, Gentlemen, and every beautiful individual in between:
After many hours, I have finally perfected the script to make a helicopter land, perform an action, and then leave. Even. Under. Fire.
// _helipad is the variable name of a helipad I have placed in the map
// "heli_drop" is the variable name of a marker where I want the
// helicopter to land
_position = _helipad getPos [600, random 360];
_veh = createVehicle [
"C_Heli_Light_01_civil_F",
_position, [], random 360, "FLY"
];
createVehicleCrew _veh;
_group = group ((crew _veh) select 0);
_group setBehaviour "CARELESS";
_veh move (getMarkerPos "heli_drop");
sleep 3;
while { ( (alive _veh) && !(unitReady _veh) ) } do {
sleep 1;
};
if (alive _veh) then {
_veh land "LAND";
};
while {
_alive = alive _veh;
_vector = velocity _veh;
_alive &&
abs (_vector select 0) > 0.01 &&
abs (_vector select 1) > 0.01 &&
abs (_vector select 2) > 0.01
} do {
sleep 1;
};
// Helicopter has now landed. Do what you please
hey guys, how would I go about selecting selectRandom in allUnits, but I dont want the player ?
hmm
I mean I cant do _aRandomUnit = allUnits - player;
_arr = [1,2,3];
_arr deleteAt (_arr find 0)
maybe this?
_units = allUnits;
_units deleteAt (_units find player);
_unit = selectRandom _units;
worked for me in my debug console
It work, ty
hooray
does anyone know how to have a player's initial spawn be instant and not abide by the respawn timer?
Idk
I've been working a bit with the thing we talk this morning.
player allowDamage false;
player addEventHandler ["Fired", {
_units = allUnits;
_units deleteAt (_units find player);
private _unit = selectRandom _units;
private _projectile = param [6];
private _vel = velocity _projectile;
_projectile setPos (_unit getRelPos [0.01, ((getDir _unit) - 180)] vectorAdd [0,0,1.6]);
_projectile setVelocity _vel;
}];
Actually it works only if I fire on the same direction that the bots are looking, @tough abyss @still forum, Im a bit stuck
check comment there, rK > https://community.bistudio.com/wiki/getRelPos
thankyou
if (_jetUnit inArea jetTrigger) then {
_jetUnit enableSimulation false;
systemChat "JUST";
};```
i am having an autism fit and i can't figure out why this doesn't eval.
if i replace _jetUnit with a global variable it works?
_jetUnit undefined variable ? 😃
it's defined
how ?
sec
[] spawn { _unitCaptureData = [UNITCAPTUREDATA];
_jetUnit = "B_Plane_Fighter_01_Stealth_F" createVehicleLocal [0,0,500];
_jetUnit setPosASL [0,0,500];
_jetUnit engineOn true;
[_jetUnit, _unitCaptureData] spawn BIS_fnc_unitPlay;
_jetUnit action ["LandGearUp", _jetUnit];
_memeTimer = time + 1;
waitUntil {time > _memeTimer};
_cameraOne = "camera" camCreate (getPos front);
_cameraOne cameraEffect ["internal", "BACK"];
_cameraOne camCommand "inertia off";
_cameraOne camPrepareTarget _jetUnit;
_cameraOne camPrepareFOV 0.85;
_cameraOne camCommitPrepared 5;
_cameraOne camPrepareFOV 0.75;
_cameraOne camCommitPrepared 5;
_cameraOne camPrepareTarget _jetUnit;
_cameraOne camPrepareFOV 1;
_cameraOne camCommitPrepared 15;
if (_jetUnit inArea jetTrigger) then {
_jetUnit enableSimulation false;
systemChat "JUST";
};
};```
Is there a way to set an AI's team from the server using assignTeam?
AssignTeam is global
It ain't working for me, from the server I am doing assignTeam and nothing is happening as a result
@still forum https://community.bistudio.com/wiki/assignTeam what do you mean race condition?
There is no parallel execution in Arma, even network shit is all sequential. Bad things happen when you put global commands in init, but that "solution” example makes no sense. Should be if (local this) then {.... and note made that this is A3 example as for A2 putting it in init as is is valid
OH
@fringe yoke how you do it from server
wait
no nevermind
i wouldn't need to pass the variable
hnghnhhh
@tough abyss Race conditions can also happen in non parallel languages
In this case, the units Team might not be Set yet when the command gets executed
Meaning your change gets overriden by the "default"
private _bulletSpeed = getNumber (configfile >> "CfgWeapons" >> _weapon >> "initSpeed");
private _vectorFromTo = eyePos _unit vectorFromTo eyePos _target;
_projectile setVelocity (_vectorFromTo vectorMultiply _bulletSpeed);
```headshot ^ @compact maple
is there a command to check what pbo's are loaded on a client? (in-game)
@queen cargo Re reading the conditions, it is a bit more clear that delay is needed so that player is fully initialised, but this doesn’t change the fact that sticking it in init is bad idea, I would go as far as saying do not put it in init period, or even use in postInit only.
@drowsy axle activatedAddons maybe?
Would that be the pbo name?
Print it out and see
ok