#arma3_scripting
1 messages ยท Page 528 of 1
I dont put the _handle in the _args of CBA_fnc_addPerFrameHandler; do I?
where it says args here: https://cbateam.github.io/CBA_A3/docs/files/common/fnc_addPerFrameHandler-sqf.html
is possible to move cursor down in mutiline rscEdit with script?
when i start new line - cursor is not moving to new text line
can you move cursor at all?
yes, when press enter - move cursor at the new line
so press enter
like text editors ๐
in short no you cant move it by script, in long yes you can move it by script if you use extension and send enter keystroke to arma
ah, understand
is it ctrlAddEventHandler or drawIcon that isn't JIP ?
For some reason it's working for clients on mission start but not for JIP clients
then how come drawIcon3D is ?
sorry I most be explaining the wrong way round
There is no synced state or anything
What I mean is
My JIP clients can see displayed things created via drawIcon3D but not with drawIcon
Is it normal ? Is there a way for them to see the drawIcon effect ?
Looking for advice on best approach to moving a static object with easing. Want to change the Z coordinate on an object to make it look like it's landing. (Imagine a giant arrow falling form the sky and pointing at the ground) Is the easiest way to just use a loop and decrease the Z position by like .001 a thousand times or something?
Or is there some object animation function I should be looking at
@quartz coyote is your script that contains the drawIcon even being executed?
client that join at mission start are working fine
@craggy adder yes a loop is what you would do. There is probably already a BIS function that does that for you, don't know of a name though
only JIP clients not getting it
Turns out the engine has support for keyframing, but I think that'll be overkill for me: https://community.bistudio.com/wiki/Arma_3_Key_Frame_Animation
Doesn't answer my question @quartz coyote
Other things happening in the same script like drawIcon3D are correctly displaying for JIP clients. so yes
do the lines before/after the drawIcon3D execute?
did you try actually adding logging?
is the position/object that you give to it correct? does it exist? did you add logging to check that?
just log everything if you don't know what specifically to log
A whole bunch of diag_log
you look at a line of code, gather all variables that are used in there.
then add a
diag_log [variable1, variable2, variable3] just above that line. with all the variables
And do that on every line that you want to make sure that it executes correctly
@craggy adder how about BIS_fnc_UnitCapture
@digital hollow That seems to capture the movement an object makes. I'm looking to actually move the object in an automatic way.
I'll play with just looping a Z-axis decrement. I'm afraid of it not being smooth due to frame rate/loop speed difference but we'll see how it goes.
Yes, then you play it back with BIS_fnc_UnitPlay
I'm afraid of it not being smooth due to frame rate/loop speed difference but we'll see how it goes. Well you can only update once per frame
If that is still laggy for people then everything else is laggy too so whatever
Right so 30-60 fps will limit the amount of vertical space I can animate through smoothly
We'll see how it goes tonight
you can use diag_fps and adjust your stepping based on fps
or diag_tickTime to get deltaT
I'll keep that in mind, thanks
I've been trying to get a .ogg file to loop on an object (a little melody that loops on a radio), but I'm confused on how to use CfgSFX or if I should use something else like say3D or playSound3D and make a script that loops it (which I also don't know how to do). Any ideas?
I have some looping sounds in a mission file. I'll paste the code in here when I get home if no one has answered.
but yeah I think I just used a loop and set a 'wait' for the duration of the sound
the wait thing is really ineffective
that's the route I'm going down now, I'm trying to use sleep 40; but for some reason it isn't working
but I dont know of a better way. Supposedly Jukebox allows you to do this stuff by determining when it ends but... I haven't gotten that to work
says that jukebox is A2OA only
Ah, that might be why
@stuck lodge Here is the code from my old mission. It was just a simple SP mission though.
// Turn on generator sounds
_root = parsingNamespace getVariable "MISSION_ROOT";
while {gen1_on} do {
playSound3D [_root + "sounds\generator_running_short.ogg", cut_power_gen1];
sleep 4;
};
while {gen2_on} do {
playSound3D [_root + "sounds\generator_running_short.ogg", cut_power_gen2];
sleep 4;
};
The track was trimmed to 4s so it matched up with the loop
Yeah I just got it working on my end, I hadn't realized that trying to test the script in the debug console wasn't very smart but eh.
Don't feel bad I still forget the then on my if statements about 30% of the time
....and I'm a developer by trade
Well so far I've got it to work, but I want two objects to be playing sound at the same time, is it possible to combine these together?
`_soundPath = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString;
_AmbientRadio = _soundPath + "Radio.ogg";
_LongRange = _soundPath + "Static.ogg";
while {true} do
{
playSound3D [_AmbientRadio, FM_Radio, false, getPosASL FM_Radio, 15, 1, 5];
sleep 148;
};
while (true) do
{
playSound3D [_LongRange, Longrange_FOB, false, getPosASL Longrange_FOB, 10, 1, 5];
sleep 34;
};`
Because currently like this it only plays the first one "FM_Radio"
Anyone have a quick syntax example of using remoteExec to addAction?
@stuck lodge Put them each in their own sqf file and use execVM to play them?
[unit,[the action params]] remoteexec ["addaction",unit] probably
Got it figured out actually
[
_object_to_attach_action_to,
[
"Collect Powerup",
{[_this select 0, _this select 1] execVM "scripts\powerup_collect.sqf"},
[],
1,
true,
true,
"",
"true",
3
]
] remoteExec ["addAction", 0, false];
Hey guys, how can I use the eden debug console to set the camera position on a xyz position? What's the object reference for the editor?
hmm.. what's this new forcedInitialOrientationDir that I'm hearing about
never heard about that till now
Can you queue up spawns in a loop? For instance _localthing = createvehicle "thisthing" [here, here, and here]; spawned say 20 times in one line?
hopefully in an array?
Is it possible to remove the "Light fire" option on campfires and burning barrels
@fluid wolf you can use a forEach
I need to run it off a single activation though, a foreach would only run it once per activation.
hmm... explain..... more?.. particularly if it has to do with tank cannons
@whole badge 3D particles spawn with random dir, with this param in particle array you can remove this randomness
Anyone messed around with ctrlAddEventHandler ["Draw" and drawIcon in MP before ?
@quartz coyote I did ((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["Draw", ... to the map control... why would MP worry you? This stuff is local
@astral dawn my JIP clients don't get the effect... It's perfectly working for players joined form mission start.
hmm... how do your JIP clients run the ctrlAddEventHandler? They probably can't run it in the JIP queue because at this moment the controls don't exist yet?
a function in initPlayerLocal
I do the initialization like this:
0 spawn {
waitUntil {! isNull (findDisplay 12)}; // Wait until we have the map!
// Add a Draw event handler to draw markers
// It will call onDraw of every MapMarker object
((findDisplay 12) displayCtrl 51) ctrlAddEventHandler ["Draw", {call MapMarker_EH_Draw}];
And MapMarker_EH_Draw iterates through all objects it has to draw
maybe waitUntil needs even another check like 'if !isNull (finddisplay ... displayctrl ...)' to make sure the control is already here?
try this: ```sqf
waitUntil {sleep 0.5; !isNull (findDisplay 12)};
i have a question ๐
how RscStructuredText size depends from HUD size settings?
^^ that on big hud
but on small hud - is have a normal size
The bigger the settings, the bigger the text IIRC
Did you use safezoneW and safezoneH for the size of the control items?
If you did so, then the items' size is the same % of the screen size, but the text size varies according to UI scale
@astral dawn @dusky pier waitUntil {sleep 0.5; !isNull (findDisplay 12)}; did not change anything
so here is how I did mine :
initPlayerLocal is already scheduled
@high marsh what do you mean ?
you would use the waituntil before adding the event
itl do no good in the event because it wont fire if the ctrl is null
also the event is unscheduled so waituntil shouldnt work anyway
what do you suggest ?
move that waituntil to before the event is added
@astral dawn ty, but is possible to get hud size from profile? I think is saving to profile, but can't find that
i use safeZone coordinates
@robust hollow @dusky pier now working ! thanks !
๐
@quartz coyote I don't know what you were adding the event to, I was adding it to map display (IDD 12) and map control (IDC 51), you must use IDD and IDC of your display and control for reliability
as i understand size text = size* sizeEx
Wow Flash-Ranger.. So it was what I thought at first, the code isn't even executed and it's not drawIcon's fault. Adding logging would've showed you that ๐คฆ
@dusky pier You can get user UI from getResolution
@tough abyss ty, i used that ```cs
#define TR_H_coord(Hs) h = Hs; sizeEx = Hs * 0.8
is works
80% of H
guys. Made a script call for the button.
while {true} do {
if ((inputAction "User15") > 0) then {
[] call life_fnc_start;
};
};
sleep 0.1;
};
life_fnc_start:
In file added such.
if !(isNull (findDisplay 4500)) exitWith {closeDialog 0;};
Ok!. What now?
When you click the my button, the dialog menu opens. If I press again, it does not close.
disableSerialization;
if (isNull (findDisplay 4500)) then {
createDialog "list_building";
};
private _display = ((findDisplay 4500) displayCtrl 4502);
{
_display lbAdd (getText(_x >> "displayName"));
_display lbSetData[_forEachIndex,getText (_x >> "classModel")];
} forEach ("true" configClasses (missionConfigFile >> "CfgItemBuild"));```
@still forum What did I do wrong?
Has anyone made a vectordiff calculate function for determining if an AI is properly aimed at a target? For use with the various force fire commands
I can calculate vector deviation just fine, but it does not account for elevation/trajectory of rounds. Very noticeable on AGS/MK19
You can get vectorCos
Yes I am using vectorCos along with vectorDiff to check deviation, but I want to adjust the vector for the appropriate weapondirection aim for distance
_deviationlimit + (_modifier * _distance)
Obviously the modifier for the trajectory is going to be vastly different for different weapon systems, any way to get this data or to piggy back off the vanilla AI aiming to see if it is correctly accounted for distance?
How to make the searchlight or AI that mount it. to rotate randomly "search mode" like scan horizon. I can't seem to find any commands for it.
I have tried this:
null=[this] spawn { while {alive (_this select 0)} do {sleep random (2)+3;(_this select 0) setformdir random 360};};
But this did not work.
any1 know command for this?
lookAt command could work
maybe doTarget with different surrounding positions
ninja'd!
@slim oyster if I understand correctly you need to ignore vertical misalignment between gun's vector and vector to enemy? You can ignore the Z components of vectors then
Just to clarify, do you do it like this? Take vector where gun's pointed at, and take vector to the enemy, run vectorCos to get cosine of angle between them, then you can do acos of this angle to get the angle?
Yes
Of course there are a ton of ways to calculate the deviation/errors of those vectors, but what I would like is a way to account for specific ammunition/weapon trajectory so I can tell if the weapondirection deviation is actually going to land a hit or not
I know the AI does this with their AIMINGERROR behavior, don't know how to piggy back off that system to adjust muzzle vector
agh I hate the missing ; error
I can never find it
is there a utility that helps that besides notepad ++?
Yea I know
problem is I still cant find why that error is there
VScode is the program?
ah yes, got it
thanks
There is also SQF-VM which can compile your code just like arma compiles your code
Oh, sweet
_affected = nearestobjects [(this), ['Soldier'], 5];
0 elements provided, 3 expected
That's... how that works though right?????
Are you sure that this is defined?
Yes its in a trigger
so it should be an object
...actually no sorry thats the object the trigger is ON.
try position this
just diag_log this?
or just do ade_dumpcallstack but wait you are not subscribed to arma debug engine do you?
position thisTrigger
gave this a local variable and still the same error
Will dump all local variables on script errors
https://steamcommunity.com/sharedfiles/filedetails/?id=1585582292
So you have that code in the onActivation field of the trigger?
Position thisTrigger works, but position object does not... ok.
If that's the case then this does not refer to the trigger, instead use thisTrigger like @still forum suggested.
they're in the same spot so I guess that doesn't really matter but its still weird
I stand corrected. it stopped erroring but it doesn't return anything
Hello !
Would this work ?
diag_log waitUntil {(west countSide allPlayers) > 0 || (east countSide allPlayers) > 0};```
is that how you use diag_log ?
no that's not how you use diag_log
waitUntil returns "nothing" once it's done. so... you are logging exactly nothing
okay so how would I log this particular line ? because my mission randomly blocks at that point sometimes
maybe this ?
waitUntil {diag_log (west countSide allPlayers) > 0 || diag_log (east countSide allPlayers) > 0};```
no diag_log returns nil, so now you are breaking the waitUntil
You want to see when it blocks? or why?
waitUntil {
diag_log [west countSide allPlayers, east countSide allPlayers];
(west countSide allPlayers) > 0 || (east countSide allPlayers) > 0
};
this will log both values on each iteration of the waitUntil
What the best way to break out of the while loop? Does exitWith work? The wiki has examples for onEachFrame and waitUntil but not for while
@cosmic lichen yes it works
@still forum okay so I logged the line as you showed me.
it appease that when my scenario gets blocked altho i'm slotted and I passed briefing, the waitUntil loop still get [0,0].
Why would the game not see me slotted in blufor or opfor ?
In order for it to work, I simple reassign the mission, reslot, launch and that time, it works
There was no issue before I added this line. it has to be that very one line
So i just want to check: isNil returns true if the variable has been defined and isNull returns true if an object is defined
because if it does then it means I'm a bit silly
no and no
isNil checks if a variable is nil
isNull checks if something is null, object, control, config and so on, many different things that can be null
anyone worked with "vurtual's Car Seat & Stretcher " mod before? I want to spawn a seat locally via script and then hide it. Issue is, I cannot use hideObject as it would also hide the unit sitting in it. hideselection only works with simple object and the seat model has no hidden selections. Yet, the seat can be made invisible via eden
what better enableDynamicSimulation or enableSimulation false;?
these are totally different things
enableSimulation just manipulates simulation of an object
i use that for buildings
dynamic simulation is an arma 3 thing that dynamicly disables simulation of objects away from players
https://community.bistudio.com/wiki/Arma_3_Dynamic_Simulation
"i use that for buildings" buildings aren't really simulated at all
disabling simulation on buildings doesn't really make sense
as tested - enableSimulation false - brings add 5 - 10 fps
wat
all buildings use enableSimulation true;
what kind of "building" do you have there?
how many did you disable?
all
vanilla? or modded buildings?
vanilla
anyway, I think if you disable building simulation, you might not be able to break its windows, which your players can notice...
when i use simulationEnabled cursorObject when near building - getting true
but it means that it's still being simulated
If I want to access a variable from a group's namespace from a different machine, does this variable need to be public _group setVariable ["Var",true,true]; or can the group's namespace be accessed from everywhere?
most likely general rules of setVariable apply
so it sets the variable locally
must set it to public to let other machines access it
or use some sort of remoteExec to set this variable only on needed machines
no variables anywhere are accessable from everywhere
"or use some sort of remoteExec to set this variable only on needed machines" setVariable also takes a target parameter
what ๐ฎ
oh really, since what version? ๐
ever
damn how did I miss that ๐
if (!is3DEN && !(_value == '')) then
{
[_this,_value] spawn
{
params ['_group','_value'];
private _leader = leader _group;
private _marker = createMarker
[
format ['Enh_GroupMarker_%1',str floor random 10e5],
_leader
];
_marker setMarkerType _value;
_marker setMarkerText groupId _group;
_marker setMarkerColor ([side _group,true] call BIS_fnc_sideColor);
_group setVariable ['Enh_GroupMarker_Pause,false,true];
while {true} do
{
if (count units _group == 0) exitWith {deleteMarker _marker};
if !(_group getVariable ['Enh_GroupMarker_Pause',false]) then
{
_marker setMarkerPos position leader _group;
_marker setMarkerText format ['%1 (%2)',groupId _group, count units _group];
};
sleep 1;
};
};
};
Any suggestions regarding performance or so? It's en Eden Editor attribute
count units _group == 0 group might delete itself and become grpNull. No idea what units does with that
!(_value == '') != ?
the unit count goes 0 first, then the unit gets deleted and becomes null, if that's what you mean
_value is the value selected in the attribute window. I see what you mean now. sorry
it's scheduled
there is no "first" and "then"
your while loop may suspend for an hour and continue long after the group is gone
I see. What do you suggest?
checking for isNull
but only need it units does something weird on grpnull
also count == 0 is slower than isEqualTo []
but in scheduled that diff is so low that it doesn't matter
The problem with the check of isNull is, that the group exists long after the group is empty which causes the marker to get set to position [0,0,0].
So I would need to check if the group is null first, then check if it's empty.
I have some SQFs I want to execute, I put them in a initPlayerServer.sqf like this,
[] execVM "scripts\DEVDAN_Static.sqf"; [] execVM "scripts\DEVDAN_Ambient_Radio.sqf"; [] execVM "scripts\DEVDAN_Lighting.sqf";
But they don't execute on my dedicated server, I don't know what I'd need to do in order to have them execute.
What's in the files? You can't use local functions
units grpNull //[] So nothing weird.
Seriously... Where do they still advocate execvm?
@stuck lodge what the scripts do?
Can we please burn that place down and burry it?
it's just a playSound3D loop
@dusky pier if everything works then you didnโt disable simulation
@stuck lodge maybe your server doesn't know what the soundSource is?
So you have player joining dedicated server and you want to execute playSound3d on the server when it happens? @stuck lodge
I've tested it on locally hosted server, I'm trying it to run the script on mission start up
What's the source of the sound though?
It's an ogg, that is in the mission directory.
1 playSound3d is not JIP compatible so you need players already be loaded to hear it. 2 initPlayerServer only executed upon player joining server
the second parameter is the object variable name,
And it may be prohibited by cfgremoteexec rules
There is no command in arma to make sound pick up for JIP players, even with playMusic where you can start it from offset you canโt because you canโt play it on the server in order to give JIP current play time
The whole thing is a disaster
"wHo STiLl uSeS X anYmOre"
Doesnt provide working solution.
nice. ๐
Well would the script execute on JIP clients , because it's just a looping sound that doesn't really need to be synced around the board for players?
Then use local playSound or say3d
alrighty,
If it is looping you might want to createsoundsource
I was looking into that, but it said that the audio file needed to be an addon or something, I stopped heading that direction though
When did you look into it? You can use mission sounds as well as addon sounds now
just this week, I was just looking at the wiki
Well it says it there in black and white
It was under CfgSFX, again I didn't look into it very much mostly skimming, and I was seeing more people use playSound3D, ยฏ_(ใ)_/ยฏ
in which situation would I use uiSleep instead of sleep ?
if you set accTime to zero for example, but you want the game to wait 1 real-life second to go back to accTime 1
or simply if you don't want to have to do sleep accTime * _wait
every scheduling script would be F-ed beyond repair at that point
everything would just be frozen basically
So I'd consider that game breaking
Not fucked beynd repair but unprecise as fuck
no
At one hour delay you are basically dead
assuming minimum 1fps that means 3600 scheduled scripts that each take full 3ms.
CTRL+ALT+DEL and kill arma
Dedmen is right, you can completely clog the scheduler to the point that it never recovers so the game runs, unscheduled scripts on events run, but all scheduled scripts are stuck. Because sorting of the queued scripts takes so long it has no time left to run scheduled scripts.
I'm having a little issue with nearObjects vs nearestObjects vs nearEntities. I'm trying to find MAAWs rounds that are in the air but for some reason only nearestObjects is able to detect those:
https://steamuserimages-a.akamaihd.net/ugc/796485291368458912/3D6ACE64235B8B07413C69528465CE2013A05A04/
Anybody know why?
What have you passed for 2d/3d param in neatestObjects, not visible on screenshot @wispy cave
true is the argument after 1000
For now I've found a way around it with this monstrosity but I'm really thinking of rewriting it to eventhandlers
https://i.imgur.com/XVP6CBU.png
it does yes ๐
Would have been nice if they added an easier way to detect missiles together with the new missile commands.
yea, i want to make it compatible with players so incomingmissile event isn't something I can use
Problem with incomingmissile is, that it does not return the actual missile which is a bummer.
Yes, I had exactly the same idea. There was a scripted mod a while ago with an active anti missile system. Quite neat, but too much scripted workarounds to get the missiles for my taste.
or add the projectile with a fired EH to the vehicle local variables and retrieve it from there with incomingmissile EH...? "lastprojectile" memory so to speak
Would anyone know of a well made tutorial on how to create an ingame ctrl (ctrlSetStructuredText, ctrlSetPosition, ctrlCommit, etc ...)
to me right now it's SIFI. and honestly i'm really bad at understanding the biki
I'd simply like to create three text displayed above the heads of 3 winning players in a camera scene
trying it now, doesnt seem to work
maybe missile is already beyond 50m
@quartz coyote you can take this as example, it's some control panel I made long time ago with scripts
https://github.com/A3Antistasi/A3-Antistasi-Membership/blob/master/AntistasiServerMembers/fn_createRestartDialog.sqf
typically you apply your settings (position, text, color, whatever) and in the end do ctrlCommit 0;
ctrlCommit can gradually commit changes so I think you can move it? but I might be wrong
just do ctrlCommit 0 for instant change
Thanks, although it doesn't help me understand how to create it myself
oh wait no it's all good. I can figur it out myself
so... you add controls to display, allright? like game display or map display or your custom display
you do ctrlCreate, it returns a control handle
then you do ctrlSet*** to set properties and do ctrlCommit to apply the changes ๐ค that's all really
yes, thanks man
uiNameSpace setVariable ["displayRestartPanel", _display];
can displayRestartPanel be what ever varname I want ?
yeah, I store it in profile namespace to retrieve in event handler
https://github.com/A3Antistasi/A3-Antistasi-Membership/blob/13b846318d1bfcaee3da28040727cc96db2e7fc8/AntistasiServerMembers/fn_createRestartDialog.sqf#L56
Is it just me or is the engine based tv search functionality quite slow?
https://community.bistudio.com/wiki/ctrlCreate Exampel 4 is what I mean.
but you must really understand how safezone coordinates and viewport coordinates work, otherwise you will get issues with people using different UI size and text clipping, or your controls not being where they should be (outside of screen)
Use the GUI Editor and set everything to safezone. That works in 99% of all cases.
hmm wait, he said he wants to put the controls above people's heads ingame
In camera scene
yes... well https://community.bistudio.com/wiki/posWorldToScreen might be useful, if static position won't fit ๐คท
how does one emulate a click on a class List: RscTree ?
want to make it possible to switch between units and locations in the observer mode by hitting tab
i can trigger the update, but the leaves the tab state untouched
So a bit like Eden Editor does that?
@velvet merlin try tvExpand/tvCollapse
Don't think that works. He wants to switch the tab to a whole new tvTree control if I understood him correctly.
the tree view does not exist in other tabs, it is redrawn depending on which tab is selected, so not sure I understand what you mean either
unless there are multiple trees each on separate control that is hidden then revealed, but don't think this is how it works
Maybe @velvet merlin wants to simply select treeview item then https://community.bistudio.com/wiki/tvSetCurSel
Right so now I'm using this:
_x addEventHandler ["FiredMan", {
params ["", "", "", "", "", "", "_projectile"];
{
systemChat "fired";
if (_projectile isKindOf _x) exitWith {
targetArray = targetArray + [_projectile];
systemChat "Added";
};
} forEach ["RocketCore", "MissileCore", "BombCore", "ShellCore"];
}];```
To get all the projectiles. However this eventhanlder doesn't fire every time my VLS fires. Anybody have a clue why?
(I'm firing my VLS with:
while {VLS ammo "weapon_vls_01" > 10} do {
sleep 2;
systemChat "Cruise missile inc";
east ReportRemoteTarget [player, 3600];
player confirmSensorTarget [west, true];
VLS fireAtTarget [player, "weapon_vls_01"];
};```)
anyone knows how do I set a camera feed into a screen in game? I've been googling for half an hour and found nothing useful
I want to feed a static camera position, not a unit or anything like that
setObjectTexture onto the screen
@tough abyss @cosmic lichen sorry just back now - you guys are familiar with the native A3 observer mode?
based on clicking on "entities" or "locations", it updates the listbox below
@still forum
this setObjectTexture [0, "["Paste",["Altis",[14765.7,16840,3.66647],355.165,0.75,[-37.4651,0],0,0,367,0.398854,0,1,0,1]] call bis_fnc_camera;"];
like this?
that said i mixed them up:
class Tabs: RscToolbox is the selection above
class List: RscTree is the list below
no not like that
_objectname setObjectTexture [1, "\pboname\texture2.paa"];
Hi, how can i disable tfr range limit?
can anyone help?
@dim kernel have fun with your ban ๐
?
lol
what did i do?
#(argb,512,512,1)r2t(surface,aspect)
this line basiclly converts the camera feed into a picture?
yikes
Hello. Could someone tell me this is an effective way to go about optimising asyetuntitled framework for life? ```sqf
// shopFunctions.sqf
params ["_object","_type","_vehspawn"];
EC_fnc_objectFunctions = {
params ["_object"];
_object enableSimulation false;
_object allowDamage false;
];
switch (_type) do {
case "atm" :
{
[_object] call EC_fnc_objectFunctions;
_object addAction[localize"STR_NOTF_ATM",life_fnc_atmMenu,"",0,false,false,"",' isNull objectParent player && player distance _target < 4 '];
};
case "truck_s" :
{
[_object] call EC_fnc_objectFunctions;
_object addAction[localize"STR_MAR_Truck_Shop",life_fnc_vehicleShopMenu,
[
"civ_truck",
civilian,
[
_vehspawn
],
"civ",
localize"STR_MAR_Truck_Shop"
],
1.5,true,true,"","true",5];
};
};``` the original code was inside the init. field of the unit.
optimising asyetuntitled framework for life
Delete it. And rewrite from scratch
haha thanks
I don't see anything worth optimizing in that script
this setObjectTextureglobal [0, ["#(argb,256,256,1)r2t(1,1.0)"]];
@still forum
how do I insert the camera position into that line?
Would having it in the init. field make the mission size more?
@velvet merlin I guess you have to reload RscTree when the selection of RscToolbox changes.
surface - The name that will later be used as reference in the camera script
I need to make a reference to certain camera?
@drowsy axle yes. It would make the mission bigger if you put scripts into the mission.
Do scripts count (less) towards the number of MB on receiving mission file?
@cosmic lichen this is all handled by BI functions already
the question was how to activate the tab (like hit a button)
ToolBoxSelChanged is the displayEH
the camCreate line :
_cam = "camera" camCreate (ASLToAGL eyePos player);
I put on init.sqf or inside an object init line?
lbSetCurSel changes the focus
Do scripts count (less) towards the number of MB on receiving mission file? no
But if you look at the size of a average script file.. it's not that big
Okay. Thanks for your insight.
Appreciated, as always.
Would it be worth flat filing this down more? https://pastebin.com/jj0bNWbY
I'd probably use an array with find,
But I assume that script runs only a few times at mission start, so it doesn't matter
Yeah
array as in all the pieces broken up?sqf shopsArray = [ ["actionName","Function",["_vehspawn",side,"side condition","menuName"]], ["actionName","Function",["_vehspawn",side,"side condition","menuName"]] ];
side is unary command it gets evaluated when you put it in array
without argument it is an error
Actual code: this addAction[localize"STR_MAR_Boat_Shop",life_fnc_vehicleShopMenu,["civ_ship",civilian,"civ_ship_2","civ","Billy's Boat Rentals & Ownership"],1.5,true,true,"","true",5];
I took out the second spawn "civ_ship_2"
no putting the code pieces in an array and then using select <index> to find the matching one
essentially replace the switch
so why are you asking about broken code then?
but as I said, not worth it
ahh okay
I'll stick with the switch
Once it's done, it's done. I shouldn't need to touch it.
So if a make a camera using those lines:
_cam01 = "camera" camCreate (0,0,0);
_cam01 setPos [];
inside the setPos, what part of the next line should I put inside the brackets? ?
["Paste",["Altis",[14765.7,16840,3.66647],355.165,0.75,[-39.056,0],0,0,367,0.398854,0,1,0,1]] call bis_fnc_camera;
controlName ctrlSetPosition [x, y, w, h]
How are w and h calculated ?
hello, how has everyone been?
had a bit of a break, but now im looking at my arma again
w and h are width and height
yes i'd understood that
percentage of screen size afaik
so heres my issue
ah thx
class CfgPatches {
class FEZOPS {
units[] = {};
weapons[] = {};
requiredVersion = 1.83;
requiredAddons[] = {
"ace_medical"
,"cba_common"
,"ace_common"
};
author[] = {"Fetzen"};
authorUrl = "";
version = "1.0";
versionStr = "1.0";
license = "https://www.bohemia.net/community/licenses/arma-public-license-share-alike";
};
};
class Extended_PreInit_EventHandlers {
class FEZOPS {
serverinit = "call compile preprocessFileLineNumbers 'FEZOPS\Fezops_Init.sqf'";
};
};
i have this in the config CPP
but it says that it cant find this file FEZOPS\Fezops_Init.sqf
which is there
i have the same structure in another mod which works fine
and the file is there as far as im concerned
percentage of screen size afaik
size of the view port (the one which has 4:3 dimensions)
Anyone knows a good guide or tutorial about making static cameras? i've been trying few things and nothing seems to work
@proven crystal pboprefix?
the pbo is called fezops.pbo
maybe leading \ in your path
hmm i have it the same way in another mod though...
there it says serverinit = "call compile preprocessFileLineNumbers 'FEZ\Fez_Init.sqf'";
@velvet merlin Is it working now? I am a bit busy atm so I can't answer right away.
np
did hack it now
- select the opposite tab (visual only)
- execute the code directly
Alright
[_c, true] call ace_dragging_fnc_setCarryable;
[_target, 1] call ace_cargo_fnc_setSpace;
[_c, _target] call ace_cargo_fnc_loadItem;```
how would you explain that this piece of code works 2 times over 3 tries ?
the third try create the canister near the target, but do not load it in its cargo space
whyyy
Nevermind, I just made the canister to spawn directly on the target's position with "CAN_COLLIDE", and now it works properly. With the previous code I think sometimes the canister spawn at a greater distance of the target for the ACE function to accept it
Thinking of making a function for parsing a map - creating node markers every 100m say, and then detecting nearby objects/locations and assigning that node with that information. Certain amount of trees -> forest node, certain amount of buildings -> urban node. Has this been done before?
sounds like ALiVE indexing?
kinda I guess, we make use of object IDs which sucks since we have to re-index whenever a map is updated and the IDs change ๐ฆ
is there a fnc/script that can get all the defined memory point names of an object?
Is there any way to play synced music to all players ebvent if they are not in the game (Tabulated)
https://pastebin.com/h9QdN5eu I have a problem with the interaction menu, it does not display at all, does any of you see any problem here?
So i need a file to specify my pboprefix?
Seems to work without in my other mod
Im still stuck with this error message that it wont find my init file
Started a map parsing function, for the purpose of creating nodes for AI high level/commander behavior.
private _dialogResult =
[
"Side Selector",
[
// The last number is optional! If you want the first selection you can remove the number.
["Combo Box Control", ["BLUFOR","OPFOR"]]
]
] call Ares_fnc_showChooseDialog;
// If the dialog was closed.
if (_dialogResult isEqualTo []) exitWith{};
// Get the selected data
_dialogResult params ["_comboBoxResult"];
// Output the data to the chat.
systemChat format ["Combo Box Result: %1", _comboBoxResult];
if (_comboBoxResult == 0) then
{_grp = createGroup west};
if (_comboBoxResult == 1) then
{_grp = createGroup east};
player groupChat (format ["%1",_grp]);
_dog = _grp createUnit ["Fin_random_F", _pos, [], 0, "CAN_COLLIDE"];
[_grp] joinSilent _dog;```
player groupChat (format ["%1",_grp]);
_dog = _grp createUnit [">
17:11:29 Error position: <_grp]);
_dog = _grp createUnit [">
17:11:29 Error joinsilent: Undefined variable in expression: _grp```
why is _grp undefined?
_comboBoxResult is either 0 or 1 depending on which is selected
oh shit, thanks!
private _side = [west, east] select _comboBoxResult;
private _grp = createGroup _side;
you can also do stuff like private _grp = if ... else ...;
so does private just set the variable to be used inside what ever scope it is declared to be in?
private sets the variable in current scope and makes sure that you don't overwrite any variable in parent scope
if you just use _var = 5 then if _var already exists in a higher scope, it will overwrite it
Hi there, i'm using drongos missile system, and in it's start.sqf it defines
dmsRestrictUsers=false;
In the editor I can local exec
dmsRestrictUsers=true;
and get the desired result
but adding the restriction=true to the init.sqf doesn't work
any idea why that would be?
would kindly appreciate a ping if anyone replies ๐
if it's start.sqf runs after your init.sqf it will overwrite your variable
yeah I thought that might be the case, but couldn't find any references about when start.sqf runs
Anyone know a way to identify the script in why a resource is not found ?
black box saying "Resource xxxxxx not found"
Should I say "no" if I know a way which you can't use anyway?
I'd say CTRL+F for the resource name in all files
yeah I was hopping not to do that
probably you have put your resource in the wrong part of config
IIRC dialogs are in mission config root, rsc titles are in missionRoot/RscTitles class
I found what was wrong
the message was actually displaying "Resource title "" not found"
no I most have some brackets wrong somehow
OK so that missile system issue I was having is because the variable is being set in a PostInit XEH
and my variables are getting overwritten
i've tried adding a PostInit to the description.ext to overwrite it but it still seems to be running before the one in the mod
Any idea how I can run that variable assignment after the PostInit XEHs?
spawn with sleep
@still forum could you provide an example? i assume it goes into init.sqf
[] spawn {sleep 20; <your code here>}
appreciate the help.
just waits 20 seconds. might need to be longer
and in init.sqf yeah?
@astral dawn I had added a titleRsc ["","BLACK FADED"]; to cancel the effect of my titleRsc ["Black","BLACK IN",5]; which is the source of my error. It works but creates an error.
How do you cancel a titleRsc normally ?
maybe nope...titleRsc ["", "PLAIN"]; ?
class: String - the class name of the resource. ("Default" will remove the current resource.)
IDK really I never had to remove it
See KK's comment here?
https://community.bistudio.com/wiki/cutRsc
maybe I should read the documentation for my own issues too ๐ค
so everything works great with AI, as in the dog murders them; however, with players the dog does not attack them
which is doing me a confusion
how would I go about generating average fps with diag_fps?
I have thought about creating an array of taken numbers, and then constantly adding them up, dividing by iteration number, etc.
but that sounds really jank
it also exponentially increases the number for some reason after rebuilding the proper numbers gathered from diag_fps
I have heard about cumulative average instead of regular average, but don't really understand the difference
Calculating mean (everage) is the easiest, you sum up everything and delete it by the amount of measurements
Or export it somewhere and plot its historgram, or make it measure the FPS during 90% of time, or whatever gamers like to measure nowadays ๐
@tough abyss So how soon is diag_fps available?
@astral dawn Well of course.
_recordedNums = 72 + 80 + 92 + 90;
_avg = _recordedNums / 4;
What do you mean how soon? @high marsh
mission start? Game start?
Always
How can i keep infantry flashlight and vehicle flashlight always on?
Even in daylight?
Im ๐ฏ% sure ive found an answer to that on google more than once @twilit scarab
Cool so you know one that works then? @peak plover
Anybody happen to know which algorithm is behind BIS_fnc_sortBy? Can't open arma atm
I'm trying to use BIS_fnc_ANN, but the title text is very small, I tried using <t size='2'>"Title"<t/> but it gives me an error. I'm executing it in the debug console, would that be the issue?
yes as I said I'm using the BIS_fnc_ANN, I tried doing this but it gives me an error [parseText <t size='2'>"Title"<t/>, parseText "Rolling Text"] spawn BIS_fnc_AAN;
vs with out <t size='2'><t/> it works, just that the text is really small
parseText takes aโฆ string?
it would then be sqf [parseText "<t size='2'>Title</t>", parseText "Rolling Text"] spawn BIS_fnc_AAN;
https://community.bistudio.com/wiki/parseText for reference
I've tried using quotations around <t size='2'><t/> and in between, it didn't work
I'll give it a test in a bit, need to grab food, thanks for the help
bon appรฉtit
@twilit scarab for flashlight you can force it for headlight you can disable AI https://community.bistudio.com/wiki/Arma_3_Lights
Bumping:
https://pastebin.com/LYf2jGKB
so everything works great with AI, as in the dog murders them; however, the dog does not damage players. It sits and follows them, just doesnt attack them
which is doing me a confusion
[_grp] joinSilent _dog;``` โ โ
as for why it follows (enemy?) players, no clue โ no distinction is made in this code
joinsilent takes an array of units
i know how to make player change sides (from independet to opfor, to blufor and so on) and all - but the method is very clunky because it needs a new group for each player.
Is the new-group-put-player-into-this-group the only way to change a players side? Because if they are opfor, and are in a vehicle, a blufor and/or inedependet unit cannot join the vehicle crew.
@twilit scarab enableGunLights and setPilotLight
Do isServer, hasInterface and other things work properly in preInit? Or to say it in other words, are there any limitations on what I can do in preinit?
isServer, hasInterface
yes
other things
maybe
in preinit, no objects exist yet
so setting a variable on the player for example won't work.
Allright, that's what I need, thanks!
@winter rose sos for late reply, what do u mean by distinction?
The dog is supposed to follow the player and sit when it is supposed to damage it, however, the damage is not being dealt
@surreal peak I meant I have no clue as to why the dog would sit and do nothing; but wait, the dog actually chases the enemy?
if so, maybe [_dogNearestEnemy, 1, selectRandom ["hand_l", "hand_r", "leg_l", "leg_r"], "stab"] call ace_medical_fnc_addDamageToUnit
โ ace_medical_fnc_addDamageToUnit may not be global
does that mean it wont work on players?
can I make it global?
also yeah, the dog chases the enemy
then applies the damage to it as it sits
you can use remoteExec. addDamageToUnit requires the target to be local (it also logged an error message to your RPT, which you probably didn't look at).
How can I prevent a vehicle from "drifting" on the ground while using BIS_fnc_unitPlay ? I thought placing a dummy driver with all AI components disabled would help, but it doesn't
sos for @ ing u baer, firgured it out
<jumps around happily> eventhandler, what a nice way to complement my disguise framework :3 so sweet.
Hiya, need a bit of help if anyone has a script handy.
I'm trying to make a bunch of object-to-object action menu player character teleports on a map. I can get things working in singleplayer no problem, but I'm unsure on how to set it up for multiplayer.
I'm not familiar with the difference between how arma considers players in SP and dedicated MP.
Anyone have a simple object teleport script, or mission that includes one that I can have a look at?
In the Biki, every command changing an object's state has two icons right below the heading
AL / AG and EL / EG
"Anyone have a simple object teleport script"
setPos. done.
Stands for argument local / global and effect local / global
teleporting things is literally the same in MP as in SP
Yo let me teach this guy
Local means "where it's simulated".
And if you want to teleport player. you are only teleporting player, and don't need to worry about anything MP
For AI that's usually the server or a headless client. For a player controlled unit, it's the players PC.
setPos is AG EG, so you can use that and you'll be just fine
right
one sec..
ok so, I have been using setPos
which is why i'm slightly confused as to why it doesnt want to work in mp
I've been using a simple setPos (getpos (teleportobject))
with a named object to teleport to
What kind of object is it? Have you used disabled simulation of it perhaps?
I have use disabled simulation, I believe
object is an invisible soda can as the teleport target
Disabled simulation means exactly that: render, but don't simulate it
So you need to enable simulation to change its position
well, it's the players changing position, to the object.
I'll just boot the game up. I didnt actually expect a quick reply lol
Oh I see
Can you show us a little more of your script?
The problem is maybe somewhere else. Or is that all you do?
Ok so, the teleport objects players are supposed to interact with are are signposts the init (for example);
this addaction ["Teleport to Radio Training Area","RadioAreaTeleport.sqf"] ;
the sqfs are;
_tele = _this select 0;
_caller = _this select 1;
_caller setPos (getpos (RadioAreaTeleport));
With the teleport target name variable as RadioAreaTeleport
Works for me in SP and editor testing. Even works in non-dedi Mp for the host, but not in dedicated mp?
instead of
_tele = _this select 0;
_caller = _this select 1;
you should just use
params ["_tele", "_caller"];
apart from that, looks totally fine to me
would the above break it for MP?
nope.
the only other thing that i could think of is that RadioAreaTeleport is undefined in MP for a client.
you could just type that in one of the lines below the debug console
if it doesnt return anything, it's undefined
type what, sorry? I'm completely new to scripting and code in general.
Thanks for the help by the way
you know what the debug console is, right?
I know where to find it, but not how to use it
RadioAreaTeleport is giving me an object return but I'm not quite sure what you mean
not yet, cya in a few mins because i need to boot up a server lol
for player character you need to ensure that actions are added locally (somewhere at init.sqf or initPlayerLocal.sqf). As player is local for client -- setpos commands will work fine in mp
back sorry, i cant see debug console in mp
of course you have to enable it for mp
enableDebugConsole = 1 in your description.ext
thanks
Still having some difficulty with it. Would it be possible for someone to send an example mission folder?
guy's i have a problem.
build failed. result code=1
cfgconvert task failed
file c:\users\minas\desktop\payday\filelistwithmusictracks.hpp, line 477: config 'g' encountered instead of ','
config : some input after EndOfFile
error reading config file c:\users\minas\desktop\payday\config.cpp
class destroyed with lock count 1
after a full 7 hours of working on my mod i'm at my wits end with this. i just want some damn sleep but i have to finish this first and i can't tell what's wrong here
post that header file. Syntax error shouldn't be too hard to find
or not. I don't know. I'm new here
by header file do you mean my config? i'm really new to this whole mod making thing so i'm learning everything
Yeah. The error seems to indicate the issue is in filelistwithmusictracks.hpp which is a header file
Sorry I don't know if the preffered nomenclature is 'config file' or what
@zealous silo Line 477 you have an extra " right before go_in_with_the_squad
ok so i solved my errors in filelistwithmusictracks.hpp but now i have a error in my config.cpp
@zealous silo you are trying to build from C:
you dont have the dev environment and P: drive set up?
For what it's worth I've done all of my modding from C: without issue
all of this was working before
ok you guys figure it out then
then i broke it all by doing changing some other stuff
What the arbitrary drive letter? Is that an ARMA engine constant or something?
and why have I never heard of this before :\
P: drive is the most commonly used one for virtual development drive
the tools are designed to work through it
but also the ArmaTools stuff to build it dont always work correctly
what i'm getting is
Build failed. Result code=1
CfgConvert task failed.
Config : some input after EndOfFile.
Error reading config file 'C:\users\minas\desktop\payday\config.cpp
i have a feeling on what it is but i can't be sure
cant help since you dont adhere to the common procedure
also youre using Addon Breaker that is pretty much useless if you dont feed it exactly right data to pack
Ah yeah this is way out of my league. I've never packaged an addon. I've just created scenarios
i was just using a tutorial on adding music to the game. now i have a migraine
what tutorial would that be?
it might not be totally terrible.. but it does not explain how the tools are supposed to be setup and it uses addon breaker to build.
at least its not video tutorial ๐
video tutorials are the worst
i find them to be better sometimes
perhaps thats why you are in this pickle ๐
9.5/10 video tutorials dont have quite right info
maybe
For me it's more about speed. You can't easily skim or search a video like you can a text based tutorial
I can consume a text tutorial at my speed and with the advantage of not listening to your mumbling
Well bois I'm wondering if there is a way to detect if a player is armed. Such as holding a rifle, pistol, or launcher that would preferably be able to set off an in game trigger. I have no idea where to start. The context would be if player holds weapon then player gets switched from civ side to independent side and when the weapon is no longer detected they go back to being on civ side
@fossil peak Singleplayer or multiplayer?
In singleplayer you can currentWeapon player == "" in a trigger
If i run this code on server start, server side:[_obj,true] remoteExecCall ["hideObjectGlobal",0,true]; [_obj,false] remoteExecCall ["hideObjectGlobal",0,true]; [_obj,true] remoteExecCall ["hideObjectGlobal",0,true];when a player join, all the tree hideObjectGlobal codes will run on player machine or just the last one?
Oh @@cosmic lichen thanks mate it worked for my purposes at least
@tough abyss all three
don't set to true the last param
or simply just use the command, that is global (idk if it was just for the example)
What do you have against setting already JIP persistent global command to execute 3 times globally by every JIP?
It's just an example so i can know the behavior. Thanks for the help @tough abyss!
@winter rose thanks.
The real thing is a bit hard to explain with my poor english.
How do I get nearest airport/runway coordinates?
huh, thats actually not that easy from what it looks like
i'd try nearestLocation, but apparently only tanoa has a specific "airport" location type
Yeah that is messed up becouse in A2 it returned for all maps O.o
I guess the only way would be by getting ILS position from config
And what about specific objects? I'd like to know the location of Radio towers?(on M map they are showed with markers with a little rdio tower inside)
i mean you could use airport and do special handling just for altis and stratis - that might work.
nearObjects would probably be the best solution for that, if they are shown on the map they might also have a CfgLocationTypes entry which would allow you to use nearestLocations
systemChat (".,a,.b.,c,.d.,e,.f.," splitString ",.");
systemChat ("abc.,.,.,.,.,.def," splitString ",.");
systemChat ("abcdef," splitString ",.");
systemChat (",." splitString ",.");
systemChat ("" splitString ",.");
systemChat ("abcdef" splitString "");
```output??
Generic error in expression for all lines
Dejavu
wut?
systemChat doesn't take array
are you sure those results have been correct @random crescent ?
because if they are, the biki should be wrong ๐ค as strtok should take every character as delimeter and not the whole expression
https://i.imgur.com/29VfhhZ.png @queen cargo
arr = [0,1,2,3,4,5,6]; arr deleteRange [0.6, 2.4]; systemChat str arr;
arr = [0,1,2,3,4,5,6]; arr deleteRange [2, 1]; systemChat str arr;
arr = [0,1,2,3,4,5,6]; arr deleteRange [1, 1]; systemChat str arr;
arr = [0,1,2,3,4,5,6]; arr deleteRange [-1, 1]; systemChat str arr;
arr = [0,1,2,3,4,5,6]; arr deleteRange [1, 10]; systemChat str arr;```
what happens on theese?
@queen cargo must have been a typo somewhere i suppose : )
or that ๐คท
I have two variables both of which can be nil or not nil, and I need to check their equality quickly, what's the best way?
[_val1] isEqualTo [_val2]
sheeet that's amazing ๐
might return true if both are nil. Not sure
hmm yeah ๐ค
you have to add extra check whether one of the variables is nil then, if you want false on both nil
๐ฎ
[nil] isEqualTo [nil] false ๐
in SQF-VM yes. Same in Arma too?
how about
private _var1 = nil;
private _var2 = 3;
private _isVarsEqual = (_var1 param [0,-1,[0]]) isEqualTo _var2;
both can be nil
returned nil
Also that won't work
still adding a testcase to cover that now ๐
param is silently ignored because of nil argument on left side
[_var1] param```
would that work?
y
Version number is wrong. we already have it in 1.92
oh then it's in #perf_prof_branch
On latest profiling the command syntax already changed to return group instead of nil
yes you can post a link to a picture here
ah well
does this work?
so my issue is that the game tells me on startup that it does not find the fezops\fezops_init.sqf
why though... i do it the same way for my other mod where it is just a slightly different path
Don't use pbo manager
use something real
also cba_common and ace_common are already included in ace_medical
also use a pboprefix instead of hoping that Arma can read your mind and does what you want
i tried that
made a file called $PBOPREFIX$ and wrote 'fezops' into it
that should be it, no?
if you then use a proper pbo packer which is not pbo manager or addon builder then yes
you can check if prefix is correct by opening your pbo in notepad++ and looking at the first line
if there is no prefix there, then it's wrong
interesting it has the prefix of my other mod there...
works now
once again -> thanks a bunch
What is a proper PBO packer dedmen? Will be nice for when I get back into modding
I've got a real weird problem.
I wanted to have a loadout of the enemy in my mission. I've added a CBA_fnc_waitAndExecute (just because there were a lot of units and don't wan't to execute all at the same time) with this script:
params ["_unit"];
private _a = "BOKO_RFM";
switch (typeOf _unit) do {
case "O_G_Soldier_LAT_F": {
_a = "BOKO_LAT";
};
case "O_G_Soldier_GL_F": {
_a = "BOKO_UGL";
};
};
[_unit, _a] call KAT_fnc_applyPlayerLoadout;
true;
KAT_fnc_applyPlayerLoadout is a simple loadout script that remove all the stuff and give the new (right) one.
Problem is: Nothing happend. No loadout is given, no script error.
I tried following:
Taking the InitPost Event (with CBA) and execute the funtion there. Nothing happend. I even added the funtion in the init of the unit in zeus interface.
Debug console -> Nothing happend. But if I place a new unit everything is working fine. All the ways above are funtional if the unit isn't preplaced. Why? (Pls tag me if you got a idea)
Add systemchat 'part 1' to parts of ur script and see whifh part it reaches
Hello! I'd like to use a script to simulate an one-way traffic flow. I'm thinking:
- Create a manned vehicle at a random position around point A.
- Order the vehicle to move to a random position around point B.
- Repeat 1 . and 2. in random intervals.
- Delete each vehicle upon arrival.
I have limited experience in scripting and would be grateful for any suggestions.
How can I assign an existing task? I found BIS_fnc_taskSetCurrent which makes an already "assigned" task the current task of a unit. But I want to actually really assign an existing task that is has been created for another unit (by ID) to a new unit. Can't find anything for that
or in other words - How can I add players to an existing task? Since it's possible to add an Array of "owners" to a task - how can I modify this array when the task has already been created?
I want to be sure on this one: If i put a normal event-handler on a object (example: A player) it will fire locally whenever the handle is triggered (like killed etc.) right?
And MP-Eventhandlers are added to every single player globally as i understand but there are just the three: hit, killed, respawn (totally fine!)
But my actual question is: When i put a non-mp-eventhandler on an object (player unit) it will be not-readded to the player(s object) when he/she respawns and i have to re-attach the event handler, right?
so i can add normal eventhandlers "initPlayerLocal" and they will stay as long they are on the server?
@frigid raven
With the task creation you can choose who receives the task
So you could create a task for every playable unit and then use your command
See:
https://community.bistudio.com/wiki/BIS_fnc_taskCreate
Or you can assign it to every BLUFOR for example
@signal kite https://community.bistudio.com/wiki/setDriveOnPath
https://github.com/CBATeam/CBA_A3/wiki/Per-Frame-Handlers
https://community.bistudio.com/wiki/nearEntities
https://community.bistudio.com/wiki/nearRoads
https://community.bistudio.com/wiki/inArea
https://community.bistudio.com/wiki/lineIntersects
Depending on your scenario and how dynamic you want it to be. You can go many ways with this.
Best case scenario, you know kind of which route the car should take and don't have to rely on the
vanilla paths and driving, you can get a set of points and save them in an array and just go through them with setDriveOnPath.
If not, you can just use waypoints or doMove etc.
I would make a script like this:
Car spawns, drives from A to B,
The car is added to an array,
A per frame handler loops through all the cars
Checks their position,speed and determines if they are stuck.
In which case nearEntities and nearRoads can be used to find another path or retrying the same one.
lineintersects could also be useful to finding a clear path and then using setDriveOnPath to drive past obsticles etc.
nearRoads is really nice for finding road positions to drive to or some in between, use getPos alternative syntax and getDir alternative syntax to get a road in a certain direction (from a to b) etc.
In the end you could also just have a special function on the first few cars that will periodically save their positions and do a lot more checks to make sure the road is clear etc.
Then use those positions and setDriveOnPath later on in order to avoid ai issues with road paths etc.
Maybe even drive the path yourself and then setdriveonpath with that, if nothing else works and you don't wanna make 100 markers or save 100 positions manually
@peak plover thx for the elaborate reply. Sadly this surpasses my skills greatly; I had something much simpler in mind with just using addWaypoint. (Actuallly I'm fine with the bad AI-driving because it adds some kind of "fog of war"; Vehicles get stuck, break down and so on. I even appreciate that kind of stuff as it adds to the overall immersion.)
My problems are more basic: how to man a vehicle after createVehicle, how to assign a waypoint to it and how to have it deleted upon reaching the waypoint.
It is way more simpler.
CBA_fnc_waitAndExecute
createVehicle command
[{
private _vehicle = "vehicleclassname" createVehicle position;
private _group = createVehicleCrew _vehicle;
private _wp = _group addWaypoint [center, radius];
_wp setWaypointStatement ["true", "deleteVehicle this; {deleteVehicle _x} forEach units group this"];}, [], seconds of vehicle spawn] call CBA_fnc_waitAndExecute;
You could make the real script a function that will call the function again. As a infinite loop with random numbers so like random (150) -> will be a random number under 150
Not tested just at the mobile @signal kite
AI on a Street is quiet good not to get stuck
@spice axle thx. I will try that. Actually I don't need the AI to get stuck, but I don't mind if it does ๐
actually it returns false
switch [nil] do {case [nil]: {hint "true"}; default {hint "false"}}
@surreal peak armake or mikeros makePbo/pboProject.
Mikero is the safest one.
thanks!
Can i get a units description? That what we see in selection like "unit xyz" "description: Tough Medic"?
What's the most efficient way of copying the contents of an array? E.g I have a global array called array1 and I want to copy the content of it into array2 but if I make changes to array2 I don't want stuff in array1 to change.
array2 = +array1
tnx
is there a command to get the mean of an array?
is there a command to set a vehicles name with the debug console?
removed
that's not the mean.
You're right. Not sure why I thought that would work.
private _sum = 0;
{ _sum = _sum + _x } forEach _array;
_sum / count _array;
I don't think there's a much shorter way
Some of the things missing from SQF are maddening. += is one of those things.
Some kind of array_sum function would be nice too, but it's not quite as prolific
im trying to unhide a fuelprobe on a blackhawk form a different mod (i know ignore the fact of its a mod lol)
_this animate ["Hide_Probe", 0];
that script doesnt seem to wor
ive given the blackhawk a variablename and it works but in mulitplayer i cant set a variable name
+= is one of those things. not possible with the way SQF works
sorry im totally new to coding lol
Except array append I guess. But we already have append
Some kind of array_sum function would be nice too, but it's not quite as prolific
we've got map (called apply in this case), reduce would be nice now, too. something like this:
private _mean = (_array reduce [0, {_left + _right}]) / count _array;
do it dmenn
pls
reduce? intercept_cba?
not through intercept ๐ฆ
oh
only problem i see is the introduction of at least one magic var
SQF has map/reduce/filter functions? I had no idea
no reduce, no
how?
[1,2,3,4]
1 op 2
3 op 4
res1 op res2
or
1 op 2
res1 op 3
res 2 op 3
?
map = apply, filter = select
neat
the latter
oh
one sec
_array reduce [0, {_acc + _x}]; // initial accumulator = 0
_array reduce {_acc + _x}; // initial accumulator = _array select 0
game_value cur = array[0];
for(auto i = 1u, i < array.size(); i++){
_x= cur
_y = array[i]
cur = call operator;
}
that?
reduce basically does
[1, 2, 3, 4] reduce {_acc + _x} == ((1 + 2) + 3) + 4;
[1, 2, 3, 4] reduce [0, {_acc + _x}] == (((0 + 1) + 2) + 3) + 4;
sadly these need to be scheduler capable.. which requires crappy boilerplate
Can you check if my impl is basically right?
I prefer _x for left and _y for right
Or maybe _this for left and _x right? that's shit..
Adding new magic variable might confuse people?
_acc would be more meaningful imo
Feels like it implies that you can change it. Aka "this is the accumulator, you can do stuff with it"
Maybe I'm too tired. Plus shorter variables faster, and for things like this, that might be enough to matter
We already know how bad _forEachIndex is ๐
your implementation looks right for the ARRAY reduce CODE variant
you can change the accumulator. it could be a different array for example.
you can implement select through reduce
"select through reduce" hey hey. put the gun down
_array reduce [[], {if (_x mod 2 == 0) then {_acc pushBack _x}; _acc}];
^ == _array select {_x mod 2 == 0}
I told you to put the gun down! Not fire it off -.-
i uuuuuh dropped it
_array reduce [[], {_acc pushBack if (_x mod 2 == 0) then {_x} else {nil}; _acc}];
๐ค
oh that is neat
but very cryptic
also dunno if then has higher prio than pushBack
if is unary so yes. But then is binary. Not sure about that one
the if was actually part of the sentence structure ๐
vehicle does NOT return me the vehicle the player is in. What am i doing wrong?
_plVeh = vehicle player;
?
<stares at @still forum out of my Karatel>
he's right tho
whats the solution i am looking for? objectParent also does not return the vehicle i am sitting in.
vehicle returns the vehicle the unit is in.
If vehicle and objectParent don't return the vehicle.. Only reason I can think of is that you are not inside a vehicle
or your mistake is somewhere else.
I am in a vehicle.
Or player isn't defined. Server exec.
Undefined
player CANNOT be undefined
it's a command
it's never undefined
never ever ever
EVER
_plVeh would be if just player
Anyhow
It's a command
Not a var
This is understood
there is simply no way vehicle player will fail.
Unless you're executing on server. (Which was my intended statement before pre caffeinated freakout)
Unless you're executing on server
it will return null, which is correct.
Lol.
Add another line
test1
What, please?
are you remote controlling a unit?
nope.
1: Eden Editor -> "Play in MP"
2: Get into Vehicle
3: debug console "test1 = vehicle player;"
4. Gives back unit, n ot vehicle.
are you sure?
typeof vehicle player
maybe they just both have the same name?
there you go.
so with typeOf i get the vehicle class but without typeOf i dont get the vehicle at all? But 'vehicle' states it gives me actual vehicle object and if there's none the unit.
okay, i will now spawn a total different vehicle
dude
๐คฆ
oh wait, i understand
vehicle just takes on your name
it's the callsign
at that moment I AM the vehicle (the vehicle object is actually me) right?
vehicle player = vehicle object?
My house number 4, has the same number as house number 4 in the next street. but they are different houses ๐
it was too confusing for me seeing my name XD
The name essentially tells you "the vehicle that Narsiph is in"
You are in both your body, and the vehicle. so both vehicles have Narsiph inside.
Not sure if there is a easier way to see the difference besides typeOf
the typeof was exactly the next step in my script, thats why i didnt execute typeOf earlier. I would've seen it then ^^
wait might be wrong obj name
@slim verge if objects are not spawned in mission, for example they beaing unused playable units. Then it will be nil.
You should add a isNil check on _x
was me being an idiot should knopw better been doing this for 17 years now
developing a script atm so not added niceties
maybe reduce is a too generic name and not obvious enough? on the other hand neither is apply nor select
I'm finding problems where there are no problems to find
Performance will be stupid for unscheduled if I don't write everything twice :/ And BI won't accept that if I'd do
I already hate it, I could make it fast but I can't
An alternative for reduce that's often used is fold
Hey guys, I'm new here. I've had a PC for 10 month now came from console I purely built my PC to play arma I've clocked 1k hours had fun in milsims and public servers now I want to move to making my own content I.E cinematics missions and so forth problem is I have 0 knowledge on scripting and was hoping I could get some help off the guys here
https://community.bistudio.com/wiki/ for starters!
Thank you Lou I'll go check it out mate
https://community.bistudio.com/wiki/Code_Optimisation for structure and good practice
and many other links I don't have right now ๐ (such as Multiplayer Scripting)
I've made a little scenario on a map and got the mission in my missions sqf folder just want to learn more to add to it and I believe ite scripting where I'll achieve that
You the man ๐
My pleasure!
can someone explain to me how to use this? https://community.bistudio.com/wiki/BIS_fnc_keyframeAnimation_init I want to activate a keyframe animation via script but i can't get it to work
@winter rose I've read through most of it but I cant find a section regarding how to write out the coding where to put it and what does what I.e what null means and stuff
@burnt torrent you can create a script by creating a new txt file and changing its extension to sqf. One of the most used is "init.sqf", which is a script that is automatically fired (if it exists) on mission start/join for everyone (server and clients)
for other scripts, see execVM on the wiki ;-)
@still forum I blame morning and mobile keyboard (-:
Blame for what? I didn't even read your messge
right im a bout to try my first bit of scripting wish me luck hahaa
I might've asked this one already but forgot the answer tbh. Is it possible to remove the map marker of a task (task framework) or at least hide it?
change the game difficulty?
Already have - think this one is not affected by the difficulty
not the 3D marker but the marker on the map tho
this here
ahhh i see im unsure tbh on that one xetra
wait a sec - I think this one is created by the "destination" param for a task
@still forum I thought you pointed @ my typos ;-)
Is c++ the scripting I should learn @winter rose
No. SQF has barely anything to do with c++
okay thanks dedmen
@still forum nooby question mate how would i input a camera script into the editor
Some days ago I had a private message and the guy said he want to script the Arma mods with c++. Who is the guy telling newbies that c++ is the language for Arma? Thatโs absolute wrong
i seen it on a discussion on steam, im just a little bit lost with it but im not giving up haha
You got a link for me?
i can try and find it for you mate
ive bin reading for last hour about c++ as well fml haha
all im trying to do is make cinematics i don't need to know that much surely
Arma has a standard interface with .dlls called callExtention. Parameters are converted to string and your functions receive a string.
Or there is an Intercept addon that lets you handle arma's data types natively
So you can even pass object handles and other things, and you can call all arma's scripting commands from the .dll side
C++ arma scripting is a thing. But that's something different
But that's something you might touch AFTER you've learned SQF itself
is it worth me just finding a local pc class and paying for lessons ?
no
c++ knowledge won't help you much with SQF
Will help as much as general programming knowledge
there are free video courses online
so i just need to learn sqfs then correct?
sorry for all the questions guys thanks for your paitience
ive downloaded notepad++ but cant find the impot on langauge for sqf?
SQF is a proprietary language for Arma
There are community made Notepad++ addons that add SQF language
you don't even need notepad++
any text editor works.
Or you can even not use any text editor if you write your scripts ingame in the editor
ahhh nice, so where can i learn what i need for scripting, i.e what null and stuff means?
and when and where i should use them
where i should put ; and [] and stuff if you with me
I have no idea. I learned everything by myself by just reading the wiki
ill keep going through the wiki then thanks dedmen appreciate the help man i really d o
do*
@burnt torrent . I'm about 6 or 7 months into my study of sqf with very little code experience coming in. This is my third attempt over the course of a few years and I'm finally getting traction. Stick with it. Read a lot. Then read more. Generally speaking the semi colon ; is used at the end of a line of code. It's sort of like the period to a sentence. The brackets are, again generally speaking, containers. Within them go the arguments or values you are passing to a script...or sometimes they contain elements of an array, which is like a group of things. I'm sure they do other things I've yet to learn. Null seems to equate to "nothing". It is an undefined value. I've seen null used to launch a script which is called by execVM after declaring that null = [] execVM SCRIPT.sqf; I'm unclear why this would be used over just a standard execVM in the init sqf group (init.sqf, initplayerlocal.sqf, and initserver.sqf), but I'm sure there's a reason.
Good luck!
thank you ever so much, i certianlly not be giving in! im slowly getting there ive had a pc 8 month now had one before sept a laptop which was used for just browsing the web then i got bored of console so built a rig purely for arma 3. im now 1k hours in and have often thought i wish the game did this or this happened so starting looking at scripting! i wish you all the best also with your studdying and i hope it all comes to you, thanks for pointing out certian things there they make sense now where as before they seemed to just mean nothing to me as such. im currently reading the wiki with a cupper t so no doubt ill progress some what today!
there is no "null" in sqf. There is nil and null types like objNull or grpNull.
@unique atlas
null=[]... is used in init boxes in editor, as there is a bug in there that won't let you confirm the script if it returns anything.
And x=x not returning anything is actually a bug in SQF that you need to use to workaround that editor script field bug.
It makes no sense if used outside of editor script boxes though. And CBA auto-fixes that bug and you don't need to do anything like that if you run CBA
I do run CBA. Thank you @still forum , and you're welcome @burnt torrent ! So basically @still forum , I could convert those lines in an init file to just the standard execVm call without repercussion?
noteworthy here: if one wants to know some inertias of SQF, there is a community led implementation of the internal VM
there are minor differences but it allows for an understanding why SQF is what it is (c/c++ knowledge required https://github.com/SQFvm/vm if you are not able to understand c/c++ then this is not really of much use probably to you)
I have seen nil, and nul, and null used. Very confusing, I must say. But I love to read so I find things out as I encounter them. Sometimes it takes learning a bit more before I can digest stuff. All good.
0 = [] execVM
works too. It actually sets the "0" variable..
Yes if you have CBA, you don't need to use it
thanks again. This conversation will spur me to learn about the differences in them.
Can you limit the Garage? I'd like to have a Virtual Garage (so similar to the Virtual Arsenal) but I'd like to limit it to only a handful of vehicle.
@winged wing had edited it once for a mission, maybe he knows
No, the Virtual Garage cannot be limited. It also creates vehicles locally, which is problematic if you want to use it in multiplayer.
๐ฅ sad but okay. Thanks for the answer! ^^
Hi! I am new to the scripting in Arma. I am using this http://www.armaholic.com/page.php?id=30731 script to do an intro, I want to get a camera strictly looking down while attached to the drone. But all the scripts seem to make camera attach to a static target
Does anyone know how to deal with it?
I have seen nil
You can assign to nil?
You can assign to global with name nil
What does this mean?
nil = 123;
missionNamespace getVariable "nil";
myVar = nil;
ah you mean that way around
1 = 2;
missionNamespace getVariable "1"; // 2
when i save a scenario in editor then try to export it as a sqf i just get a error line am i doing it correctly?
What error line?
error generic error in ecpression
You are using 3den Enhanced?
yes i am pal
Yes. Exporting doesn't seem to work with custom attributes.
ahhh i see thanks r3vo i would of never of found that
im litreally so new im only learning how to export sqfs haha
i don't even know about scripting
I asked a developer a while ago but never got an answer.
what other mods should i look out for ?
and you mentioned exporting with the ingame tool is that the best way?
There a script which do similar exporting, but I can't recommend one. Never used them.