#arma3_scripting
1 messages · Page 23 of 1
anyone know if you can use setdamage to deal ace damage
or if ace has some special thing
You can add dmg to unit with ace_medical_fnc_addDamageToUnit; https://github.com/acemod/ACE3/blob/master/addons/medical/functions/fnc_addDamageToUnit.sqf
k thanks
It’s fixed, that’s why I need the aiming camera
A custom camera that the player can switch to is probably best. Create one and attach it to the weapon. You can make a basic centre crosshair with cutRsc or something but calibrating it is up to you.
how can you make __has_include to work with files inside a .pbo?
As I wrote in the BIKI, do not binarize the config
hmm binarization is off in addon builder
How's your config?
well there's CfgPatches and CfgFunctions
I mean... the exact config. Also #arma3_config
basically just this: https://pastebin.com/vjREfHBq
then I have in init.sqf https://pastebin.com/w5hrRyuV
Why you need this in a script file? You can use fileExists in SQF
true but I have check like this also in description.ext. cant use fileExists there
Are you sure that \fow\initMission.sqf exists? Where's the file, what's the file and which Mod?
my mod. that line works when filepatching is on
actually nevermind it works after all , was just doing something stupid
hmm looks like dedi cant find the files, have to look further into this
when i use a normal script command for multiplayer it only shows for me as the host
but when i use remoteexec
for some reason it duplicates itself
lets say with subtitles its like the command executes multiple times
or addaction theres like 5 copies of the same action
is there something im doing wrong?
Without looking the code, no
[
["MAN", "Hey1", 0],
["MAN", "Hey2", 3]
] remoteExec ["BIS_fnc_EXP_camp_playSubtitles"];```
this for example for some reason executes multiple times when im hosting
i was thinking maybe it had to do something with the targeting of remoteexec?
this
targets (Optional, default: 0):
Number (See also Machine network ID):
0: the order will be executed globally, i.e. on the server and every connected client, including the machine where remoteExec originated
2: the order will only be executed on the server
Other number: the order will be executed on the machine where clientOwner matches the given number
Negative number: the effect is inverted: -2 means every client but not the server, -12 means the server and every client, except for the client where clientOwner returns 12
Where are you putting the code? Object init field, init.sqf, ...?
Object inits, init.sqf, and some other fields under certain conditions, are executed on every machine, so if they include a global command or in your case a global remoteExec, the command will be executed for everyone multiplied by the number of connected machines
i put them in a trigger if i remember correctly
Depending on the trigger condition, a trigger's activation code can run on every machine. Try setting it to Server Only.
so i should use non-remoteexec commands and run via server only right?
No, either remoteExec and server only, or non-remoteExec and non-server-only
If you use server only and non-remoteExec, the command will only run on the server, which isn't very helpful if it's not a global command
Hey, I'm pretty new to scripting and have almost 0 idea what I'm doing.
I need an animation to loop and as soon as an alarm sounds the unit quits the animation and enters regular combat mode.
I've done the loop with this:
0 = [this,"_anim"] spawn animLoop;```
and I've managed to make the animation loop.
This is how the trigger looks:
```Var Name: SirenTrigger
Activation: OPFOR
Activation Type: Detected by BLUFOR
nul = [thisTrigger] spawn {while {true} do {(_this select 0) say3D ["Siren",1000,1]; sleep 150;};};
if (triggerActivated SirenTrigger) then {
Rifleman switchMove "";
};```
The "if" command will make the unit "twitch" for a split second as if he exits the animation, but will get right back to looping.
How do I make him quit as soon as the alarm sounds?
In your loop, have something like while {(alive _unit) && !(triggerActivated SirenTrigger)} ...
That will make it so the loop will only proceed if SirenTrigger is not activated. Once it is activated, the condition fails and the loop stops.
In your trigger, you don't need the if (triggerActivated ... check - the code in the On Activation field is only run when the trigger is activated, so the check is pointless
it's inside spawned whileTrue though
Thank you! It worked
or am i misreading and it's outside?
No it isn't. It's outside the spawn's closing bracket
Hi all - using a barely modified version of an example to play with an idea -
private _cam = "camera" camCreate (player modelToWorld [0,0,0]);
_cam attachTo [(vehicle player),[0,1,0],"head"];
_Zoom = (
[0.5,0.5]
distance2D
worldToScreen
positionCameraToWorld
[0,3,4]
) * (
getResolution
select 5
) / 2;
_cam camSetFov _Zoom;
_cam cameraEffect ["internal", "back", "rtt"];
"rtt" setPiPEffect [12];
_cam camCommit 0;
with uiNamespace do {
private _pic = findDisplay 46 ctrlCreate ["RscPicture", -1];
_pic ctrlSetPosition [0,0,1,1];
_pic ctrlCommit 0;
_pic ctrlSetText "#(argb,512,512,1)r2t(rtt,1.0)";
};
Was wondering - is there a way to create a circle instead of a square with this?
how can I reveal a target to player and keep it revealed, without a loop if possible?
player reveal [target, 4] reveals the target for about 1 frame and then knowsAbout goes to 0, having both target and player knowing each other doesn't change that
Use forgetTarget along with it
but forgetTarget will drop knowledge to 0 anyway, right?
But it should work
okay, I'll try it out then
Hey guys, I am trying to set up a trigger which activates when a APERSMine is placed inside inside the trigger area. I thought setting up a trigger w.
Activation: Game logic
Activation type: Present
Condition: ```sqf
{_x iskindof "APERSMine"} count thislist == 1
On activation (this is just to tell me if it works):```sqf
hint "You placed an APERS mine!";
But so far it is bust, but the code works fine w. i.e a car
Try changing it from Game Logic to Anyone
Tried, didn't help :/
there seems to be no ammo of class "APERSMine", try to check for "APERSMine_Range_Ammo"
🤷♂️ then probably place a "Fired" EH at every unit (player?) that can place a mine and call it a day
Can you try typeOf _x == "APERSMine_Range_Ammo" instead of isKindOf?
Actually, first of all, place a mine of the type you want, look directly at it, and run typeOf cursorObject in the debug console. Just to prove the point.
something like sqf this addEventHandler ["Fired", { params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"]; if !(_magazine isEqualTo "APERSMine") exitWith {}; // wrong magazine if !(_projectile inArea namedTrigger) exitWith {}; // not inside the trigger hint "You placed an APERS mine!"; // for local use //["You placed an APERS mine!"] remoteExec ["hint", _unit]; // uncomment if you add EH only on server }]; on every unit
So turns out it wasn't any of them 🙃 This is the name when placed "ACE_Explosives_Place_APERSMine"
There's your problem
I'd still be surprised if mines worked for triggers, given that they're apparently not an entity.
Okay so the problem was the type name, as the code works fine with isKindof works fine with the type name given by typeOf cursorObject 😄 Thanks guys 🙂
Trying to make 2 units look as if they are conversing next to their vehicle using this
0 spawn {
sleep 20;
_unit switchMove "";
};
_unit assignAsCargo _vehicle;
[_unit] orderGetIn true;
[_unit] allowGetIn true;```
I got an issue tho. When I run the scenario, the units go from facing one another to looking at complete different directions. How can I make them look at each other?
I've tried using the lookAt and doWatch, but none of the 2 seem to work (unless I did something wrong)
(Also a minor issue is that as soon as I run the scenario the squad leader orders his team to enter the vehicle. Is there a way to make him sound the order when the "sleep" is over?
Put the orderGetIn stuff inside the spawn, after the sleep
Try using disableAI on them to prevent them from deciding to do things on their own. (Remember to re-enable it when you need them to move!)
Also, you need to pass _unit into the spawn or it won't be defined.
_unit spawn {
params ["_unit"];
// ...
I didnt notice any difference when I run it. What would that do? 🤔
spawn is its own scope and does not automatically inherit local variables from the script that spawned it. You have to pass them as arguments. See example 3: https://community.bistudio.com/wiki/spawn
Ah okay gotcha
Can i set god mode on some of the Atlis city walls?
I tried allowDamage false in every way, it not work.
you can disable simulation of them, AI might try to walk through them but they won't take any damage
Thanks!
I tried a loop with forgetTarget but it's not constant, every time there is a frame where target about knowledge is 0 and it makes my 3D task icon blink
for now I'm just using target's position to display the task destination/3d icon but that's a workaround I don't really like
somehow knowsAbout is always 4 for vehicles when i use reveal on them, for units it will dissapear as soon as I can't see the target anymore
i found this script online, basically it lets you kick a football but there is no sound effect and i wanted to add a kicking sound effect but i dont know where to place it.
addMissionEventHandler ["EachFrame",
{
{
if((velocity _x) vectorDistance [0,0,0] < 1) then
{
if((velocity player) vectorDistance [0,0,0] > 1) then
{
if((getPosATL player) vectorDistance (getPosATL _x) < 0.5) then
{
_p = ((velocity player) vectorDistance [0,0,0]) * 2;
_v = velocity player;
_m = 1.5;
_z = 1 + random 2;
_v set [0, (_v select 0) * _m];
_v set [1, (_v select 1) * _m];
_v set [2, _z];
_x setVelocity _v;
};
};
};
}forEach (entities "Land_Football_01_F");
}];
below _x setVelocity _v;, should work
it starts to loop the sound as soon as i touch the ball
do you add the sound as say3d?
like this
playSound3D [getMissionPath "\sounds\footballKick1.ogg", _x, false, getPosASL _x, 90, 1, 60];
That is an eachFrame event handler so I would not recommend putting the sound generator anywhere in that, because it will cause the sound to be played every single frame
is there any scripting function to check if this
23:07:45 NetServer: trying to send a too large non-guaranteed message (len=1348/1353) to 235505265
happens that the specific player is getting kicked?
Are we unable to change the tooltips on inventory items?
I have
_control lbSetTooltip [_index, _tooltip];
_control lbSetText [_index, "test"];
All the items get their text set to test, but all the tooltips remain visually unchanged, the return value of lbTooltip does change
Hi - I'm relatively new to scripting, so apologies if I'm not asking a very useful question. I'm attempting to create a script that smoothly moves a static object between two predefined points when activated, and it has to work on a dedicated multiplayer server. Does anyone have any idea where I would start with this, or any suggestions for documentation/methods to look into?
To have it working smoothly in multiplayer you need to ensure that the velocity parameters match the velocity that you're actually moving it with.
I think there are simpler ways for a fixed object + predefined points but I don't deal with those :P
hi i want to make a body falling jumpscare, how would i go anout making that?
i know i would have a trigger, but im not sure how to make the body fall
I found this script online and it works on my MP server but only the person who picks the song can hear it.
I remember playing an exile server years back that had the script but they had it so everyone could hear and as helis flew over you would hear the song they are playing with doppler effect
.any idea how to modify this script to make that happen?
remoteExec
Does anyone have a solid guide on how to create custom zeus modules?
https://community.bistudio.com/wiki/Modules Seems years old without much for updated information
you can place civilians in the editor
or
use the Civilian Population modules
or
script it all yourself
I've watched a lot of videos trying to do it with the module, but the civilians never spawn.
see a tutorial 🙂
https://community.bistudio.com/wiki/Arma_3:_Civilian_Presence
Thx
If you use Zeus Enhanced they have a freamwork where you can easly create your custom modules see here:
https://zen-mod.github.io/ZEN/#/
So in the init when it calls the script
[] execVM "rscripts\addaction.sqf";
I just use remoteExec instead of execVM? And where should call to script? I
It would be something like this:
"rscripts\addaction.sqf" remoteExec ["execVM",[0, -2] select isDedicated, true];
```You can read more on Remote Exec and how it works more here: https://community.bistudio.com/wiki/remoteExec
stop with this -2 already
Is something wrong with -2 with remoteExec ? if so can i know what? also it says this on Wiki for remoteExec
[-2] Negative number: the effect is inverted: -2 means every client but not the server
yes, see Example 6
Ty ty
{
_myFilledArray = [radio1, radio];
_myFilledArray say3D "radiomusic1";
sleep 151;
_myFilledArray say3D "radiomusic2";
sleep 211;
_myFilledArray say3D "radiomusic3";
sleep 162;
};
This script works when putting an object before the say3D, but i am trying to make it run on multiple objects, this clearly doesn't work, as only say3D applys to the first element in the array, is there a better way to acheive this, or is there a way to make the say3D script read a whole array and apply to all elements inside an array?
forEach?
I have looked into that but I can't figure out where the say3D script will go as it requires an object to be before the sound it plays, unless you know how to lay it out properly, would be appreciated
private _radios = [radio1, radio2];
while { true } do
{
{ _x say3D "radiomusic1"; } forEach _radios;
sleep 151;
{ _x say3D "radiomusic2"; } forEach _radios;
sleep 211;
{ _x say3D "radiomusic3"; } forEach _radios;
sleep 162;
};
would that suit you?
that works perfectly! You're a magician
for learnings sake, "_x" is acting as the object for both radio1 and radio 2 right?
correct; it is a "magic variable" pointing at the current array element
tysm!
How can I make units move to a waypoint after they complete a script?
If I set a waypoint from the editor and run the scenario, they do the script but not the waypoint. Do I need to create a waypoint using a script? If so how?
What are you doing with them in the script?
0 spawn
{
sleep 20;
_unit assignAsCargo _vehicle;
[_unit] orderGetIn true;
[_unit] allowGetIn true;
_unit switchMove "";
};```
I basically have them do this
that's not your actual code is it?
_unit switchMove "_anim" won't work. You're telling switchMove to look for an animation literally called "_anim", and the chances of that existing are, uh, slim
You also still need to pass _unit into the spawn so that it's defined
hi
How can I switch scenarios in the task, that is, how can I make the screen go black, and a text will appear at that time, and the team will spawn in another place.
I'm new to scripting so I guess it might be flawed, but it works for what I'm trying to do
My actual actual code is
0 spawn
{
sleep 20;
Medic assignAsCargo Car;
[Medic] orderGetIn true;
[Medic] allowGetIn true;
Medic switchMove "";
};```
I tried doing what you said yesterday (passing the unit to spawn) but couldn't make it properly. Where in the lines should I add it?
Replace this:
0 spawn {```
with this:
```sqf
[_unit] spawn {
params ["_unit"];```
Will do
Oh hold on, if your code doesn't actually use _unit but instead a global variable (Medic) then you don't need to do it, because global variables are available in all scopes
This is why it's important to give the actual code :|
Oh oh okay 😅 my bad
thank you! i did try this in the server_init but other people cant hear the music still, just the person who activates music via addaction hears it
sighs
The muzzle parameter of compatibleMagazines is case-sensitive, and of course the first one I try has the wrong case.
configName sanity filtering again :/
It looked pretty good up until there because it corrects the casing and removes missing classes from the output.
any idea what this error means
'...ypeof _this) >> 'backpack'); waituntil {|#|sleep 0.2; backpack _this ==
backpack};...'
Error Suspending not allowed in this context
The script is running in unscheduled context (eg event handlers) and you can't sleep or waitUntil there.
If an event handler needs to do something on a delay then use a spawn.
Then you're in the wrong channel.
Oh where do i go
And you need to remove your broken mods.
I was using scripts earlier but i took them out of the mission folder
could it have left something behind
you may have something left in triggers
yeah
I have 3 triggers down but those werent causing any problems til now
theyre just for uh
that or an init field
Sector control
(otherwise, you are not editing the proper mission directory)
just empty the init fields
at least, wherever you see sleep
ok i have init.sqf and initplayerlocal.sqf
neither have sleep and initplayerlocal is empty cuz i deleted everything in it
but this is after i restored them
i havent tested yet
to see if it will happen again
lemme check
lemme restore the one initplayerlocal to what i had before
cuz earlier i was using scripts to let AI and players respawn with a custom loadout
and it was all fine but the problem was they ran out of ammo
so i used ALiVE to create custom faction pbo
so they would have default loadout
and would respawn with full gear that i wanted them to have
then i deleted the respawn scripts cuz i figured i dont need them anymore
but then its doing the error now so
lemme try doing the thing
i just wonder if the scripts messed with mission.sqm somehow
cuz how could a faction pbo cause a sleep error
ok the error is gone now lol but now the AI are spawning with the kit they died with which means they will have the same amount of ammo they died with which i do not want
So if i delete the scripts i get the error but i keep the scripts the ai will run out of ammo
The specific script i added back is this
player setVariable ["TAG_LoadoutStart", getUnitLoadout player];
player addEventHandler ["Respawn", { player setUnitLoadout (player getVariable ["TAG_LoadoutStart", []]); }];
lemme try deleting it again
ok i think this script had nothin to do with it cuz that only affects players loadout
Ok i fixed it but i have no idea how
i literally re-added the scripts and then re-deleted them
Question, so I have a hostage in the hostage stance, but how do I make it so I can free them & then they join my squad.
hello, im trying to get a bit of code to assign cost to vehjicles in zeus
ZeusMaster addEventHandler [
"CuratorObjectRegistered",
{
_classes = _this select 1;
_costs = [];
{
_cost = if (_x isKindOf "Man" or _x isKindOf "tank" or _x isKindOf "Air" or _x isKindOf "Car") then {
switch (true) do {
case (_x isKindOf "tank"): {[true,0.8]};
case (_x isKindOf "Man"): {[true,0.05]};
case (_x isKindOf "Air"): {[true,0.8]};
case (_x isKindOf "Car"): {[true,0.4]};
};
} else {[true,0.8]};
_costs = _costs + [_cost];
} forEach _classes;
_costs
}
];
and for some reason its like its ignoring the costs of items
im trying to use RHS vehicles specifically
You aren't passing cost in cases to costs
Sorry miss readed
Have you confirmed that it's called your EH at all?
I dunno, I don't work with object init handlers. I'm not even sure whether the object var is set before the init is called, so maybe try it with this instead of ZeusMaster.
does RHS have a diffrent structure?
For tank/car/air/man? Not that I recall.
using "this" didnt work
Does anyone have a trigger init. Command that makes a squad member leave your squad once they enter?
yes, join or joinSilent could do (with the proper arguments of course)
So i if I was Alpha 1-1 and could tell them to join a reserve squad like A 1-5 then?
the group you like or a new one yes
hello, is the lock command (https://community.bistudio.com/wiki/lock) still working ?
yes.
Remember it's Local Argument, which means it must be executed on the machine where the vehicle is local, otherwise it won't take effect
I'm trying it in sp for now and i can't make it work. I've try yunowork lock 2; and with _this lock 2; in the vehicle init
When you use the variable name, make sure it's spelled correctly and the vehicle has that name.
In an init field, the object is referred to with this, not _this.
Also if you're using init fields you can just use the lock state dropdown in the attributes.
When you use the variable name, make sure it's spelled correctly and the vehicle has that name.
Just double checked it, it's the same !
In an init field, the object is referred to with this, not _this.
Neither seems to work.
Also if you're using init fields you can just use the lock state dropdown in the attributes.
I'm testing the command to implement in a script later
[_yourVehicle,2] remoteExec ["lock",_yourVehicle];
``` is good practice for mid-mission scripts since client ownership of vehicles can frequently change
I'm also not sure about the difference between lockstate 2 and lockstate 3 !
In state 2 it's locked for everyone. In state 3 it's locked for players but not for AI.
Thanks. I think the description was confusing me "Description: Lock vehicle (disable mounting / dismounting) for player. "
I'm still trying to solve a problem and what I don't understand why the lightpoints won't show up in MP.
this is the same code in SinglePlayer:
https://www.veed.io/view/a0981c64-4bd6-4ac0-bf5f-c124d5042de7
and this is the same code in Multiplayer:
https://www.veed.io/view/bd561f32-416f-4de9-8fa0-566b8c32549b
the code:
https://pastebin.com/mae53RSP
is there a problem with lightpoints??
I can't make it work !
You're creating the lightpoint as a local vehicle, meaning it's only created on the machine where the script is executed. That's the correct way to create lightpoints, but it means it isn't visible for any other machine. I'm not 100% sure that's what's causing the problem here, but it seems pretty likely.
I'm not able to reproduce the problem; this lock 2 in the init field is working for me.
If you have any mods loaded, try unloading them and testing it.
the problem is even if i use createVehicle then the lightpoint is visible for me but not for the others so i can see my lightpoints but i cant see the lightpoints from the other players vice versa
Well, don't use createVehicle, because it is the wrong way to create lightpoints.
The best way to handle it would be to put all the light creation stuff, in local form, in a function which is then executed locally by all clients.
you mean via
https://community.bistudio.com/wiki/CfgFunctions
will try
Setting it up in cfgFunctions is not strictly required - you could use a script and remoteExec execVM, or define the function in init.sqf or something. But you should use cfgFunctions. It's not difficult and it's best for something that will be run repeatedly and needs to be fast.
is there a way of figuring out if the current game session is on a dedi?
isDedicated on the server itself
Not if the running script is running on a dedicated server
nothing client-side I believe, but why would it matter?
fair
not that you should need it but you could always broadcast the value from the server 🙂
missionNamespace setVariable ["SGT_isDedicated", isDedicated, true];
true
Can someone help me find a mod or scripts that allows divers to shoot non uw rifles if the weapon is out of the water?
The problem is a mod indeed !
it's always lupus a mod
@gray mica wait a bit before upping a 5 minutes request, thanks
using Search on the Steam Workshop could bring results too
sorry, a script. I am just the end user of the content, I have a hard time understanding wizard
Any suggestions on how to figure out if a classname is a tank or a tankette?
that is not helpful both are 'Tank'
true
my initial angle is to try and see if I can figure out how much armor they have. or see how big their gun is
like if i select the MLRS tank for blufor it has magazines[] = {"12Rnd_230mm_rockets"}; so that's obvious since it's rockets
but the IFV Panther is also a "Tank" with armor 500 and its main gun fires 40mms and 50cal which is less obvious
oh I guess I could see if it fires a shell.
problem solved, thanks to you all ❤️
by size (boundingbox or sizeOf) or weight?
last time i've checked algorithmically sorting tanks from APCs took way more effort and lines of code than just manually splitting the list 🤷♂️
if you want consider mods, scripts are a requirement
but also: what makes a tankette?
and then you get RHS and some WW2 mod. And BMP-3 has 100mm cannon and comparable armor to most early-war medium tanks XD
@winter rose dwbi I figured a decent way of doing it
@south swan yeah I would be OK with a bmp w/ a 100mm gun spawning for this I think
_filtering_fn = {
private _armor = getNumber (configfile >> "CfgVehicles" >> _x >> "armor");
private _is_uav = getNumber (configFile >> "CfgVehicles" >> _x >> "isUAV");
private _has_gun = isClass (configFile >> "CfgVehicles" >> _x >> "Turrets" >> "MainTurret");
private _shells = [];
if (_has_gun) then {
private _mags = getArray (configFile >> "CfgVehicles" >> _x >> "Turrets" >> "MainTurret" >> "magazines");
private _ammo = _mags apply {
getText (configfile >> "CfgMagazines" >> _x >> "ammo")
};
_shells = _ammo select {_x isKindOf "ShellBase"};
};
(_armor > 500) && (_is_uav == 0) && (count _shells > 0)
};
is a bmp tracked? I thought a bmp was wheeled
ah yes it is tracked. I mean tbh. the difference between a tank and an IFV is pretty tenuous
(PS: for perf purpose you could store configfile >> "CfgVehicles" >> _x in a variable (and I am going to shut up about it now ^^))
ah yes that'd be smart
(also configOf I believe?)
its a function that isn't called very frequently so I tend toward readability
oh that would also be smart. Hey one quick thing though, and I dunno if this is more for this channel or for #arma3_config but - is there a way to get the size of a shell? Like how many mm across it is
you'd think it would be "caliber" but that doesnt work for subcaliber rounds
store the config once, then reuse it instead of constantly looking it up
[calibre]
I don't believe such a thing is actually stored anywhere as a specific thing. It might be in the classname but that's up to the creator to do.
Most gun projectiles are just "points" with a tracer model and no real size.
is there a way to get the size of a shell
I am not exactly good with this, I would say that if there is no config entry then you can try to figure it out of its impact value, but it's as good as a ballpark estimate
shame. i was hoping for a way to determine the size in mm of a gun
also an exitWith at line 4 would be really good here, the (_armor > 500) && (_is_uav == 0)
use the ammo stringtable value and search string "120mm" in it :p
an awful one indeed 😄
and yeah @copper raven i wrote it quick so its not optimized.. but it's also not called very often
i mean the calibre has nothing to do with the game itself right? 😄 it's literally just for "description" purposes
like the way damage works and stuff

caliber according to the wiki is
Acts as penetration multiplier for the projectile.
maybe you can deduce it from some value in ammo config 😄
lol yup
caliber (the config value) doesn't really have any connection to the physical calibre of the projectile. A 120mm HE is going to have less caliber than an APFSDS despite being, in theory, physically larger. The game just doesn't actually simulate or care about the physical size of most projectiles. Their physics behaviour is determined by a combination of speed and drag which are just numbers, and what gun they fit is determined by including the magazine in the gun or magwell's config, not by any sort of physical compatibility.
I took a look for magazines with configFile >> "CfgMagazines" >> "10Rnd_338_Mag" >> "mass" was thinking myb you could get the size of the mag/shell by the mass but then i took a deeper look and saw that 5.56 round has more mass then the 120mm Heat so yea.
mass on magazines is used for inventory space calculations which, IIRC, vehicle magazines don't care about.
well also you'd ideally want to use cfgammo and see how heavy a single shell is
but yeah I think using caliber or just the fact that it's a shell alone is prob the best choice
nvm yeah
there is no "caliber" in arma itself
best you can do is just scrap the descriptions/displayNames
for vanilla atleast you can maybe get it from the ammo classname, pretty sure all of them have the "caliber" in them
but for mods, there is no consistency i'm afraid
maybe get ammo "hit" (damage) value? and "indirectHit" i think
i tried with remoteExec execVM but unfortunatly it did not work, i had the same result, we could only see our own lightpoints, but now i will try it via init.sqf
Which of those methods you use shouldn't matter in making it work, as long as the script/function itself is properly constructed (though you still should use a cfgFunctions function, it is better). So there is probably a problem with how you've converted it to local operation.
you're supposed to create lightpoints locally, fx,
// should use CfgFunctions
my_fnc_createLightpoint = {
params ["_positionASL"];
private _lightpoint = "#lightpoint" createVehicleLocal [0, 0, 0];
_lightpoint setPosASL _positionASL;
_lightpoint setLightColor ...
};
// usage
[getPosASL player] remoteExecCall ["my_fnc_createLightpoint", [0, -2] select isDedicated]; // create lightpoints on all clients
i'll test this later, but thank you guys in advance
I want to disable manual saves for my scenario as scripted saves/autosaves are frequent and manual save might break something.
I put enableSaving [false, true]; in init.sqf and then first saveGame; is executed some time later, at the end of a different .sqf file exeVMed by a trigger. What the game does tho is making a save right at the start of the game, and then the triggered saveGame does not happen. Should those be used other way to actually work?
https://community.bistudio.com/wiki/enableSaving
save: Boolean - create an autosave on command execution
you're passing true so it autosaves immediatly

I thought it means create an autosave on saveGame command
so I have to execute enableSaving everytime I want to do an autosave, right?
not sure how it works tbh
how do you get if waypoints are completed?
me neither, I'll keep trying then
waypoint statements?
hmm. that returns an array? or does it return code
no, waypoints can have a statement set similar to trigger "on activation", that runs once the waypoint is completed
ok so it returns code
cool
actually that doesn't matter to me thinking about it. a better question is if there's a way to get if a unit has completed all its waypoints @copper raven
basically if the unit is idle
https://community.bistudio.com/wiki/unitReady if you give a chopper a SAD waypoint, this will be 'true' when it's done with that right?
currentWaypoint _grp == count waypoints _grp perhaps
is there a reason to do that vs. just unitReady _vehicle
my_fnc_execNextFrame = {
addMissionEventHandler ["EachFrame", {
_thisArgs params ["_frameNo", "_code"];
if (_frameNo > diag_frameNo) exitWith {};
call _code;
removeMissionEventHandler [_thisEvent, _thisEventHandler];
}, [diag_frameNo + 1, _this]]
};
my_fnc_saveGame = {
enableSaving [true, false];
{
saveGame;
{ enableSaving [false, false] } call my_fnc_execNextFrame;
} call my_fnc_execNextFrame;
};
// usage
call my_fnc_saveGame
this works, alternatively if you have CBA, replace the call my_fnc_execNextFrame with call CBA_fnc_execNextFrame
maybe someone else knows how to do it properly 
huhhh…
just use saveGame?
and what's the deal with the Frame EH here really x)
isNil is enough if you want to run code unscheduled
saveGame doesn't work if you have saving disabled, but they want to still save manually via script
enableSaving [false, false];
//...
saveGame; // works?
nope doesn't
needs to run a frame after the enableSaving
oh, i missread, that wouldn't work at all 😅
why not?
it just doesn't, neither enableSaving [false, true] after double false
dunno, enableSaving seems to also disable the saveGame command
is there any way to disable shadows of an object with script or am i going to be fucked
I call bug, this should only prevent manual save, not scripted one
it also seems impossible to do false,true twice
2nd option, prep lube
i agree
will a baguette do instead
your choice, beware the crust
XD
just use my code for now, it works ok
worthy a FT ticket perhaps
i like the end pieces 😳 👉 👈
can I just pop it into init.sqf?
« croûtons »
no one reads FT except bots and reyhard
lies, well, Dedmen is a bot so
sure, CfgFunctions is better though
silly man with spaces between punctuation!
guilty as charged!
dont you mean guilty as charged !
guilty as charged !*
i am going to stop this before i get muted again 💀
give me time, I'm on mobile
is there no hacky way to stop objects having shadows or is it a straight engine limitation
@copper raven @jade acorn also isn't there a BIS_fnc_saveGame (might help)?
lower video settings
making hiddenselections transparent still gives it shadows 💀
Evaluates the current battlefield situation 💀
doesn't look like it, it exists, but doesn't help the situation
dang, welp
sadge i need to use objects as a roof but scenario needs to be day time so lights wont work 
make it night when you are inside :p
lights also don't work then 😂
dont know why but its a modded map so thats probably the reason
hm, dunno
you could play with setApertureNew?
hang on i found some game logics in the scenario that work as lights
however theres 6k objects present in the scenario which i placed so searching takes a while
game logics that work as lights
what did you bring upon these cursed lands
i'll let you know when the attributes page loads 😂
call{light = "#lightpoint" createVehicleLocal position this;
light setLightBrightness 0.8;
light setLightAmbient[0, 0, 0];
light setLightColor[10, 10, 10];
light lightAttachObject [this, [0,0,0]];
light setDir (getDir this);
light setLightDayLight false;}``` this apparently
aaaaand doesnt work for where it needs to go
Question, I'm trying to get this to work:
skillspopup = true; publicVariable "skillspopup";
_players = allPlayers select {alive _x};
[_players] spawn {
params ["_players"];
_skillstargets = nearestObjects [skilltgt, ["TargetBase"], 1000]; publicVariable "_skillstargets";
{ _x animate ["Terc", 1]; } foreach _skillstargets;
while {skillspopup} do {
{
if (_x distance _players < 70) then {
_skillstargets = _skillstargets - [_x];
};
if (_x distance _players > 200) then {
_x animate ["Terc", 1];
} else {
_x animate ["Terc", 0];
};
if (skillstgtactive distance _players < 80) then {
_x animate ["Terc", 0];
};
} foreach _skillstargets;
pltskillstimer = selectRandom [2,5,10];
uiSleep pltskillstimer;
}
}```
Everything works except for the if statements to distance. I'm trying to get this to work on dedicated it works in SP with "player" but I was told that "player" doesnt work in MP Dedicated.
Am I calling _players correct here? What is a better solution if I am not?
Thanks for any help!
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
pls sqf syntax
publicVariable "_skillstargets"; you can't pvar a local variable
thanks fixed!
_x distance _players OBJECT distance ARRAY does not exist
you can use https://community.bistudio.com/wiki/inAreaArray here
well this is the error I am getting:
Error 1 elements provided, 3 expected
So I should do InAreaArray instead of nearestObjects?
yes you also need to provide x and y axes
no
so I should do that to _players?
_players = allPlayers inAreaArray trigger```
no i meant your distance checks
fx, you can write, _x distance _players < 70 as count (_players inAreaArray [ASLToAGL getPosASL _x, 35, 35, 0, false, 35]) == count _players
any way to check if player has access to zeus or not btw
!isNull getAssignedCuratorLogic player perhaps?
legend thanks
ahhh, so the 35 is the distance?
in x y z?
half the distance
ahh, so i need to change those numbers for the other checks?
yes
for the greater then 200 would be:
count (_players inAreaArray [ASLToAGL getPosASL _x, 100, 100, 0, false, 100]) == count _players
As Im writing this lol how does it know which is greater and less than?
greater than 200, you'd be comparing to an empty array
_players inAreaArray [ASLToAGL getPosASL _x, 100, 100, 0, false, 100] isEqualTo []
this addAction ["Open Dock Door", {
0 spawn {
params ["_target","_caller"];
if (isNull getAssignedCuratorLogic _caller) exitWith {};
DDDoor enableSimulationGlobal true;
DDDoor animate ["open_left", 1, 0.2];
DDDoor animate ["open_right", 1, 0.2];
sleep(40);
DDDoor animate ["open_left", 0, 0.2];
DDDoor animate ["open_right", 0, 0.2];
DDDoor enableSimulationGlobal false;
}
}]``` arma complaining _caller is undefined 
_this spawn
also stay in unscheduled for aslong as you can
you first 5 lines could be before the spawn
i could just wrap the sleep in the spawn could i not
does it actually
wiki states so
oh gosh
The script, whether it is a file or a code, will run in scheduled environment, i.e. it is ok to use sleep
bruh moment

i actually didn't know that 
Well thank you very much! It worked in SP and I've been working on it for a week and it gave weird behavior in MP Dedicated... lol
is it a good replacement for "player" in MP Dedicated?
_players = allPlayers select {alive _x};
player returns the player controlled unit on the current machine
your code returns all alive players in the mission
yea, to my understanding, player shouldn't be used in MP Dedi because its objNull?
correct
You can use it in an MP game that's being hosted on a dedicated server, you just can't use it on the dedicated server machine itself, only on clients that actually have players
So, if I was to put this in a trigger onact:
count (player inAreaArray [ASLToAGL getPosASL _x, 100, 100, 0, false, 100]) == count player```
with Server Only Checked, that shouldn't work? Because its only be evaluated on the server?
But if I did the same code above without Server Only Checked, it should work?
I understand the concept of Locality, but then I dont lol
It would """work""" but it's not the right way to do it. player only returns the local player unit on the current client that the code is being executed on. count player would always be 1. It doesn't return every player, just this player.
ahh, okay
Actually count player probably would cause a script error because player returns object, not an array or anything else that can be counted
yep
So the correct way in MP Dedi is to use sqf allPlayers
for this purpose it appears that way. But it's not a universal answer, sometimes there are things you want to use player for in a DS mission. Just not this.
use distance if it's just for a single unit, it's cheaper
yea, I was wanting the code to be affected by any player near a target to prevent it from popping up again.
so it seems yours will work the best.
pretty cool
so another question, because this is a while do loop, would it be better to do it via a trigger onact with a spawn block or would it be better to execVM via a function or file? Just thinking performance.
function is best
okay, I've been looking into functions, but I'm just not there yet lol
https://community.bistudio.com/wiki/Arma_3:_Functions_Library is all you need
yea I was reading it, but calling a function is where I'm confused lol like would I do: sqf execVM Tag_fnc_thing;?
ahh okay spawn it
could you make the time of day as night time for the local player? 🤔 cant test if it'd work or not atm
you can but it will sync with the server shortly afterward
yeah, thats the emphasis on the could part -- an oneachframe would work I would imagine but be quite bad on performance? 🤔
you could always try but I would imagine that's the case
seeing as the mission is hovering around 8k 3den objects i think it'd be smarter to keep performance up :p
setting time isn't the quickest engine function
Only looking to get players that are in a current list to add an addAction from a trigger. Would this work:
_players = allPlayers select {alive _x};
{ maingatecac = _x addAction ["Show CAC", "mgate.sqf"];} foreach thislist select _player```
well, I want to add the addAction to only the players in the trigger and no one else.
if the trigger runs locally for every client then yeah, if you got select right
I don't know what you're doing specifically but it seems like it's being overcomplicated
is a trigger strictly necessary?
Yea, I wanted to do an addAction only on an object, but while in a vehicle, players aren't able to activate the addAction sometimes. So my work around is to use a trigger so that when a player enters the trigger, it will force the addAction on the player. But the way had it before, which was sqf player addAction <code>; it would place the code on every player in the server.
I don't think your select is correct syntax
maybe you're looking for arrayIntersect?
wait _player and _players 
i mean _players lol
array select array is not correct syntax
You would want thisList select {_x in _players}
But I can't shake the feeling the better approach would be to add the action to everyone, and give it a nice condition that makes it only appear when the player is in the relevant area
are dead players even counted in thisList?
I tried:
{ maingatecac = _x addAction ["Show CAC", "mgate.sqf"];} foreach thislist select {isPlayer _x}```
But it would also assign it to the vehicle and wouldn't remove it when I did ```sqf
player removeAction maingatecac;```
I will try this!
"player inAreaArray yourTrigger" //wrong, i meant inArea
``` would be appropriate for the action condition yeah?
I have the condition to of anyPlayer present
or even list
Not the trigger condition, the action condition
thisList select {_x in _players}
usearrayIntersect
hold on looking it up lol
No, not really - inAreaArray doesn't return bool
so do:
_players = allPlayers select {alive _x};
{ maingatecac = _x addAction ["Show CAC", "mgate.sqf"];} foreach (thisList arrayIntersect _players);```?
That may work.
However, I still think it's probably better to add the action to everyone, and give it a condition that makes it only available when the player is in the area. Much less of a pain in the ass.
I have two gates, im all about learning so Ill do both! lol
player addAction ["Show CAC", "mgate.sqf", nil, 1.5, true, true, "", "_target inArea yourTriggerVariable"];
run this on every client and you should be fine unless I missed something again
so that would be good to use in the init.sqf?
also, will it remove the addAction when they leave the trigger area?
it wont show the action unless the condition is met, just like how a trigger constantly checks the condition
ahh, okay
this is the easiest way for conditions that are not performance-intensive
so what is "_target"?
https://community.bistudio.com/wiki/addAction see condition
when there is a script error is there a way to make that black box bigger or something so I can read it fully?
go to %localappdata%\Arma 3 where your .rpt files (probably) are and open them as text files
I can't run this in a trigger because this is a local variable right?
_players = allPlayers select {alive _x};```
nope
you can define local variables as much as you want
so that would work
youre gonna make me cry lol
you can't reference local variables you defined outside the trigger
So this is working on Dedicated but when I added it to my mission it doesnt work...
skillspopup = true; publicVariable "skillspopup";
_players = allPlayers select {alive _x};
[_players] spawn {
params ["_players"];
_skillstargets = nearestObjects [skilltgt, ["TargetBase"], 1000];
{ _x animate ["Terc", 1]; } foreach _skillstargets;
while {skillspopup} do {
{
if (count (_players inAreaArray [ASLToAGL getPosASL _x, 70, 70, 0, false, 70]) == count _players) then {
_skillstargets = _skillstargets - [_x];
};
if (_players inAreaArray [ASLToAGL getPosASL _x, 200, 200, 0, false, 200] isEqualTo []) then {
_x animate ["Terc", 1];
} else {
_x animate ["Terc", 0];
};
if (count (_players inAreaArray [ASLToAGL getPosASL skillstgtactive, 80, 80, 0, false, 80]) == count _players) == count _players then {
_x animate ["Terc", 0];
}
} foreach _skillstargets;
pltskillstimer = selectRandom [10,15,20];
uiSleep pltskillstimer;
}
}```
the targets pop down, but its like the while loop isn't running. But the "skillspopup" is set to true.
the rpt file has some stuff about which dlcs I have in it
The RPT has a lot of things in it. Only some of them are relevant to what you're after. Try scrolling to the end and working from there, or if you remember some keywords from the script error ctrl+f for them.
multiple things to unpack there, but first step (assuming you're just running it in the editor preview) is to add some form of debug lines to find where the issue is. systemChat logs to the chat box and diag_log logs to the .rpt, whichever is more convenient for you
did you write this script?
Well, in SP and Dedicated where this is the only thing on the map, it runs just fine. Everything works. But once I add it to my mission file on MP Dedi it just doesnt loop. I assume because its not finding player. But yea, let me try systemChat. and yea I wrote this. lol thats why it doesnt work!
is there something I need to do to generate it cus I went in singleplayer then mp got the error went back to check and there is no new rpt
make sure logging is enabled
some performance guides tell the masses to disable logging (to our peril)
just because it bothers me
pltskillstimer = selectRandom [10,15,20];
uiSleep pltskillstimer;
``` is redundant, you just need
```sqf
uiSleep (10 + random 10);
unless you're referencing that variable elsewhere
Aside from what Real Artisan Foods said, as long as you don't restart the entire game client, new logs are added to the same RPT file
so I did the selectRandom to try and select a different time every time. I couldn't find a selectRandomrange
so that will do like a random range?
random 10 will return a random number between 0 and 10
add 10, there's your 10-20 range
ahh
okay, going to test with this, lol hopefully itll give me something...
skillspopup = true; publicVariable "skillspopup";
_players = allPlayers select {alive _x};
[_players] spawn {
params ["_players"];
_skillstargets = nearestObjects [skilltgt, ["TargetBase"], 1000];
{ _x animate ["Terc", 1]; } foreach _skillstargets;
systemChat "Loads before while loop.";
while {skillspopup} do {
systemChat "Loads loop start.";
{
if (count (_players inAreaArray [ASLToAGL getPosASL _x, 70, 70, 0, false, 70]) == count _players) then {
_skillstargets = _skillstargets - [_x];
};
if (_players inAreaArray [ASLToAGL getPosASL _x, 200, 200, 0, false, 200] isEqualTo []) then {
_x animate ["Terc", 1];
} else {
_x animate ["Terc", 0];
};
if (count (_players inAreaArray [ASLToAGL getPosASL skillstgtactive, 80, 80, 0, false, 80]) == count _players) == count _players then {
_x animate ["Terc", 0];
}
} foreach _skillstargets;
systemChat "Loads before timer";
uiSleep (10 + random 10);
systemChat "Loads after timer";
}
}```
bear in mind that systemChat is local, so this will only show chat if you run it on your client
or just remoteExec systemChat
tru
or log to dedi rpt
if (count (_players inAreaArray [ASLToAGL getPosASL skillstgtactive, 80, 80, 0, false, 80]) == count _players) == count _players then
is this a typo?
im the R word
lol
no way
it should be
((count (_players inAreaArray [ASLToAGL getPosASL skillstgtactive, 80, 80, 0, false, 80]) == count _players) == count _players)
ugh and its in every one lol
I think that might be the problem
You have only solved part of the problem with that
Take a moment to go through the logic of what each step is doing. Here's a hint: one of your layers is redundant.
hmm
you're not pasting this code into multiple triggers are you?
so my thought process:
if (count (_players inAreaArray [ASLToAGL getPosASL _x, 70, 70, 0, false, 70]) == count _players) then {
_skillstargets = _skillstargets - [_x];
};```
This removes the target from the list so that it doesnt popup if a player is within 70m of the target. If they are not, it should be skipped and they should popup.
```sqf
if (_players inAreaArray [ASLToAGL getPosASL _x, 200, 200, 0, false, 200] isEqualTo []) then {
_x animate ["Terc", 1];
} else {
_x animate ["Terc", 0];
};```
this block checks to make sure any target greater then 200m of a player, is not popped up so that only some sections are active at a time as they progress.
```sqf
if (count (_players inAreaArray [ASLToAGL getPosASL skillstgtactive, 80, 80, 0, false, 80]) == count _players) then {
_x animate ["Terc", 0];
}; ```
This part, there is a section of the course that the targets are greater then 200m but I need it to popup only when they get to that section. So the skillstgtactive variable object once they get within 80m of the target, it pops up the further targets that are around 500m.
Okay, no, it's simpler than that, I am only talking about in the context of the if condition
This if condition specifically
hmm, im trying to see it lol but I'm lost. something is redundant.
You have == count _players twice. You only need one. The second one is...not good
so it should be = count _players
does count even need to be there?
== can compare arrays directly right?
oh guess not
No, I mean you literally have the expression == count _players twice. You only need one instance of == count _players
ohhhhhhhhhhhhhhh
^
(it cant, keep count)
Okay, the testing block:
skillspopup = true; publicVariable "skillspopup";
_players = allPlayers select {alive _x};
[_players] spawn {
params ["_players"];
_skillstargets = nearestObjects [skilltgt, ["TargetBase"], 1000];
{ _x animate ["Terc", 1]; } foreach _skillstargets;
["Loads before while loop."] remoteExec ["systemChat", 0];
while {skillspopup} do {
["Loads loop start."] remoteExec ["systemChat", 0] ;
{
if (count (_players inAreaArray [ASLToAGL getPosASL _x, 70, 70, 0, false, 70]) == count _players) then {
_skillstargets = _skillstargets - [_x];
};
if (_players inAreaArray [ASLToAGL getPosASL _x, 200, 200, 0, false, 200] isEqualTo []) then {
_x animate ["Terc", 1];
} else {
_x animate ["Terc", 0];
};
if (count (_players inAreaArray [ASLToAGL getPosASL skillstgtactive, 80, 80, 0, false, 80]) == count _players) then {
_x animate ["Terc", 0];
}
} foreach _skillstargets;
["Loads before timer"] remoteExec ["systemChat", 0] ;
uiSleep (10 + random 10);
["Loads after timer"] remoteExec ["systemChat", 0] ;
}
}```
isEqualTo can do it, but I'm pretty sure it would require the arrays to be in exactly the same order, which I don't think can be guaranteed in this context
- without adding a sort which would be a waste of performance
if (count (_players inAreaArray [ASLToAGL getPosASL _x, 70, 70, 0, false, 70]) == count _players) then {
_skillstargets = _skillstargets - [_x];
};
``` @cold pagoda I don't quite follow the logic here. If all players are near the target, it is permanently removed from the list of targets?
shouldn't it be ```sqf
(count (_players inAreaArray [ASLToAGL getPosASL _x, 70, 70, 0, false, 70]) > 0)
well, I just want at least 1 player near the target. Once at least 1 person is near it, it will remove that target from the variable.
and the _skillstargets should be refreshed after the loop, right?
well, doesnt it technically refresh it with:
_skillstargets = _skillstargets - [_x]; ```
all that does is subtract the target from the array. How does it get added back in?
ahh, yea, so it gets added back in when they leave the trigger area and go back in to restart it.
okay
how about this?
now... I assume, when we do false on the while loop, it destroys the spawn?
yeah it skips the loop and terminates the spawned script
okay, I thought so lol
okay, about to test it.
lol it works! it was because of that ")"
and it having the double "=="
epic
Anyone have an idea on how to return all applied .bisurf materials to each hit point of a vehicle, or something that can give me a step in the right direction?
Being a pain trying to abuse the "HitPart" event handler applied to either bullets or the object itself
{
_x setCombatMode "RED"
} forEach allUnits;
``` would this work or does it need to be for group
add points to a zeus every 60 seconds if zeus team owns the sector
anyone have an idea on how i could do that?
how could i do this but loop it where when owning the sector it would generate points on the sector ```cpp
{
[ _x, "ownerChanged", {
params[ "_sector", "_owner", "_ownerOld" ];
if ( _owner isEqualTo EAST ) then {
ZI addCuratorPoints 0.5;
};
if ( _owner isEqualTo WEST ) then {
ZO addCuratorPoints 0.5;
};
if ( _owner isEqualTo independent ) then {
ZI addCuratorPoints 0.5;
};
}] call BIS_fnc_addScriptedEventHandler;
}forEach ( true call BIS_fnc_moduleSector );
im afraid of it getting caught in a loop if i use a loop to generate points
then run adding the EH after all the points are created 🤷♂️
add points to a zeus every 60 seconds if zeus team owns the sector
or actually write in SQF what you've asked initially
while {true} do {
sleep 60; // every 60 seconds
if (east call BIS_fnc_moduleSector > 0) then {ZI addCuratorPoints 0.5}; // if team owns any sectors - add zeus points
if (west call BIS_fnc_moduleSector > 0) then {ZO addCuratorPoints 0.5};
if (independent call BIS_fnc_moduleSector > 0) then {ZI addCuratorPoints 0.5};
};``` 🤷♂️
i appriciate it
What is the maximun visible distance of a laser draw with drawLaser?
I know it's is not draw if you is too far away.
It should be getObjectViewDistance
@warm hedge i found 1700 meters by visual inspection, i will check getObjectViewDistance. Thanks!
Hi,
For this (for my own)
Can you use ||
Like
If (_owner isEqualTo (east || independent)) then {
..
} else {
};
Or should it be
If (_owner isEqualTo east || _owner isEqualTo independent) then {
..
} else {
};
|| is logical OR, it needs two booleans to its side. So you either go for the _owner isEqualTo east || _owner isEqualTo independent, or go for _owner in [east, independent] to check a variable against the list 🤷♂️
Thanks
also you can use == instead of isEqualTo
isEqualTo is fine, in some cases it's a tiny bit faster than == even
just less to type 🙂
and how would i do this if its in an init?
one with addaction
just run addaction in the Init, it would get executed on all machines by default 🤷♂️
and then the functions inside of it as remoteexec right?
🤷♂️ if the code of action needs to be executed on every machine - you make it remoteexec. If it doesn't - you don't
Yeh,
More i was interesting how to use || (or)
my sector respawn expression seems to of just stopped working 8:19:00 Error in expression <sectorRespawn call BIS_fnc_removeRespawn> 8:19:00 Error position: <sectorRespawn call BIS_fnc_removeRespawn> 8:19:00 Error Undefined variable in expression: sectorrespawn
sectorRespawn call BIS_fnc_removeRespawnPosition; sectorRespawn = [(_this select 1), (_this select 0)] call BIS_fnc_addRespawnPosition;
am i doing something wrong?
if that's exactly what you're running - you are using the variable before you give it any value 🤷♂️
I have a display that I change the texture of by script. the first time a texture gets applied there is a brief flash.
Im guessing the texture gets cached or something because the flashing stops after the first loop, any way to do that manually from start?
you didn't reload the script then
or aren't showing the entirety of situation
i.e. the map had a "sectorRespawn" assigned, say, in-editor and script is intended to replace it 🤷♂️
well it was working then i added an ambient civilian presence module and then it stopped, i checked my log and it said what i replied to
actually i did mess with a script using sectors i wonder if its killing that
i remember now lemme disable that
disabling it seems to of not changed anything
is there anywhere other then rpt log that say any errors ?
actually its strange so the error its self disappears when i have it the right way round but it still says respawn disabled?
i guess ill put my rpt log
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
no
yes?
on the server, use time and do your calculations?
I'm quite new to mission making and scripting. I'm trying to spawn enemies and have a task start upon a trigger. But since I'm using !alive to check if the units are alive it checks that before they spawn so nothing works. Just wondering if anyone could help me out
Do you spawn enemies from script or from module? Do they have variable name ? If they have you can add condition to trigger
!isNull ( missionNamespace getVariable[ "grpVariableName", grpNull ] )
I just have the enemies spawn from a trigger since I'm just testing things out
they do have variable names as well
and then the task is is just started from the trigger as well but the !alive is already active so nothing spawns. So is there a way to delay it or a wait until?
you're spawning units with one trigger and checking their state with another?
yes
(triggerActivated trigger1) && (_yourUnitArray findIf {alive _x} == -1)
And should I be putting that in the trigger for the task that checks if they are alive
triggerActivated checks if another trigger has been activated, and the && operator checks if both conditions are true
for the condition on the right I just made something up because you haven't shared what your trigger condition is
Okay, I'll give it a test and my trigger condition is just triggerActivated task1_complete but I'll let you know if it works when I put what you wrote in
i thought you said your trigger condition checks if they are alive?
there's nothing wrong with the trigger that spawns them right?
My bad I actually meant I'm unhiding the units with trigger instead of spawning them
How do I estimate the angle/vector regarded to the zeroing offset?
(disclaimer: I'm not a math guy)
shoot and compare
🔨
You can get the zeroing distance from currentZeroing and then something something cfgAmmo ballistics maths? Or make a general assumption that x distance is probably roughly y degrees elevation, depending on how accurate you need to be
If I can get the vector that the bullet should fly (aka final vector minus the dispersion) that's much better
is there a way to script trigger for a heli to come offmap into the map to drop something off
yeah
so I'm trying to give an aircraft Infinite fuel
and i came up with this to put into its Init
params ["_vehicle", "_hasFuel"];
if (_hasfuel == false) then
{
hint "refueled";
_vehicle setFuel 1;
};
}];
this doesn't seem to work, I'm guessing I'm just not using the EH correctly or there's a scope issue but could someone explain to me what's wrong here?
this addEventHandler ["Fuel", {
params ["_vehicle", "_hasFuel"];
if (!_hasFuel) then { hint "refueled"; _vehicle setfuel 1; };
}];```should work but remember that it will activate when fuel reaches 0, so you'll have to start engine again
isn't there an engineOn true way?
ah right, can be added after setfuel
and for planes you could add setAirplaneThrottle, not sure what for helicopters if anything at all
how to export gui editor to something that can be run in debug
Pretty sure there's a GUI button in the debug console
Once in the editor, here's the hotkeys (and other info) on how to export and all that:
https://community.bistudio.com/wiki/Arma_3:_User_Interface_Editor#Key_Shortcuts
If you have a premade GUI or one in progress you're working on, you can import it through the GUI editor to continue working on it. Otherwise, no way to just execute in debug since it likely requires a defines.hpp and config.hpp
how do I make it sqf I mean not hpp or anything like that
An SQF based interface is created without the GUI editor to my knowledge and uses script commands (Not as hard as it seems, I prefer the scripted method).
https://community.bistudio.com/wiki/Category:Command_Group:_GUI_Control
Example:
test = true;
waitUntil { !isNull (findDisplay 42) };
private _myDisplay = findDisplay 42 createDisplay "RscDisplayEmpty";
private _b1 = _myDisplay ctrlCreate [ "RscButton" , 0506661]; //ID is whatever you want, has to be unique
_b1 ctrlSetPosition
[
(0.325*safezoneW+safezoneX),
(0.38*safezoneH+safezoneY),
(0.09*safezoneW),
(0.025*safezoneH)
];
_b1 ctrlSetBackgroundColor [ 0 , 0 , 0 , 1 ];
_b1 ctrlSetText "TEST";
if ( test ) then {
_b1 ctrlSetTextColor [ 0 , 1, 0 , 1 ];
}else{
_b1 ctrlSetTextColor [ .5 , .5 , .5 , 1 ];
};
_b1 ctrlSetTooltip "Test tooltip";
_b1 ctrlAddEventHandler [ "ButtonClick" , {
if ( test ) then {
(_this#0) ctrlSetTextColor [ .5 , .5 , .5 , 1 ];
test = false;
}else{
(_this#0) ctrlSetTextColor [ 0 , 1 , 0 , 1 ];
test = true;
};
}];
_b1 ctrlCommit 0; //Required for changes to actually work
@violet gull where do I see the other display numbers like for escape menu and stuff
Some helpful IDDs listed here:
https://forums.bohemia.net/forums/topic/204462-armas-dialogs-and-displays-list/
@open fractal @hallow mortar I'm back.. So, I was able to test this on dedi with more then just myself on the server. So, I have to find a better way to represent "player".
So sqf _players = allPlayers select {alive _x};
When a player would get near a target, it wouldn't remove the target from the target variable:
_man242targets = nearestObjects [man242center, ["TargetBase"], 50];```
```sqf
if (count (_players inAreaArray [ASLToAGL getPosASL _x, 20, 20, 0, false, 20]) == count _players) then {
_man242targets = _man242targets - [_x];
}```
it seems that its random as to when it wants to remove a target from the variable and it doesn't seem that it evaluates allPlayers as a player. Do you know of a better way to represent player with multiple players in MP Dedicated?
allPlayers returns an array of all players and headless clients
allPlayers as a player
apples and oranges
i already wrote you an example of evaluating if any player is nearby
I'd recommend creating a separate array of nested arrays like this:
private _players = [];
{
_players pushBack [ _x distance _badboi , _x ];
}forEach (allPlayers select {alive _x});
_players sort true;
private _nearestPlayer = ( _players # 0 ) # 1;
Sorts players based on distance from _badboi in a separate array, then selects nearest player
why do that instead of inAreaArray
Then it'll be random
well, Im using your example:
(count (_players inAreaArray [ASLToAGL getPosASL _x, 70, 70, 0, false, 70]) == count _players)```
This is the entire code which uses your example:
```sqf
skillspopup = true; publicVariable "skillspopup";
_players = allPlayers select {alive _x};
[_players] spawn {
params ["_players"];
_skillstargets = nearestObjects [skilltgt, ["TargetBase"], 1000];
{ _x animate ["Terc", 1]; } foreach _skillstargets;
while {skillspopup} do {
{
if (count (_players inAreaArray [ASLToAGL getPosASL _x, 70, 70, 0, false, 70]) == count _players) then {
_skillstargets = _skillstargets - [_x];
};
if (_players inAreaArray [ASLToAGL getPosASL _x, 200, 200, 0, false, 200] isEqualTo []) then {
_x animate ["Terc", 1];
} else {
_x animate ["Terc", 0];
};
if (count (_players inAreaArray [ASLToAGL getPosASL skillstgtactive, 80, 80, 0, false, 80]) == count _players) then {
_x animate ["Terc", 0];
}
} foreach _skillstargets;
uiSleep (10 + random 10);
}
}```
Because it is launching via a trigger onAct with Server only unchecked, could that be causing anything? Would it be better do do an execVM with server only checked?
that is not my example.
Oh, was it this:
(count (_players inAreaArray [ASLToAGL getPosASL _x, 70, 70, 0, false, 70]) > 0)```
?
yes
ahh, sorry about that
Is there a good way to test if a OnPlayerRespawn.sqf is written correctly/firing? I use sublime and have the SQF formatting but don't know how to test it and I think mine isn't working properly. Pretty amateur/new to this sorry!
You can create a mission in the editor, Export to MP, then try MP hosting it yourself and just respawn in the mission. If your code does the things on respawn, it works.
Ah okay, it's not working then 😢
@violet gull I kind of got it working the stop animation button works but im not sure how to make the list buttons do something
You can use ctrlAddEventHandler, think that's what I use
The example I gave makes the button text color change when you click it
you were originally trying to do _x distance _players which as i've said previously doesn't work, that to me looked like you were wanting to check if all _players are close, the code i sent does exactly that, if you're looking for only atleast one player in range, compare > 0 instead
if you mean manually, you can simply execVM (or other option) it with some dummy args, fx., [player, player] call compileScript ["OnPlayerRespawn.sqf"]
you can use https://community.bistudio.com/wiki/User_Interface_Event_Handlers#onLBDblClick or other listbox related EHs
I know how to make normal button do something but I dont know how to make list box button do something
am_list ctrlAddEventHandler ["LBDblClick",{
params ["_idc", "_Index"];
if (_idc lbText (_Index) == "dance" ) then {
player switchmove"";
player switchmove "Acts_Dance_01";
_idc ctrlSetTooltip "dancing :)";
};
if (_idc lbText (_Index) == "KO" ) then {
_idc ctrlSetTooltip "Nice Hit :)";
player switchmove"";
player switchmove "acts_miller_knockout";
};
}];
try this maybe
works great i changed LBDblClick to LBSelChanged very clean
Nice👍
If I get a missionNamespace variable
_omtk_wu_is_completed = missionNamespace getVariable ["omtk_wu_is_completed", false];
and use it as a while loop condition running on clients waiting for it to be true, set by server, do I need to get it all the time in the loop, or will it automatically update once server pushes the update?
_omtk_wu_is_completed wouldn't update by itself (unless it's an array, but it would be a dodgy territory)
It's a simple true/false, so I need to call this in the while loop and update it manually.
Thanks for the info!
is it possible to make ctrlSetBackgroundColor match whatever the player color is
Does anyone here have much experience with onPlayerRespawn.sqf? I am trying to implement some help someone gave me with ACRE2 but I think I've done something wrong with that particular file.
What do you mean by player color?
pColor = ["IGUI", "BCG_RGB"] call BIS_fnc_displayColorGet;
am_search ctrlSetBackgroundColor pColor;
```like this?
Try not to use a global variable only for that, use local variable
Or, simplysqf am_search ctrlSetBackgroundColor (["IGUI", "BCG_RGB"] call BIS_fnc_displayColorGet);
Hi guys question. How can i detect when player is using UAV or Plane camera. Is there EH or something like that ?
Targeting pod you mean?
Yea So basicly what i want to do is have this compass what KK made and enable it when player is in targeting pod/ camera.
http://killzonekid.com/arma-scripting-tutorials-3d-compass/
Maaaybe try this?
https://community.bistudio.com/wiki/cameraView
Ty i manage to get it working.
Also a question is this code MP friendly ?
here is code if anybody else is interested:
onEachFrame {
private _veh = vehicle player;
private _uav = getConnectedUAV player;
if(_veh isKindOf "Air" || _uav isKindOf "Air") then {
if(cameraView == "Gunner") then {
{
_center = positionCameraToWorld [0,0,3];
_x params ["_letter", "_color", "_offset1", "_offset2"];
drawIcon3D [
"",
_color,
_center vectorAdd _offset1,
0,
0,
0,
_letter,
2,
0.05,
"PuristaMedium"
];
drawIcon3D [
"",
_color,
_center vectorAdd _offset2,
0,
0,
0,
".",
2,
0.05,
"PuristaMedium"
];
} count [
["N",[1,1,1,1],[0,1,0],[0,0.5,0]],
["S",[1,1,1,0.7],[0,-1,0],[0,-0.5,0]],
["E",[1,1,1,0.7],[1,0,0],[0.5,0,0]],
["W",[1,1,1,0.7],[-1,0,0],[-0.5,0,0]]
];
};
};
};
onEachFrame is always not recommended to be used in your actual code
And... I don't think this somehow wouldn't work in MP game. Everything should be local, yes? Then this is fine, except onEachFrame
Instead onEachFrame would it be better to use MEH EachFrame ?
yyyyep
Oh yeah, true
^
in my (limited) testing "EachFrame" behaved better than "Draw3D" for a geometry/coordinate task (imitating a visible laser pointer with drawLaser, though 🤔
or your spawn, we don't judge
Idk if you are still refuring to is that better then OneachFrame but for the 3d Compass to update visual you need somekind of loop with that you would have only 1 call ?
we'd judge execVM inside the EH, though 🍿
"don't draw the stuff when the game isn't active". IIRC there was some funny game-crashing bug some time ago that was suspected to be caused by drawcalls accumulation when the game was in background. Or something like that.
onEachFrame does not care if UI is available or not, means you need to check manually (fx., isGameFocused)
Hi another question is there a way to detect zoom level of a targeting pod / camera.
why does arma read input anyway when in background? sometimes alt-tab causes editor stuff , for example, to move around
no one else has this problem 😵💫
everybody is "meh, this is arma. Nothing exploded - then everything is good"
we have flying tanks, I mean
my head explodes... does that count? 😄
Hi so i have this problem where the compass is lagging behind the camera cursor when in flying/moving vehicle any tips how to fix this Picture:https://gyazo.com/a4673ca6660454b273122421dda505d7
it's a still image, what is the actual angle?
So this is when the plane is stationary: https://gyazo.com/2af068d27c46f6e0bfa2223110b67071 and this is when the plane is moving: https://gyazo.com/15a2a3da40cf05dab9602d59cf61d317
Also i have a problem once i enter in camera then when i exit and control the guy and use the guns optics then it also shows the compass but i want it to only show in targeting pod / camera code:
addMissionEventHandler ["EachFrame", {
if (!isGameFocused) exitWith {};
private _veh = vehicle player;
private _uav = getConnectedUAV player;
if(_veh isKindOf "Air" || _uav isKindOf "Air") then {
if(cameraView == "Gunner") then {
{
_center = positionCameraToWorld [0,0,3];
_x params ["_letter", "_color", "_offset1", "_offset2"];
drawIcon3D [
"",
_color,
_center vectorAdd _offset1,
0,
0,
0,
_letter,
2,
0.05,
"PuristaMedium"
];
drawIcon3D [
"",
_color,
_center vectorAdd _offset2,
0,
0,
0,
".",
2,
0.05,
"PuristaMedium"
];
} count [
["N",[1,0.1,0.1,1],[0,1,0],[0,0.5,0]],
["S",[1,1,1,0.7],[0,-1,0],[0,-0.5,0]],
["E",[1,1,1,0.7],[1,0,0],[0.5,0,0]],
["W",[1,1,1,0.7],[-1,0,0],[-0.5,0,0]]
];
};
};
}];
@fleet sand please use https://sqfbin.com/ for big chunks of code
https://community.bistudio.com/wiki/lookAt
are arguments global or local? and is the effect local or global?
local like the other AI related commands probably
shouldn't be a concern, you should always be doing AI stuff locally (imho)
on the position lagging behind when the vehicle is moving - "Draw3D" EH seems to get rid of that O_o
its not a big chunk tbh, longer text paragraphs change to a txt attachment
the lagging is answered above, use Draw3d, the latter, you're checking the connected UAV, but not if the player currently is controlling it, maybe something like https://community.bistudio.com/wiki/shownUAVFeed
Discord does that to 2000+ chars text iirc
I am more concerned about having to scroll down a wall of text 😄
power abuse!!!
wondering if the unit will look at something and every client will be able to see it looking at that thing
basically if its GE
shownUAVFeed doesn't seem to work, but UAVControl getConnectedUAV player can work, i.e.sqf _control = (UAVControl getConnectedUAV player); if ((_control find player) + 1 == _control find "GUNNER") then {hintSilent "Player is currently gunning UAV"};
but the return format of https://community.bistudio.com/wiki/UAVControl is kinda bizarre
how so?
single interlaced array of ["unit1", "role1", "unit2", "role2"]. Are there many other operators with returns like that?
fullCrew, for example (which has similar enough intent), returns array of array-per-unit-s
some others
it was extended this way in order to not have array of array, which would break backward compatibility
yep. I can see it's the extension of previous single-unit-only version. But the output format is still bizarre
bizarre but understandable 😉
another way would have been [unit1, "role1", [[unit1, "role1"], [unit2, "role2"]]
but, hey, "it is how it is" now
@fleet sand sorry for ping, but i feel the message can get lost in the wall of text :3
when importing config into gui editor where does the path have to be from?
Yea no worries for the ping. Ty very mutch for your help i mannage to get it working. But now i would like to see if i can resize the compass depending on the zoom level on the camera if you have any tips how i would go about doing that. Here is working version: https://sqfbin.com/qotevubehilavutozoju
yeah ofc
Looking for a script or mod that allows you to fill out a card, like a casualty or capture card with details of time, injury etc. Does anyone have anything like that?
That feels like something ACE would have, but I don't use ACE so I can't prove it
ace got a list of injurys in his medical menu but no card or something like that
also i need a bit of help at scripting i tried to make an easy revive system that works with ace and it works but the action for reviving someone is added 4 times anyone now how to fix that ? https://steamuserimages-a.akamaihd.net/ugc/1811034537817056754/A47FF22A282AD90C5D0C8385486E1D8FC96F0213/?imw=5000&imh=5000&ima=fit&impolicy=Letterbox&imcolor=%23000000&letterbox=false
script called by this eventhandler player addEventHandler ["Dammaged", { if (lifeState player == "INCAPACITATED") then { execVM "Wiederbeleben.sqf"; } }];
Wiederbeleben.sqf script ```[player] remoteExec ["removeAllActions"];
[
player, // Object the action is attached to
"Wiederbeleben", // Title of the action
"A3\Ui_f\data\IGUI\Cfg\HoldActions\holdAction_revive_ca.paa", // Idle icon shown on screen
"\A3\Ui_f\data\IGUI\Cfg\HoldActions\holdAction_revive_ca.paa", // Progress icon shown on screen
"true", // Condition for the action to be shown
"true", // Condition for the action to progress
{ hint "Started!"; _name0 = name _target; _name1 = name _caller; format ["%1 wird von %2 Wiederbelebt", _name0 , _name1] remoteExec ["systemChat", 0]; _caller playAction "MedicOther";}, // Code executed when action starts
{}, // Code executed on every progress tick
{["#rev", 1, _target] remoteExecCall ["BIS_fnc_reviveOnState", _target]; [_target] remoteExecCall ["BIS_fnc_reenableRevive"]; _target setUnconscious false;
[_target] remoteExecCall ["ace_medical_treatment_fnc_fullHealLocal"]; [_target] remoteExec ["removeAllActions"];
_name3 = name _target; _name4 = name _caller; format ["%1 wurde von %2 Wiederbelebt", _name3 , _name4] remoteExec ["systemChat", 0]; }, // Code executed on completions
{ hint "Abgebrochen"; _name2 = name _target; format ["Das Wiederbeleben von %1 wurde abgebrochen", _name2] remoteExec ["systemChat", 0];}, // Code executed on interrupted
[], // Arguments passed to the scripts as _this select 3
6, // Action duration in seconds
9999, // Priority
true, // Remove on completion
false // Show in unconscious state
] remoteExec ["BIS_fnc_holdActionAdd", 0, player]; ```
You need to detect a transition between lifeStates. Otherwise you'll be firing that script several times each time a player is downed.
So setVariable a lastLifeState var on the player or something like that.
also make a function (https://community.bistudio.com/wiki/Arma_3:_Functions_Library), you're recompiling your script everytime that event fires
running into an issue somewhere with _position1 not being set properly resulting in _weaponholder being in an undefined position ive tried a few things and cant see why it isnt working https://sqfbin.com/minuxudedusadofopaqa any ideas?
around line 102-107 and line 32-34
indeed.
Not all buildings have positions.
i know these buldings have positions
and how does "not set properly" and "in an undefined position" look like?
at the position 00
bottom left corner of the map
try adding systemchat str(_buildingPositions); at line 101 and see what it says
or diag_log if you need more persistent tracing.
sorry for ping
the lightpoints won't appear regardless how i do it.
//CfgFunctions via description.ext
class CfgFunctions
{
class PARADOX
{
class missionFunctions
{
class setBulletLight1 {};
};
};
};
//setBulletLight1.sqf
my_fnc_createLightpoint1 =
{
params ["_bullet1"];
_light1 = "#lightPoint" createVehicleLocal [0,0,0];
_light1 attachTo [_bullet1,[0,0,0]];
_light1 setLightIntensity 300;
_light1 setLightAmbient [0,0,0];
_light1 setLightColor selectRandom [[1,1,1],[1,0,0],[1,0,1],[1,1,0],[0.5,0.5,1],[0,1,0]];
_light1 setLightUseFlare true;
_light1 setLightDayLight true;
_light1 setLightFlareSize 1;
_light1 setLightFlareMaxDistance 500;
waitUntil {isNull _bullet1};
deleteVehicle _light1;
};
how it is called:
https://sqfbin.com/eyajadagovukiwonepun
that's not how CfgFunctions works https://community.bistudio.com/wiki/Arma_3:_Functions_Library. Do you actually run the sqf file with, say, execVM? If not - there shouldn't be any my_fnc_createLightpoint1, so there's nothing to remoteExecCall 🤷♂️
im like
XD
CfgFunctions compiles the code for you, and assigns it to a variable, you don't need to do anything additionally
with the CfgFunctions you've sent ArmA will try to find a function at <missionRoot>/functions/missionFunctions/fn_setBulletLight1.sqf
the name of the function would be PARADOX_fnc_setBulletLight1
so for it to work via CfgFunctions you'd need to move and rename the souce file accordingly and either a) remove my_fnc_createLightpoint1 = { ... } wraparound from your function and then remoteExec the PARADOX_fnc_setBulletLight1 (and remoteExecCall wouldn't work, because waitUntil {...} wouldn't work there
if _bullet is a projectile indeed, you can use ammo event handlers over polling whether it's null or not
or b) run PARADOX_fnc_setBulletLight1 at least once at every machine for it to create a my_fnc_createLightpoint1 function at every machine and then remoteExec it (remoteExecCall still wouldn't work);
or c) run PARADOX_fnc_setBulletLight1 at least once on any machine (i.e. server) and publicVariable "my_fnc_createLightpoint1" for it to get transferred to other machines. And then remoteExec it
and pray that _bullet1 would be global enough for it to work, yes
okay i just tried method a. and it seems to work for me atleast i can see the lightpoints now
a bit of a technical question, what is the largest value of serverTime possible?
wat? for as long as you're gonna run the server
float max
that is for sqf?
yes
yeah how much?
3.4e38 something
i assume its the same thing for time too
well
its not because I'm reaching it
I have a section in game where a character mentions how long the mission has been running for
just needed to make sure what is the max value so it can comment probably on it
if it is for mission duration, use time
serverTime is the server's uptime
is there a way to make music play during ticket bleed gamemode when the tickets reach a certain point
I have a initserver.sqf that stores serverTime in a variable so I can precisely know for how long the mission been running since then
you can use a BIS_fnc_respawnTickets call to check remaining tickets and use playMusic with remoteExec to play the track
I'm not sure what happens with time & serverTime once they run into float accuracy problems. At one-second precision you'd get about 200 days of uptime.
One would hope that they're translating a higher-precision accumulator per frame, rather than doing some time = time + frametime thing which would break after a few days.
diag_tickTime may have more precision
where does a path need to be from to import config into gui editor
Is there a way to create a public variable, like public public.
I know I can use missionNamespace and get/setVariable and broadcast it, but is there something that will do it "automagicaly", mainly so I don't have to get it every time I use it in a loop
no
well, use the public flag to do so
missionNamespace setVariable ["TAG_myVariable", 42, true /* aka publicVariable */];
so I don't have to get it every time I use it in a loop
if this is a very fast loop, refreshing the var every loop seems a bad idea
so I can use TAG_myVariable anywhere else without the need to getVariable?
I don't get your question
A missionNamespace global variable doesn't require getVariable to retrieve unless you need the default value thing
That's what I needed to know, thanks
If you look at https://github.com/iEzhuk/WMT_MapTools/blob/master/addons/WMT_Main/functions/moduleTime/fn_PrepareTime_client.sqf
They are using WMT_pub_frzState without ever setting it in this file.
Ok, for instance.
I have two files - warmupServerStart and warmupClientStart
I need to define some variables in the server part that I need to "wait for" in the client part and then I can continue further.
Let's say somewhere in warmupServerStart there will be missionNamespace setVariable ["IMF_warmupState", 1, true];
So in warmupClientStart I can just do waitUntil {sleep 1; !isNil IMF_warmupState};
and once it get's set in warmupServerStart the code will continue in warmupClientStart.
No need to do _warmupState = missionNamespace getVariable ["IMF_warmupState"]; and then check that, for instance
_warmupState = missionNamespace getVariable ["IMF_warmupState"];
while {isNil _warmupState} do {
sleep 1;
_warmupState = missionNamespace getVariable ["IMF_warmupState"];
};
hope this makes more sense
Last try:
is
_warmupState = missionNamespace getVariable ["IMF_warmupState"];
while {isNil _warmupState} do {
sleep 1;
_warmupState = missionNamespace getVariable ["IMF_warmupState"];
};
equivalent to
waitUntil {sleep 1; !isNil "IMF_warmupState"};
?
That getVariable implementation wouldn't work because that syntax requires the default value to be specified. But yes, the second example appears to be correct
Oh, so setting it by default to -1/nil and waiting for it to be something else would be correct then?
Alright, thanks for the info, I'll use the nicer one
server: publish the variable
client: wait until it is not nil
that's enough
I noticed there is difference when using trigger condition to check for player in a vehicle between SP and MP.
Vehicle variable name: car
in SP, trigger condition:
player in car
My question is, what do I need to adjust/change for MP (dedicated server) ?
What is the goal? I don't know if it is car or car1, but you want to detect if everyone is in the car or not?
correct, any player in car
Everyone is not anyone, though
just any player (not all players)
Do you want to execute the trigger in the server or anyone can trigger it?
anyone
Then player in car is enough
it did not work.
Did not work how?
I have my friend (playing as playable unit) got into the car. The trigger was not triggered. Then he got out, Then when I am in the car, trigger was triggered
Does your friend triggered it?
negative
In their end, not your end
He played from a different country.
What?
I don't understand your question clearly. Please specify
If the trigger is activated in your friend's game, it is working properly
it was not activated neither their end nor mine
Then check that if the trigger has “Server Only” checkbox or whatever its called
To confirm, if "Server Only" box is unchecked. It does not work during dedicated server MP?
It does work. Just not for everyone, but only server If unchecked, it will work for everyone, regardless if it is dedicated/local host MP/SP
unchecked, correct ?
Uncheck it, then
Ok. On the related topic of using "player" on MP dedicated server
I assigned each playable-object with variable name as Soldier1, Soldier2....
I noticed that when the player died and respawned, the playable-object variable name gets refreshed and variable value gets deleted.
Is that correct ?
I forgot about this thing, sorry. My half part of brain said yes other half said no
Ok. Is there a way to make the variable name not changed after respawned ?
reassign it
Is there a way to script it ?
respawn event handler
@outer oceanis your only goal just "check if a player is in a vehicle"?
For first question, yes.
then```sqf
call BIS_fnc_listPlayers findIf { _x in theSuperVehicle } != -1
place in the trigger condition, correct ?
yes
theSuperVehicle is the vehicle variable name ?
hopefully 😄
can you specify
meta-question: do you need these variables? 🙂
Yes. Some ingame trigger condition is connected to specific playable-object role.
okidoki 😉 just wanted to make sure the goal was not a "big array of players"
Do I place it in the init of the playable-object OR an .sqf ?
initplayerlocal
initPlayerLocal.sqf , correct ?
ye
To confirm, the reassign by using Respawn Event Handler, will reassign exact variable name after respawned, correct ?
if you just add the handler without doing anything it will do nothing
(obviously)
you need to probably check https://community.bistudio.com/wiki/vehicleVarName
then if it's the correct unit, set the varname onto the new unit and also broadcast it
I am not experienced enough to fully understand how to do it. May you briefly guide me?
the vehicleVarName
it returns a varname, the one you set in 3den
use that and check if it's the correct one, like _varname select [0, 7] == "soldier"
Do we place it in the playable-object init OR .sqf ?
... in the respawn event
the unit respawns, you get the varname of the corpse, see if it's one of the SoldierX, if it is, you set the exact varname onto the new unit and also broadcast the new value, like missionNamespace setVariable [_varname, _newUnit, true]
Your level of understanding is higher than I do, I am having a hard time to realizing the script
Hey guys, is there a way to check what options are activated per script? I want to see if the client got dynamic lights activated
it seems RespawnEventHandler is for local. It is not global. Will it work for MP dedicated server?
respawn event handler
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Respawn
okay, the snippet is right there, so
this addEventHandler ["Respawn", {
params ["_unit", "_corpse"];
}];
params ["_unit", "_corpse"];
_unithere is the newly respawned unit, while_corpseis the dead previous unit
the unit respawns, you get the varname of the corpse
private _varname = vehicleVarName _corpse;
see if it's one of the SoldierX
if (_varname select [0, 7] != "soldier") exitWith {};
if it is, you set the exact varname onto the new unit
_unit setVehicleVarName _varname;
and also broadcast the new value
missionNamespace setVariable [_varname, _unit, true];
you don't need anything global here
the 0,7 mentioned is the soldier0 to soldier7, correct ?
no
its start index and length of a substring
"Soldier1" select [0, 7] gives "Soldier"
Thanks. Understood
This. Understood
Thank you @copper raven
hello, i want to limit the charge you can use on mortars ( disable the last one), how i can do it?
without the artillery computer
hmm. Probably config only.
how does ACE to unable you to fire when weapon is jammed
no idea - ask them?
is reading the code :P
They do a mid-burst stop with setAmmo 0, but that's not the permanent method.
they change the mag perhaps
nah, they override the DefaultAction on the weapon :P
Check out this madness: https://github.com/acemod/ACE3/blob/master/addons/common/functions/fnc_addActionEventHandler.sqf
yea i just found that lol
is there any way to find out the offset of a memory point from the players origin? i.e players muzzle from players origin
ah
thanks 🙂
_muzzlePos = ace_player selectionPosition "usti granatometu";
_initialRopeHelper = createVehicle["CBA_B_InvisibleTargetVehicle", _muzzlePos, [], 0, "CAN_COLLIDE"];
_initialRopeHelper attachTo [ace_player, [], "usti granatometu", true];``` game complaining of nothing being passed to attachTo..?
0 elements provided, 3 expected
or is it because i left the offset blank -- if so how do i keep it as automatic?
getRelPos perhaps
but needs to be between two objects :p
ah having the same issue as I was before with physx objects not liking this and ropes not liking non physx objects
welp
params["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
//rope shit starts here
_playerPos = getPosASL ace_player;
_playerHelperObj = createVehicle["Pole_F", [0,0,0], [], 0, "CAN_COLLIDE"];
_playerHelperObj setObjectTextureGlobal[0, ""];
_playerHelperObj setObjectTextureGlobal[1, ""];
_playerHelperObj setPosASL _playerPos;
_playerHelperObj attachTo [ace_player];
_firstRope = ropeCreate [_playerHelperObj, [0,0,0], _projectile, [0,0,0], (player distance cursorObject)];```
pole creates fine, texture is set fine, position and attachment is also fine.... but rope doesn't work 
weirdly i cannot create a rope between two cones either...
ropeCreate [jennifer, [0,0,0], bob, [0,0,0], 5];``` doesnt work
no error message, nothing happens
returns <NULL-object>
Hi, I think I'm going mad. Can anyone tell me why I get
Error in expression < [c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11] ; _unit setUnitLoadout (getUnitLoadout _u> Error position: <_unit setUnitLoadout (getUnitLoadout _u> Error Undefined variable in expression: _unit
The code is this
if !(isserver) exitWith {};
_unitToCopy = selectRandom [c1,c2,c3,c4,c5,c6,c7,c8,c9,c10,c11] ;
_unit setUnitLoadout (getUnitLoadout _unitToCopy) ;
lockIdentity _unit;
[_unit, (speaker _unitToCopy)] remoteExec ["setSpeaker", 0, true];
[_unit, (face _unitTOCopy ) ] remoteExec ["setFace", 0, true];```
how are you calling the script
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
Found the problem, I've called it from the Init box of the Civilian Precense model instead of the Code on Unit Created
@open fractal
(new to scripting so please be gentle)
does anyone know what I am doing wrong here? I am trying to declare my variable "Hackable" and then set it to equal 1 when the player performs this add action.
private _variable = Hackable;
player addAction ["Hack Door Control Panel",{Hackable = 1;_building = cursorObject;_owner = player;_init = [_building,_owner] call GOM_fnc_initBuildingDoors; call GOM_fnc_HackState;},[],-1,false,true,"","((unitBackpack _this isKindof 'B_AssaultPack_blk'))"];
Then this function which is also called in the add action is supposed to print a hint on screen that says "Invalid Target"; however, it does not print that or anything else. I know the Variable is working though because if I put hint str Hackable after the IF Else statement it does print the number 1.
GOM_fnc_HackState = {
if (Hackable == 1);
{
hint "Invalid Target"
}
else
{
hint "Hacked!"
};
};
so basically the addaction should be setting Hackable to 1 and then printing a hint that says "Invalid Target" (the later intention is to use getCursorObjectParams to detect if the player is looking at a specific object). I don't understand why this isn't printing the hint though because I get no errors and if I put hint str Hackable after the IF Else statement inside the HackState function it prints a hint in game containing "1" so I know that Hackable is getting set to 1 I just don't understand why the IF statement can't seem to understand that's true/false.
if (Hackable == 1);
You have an excess semicolon here.
private _variable = Hackable;
What are you doing here?
private _variable = Hackable; is just me declaring the variable, I think lol again i'm a bit new to all of this
are you sure that semi colon is excess because when I remove it I get errors saying it is expected?
Oh, yes, sorry, replace the semicolon with then.
Oh my god
it fucking works now
why the fuck do you need to state then
Why isn't that just implicit in the if statement?
What you need is a global variable:
private _hackable = 0; //Declares and initializes the local variable "_hackable".
Hackable = 0; //Declares and initializes the global variable "Hackable".
```What you are doing right now is assigning the value of the (at that point probably undefined) global variable `Hackable` to the local variable `_variable`.
I see
that makes sense lol
So follow question if you would be so kind! If I assign Hackable = str getCursorObjectParams then when I am not looking at an object it should always equal [<NULL-object,[],1e+10] which means if I plug that into my if statement like this
GOM_fnc_HackState = {
if (Hackable == "[<NULL-object,[],1e+10]") then
{
hint "Invalid Target"
}
else
{
hint "Hacked!"
};
systemchat str Hackable
};
then it should end up outputting "invalid target" when I am not looking at anything and "hacked!" when I am looking at an object; however in practice it's always outputting the hint "Hacked!" even though systemchat is saying that Hackable indeed is "[<NULL-object,[],1e+10]"
oh hold on
is it because the str is spitting out that string with "" on it
instead of just a string?
That seems like an overly complicated and (as you've already noticed) error-prone approach.
If you need a condition based on whether or not there is a cursorObject, you can just use isNull cursorObject.
I thought that would work but I wasn't sure how to do it
Oh yeah that works great lol
I think I tried that at one point but gave up because of my if else statement issues
which I now know was just caused by the "then" bit and not that isNull argument
thank you!
SQF grammar is pretty simple, so command-bool-code isn't a valid construct. Technically they could have skipped the if though.
sqf has no control statements, it's simply 3 operators with a bunch of literals
an if is made up of two commands (or three if you add else), if and then, if is a unary command which takes a BOOL and returns a special IF type, then is a binary command, which takes that IF as it's left argument and CODE as it's right argument, it can also take an ARRAY type, an array of two CODE values (which is what else command generates), fx., hint str ({} else {}) would give [{},{}]
Is it possible to output my own debug stuff into an RPT or own log file? 🤔
_a=nearestObjects [_this select 0, ["Man"], _d];
I believe this line is causing an issue in a mission I'm playing because it's only supposed to apply to AI and not players, but I think the "Man" doesn't differentiate. Is there a way I can replace that with something that's only a player? Having trouble finding something on the wiki, I feel like I'm missing something obvious.
@sullen sigil diag_log
I could swear wiki said it did nothing in retail version lemme check history
It certainly does.
@torpid pewter You'd need a secondary filter, like:
nearestObjects [_this select 0, ["Man"], _d] select { !isPlayer _x };
In some cases _units - allPlayers would be preferable.
anybody have any idea why my 'find' isn't working on this search?
if I pipe in the whole string it works just fine and returns the item in the array.
"('MyClassSubString' find (configName _x)) != -1" configClasses (configFile >> "CfgVehicles") apply {configName _x}
Is MyClassSubString the search word?
find is case sensitive
also use in (also case sensitive, but more suitable here)
but Substring, if you want to search for a substring indeed, you need to swap operands here
I actually got it using the code below
("['substringHere',configName _x] call Bis_fnc_instring && {getNumber (_x >> 'scope') in [1,2]}" configClasses (configFile >> "CfgWeapons") apply {configName _x});
yeah not too miffed about performance anyways.
Its being used to fill out some stuff in the ace arsenal dynamically
but trying to figure out the syntax to read configs in SQF was a pain
it's like any other sqf expression
it was pretty much trying to find the variables tied to the config, which the params redirected to the generic variables page and didn't really help
also @copper raven ty for the help anyways! its much appreciated
Did VSCode do something new on its variable preview?
I didn't remember it being this awesome.
Can drill down into arrays so easily now, amazing
https://code.visualstudio.com/updates/v1_72 yea they did
I've been trying to do some work with ACE Fortify, and was trying to make just a simple script that gets called whenever you place something with ACE Fortify, it plays a hint, but the script doesn't seem to get called. I was reading on the Fortify Framework on the ACE wiki and as far as I can tell everything is correct.
// initServer.sqf
[west, 5000, [
["3AS_HeavyRepeater_Armoured", 0] // Turret
]] call ace_fortify_fnc_registerObjects;
// test.sqf
this addEventHandler ["acex_fortify_objectPlaced", {
params ["player", "side", "objectPlaced"];
if (typeOf objectPlaced == "3AS_HeavyRepeater_Armoured") then {
// setAmmo [objectPlaced, 0]; // Old Line
objectPlaced setVehicleAmmo 0;
};
}];
I did just realize that the setAmmo part itself it wrong, but I tried displaying a hint (instead of the ammo part) and nothing was displayed (Should be) fixed
addEventHandler is only for engine events, the one you're trying to add is most likely a scripted CBA event https://cbateam.github.io/CBA_A3/docs/files/events/fnc_addEventHandler-sqf.html
also global variable is not allowed in params
Ah alright, yeah first time working with events so I had the fortify wiki pulled up along with the Arma 3 event handlers, I'll give the CBA handler a shot, thanks!
_whenPlaced = ["acex_fortify_objectPlaced", {
// code
}] call CBA_fnc_addEventHandler;
So something more like this correct?