#arma3_scripting
1 messages · Page 753 of 1
no. they can be literally whatever you want, just don't forget the _ before each one
yeah no
i get what you're saying
thanks dude you've been really helpful today
also my logic was this hypoxic
if i put variables in initplayerlocal as private variables
they can only be accessed by the player right?
noone else
or did i mess up
incorrect
uh oh
local/private variables are only available in the scope that you put it in. it has nothing to do with what goes in what file
so i've got two problems now haha
we will ignore that
firstly now that i've turned a variable private and routed it to another sqf file the mission event handler is printing this
global variables can be accessed anywhere and are local to that client UNLESS its a public variable which is going to be the same on all clients
initPlayerLocal.sqf```sqf
// initPlayerLocal.sqf
// Variables
private _xp = 0;
private _gold = 0;
// Executables
[_xp, _gold] execVM "mobs.sqf";
[_xp, _gold] execVM "shops.sqf";
mobs.sqf```sqf
// mobs.sqf
params ["_xp", "_gold"];
// there is a big event handler here just to not make the post messy
hintSilent format ["Loot obtained!\n You gained %1 xp \n You gained %2 gold", _xp,_gold];
that should be fine unless you are accidentally overriding your variable on the way down there
nah i don't think so but my hint prints the whole string but the sqf %1 xp
same with the gold
instead it's replaced with NaN Scalar
i'm guessing NaN Scalar means no value
would you like me to send the entire thing?
you are messing something up because
_xp = 1;
_gold = 2;
hintSilent format ["Loot obtained!\n You gained %1 xp \n You gained %2 gold", _xp,_gold];
works fine
use sqfbin.com
to send the whole thing
okay
its either something up with my variable's or sending the variable into another sqf anyways
oh you didn't mention that the hint was inside the scope of the event handler
you haven't given any of the variables TO the event handler
oh
so would i just stick the params inside the event handler?
okay
basically i'm trying to have a system were different players will have the same variable but different values
thats why i tried privatising it in initplayerlocal but i just foudn out now it makes no difference haha
//mobs.sqf
addMissionEventHandler ["EntityKilled", {
params ["_killed", "_killer", "_instigator"];
if (
player isEqualTo _instigator
&& side group _killed isEqualTo east
&& _killed isEqualTo man1
) then {
private _currentxp = _instigator getVariable ["xp", 0];
private _currentgold = _instigator getVariable ["gold", 0];
_currentxp = _currentxp + (round (random 3));
_currentgold = _currentgold + (round (random 5));
hintSilent format ["Loot Obtained!\nYou have %1 XP\nYou have %2 gold", _currentxp, _currentgold];
_instigator setVariable ["xp", _currentxp, true];
_instigator setVariable ["gold", _currentgold, true];
};
}];
oh wow thats very clean
player setVariable
is it this?
is that the key
player setVariable [
should be instigator
just because isPlayer is true doesn't mean it's THE player
yup
private _currentxp = _instigator getVariable ["xp", 0];
private _currentgold = _instigator getVariable ["gold", 0];
and these should be added in theif
wow
this is so classy
thats beautiful
thanks alot
alright another thing
is theere a way i could add a timer into the event handler
so the guy could like respawn after 60s
on a certain x y z
i mean you could, most things are possible. but thats for you to figure out and try first
will do
I'm trying to make a mission with limited lives using the respawn ticket system.
However using the description.ext I'm not sure how to set it so tickets are subtracted on respawn, not on death.
I want to do this so I can have players die, and then disable respawns when there is one ticket left so people can't respawn using the last ticket triggering a game over. This would let the remaining players alive attempt to finish the mission while those that are dead can spectate.
using
respawnTemplatesWest[] = {"MenuPosition", "Tickets", "Spectator"};
at the moment
Does the mission end when all tickets run out?
It says you need endMission aswell as a respawn template. This should work for what you want.
@torpid quartz
I'm getting respawns disabled at 0 tickets, but the tickets are being removed on death, not when pressing the "respawn" button.
hitting 0 tickets triggers the "mission failed" screen too
mission is currently just a respawn tickets module with 2 blufor tickets, and 1 opfor ticket, and a respawn module
respawn = "BASE";
respawnDelay = 3;
respawnOnStart = -1;
respawnTemplatesWest[] = {"MenuPosition", "Tickets", "Spectator"};
``` is the description.ext
just handle tickets yourself
@torpid quartz use "TicketsSpawn" for your template to subtract on respawn instead of death.
is there a way to get the actual car object a unit is embarked on, instead of the driver/group leader?
wat? vehicle returns the vehicle
hi, can we moveTo a vehicle ? because moveTo a unit work but not a vehicle.
moveTo works on vehicles too. you might need doStop (and some sleep)
didn't know that even existed 
oh ok but i said this without try because i tried and moveTo seems to doesn't work for me. I used myunit moveTo [1490.73,5021.72,0]; but my unit doesn't move
like I said moveTo needs doStop
the vehicle
then why did you say:
moveTo a unit work
oh ok but i said this without try because i tried and moveTo seems to doesn't work for me.
so i'm sorry
about AI do you know if we can move a unit or a vehicle without path ? i mean directly to be very precise on the end position ?
if land vehicle yes. setDriveOnPath
oh ok thanks you and can we have an other command for man ?
there's none
any way to detect if Eventhandler Fireman has silencer?
yes, see here @clever radish
Thanks, didn't see people replied
I, hummm… what ?
i mean setDir. i would rather command it
so it turns in the right direction by itself
have you tried that?
read the notes, though
apparently it's not too accurate
cars are hard too, because they dont have tank-controls and cant turn on the dime
🤔
maybe command them to turn and have a loop which checks the direction and tells them to stop when turned to desired direction
works on open ground, but not really in areas with obstacles
but i wouldnt trust the AI to do anything complex
so if you really want them to face a direction, just use setDir
otherwise prepare to see flying cars
does anyone have a possible way of making a unit simulated but like really fucking tiny with setobjectsclae?
setObjectScale doesn't really work with simulated things from what I know of
seen people use this but it seems to kinda just bug out
[] spawn {
while {alive dude1} do {
dude1 setObjectScale 0.3;
};
};
However there are workarounds that aren't perfect but can get the job done.
For example you can attach a tank to an eddie drone, set the tank size to be the size of the eddie, and then for all textures on the eddie set them to "" so it technically "hides" the eddie but will still make it work and allow AI to shoot at it.
The eddie shooting will then represent the tank shooting
i mean the units still shoot in a way
also done the eddie trick for my goliath remote controlled at mine lol
i was just hoping to be able to avoid making a upscaled house lol
you have to do it every frame
but in any case it's not supported so why bother?
do you have a example of how i could do it? so far every way i tried it just breaks lol
nvm figured it out
i take that back when he tries to move it breaks
that's why you have to do it every frame
also, you shouldnt do this in multiplayer
i tried it with every frame
worked so he doesnt spaz out but as soon as he moved it kinda died
how are you running it?
can you post the script?
[] spawn {
while {alive dude1} do {onEachFrame
{dude1 setObjectScale 0.3;}
};
};
aight fair enough
do {onEachFrame {dude1 setObjectScale 0.3;}
};
};
so like this instead?
onEachFrame {dude1 setObjectScale 0.3;}
dont worry, everyone started there
if you've done this for years now and still kinda not good, then worry
i worry everyday
😐
ive done it for a max of like 2 months lmao and it was simple scripts and triggers
How do I play a voiceline from the campaign?
only now trying to dive in the deep end and bring the game to its limits for the memes
the names can be found at CfgSounds
doesnt say3d cause issues in multiplayer?
i remember it always breaking for me and had to use the cba sayglobal function
what about the radio voicelines
say3d has local effect, so does every other one
you need to execute them locally (to where you want to hear the sound)
ah fair enough
https://community.bistudio.com/wiki/sideRadio
and all its derivatives
the messages are defined in CfgRadio
remember to read the biki
okay, thanks
Is it possible to get the cfg radio from the campaign?
Like, I want to make a mission that's basically a diffrent perspective of the stratis incident
Yes, cfg viewer is part of the debug tools
You can also depbo the arma 3 addon folders to your pdrive
And explore them at your own leisure
I recommend the former for tracking inheritance and the latter for understanding what's going on
I also recommend advanced developer tools by @little raptor
arma 3 tools offers tools for bot setting up your project drive and extracting the game data
3den enhanced also has the cfgsentences viewer as well which is useful
I've set up the CFGRadio, but I can't hear anything
only text appears
my CFGRadio
{
sounds[] = {};
class RadioMsg1
{
name = "";
sound[] = {"a3\dubbing_f_epa\a_in\120_range\a_in_120_range_ran_0.ogg", db - 10, 1.0 };
title = "Kamino to broadway, shots fired!";
};
class RadioMsg2
{
name = "";
sound[] = {"a3\dubbing_f_epa\a_in\120_range\a_in_120_range_BHQ_0.ogg", db - 10, 1.0 };
title = "Kamino, broadway, we read you, wait one.";
};
class RadioMsg3
{
name = "";
sound[] = {"a3\dubbing_f_epa\a_in\120_range\a_in_120_range_ran_1.ogg", db - 10, 1.0 };
title = "Requesting support! Brodway, do you copy, over.";
};```
how are you calling it?
We were doing this not too long ago and got it working. Add a @ before the a3 in your file paths
NVM
yeah that worked
can mission parameter values only be integers? Could I pass a string?
Mission parameters are integer values that are passed to the mission at the beginning and which are used by the mission designer to customise user experience accordingly.
I assume not
when you go to add your parameter functions, just do a switch do for the integer and convert it to the string you want
So I'm running this code which is giving me an error but no pointer on where the issue is.
Function: https://sqfbin.com/newukifitapeyepahuhu It's long but only because of lots of commenting
I'm calling it using ```sqf
_layer = ["You are lost and stuck in a sinking boat",0] call WAG_Horror_fnc_InnerThought;
please use params
_duration = 8;if(count _this>=2)then{_duration=_this select 2};
🤮
you call it, but there is a sleep
so I hope you call it somewhere scheduled
The sleep is in a spawn remoteExec ["spawn",_targets]
Idk if I should do it like that tho...
it's meh 🙃 make a function and remoteExec that
is WAG_Horror_var_InnerThought_Layer defined?
also, is the file called / is the script called so the "function" is defined?
so many things to check
WAG_Horror_var_InnerThought_Layer is defined
File called call compileFinal preprocessFileLineNumbers "Functions.sqf"; in initServer.sqf
and what does the error say…?
nothing and that is why Idk what to do
so you don't have an error…?
It used to show an error with nothing showing location or reason. Now with the changes it doesn't show error nor does it show the message
oh and also:
it's```sqf
[[], {}] remoteExec ["spawn"];
[] for passing param?
well, spawn is a binary command
it takes a prefix as arguments and subfix as the code
That makes sense
<left> spawn <right>
[<left>, <right>] remoteExec ["spawn"];
Might be a good idea to have that as an example on the wiki bc my small brain couldn't comprehend on its own
similarily:
[object, position] remoteExec ["setPos"]
…have you read the examples? they are even coloured!!
setPos 👀
Yeah I scanned it for about 10 minutes but didn't see something like that
gniii
you got a problem with setPos?
i like setPos
because you can be imprecise with your z and it will sort of find a place for you
It's official. I'm blind
hammer time
🔨
here you go
give it a good bonk
i do not promote self harm. The hammer method is simply an enhanced learning style
Well thank you both for the help!
i didnt even help
takes both thanks for himself
Dw I'll have an issue for you to help me with in the next few days
yeah, Lou and Montana deserve thanks for this one
#include "\a3\ui_f\hpp\definedikcodes.inc"
Not allowed #include stat. on Debug console tool? I got error, just I typed only the include statement.
nope, not allowed.
thx
any suggestions on how to find images? Like the icon images, I mean
I wanna find images for an HQ, IEDs, and Ammo, but I'm not really sure where to look for that
3den enhanced has a texture finder which includes icons
cool thanks
out of curiosity, what are the practical applications of https://community.bistudio.com/wiki?title=loadConfig
is the example for https://community.bistudio.com/wiki/setMarkerType outdated or am I misinterpreting the context?
"MarkerOne" setMarkerType "Warning";
did not work for me however
"MarkerOne" setMarkerType "mil_warning";
worked just fine. I thought I was doing something wrong but I believe the example is based on arma 2 classnames
Config reading from files that are not part of configFile or missionConfigFile.
For example reading and analyzing a bisurf file
Ty
Could be, yes
main idea was for loading bisurf files. With the new ammo eventhandlers, they give you the bisurf name of the surface the projectile has hit
Ah cool, thanks
though just realized it doesn't work for terrain surface names 👀
Perhaps. setObjectTexture should do it as well since it's just a selection, though you might need to re-apply it every time someone with a unit insignia gets in
yeah, makes sense
better just to config out the clan selection
insignia can be set by script but the clan is set by engine
is there any reason not to use a .jpg for setObjectTextureGlobal?
I'm getting what looks like compression artifacts when I convert to paa
is your image power of two?
^in pixel dimensions, e.g. 512x512, 1024x1024 etc
2048x2048
btw, jpeg is a lossy format and introduces compression artefacts on its own
I should try converting from png
or I guess I got options from photoshop
I'll try converting a heavier file and come back
it's because I was trying to convert from jpeg
Is there up-to-date information about best practices when developing a (multiplayer) mission?
Like CfgFunctions, BE filters, optimization etc etc
Also which mods are the most up-to-date/recommended when it comes to scripting?
no
If you think about something bigger then no, every big mission that exists seems to be written a bit differently.
Oh boy, the joy and horror of coding... 😅
Hellooo, is there a way to make the bulletcam (BIS_fnc_diagBulletCam;) work for only the shooter in mp? Or would I need to use a different script?
you can open up the functions viewer and take a look. Looking at the wiki page it doesn't seem like it'd be complicated
Will do, thanks
Hello. I want the player who chose the red side at the beginning of the mission to be unable to switch to the blue side until the end of the game, even if he leaves the game. Is it possible?
yes its possible
when player joins, store his steamid and side
when player joins, check if steamid is already there, if yes and side is different, instakill him or kick him or smth
Oh, this is still difficult for me, but thanks. I'll try to figure it out but I hope it helps.
@still forum https://community.bistudio.com/wiki/getPlayerUID
It's here?
hey can anyone tell me what line I would need to put in my description.ext to allow composition scripts?
they should be allowed at all times on your host anyways
oh, didnt know that alright then. Also is there anything you need to do besides subscribing to them for them to show up in your compositions when your in-game? the only new thing I had was a custom composition with a composition icon next to it but couldnt place whatever it was
nope, you just subscribe. it will depend on if you have the right mods or not.
hello what is best script for AI paradrop without them loosing their backpacks
you want someone to give you a script? or do you want to learn how?
i found a script but sadly it demands deleting the backpack and replacing them with parachutes
and i was asking if someone knows a script that doesn't remove back pack
kick the AI out of the vehicle, spawn a parachute, place the AI in it, done
parachutes are just vehicles like anything else
what is the maximum amount of data that can be stored in profileNameSpace?
why don't you give it a try?
local _s = "a";
while { true } do
{
profileNamespace setVariable [_s, _s];
saveProfileNamespace;
_s = _s + _s;
};
see how big the file gets
maybe back it up first though. the game will probably crash too
I don't think there's a limit
the limit is probably one of 2^31-1, 2^32-1, 2^63-1, 2^64-1 bytes, or however much disk space you have available
well I mean in game limit
Is there a way to make a map marker that anyone can delete it with 'DELETE' key, just like INSERT MARKER on mission map.
_marker = createMarker ["markername", player];
_marker setMarkerType "hd_dot"; //can't delete with DEL key
you should set the creator (and maybe channel too)
I think... 
give me more tips, please.
that's what she said
createMarker [name, position, channel, creator]
It doesn't work. I couldn't delete the marker with 'delete'key, even though I put channel and creator arg.
it always depends on the arguments…!
it was just a guess
private not local
(unless Arma 2) (where profileNamespace doesn't exist)
profileNamespace does exist in A2OA
ah, OA perhaps indeed! I only remembered it being introduced with TKOH 🙂
@winter rose You had some algorithm for working with MP missions, right? I.e. to test the locality only on server and the other stuff in editor etc. What was it exactly?
I usually do everything logic-wise server-side and remote exec what needs to be
anything that is exclusively local (e.g UI, etc) is locally executed as to alleviate the server
True that, I think I just read it from the wiki as well. I assume you're the writer 😄
IIRC the server FPS/CPS and client FPS have been decoupled already? So that it'd be indeed better to stress the server (to some extent) instead of clients when it comes to computation?
addActions are repeatable by default (assuming the effect of the action doesn't make one of the conditions false). holdAction has an argument to remove after use or not [note: this argument only removes the local version of the action, not MP-safe]
hmmm
I want to have a laptop players can interact with to watch a video
but I dont want this to effect all players at the same time
nor do I want to to go away as an action after its done
What command are you using to play the video?
play = ["Video_feed1.ogv"] spawn BIS_fnc_PlayVideo;
That function has local effect so it shouldn't affect other players unless you go out of your way to remoteExec it
figured
ive tried this as a substitute
but I cant seem to get it to work
am I missing something?
like should the screen have a name?
hu, seems like I somehow got it to work
okay new question
I want a unit to act as under-cover
I dont want other players knowing about this
so my idea is for the unit to remain on that side until they either damage a unit on the same side, or a trigger event happens
How can I best change the faction side of a unit mid-mission?
this is mp
Join them to a group of a different side.
Any recommended methods?
I want them to stay as that side afterwards
So respawn shouldn't reset it
does setWaypointLoiterRadius use flyInHeight or flyInHeightASL?
loiter radius has nothing to do with altitude 
oops I mean in editor's altitude parameter for the loiter waypoint. which I found the answer, it uses ASL.
are you sure? it should be AGL 
well if it was AGL, it would follow terrain when above terrain which it does not. it maintains a steady altitude no matter what is underneath it
Altitude above waypoint's initial XY position in which vehicles in the group will loiter. They will maintain this altitude steadily, not copying the terrain. When -1, vehicles will fly in the default altitude and copy the terrain.
you can also try setCaptive
that one doesn't create new groups
you probably need a respawn EH for that
this spawn {
_fakebomb = "Bo_Mk82" createVehicle (_this modelToWorldVisualWorld [0,1.5,-6]);
_fakebomb enableSimulationGlobal false;
_fakebomb attachTo [_this];
_this addMagazine "PylonMissile_1Rnd_Mk82_F";
_this addWeapon "Mk82BombLauncher";
_this addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
_velocityslot = velocityModelSpace _projectile;
_projectile setPosASL (_unit modelToWorldVisualWorld [0,1.5,-1.3]);
_projectile setVelocityModelSpace _opp;
_fakebomb hideObjectGlobal true; //problem here
}];
};
hello, my issue is simple
_fakebomb hideObjectGlobal true;
which is at the end of the script, is not doing its function, its not hiding the fakebomb
the bomb stays visible
it seems to be a getVariable issue, the game treats _fakebomb like an empty variable
it's not defined inside the EH
yep how do I define it
inside the EH?
Anyway to not make it global?
setVariable
_fakebomb = "Bo_Mk82" createVehicle (_this modelToWorldVisualWorld [0,1.5,-6]);
_fakebomb enableSimulationGlobal false;
_fakebomb attachTo [_this];
wat? how do you expect to "attach" a disabled object?
sorry, I didn't catch what you meant?
_fakebomb enableSimulationGlobal false;
yeah whats about it
its a bomb don't want it to explode or have collision of any sorts
If you're trying to create a visual-only bomb, you should create the bomb's model as a Simple Object
True but
I'm using this for zeus
pub zeus
worked wonders thanks
iirc when you disable the sim you can't attach the object (you can but it won't move)
yeah it is supposed to be a pylon
I don't play public Zeus. Does it disable the createSimpleObject command...?
just there to mimic a bomb being carried
as far as I know yes
I mean the attached disabled object doesn't move with the plane
it does
what NikkoJT said
if it works then 
Don't attached objects usually inherit the simulation properties of the object they're attached to? That's probably what's happening here.
I would be mildly concerned about a non-simple-object bomb eventually going off, though.
Safety is not guaranteed, that is our motto
basically I want to hideobjectglobal false when the plane rearms
but I can't find an event handler for such a thing
and I don't want to run a loop for checking ammo count
Remind me why you're doing this instead of using the actual pylons system
maybe
I believe it'll work when the reload is finished and not at the start. but im not entirely sure what you are wanting. is the plane rearming at a base or soemthing?
yes
myObject addEventHandler ["Reloaded",
{
myObject hideObjectGlobal true;
myObject removeEventHandler ["Reloaded", _thisEventHandler];
}];
if its an object you are wanting to hide after rearming, this should work and can be pasted in the init of the plane
if it doesn't work for the init, then youll have to make it into a script. which giving an addaction to the plane to run the script will do it, or however you want to have the script ran
this spawn {
_fakebomb = "Bo_Mk82" createVehicle (_this modelToWorldVisualWorld [0,1.5,-6]);
_fakebomb enableSimulationGlobal false;
_fakebomb attachTo [_this];
_this setVariable ["Lefakebomb", _fakebomb, false];
_this addMagazine "PylonMissile_1Rnd_Mk82_F";
_this addWeapon "Mk82BombLauncher";
_this addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
_velocityslot = velocityModelSpace _projectile;
_projectile setPosASL (_unit modelToWorldVisualWorld [0,1.5,-1.3]);
_projectile setVelocityModelSpace _opp;
(_unit getVariable "Lefakebomb") hideObjectGlobal true;
}];
_this addEventHandler ["Reloaded", {
params ["_unit", "_weapon", "_muzzle", "_newMagazine", "_oldMagazine"];
(_unit getVariable "Lefakebomb") hideObjectGlobal false;
}];
};
it doesn't do
(_unit getVariable "Lefakebomb") hideObjectGlobal false;
_this addEventHandler ["Reloaded",
{
Lefakebomb hideObjectGlobal true;
_this removeEventHandler ["Reloaded", _thisEventHandler];
}];
replace your addeventhandler at the bottom with this one
and then replace this line (_unit getVariable "Lefakebomb") hideObjectGlobal false;
with
Lefakebomb hideObjectGlobal true;
i believe if you gave something a variable, you dont need to use getVariable i think
no I need to getVariable in this case since its a local variable that is not declared in the EH scope
what is basically happening is that the EH itself is not working, I tried systemChat "CHECK"; inside the EH, but it didn't type anything
so EH is not being called
_this addEventHandler ["Reloaded", {
params ["_unit", "_weapon", "_muzzle", "_newMagazine", "_oldMagazine"];
(_unit getVariable "Lefakebomb") hideObjectGlobal false;
systemChat "CHECK";
}];
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
It seems you move in the shadows
i assume this is in a vehicles Init?
Might want to chance the first this to _this
this is in a vehicles Init?
if sothisis correct
One of the things I will keep mixing up I geuss
I read back and It seems like you are using the Reloaded EH to detect a rearm? Seeing as Reloaded only fires based on new magazines (and the usage with vehicles is iffy looking around) I think you need to find a different EH.
Just test the Reloaded EH on its own to verify your use case before testing the whole code.
yep
whats that EH
can't think of any
yes to check if the vehicle is rearming
thing is
it might have to do with the vehicle I have gave weapon to
the Cessar
maybe it is not configured to work with this EH?
of course it can drop bombs since I used addWeapon
please help 😦 init.sqf not found
you make it
it goes next to mission.sqm
(inputMouse 0 > 0) && !((vehicle player == _vehicle) || visibleMap || (!isNull findDisplay 49))
why does this evaluate as true when the map is open?
oh shit I see it
idk man im up to something pretty big
extDB3: Error with Database Connection
😭
@open fractal please help me my friends
what are you doing
extDB3 is an Arma3 Addon for connecting to Databases (currently only MariaDB/MySQL). The main purpose for extDB3 is for persistent missions in Arma. Note it will require some knowledge about SQF & SQL to use. extDB3 is also designed to be flexible & secure at the same time.
ok i got everything connected
but its not working
extDB3: Error with Database Connection
everyonne please help my
Need help setting up a ai unit to fire artillery
Ii have been trying it out but for some reason it is not working
If you want us to figure it out, need to write what's the code you use, or you get nothing
please help me
I figured it out I had one number off
extDB3: Error with Database Connection
everyonne please help my
no one will be able to help if you don't give any code/context
which command do i use to set a turret's aim point, even if its a player?
yeah it seems to be it
can slave a tv turret with it
can anyone confirm that the max distance that you can see a drawIcon3D is 300 meters?
cause that's what it seems to be in my testing
no
drawIcon3D has no limit
// Calculate position
private _pos = _unit selectionPosition "Spine3";
_pos = _unit modelToWorld _pos;
// Calculate distance from player to unit
private _delta = (player distance _pos) / hyp_iff_multi;
// Draw hex icon
drawIcon3D [
"a3\ui_f\data\igui\cfg\cursors\select_ca.paa",
hyp_iff_iconColor + [0.15],
_pos,
1 * _delta,
1 * _delta,
0
];
So I've been messing around with different sizes and I can't seem to get them visible at 2k away no matter what values I try
it's related to the size you use
not drawIcon3D itself
also this is wrong:
private _delta = (player distance _pos) / hyp_iff_multi;
try 1 instead of 1 * _delta
you should use the inverse of distance
at a base value of just 1, they also disappear at 300 m
which is what i had originally and I thought, well maybe i need to make the size bigger to make them viewable from farther
but they just stop rendering at 300m. could it be a texture thing with the .paa?
probably related to other commands you use
e.g. selectionPosition or modelToWorld
hmmm good point. let me try something different
I know for a fact that drawIcon3D has no limit
or the unit gets hidden perhaps? even though I don't think it would have an impact on selectionPosition
no a hidden unit is still there 
afaik selectionPos and modelToWorld can't be the problem either
I've used them forever
yeah, I don't see any issue from the code either ^^'
I'm uh... I'm gonna go to bed now...
because its 4:49am... and I missed something stupid
I had a condition elsewhere up that limited it to 300m that I completely forgot about...
« don't sleep and code »\®
how many stupid mistakes did I make while scripting tired
or obvious flaws missed
thinking about something
writing something completely different, not related to anything you were thinking
😄
does lockTurret command works with ai only ? 🤔
I believe not
it should be executed locally though
How do I remove an HoldAction temporarily?
Add a boolean or some variables to the conditions and make the condition false using the variable
Hello! Is there a script that changes everytime I respawn my faction side from Civilian to Blufor?
Because everytime I die and I respawn it changes my faction side to civ
well this should not happen, unless you are a civilian unit to begin with
I start with a blufor unit
and when I die and I respawn it changes to civ
Sounds like you're just playing a badly made mission?
default respawn does no such thing
I'm playing Hearts and Minds but I'm the only one having this problem
Maybe are mods but I cant find which one is
So since I have a lot of them I was searching for a script or a variable that changes my faction everytime i respawn
@winter rose @warm hedge Sorry for the ping but is this correct "setside west;" in the init of the unit?
No. setSide won't work like that, nor for units
What can I use for units?
There's nothing
you are countering an effect of an ill-designed mod, try to fix/locate the issue
otherwise you would create an empty blufor group, join it
but that's ugly and most likely prone to later errors
Yeah right. Okay, thank you for the answer!
@winter rose I found the mod! It was a mod that makes soldier surrender after some damage etc
aaaah, indeed, it might interfere!
how do I get the models of weapons that are attached to aircraft pylons? note I went through CfgWeapons and CfgVehicles but can't seem to find any models?
most likely in CfgMagazines then CfgAmmo
for example the model of weapon called Twin_Cannon_20mm
I will check
well what I found was model = "\A3\weapons_F\ammo\mag_univ.p3d";
but thats just a magazine
I basically need this model:
but in magazines it just declares this as the model, which is a pouch magazine not the twin cannon
then IDK
weapon weapon should be in CfgWeapons
and if not, it's in the plane model itself that is animated this way or not (hacky)
for plane weapons it would be proxyShape not model
if it uses pylons
in cfgAmmo at least.. although yeah the magazine uses model weird
class PylonWeapon_300Rnd_20mm_shells: 300Rnd_20mm_shells
{
displayName = "$STR_A3_twin_cannon_20mm";
descriptionShort = "$STR_A3_cfgMagazine_PL20_tooltip";
model = "\A3\Weapons_F\DynamicLoadout\PylonPod_Twin_Cannon_20mm.p3d";
muzzlePos = "muzzlePos";
muzzleEnd = "muzzleEnd";
hardpoints[] = {"B_A143_BUZZARD_CENTER_PYLON","20MM_TWIN_CANNON"};
pylonWeapon = "Twin_Cannon_20mm";
mass = 230;
};
is the pylon magazine for the 20mm
yep
I just found it
I was searching for "1000Rnd_20mm_shells" magazine
that I have got from magazines object
but then I attached fired EH to the airplane and acquired the _magazine variable from it
which in the end showed it as PylonWeapon_300Rnd_20mm_shells
sorry Lou Montana
no no problem at all? you were looking for something and we tried to help
nah not about that I probably made you worried about your skills lol
oh no, I know I don't know poop about models and configs don't worry at all 😄
Hello everyone . Well, I have a problem.
I would like to detect when an explosive charge is placed in an area and then activate a trigger when it no longer exists.
Is it possible ?
thx
placement can be detected using the FiredMan event handler
explosion cannot be detected using an event handler (will be added in v2.10)
you have to start a loop to see when the ammo explodes
How do i go about calculating a vector perpendicular to a vectorUp of an object?
Maths
vectorDir is always perpendicular to vectorUp
there is an infinite number of such vectors. in fact a vector is perpendicular to an entire plane
infinite planes
Well i need to calculate a new vectorDir based on vectorUp of an object
as Untelo said there are infinite ways
do you have an azimuth
perhaps you should explain what you're trying to do and how's the new dir related to the old one, etc.
Yes
so you're trying to rotate the object around its up?
cross product between the azimuth vector and up vector gives you right vector, then cross product between the up vector and the right vector gives you the direction vector
I'm trying to rotate an object in the same way as it would rotate if vectorUp = [0,0,1] using setVectorDir
Because it overwrites vectorUp
but you just said vectorUp = [0,0,1]?
in the same way
so what I said here?
Yep
as in, setDir + setVectorUp I think yes (what you said)
I think
I have an angle in degrees and vectorUp
you can use BIS_fnc_rotateVector3D to rotate the vectorDir + setVectorDirAndUp
Thanks i will try it
actually wait this does something else
do this instead
_dir_m = [sin _angle, cos _angle, 0];
_dir_w = _obj vectorModelToWorld _dir_m;
_obj setVectorDirAndUp [_dir_w, vectorUp _obj]
will rotate it CW around the up, like setDir
and where are your privates sir? 👀 😄
I don't believe in them 😛
HERESY!!
Anyone can spot what's wrong here?
Says generic error #[
Device1Call =
{
[
Device_1,
"Download Data",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"cH && {cT isEqualTo 0}",
"cH && {cT isEqualTo 0}",
{hint "Initializing download..."},
{},
{[Device_1] execVM "Scripts\Hacking.sqf";},
{hint "Download interrupted.";},
[],
11,
0,
false,
false,
] remoteExec ["BIS_fnc_holdActionAdd", 0, Device_1];
};
yes, your code formatting!
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
Sorry, its corrected
thankie! ^^ helps understanding as well ^^
the issue is the last comma in the arguments' array
false, ]
I've just got a chance to really dig into the code on this, but unfortunately this code is filtered by using the role description and I don't have that set. Since I play with such a small group I assign roles with setvariable or setUnitTrait via a job board in game, this allows players to change roles on the fly.
player setUnitTrait ["explosiveSpecialist", true];
player setVariable ["ACE_IsEngineer",0, true];
player setVariable ["ace_medical_medicclass", 0, true];
Is there a way to change the way it looks at the role description in the Arsenal script to where it then adds the additional items based on that variable/trait?
I'm really sorry about the delay on this.
It was just a post to show you one way of doing it and the thought process behind it. You of course can use any kind of conditionals you want when you write your own script
Ok ok so this could be done with the getvariable then. Could you please give me an example of how to do this? I can't seem to figure it out.
to keep it short to show you the idea...
params ["_box", objNull, [objNull]];
// Checks
if !(hasInterface) exitWith {false};
if (isNull _box) exitWith {false};
// Remove previous arsenal
[_box, false] call ACE_arsenal_fnc_removeBox;
// Init new box with default equipment
[_box, fear_arsenal_defaultItems, false] call ACE_arsenal_fnc_initBox;
// Add additional items based on class variable
private _class = player getVariable ["fear_arsenal_class", ""];
switch _class do {
case "medic": {
[_box, fear_arsenal_medicItems, false] call ACE_arsenal_fnc_addVirtualItems;
};
case "engineer": {
[_box, fear_arsenal_engineerItems, false] call ACE_arsenal_fnc_addVirtualItems;
};
//Etc Etc
default {};
};
true;
Thank you so much!!!
read here on why things are false, true, etc in their functions. has to do with local arsenals which is how you achieve different arsenals for each person
https://ace3mod.com/wiki/framework/arsenal-framework.html
daylight_fnc_createFishSchools = {
_species = _this select 0;
_actualDepth = _this select 1;
_suitablePlaceFound = false;
missionNamespace setVariable [format ["daylight_arrFishSchools%1", _species],[]];
while {(missionNamespace getVariable format ["daylight_arrFishSchools%1", _species]) count < 10} do {
// The selected position must be in playable area (trgMapBorder)
_randomPosMapInWater = [trgMapBorder, ["ground"]] call BIS_fnc_randomPos;
_depth = abs((_randomPosMapInWater getPosASL select 2) - (_randomPosMapInWater getPosATL select 2));
// If the depth at the position we are now is within acceptable threshold of the preferred depth,
// add position to fish school array for the given species
if ((_depth > _actualDepth - _actualDepth / 5) && _depth < _actualDepth + _actualDepth / 5) then {
missionNamespace getVariable format ["_arrFishSchools%1", _species] pushBackUnique _randomPosMapInWater;
};
};
Why does the count < 10 give me an error?
because it's wrong
sqf commands are operators
e.g. when was the last time you saw 1 +?
so _something count is not valid either
Ahh, it's on the wrong side of variable 😄
yes, just like any other operator
while {count (missionNamespace getVariable format ["daylight_arrFishSchools%1", _species]) < 10} do {
There we go
Brainfart #158329
Thanks 😛
Would you go with HashMap based integrated database or use an external database (like with extDB) for a gamemode that might have a large number of players consistently?
hello, is there any way to slow down BM-21? like I feel in real life nobody shoots it so fast as AI does in-game..
thanks
Just to clarify, there wouldn't be much data stored for a single user. Or maybe saving the data encrypted to player's own profileNamespace could work as well? That's how KOTH does it AFAIK
I'd say only use extDB if you need to store them for other sessions
Yes, need to save them. Is there a reason why you wouldn't recommend HashMap based db (saving it to server's profileNamespace)?
With frequent automated backups
you can try if you want to. I personally don't like messing up the profileNamespace by large useless data
Thanks for your input! I guess the KOTH way would be an option as well to avoid profileNamespace cluttering
how do I rotate a simple object?
nope
used all of them neither worked sadly
// set exact yaw, pitch, and roll
_y = 45; _p = -80; _r = 0;
BRICK setVectorDirAndUp [
[sin _y * cos _p, cos _y * cos _p, sin _p],
[[sin _r, -sin _p, cos _r * cos _p], -_y] call BIS_fnc_rotateVector2D
];
this worked thou
I want to spawn a projectile that is facing weaponDirection, how would I go about setting the direction? Vectorfromto?
_projectile setVectorDir ((vectorDir _projectile) vectorFromTo (this weaponDirection "Mk82BombLauncher"))
this for example doesn't work
Unsure where to put this so hope this is the right place - is there a way to establish which addon is calling a function that it cannot find?
I.E if I get an RPT of Warning Message: Script \rw\functions\fn_init.sqf not found how can I find what is trying to call that script?
perhaps if you check the logs, you may get the function's name
but it looks like a config issue
That is the log 
remove half your mods, check if it happens again, if so remove half of that, etc
Alright, was hoping there was a nice easy way to do it 😦
wat? weaponDirection is already a direction and so is vectorDir
vectorFromTo is meaningless
Found it! You were right, I'd missed it under CfgFunctions
yeah I'm not good at vectors as you can see lol
Hey, does anyone know why i get the error "missing ]" here? (arma claims its in line 2) Can i not use waypoint statement to spawn a vehicle or whats the issue? Executing it in console works just fine
_btg1_dronecarryvehiclewp1 = _btg1_dronecarriergrp addWaypoint [getMarkerPos "SentsyNStagingArea", 30];
_btg1_dronecarryvehiclewp1 setWaypointStatements ["true", "_uav1 = createVehicle ["rhs_pchela1t_vvs", getPos _btg1_dronecarryvehicle, [],0,"fly"]; createVehicleCrew _uav1;
[_uav1] join _uavgroup;
_uavwp = _uavgroup addWaypoint [getMarkerPos "Sentsy", 30]; hint 'Drone launched'"];
sqf highlight gives it away
you have a " in a "" string
how do i escape the " so that it works, if thats possible?
replace with single quote or double double quote
yep
'my "quoted" string'
// or
"my ""quoted"" string"
(as you already did for the hint)
Thanks guys, fixed it, now the error is gone 🙂
how do you guys like to organize long multiline string statements?
not having them
it's not even sarcasm, long strings belong in a stringtable
if you set a looong trigger statement, better script the solution anyway
you would do this for long formatted diary entries? I have no experience with stringtables or xml
definitely yes
I always internationalise ("make translation-ready") my missions
since I like things super organized, I've been doing something like this:
private _br = "<br/>";
private _linebr = "<br/><br/>";
// Diary
player createDiaryRecord [
"Diary",
[
"Signal",
"Uni-1: V-44 Armed BlackFish (Player Vehicle)" + _br +
"Sierra-1: Rifle Squad" + _br +
"Sierra-2: Rifle Squad" + _br +
"Flight Control"
]
];
I've also done something similar with format so I've been messing around with different things. So invest the time in learning how to do string tables?
which stringtable tool do you like the best atm?
VSCode 😅
does it have a built in one? or are you actually typing out all these containers?
it's not tricky really
see https://community.bistudio.com/wiki/Stringtable.xml and it's really straightforward
I believe you can directly make "Project" → "Key", no need for architecture
I use containers to split briefing, UI, conversations etc
Hello. In my mission, I want to work on the sound effects of the environment, and I do it in the simplest way: I add a sound to description.ext, after which I select my sound in the trigger (I need just some zones). BUT. Coming out of the trigger, this sound has no decay, which means that it is very well audible as it breaks off. And the second question, will it work correctly in multiplayer? For example, if one person is already in a trigger with sound, and a second person will visit him.
@open fractal better moving as you will have answers there 😉
👍
@winter rose so I just throw this in the root folder of the mission and arma will automatically pull it in?
oh so do I have to at least put in a Original and a English for it to work?
if there is no valid language, the first one will be used (so <English> only can do)
then use```sqf
private _myText = localize "STR_myStringKey";
Guys, I need some help having the this add "handledamage" EventHandler so that it detects "real impact locations" of bullets while filtering the "side damage".
this addEventHandler ["HandleDamage", {
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
if (_selection == "head" && _damage> 0.4 && local _unit) then {hint "headshot";};
}];```
☝️ That would show the hint even if the damage was done to the chest via gunfire
I understand that grenades and shotguns might damage several body parts at the same time but these are single bullet shots... So how can I filter only the "real" damage and leave behind the residual damage on the other body parts
?
Is Poseidon tools at all relevant these days
I see the last update was in 2017, so i doubt the syntax and keywords are up to date
playSound3D [getMissionPath "" + "sound\coast.ogg", coast1, false, getPosASL coast1, 4, 1, 600];
I use this command to run 3d sound from logic. But, the task is such that I need to make sound along the entire coast, will this server heavily load? Mission for multiplayer. And is there any other way to add the sound I need to 3d along the coast?
You can use getMissionPath more directly btw
How?
without "" +
and it would be better performance-wise if you had a script to play it client-side instead
HM. That is, this script will not work correctly in multiplayer?
It is important for me that everyone has sound, and even for those players who entered the mission after it had started.
Remote exec and JIP it
yeah, but you don't want to tell a client that is a km away from the shoreline "hey, play the shore sound"
Say3d is a good way to do that too, you can set a amximum distance
playSound3D [getMissionPath "" + "sound\coast.ogg", coast1, false, getPosASL coast1, 4, 1, 600] remoteExec Call;
This may not be entirely correct?
If your misison has a lot of static sound sources, i recommend running them client side from a trigger that enables/disables them
This is wrong
I don't need to disable until the end of the mission. That is, they should always be on the mission.
There are plenty of examples. Try again and if it doesnt work/you dont understand, come back
I recommend say3d over playsound3d
I'd love to, but I can't test it in multiplayer right now.
You dont need to
I have one more question. The logic (the object from which the sound comes) has to be copied and pasted, and it turns out that on one side there will be about 40-50 lokigi objects from which the sound comes. How can I do it more correctly so as not to load the system?
playSound3D [getMissionPath "" + "sound\coast.ogg", coast1, false, getPosASL coast1, 4, 1, 600];
playSound3D [getMissionPath "" + "sound\coast.ogg", coast2, false, getPosASL coast2, 4, 1, 600];
playSound3D [getMissionPath "" + "sound\coast.ogg", coast3, false, getPosASL coast3, 4, 1, 600];
playSound3D [getMissionPath "" + "sound\coast.ogg", coast4, false, getPosASL coast4, 4, 1, 600];
playSound3D [getMissionPath "" + "sound\coast.ogg", coast5, false, getPosASL coast5, 4, 1, 600];
Etc...
It's the trigger now
I'm afraid my players' computers will say goodbye.
Is it possible to activate sound in several objects with one command?

If you really want to, you could make one object and have it created around the coast
But i dont recommend this approach
Rather, detect the players distance to the markers and play a single sound source locally
1 sound locally is much better than 5+ sounds globally
Dont use playsound3d, use say3d if you want 3d effect
If ambient stereo sound is enough, use say2d
Playsound also works for this
It has local effect
Okay, but what about the players who joined after the start of the mission? Will they be all right?
yes
If you script it locally, it should have no effect whether the player joins on mission start or 100 minutes in
Fine. Now I need to figure out how to run it properly. I can use init.sqf for this, but do I need to make a script like this for each logic?
Say3D [getMissionPath "" + "sound\coast.ogg", coast1, false, getPosASL coast1, 4, 1, 600];
Init.sqf executes on all systems
and fix that getMissionPath!
Use if hasInterface then to check for player clients
(also, I believe say3d takes a relative path)
you don't need any logic if you play it well
Say3D [getMissionPath "sound\coast.ogg", coast1, false, getPosASL coast1, 4, 1, 600];
Right?
It takes a cfgsounds entry
ah true :p
ouch heeey
If you need it
if (hasInterface) then {
Say3D [getMissionPath "sound\coast.ogg", coast1, false, getPosASL coast1, 4, 1, 600];
};
Right?
in init.sqf
No, sa3d takes a cfgSounds entry as the first parameter
Read the description and see the examples
if (hasInterface) then {
Say3D [getMissionPath "sound\coast.ogg", coast1, false, getPosASL coast1];
};

@lapis ivy
Lets an object say given sound in 3D space. This allows broadcasting of positional music or sound from a source, without having to script a fade sound or music command. Compare this with say2D which will always play a sound at the location of the player after he has been in the vicinity of a broadcasting sound. Sound is defined in "CfgSounds" of the Description.ext or main config. ```
I have Description
class CfgSounds
{
sounds[] = {};
class Coast
{
name = "Coast";
sound[] = {"sound\coast.ogg", db+10, 1.0};
titles[] = {};
};
}
Yes
Now you can play your sounds by reolacing the oath with jsut "coast"
Although i recommend a bit more complex name personally
But it's up to you
Also, check the parameters
from say3D [sound, maxDistance, pitch, isSpeech, offset]
Offset is not an offset in 3d-space, it is an offset in seconds from the beginnin of the sound-file
The sound always plays from the position of the from object
Okay
For example, I now need to place all this sound along the coast. I create objects that will make sound. I have this invisible object "game logic". But in order for this sound to work along the entire coast, I need to create a lot of game logic. How can I run them without a big load?
Move the logic
I would still use 2d sound with fade for this
But it's your funeral
Move the logic instead
I do not quite understand how to implement it and how to move it. One player can be on one part of the coast, the second on the other, and to which player which logic should be moved?
If you want it to play at specific points, get the closest point to the player and place the logic there
the object will be local
all of it only happens on clients' PC
well, players' PCs
If you want it to play along the "coast" you could mark out a rough path with markers, get the closest 2 markers to the player, intersect the path between the markers by a perpendicular line from the position of the player and place the sound source there
Run the script in a loop that checks the player's distance to the closest marker every once a while (few seconds, more?) And updates the position fo the sound source only when necessary
I roughly understand how it is, but I don’t understand how to implement it at all.
Just make sure adjacent markers are always closer to each others than others
That is, when the player is near the shore, the sound will follow him?
So be mindful of the coast-shape
What kind of aound is it? Waves?
Or is it some kind of ambient gunfire from a lansing party?
Sounds of waves.
As a coast enjoyer, i can say that the sound of waves is pretty much ambient on a coast
So you might aswell ditch the 3d aspect of it
There are mountains, behind them there is a forest. I don't think it should be there.
I tried to make a trigger, and the sound was added through the trigger effects. BUT. If the player exits the trigger, the audio cuts off abruptly.
Then dont play it if the player is far enough from the coast
Your problem ehre is measuring distance to the coast
Do you have a lot of coastline or jsut alittle?
I'll take a screenshot now.
For 3d, you want to be kind of accurate with the location
@winter rose i am sorry to tag you here, but if youre interested, this could be a useful topic for the related discussion above
https://community.bistudio.com/wiki/Arma_3:_Sound:_SoundControllers
The article is a bit stub, but it's a nice rabbithole to dive down
Im personally not super audio-expert, so i found this news when i dug around
Try the hitPart EH instead
hey guys basically i am making a shooting range and i wanna do a automatic shooting range that when i move next to the target it pups up did anyone made the script for it all ready?
[wind1, "wind"] say2d ["wind",50,1];
I decided to try say2d, but it does not respond to distance. The sound is always the same in volume, no matter how far I move away from the sound source.
[wind1, "wind"]
what does this mean?
Because say2D does it in 2D space, not 3D
Also what he said. Your syntax doesn't seem good
How can I do it right?
I want the sound to be in "mono" and be removed when I move away from it, but I don't want 3d "stereo" because you can find the point where it comes from in this area. I want to make wind on the mountain.
"wind1" is the object that makes the sound, and the wind is the sound.
I tried (from, to) but it didn't work for me.
you just write the object
"player" is a string, player is an object (which should be there instead)
[player, _officer] say2D ["HelloThere", 50, 0.9];
Well, tell me then, how should it be correct in this BIS example?
My sound "wind"
Object "wind1"
"player"is a string,playeris an object (which should be there instead)
And will the sound move away from the player?
Ok, thanks.
hey @winter rose so basically i am trying to make a squad drills mission sort of , and i got a campaign exported to multilplayer so that i could edit it out, um i am looking for automatic shooting range targets and like coun't on the right corner, on how many target u hit and miss, do you know any good script for , or any of u guys ?
rha, no ping
well,
- it is doable
- I don't know any script that would do that out of the box
- if you want, you can post an ad in #creators_recruiting to hire a scripter (even for free)
- if you want to do it yourself, we can all assist here
sorry for the ping and once again thanks for the help 👍
@wind hedge I believe ACE does this by adding a hitpoint to units, which is guaranteed to trigger last on each collection of handleDamage events, and then processing the accumulated data for that hit.
If you were hoping for a reasonably easy method then I don't think there is one.
is there any script for a randomized re-spawn, so instead of it re-spawning you on the exact spot that the module is on it would spawn you some where with in <5> meters of it
try linking it to an area marker perhaps? but yes such thing exists
Hello guys. This time instead of a question in how to, I come to you with a question of how come:
I have made a script that works according to certain objects in the inventory double click control event handler.
I've been monitoring the indeces of the double click objects using the event handler to match them in a function according to their classname and uses remaining.
The index returned by the control clicked is correct, however, the index to evaluate in the script seems to offset +1 whenever i have a weapon in the container to check. Would any of you know if this behaviour is intended?
Here you can find the way im setting the control event handler (direct name references are defines in my file):
[] spawn
{
waituntil {!(isnull (finddisplay BIS_INVENTORY))};
{
((findDisplay BIS_INVENTORY) displayCtrl _x) ctrlAddEventHandler
["LBDblClick",
{
params ["_control", "_selectedIndex"];
if !(player getVariable ["mk_isHealing",false]) then
{
[lbText [ctrlIDC _control, _selectedIndex], _selectedIndex, ctrlIDC _control] spawn MK_fnc_mkItemUsage;
closeDialog 2;
};
}];
}forEach [IDC_BACKPACKCONTAINER, IDC_VESTCONTAINER, IDC_UNIFORMCONTAINER];
};```
As stated above, when monitoring the double clicking the index return by the control clicked is correct.
Here is a bit of the code being executed by the event handler:
```sqf
[_interceptedItem, 20, _inventoryIndex, _inventoryType, "Healing"] spawn MK_fnc_mkItemInterceptionHandling;
The 3 private variables are the params being passed by the handler.
An the code to be executed relevant to the function is this:
switch (_inventoryType) do
{
case IDC_BACKPACKCONTAINER: {_itemInventory = ((getUnitLoadout player) select 5) select 1};
case IDC_VESTCONTAINER: {_itemInventory = ((getUnitLoadout player) select 4) select 1};
case IDC_UNIFORMCONTAINER: {_itemInventory = ((getUnitLoadout player) select 3) select 1};
};
{
if (_inventoryIndex == (_forEachIndex)) then
{do something;}
else
{do anotherthing};
}forEach _itemInventory
The issue here is that the _forEachIndex in _itemInventory offset positively for each weapon in the container (backpack, vest, uniform).
So just wanted to check if this is intentional or if this could be a side effect (although idk how would i go on modifiying the _forEachIndex haha) of the array being filled with the gerunitloadout command
although idk how would i go on modifiying the _foerEachIndex haha
_forEachIndex + 1...
Im already doing that to fix the offset
😄
just wanted to check why it would offset
the control might have 1 additional item
also:
lbText [ctrlIDC _control, _selectedIndex]
you can just write_control lbText _selectedIndex
for debugging try this:
for "_i" from 0 to 1e3 do {
_txt = _control lbText _i;
if (_txt == "") then {break;};
systemChat _txt; //or log or whatever
}
see what the list box already contains
for each weapon in the container? 😮
will try, thanks
what weapon? did I miss something?
IDC_BACKPACKCONTAINER, IDC_VESTCONTAINER, IDC_UNIFORMCONTAINER
these are just inventory slots
for each weapon in the container?
no just 1. probably something is there as the first item
no, that is not the case:
The index returned by the control clicked is correct, however, the index to evaluate in the script seems to offset +1 whenever i have a weapon in the container to check. Would any of you know if this behaviour is intended?
¯_(ツ)_/¯
use this to see why
this happens for every weapon in them, thats why i mentioned being a very specific problem haha
how do i translate a vector3 into a compass direction?
atan2
cool thx
Why the damage value of damage _obj is different from the MP EventHandler "MPHit" damage?
damage: Number - Level of damage caused by the hit
Return the damage value of an object.
https://community.bistudio.com/wiki/damage
they're just different
do you still need help with this?
Mmm.. thx, they are just different.
Yup
Is this command global or local? https://community.bistudio.com/wiki/forgetTarget
AI commands are generally local arg
Like can I use it on a addEventHandler "HitPart" or it has to be run where the Ai is local?
Ahh ok... so if run from the HitPart EH it has to be run using remoteExec
I need that Ai that has been recently hit to do not return fire immediately like mindless robots and so I thought about making it "forget" the player for a while
Hello
_this addEventHandler ["GetIn", {
params ["_vehicle", "_role", "_unit", "_turret"];
if ((driver _vehicle == _unit) and ((name player) find "[127" == -1)) then {
titleText ["<t color='#ff0000' size='3'>text</t>", "BLACK", -1, true, true];
playSound "Alarm";
_unit setDamage 0.9;
moveOut _unit;
[]spawn{
sleep 30;
titleText ["", "BLACK IN"];
};
};
}];
How to make this script work?
what do you want it to do and how are you using it
It shows text on the screen and darkens it, as well as deals damage and throws the player out of the transport.
class EventHandlers: DefaultEventhandlers
{
fired="_this call (uinamespace getvariable 'BIS_fnc_effectFired');_this execVM '\RD501_Vehicles\air\LAAT\fired_laser.sqf';";
init="[_this select 0] execVM '127th_main\scripts\autocrate\autocrate_mk3_127.sqf';[_this select 0] execVM '127th_main\scripts\signalka\signalka_127_laat.sqf';";
};
!code
```sqf
// your code here
hint "good!";
```
↓
// your code here
hint "good!";
can you fix your code block
_this addEventHandler ["GetIn", {
params ["_vehicle", "_role", "_unit", "_turret"];
if ((driver _vehicle == _unit) and ((name player) find "[127" == -1)) then {
titleText ["<t color='#ff0000' size='3'>text</t>", "BLACK", -1, true, true];
playSound "Alarm";
_unit setDamage 0.9;
moveOut _unit;
[]spawn{
sleep 30;
titleText ["", "BLACK IN"];
};
};
}];
I presume this is for multiplayer?
Yes
and the eventhandler is added in the editor?
Yes
then player is either the host player object or objNull if it's a dedicated server
When used via target in zeus, everything works.
on a dedicated server or on your machine?
dedicated server
used via target
what does this mean?
I see, so you are adding the eventhandler globally
what is the issue specifically? are you trying to make it work from the editor?
When I add it to the config, it doesn't work.
oh i get what you're saying
I haven't configured event handlers like that before but what might be happening is eventhandler is only firing on the server
It might be better to create a function or at least a separate .sqf file you can remoteExec
I could be wrong about this but I'll show you what I would try
_this addEventHandler ["GetIn",{
params ["_vehicle", "_role", "_unit", "_turret"];
[_this, "moveOutLAAT.sqf"] remoteExec ["execVM",_unit];
}]
//moveOutLAAT.sqf
params ["_vehicle", "_role", "_unit", "_turret"];
if ((driver _vehicle == _unit) and ((name player) find "[127" == -1)) then {
titleText ["<t color='#ff0000' size='3'>text</t>", "BLACK", -1, true, true];
playSound "Alarm";
_unit setDamage 0.9;
moveOut _unit;
[]spawn{
sleep 30;
titleText ["", "BLACK IN"];
};
};
this would pass the eventhandler params to the player's machine to execute the script locally
that way all the local commands work
and the server isn't asked to process it every time someone gets in
in case it isn't clear, the second code block is a separate .sqf file that goes in the mission directory; you can also define a function if you are inclined to do that
you might also want to add a isServer check
if (isServer) then { _this addEventHandler ["GetIn",{
params ["_vehicle", "_role", "_unit", "_turret"];
[_this, "moveOutLAAT.sqf"] remoteExec ["execVM",_unit];
}]
};
How would it be more correct to assign execution from the config?
class EventHandlers: DefaultEventhandlers
{
fired="_this call (uinamespace getvariable 'BIS_fnc_effectFired');_this execVM '\RD501_Vehicles\air\LAAT\fired_laser.sqf';";
init="[_this select 0] execVM '127th_main\scripts\autocrate\autocrate_mk3_127.sqf';[_this select 0] execVM '127th_main\scripts\signalka\1.sqf';";
};
And inside 1.sqf will be
_this addEventHandler ["GetIn",{
params ["_vehicle", "_role", "_unit", "_turret"];
[_this, "moveOutLAAT.sqf"] remoteExec ["execVM",_unit];
}]
I'm not familiar with that config process, what I suggested is assuming that the eventhandler is only added on the server. I could be wrong about that.
regardless, you'd want some kind of check to make sure it is only executing for the player who got in the vehicle. If the eventhandler is only added for the server I'd use remoteExec, and if it's a global eventhandler i'd add a check like
if (_unit != player) exitWith {};
```, that way not everyone is executing the code. I'd appreciate if someone could step in here and correct me though
Alive gos into conditions doesn't it?
CfgFunctions
Define your functions there
execVM is slow and prone to exploitation
Can you give an example?
Also, remember that init runs for every client where the unit exists
functions are really nice once you set up the library
how is it prone to exploitation? players overwriting the file?
So Alive gos into conditions in a trigger? Not currently on and it's bugging me
I don't really know what I'm talking about lol, but you can compileFinal functions at least (preventing them from being overwritten by accident or by malicious actors)
ExecVM on a file is the simplest thing to epxlout as it simply just loads the script file form the disk and executes it. You could just alter the file
Use the functions library
hi guys, does anyone have a script for carrying ammo boxes and putting the handgun in the holster please 🙂 i know i'm asking for two things but i'll give it a shot.
can you be more specific
@tiny idol like ace carry and a holster script?
yes, here it is
to transport the ammunition boxes by hand to put in a truck or the huron
to avoid putting the truck next to each box, because sometimes they are spaced
if you're not using ace you'd have to use your own cargo system
can you clarify are you not using ace?
because what you're describing is built in
no I don't use ace, it's a capture the island server in no mod
I think you'll have to write that yourself
i can list some commands that might help
it's nice, but I'm a novice and I script not ^^
yes it would be nice thank you
https://community.bistudio.com/wiki/addAction
https://community.bistudio.com/wiki/attachTo
https://community.bistudio.com/wiki/forceWalk
https://community.bistudio.com/wiki/getItemCargo
https://community.bistudio.com/wiki/addItemCargoGlobal
https://community.bistudio.com/wiki/setVariable
https://community.bistudio.com/wiki/createVehicle
https://community.bistudio.com/wiki/deleteVehicle
https://community.bistudio.com/wiki/Multiplayer_Scripting
woooooo thank you very much, I'm going to watch this thank you again
if its something like the one in invade and annex which i think it is that isnt going to be easy to make but good luck on your adventures
thank you, I will try
My process would probably be to add an action to the object that attaches it (or a stand-in of the same model) in front of the player, as well as storing the box's contents. You can kind of set up a cargo system by setting a variable on the vehicle with an array that contains the classname of the box as well as the contents. That way when you "load" the box you delete it and store the data and when you "unload" the box you can create a new one and add the contents of the old one to the new one.
that's just my brainstorming though, definitely not the best way to go about this
it'll be an undertaking since you're new
but if you got specific questions after reading the documentation someone will help you out
In any case I thank you, I look at all that and try to find the solution. Thank you
I'd try to make it in single player first to get the basics down and then figure out how to tackle the multiplayer aspect
Okay, I'll do that.
Feel really out of place here lol
Is there somewhere I can ask something to the tune of "My script isn't working, could someone point out the really minor issue that is causing it?"
yes, here
What Leopard said
So my goal is to have a action menu item to show and hide a camo net, I'm writing it for public zeus, since I thought it'd be neat, but also get me back into it, I used some of the example off the wiki for this
[this,["Show Camonet",
{params [_this animate ["showcamonetcannon1",1]]},
nil,
42,
false,
true,
"",
"",
-1,
false,
"",
""
]]
remoteExec ["addAction", 0, _this];```
The action comes up, but when I press it
```'params [_this |#|animate ["showcamonetcannon1",1]]'
Error animate: Type string, expected Object```
I feel like it's something super simple I'm missing but I can't figure it out, or is all the code bad? I usually mess around with models, this is new to me I apologize
ignore the -1, just for testing
_this#0 animate ["showcamonetcannon1",1]
oh I missed part of it apologies, but your addition worked, though I still get a
Error Type Any, expected Array,String```
What does the addition of the #0 do?
why do you keep putting the params?
that was all of it
I'm quoting the error
Sorry I probably should have said that, I assumed it'd come out as "ah yeah"
well I mean remove the params
_object = _this; //<-wat?
[this,["Show Camonet",
{_this#0 animate ["showcamonetcannon1",1]},
nil,
42,
false,
true,
"",
"",
-1,
false,
"",
""
]]
remoteExec ["addAction", 0, _this];//<-wat?
This is all my code right now
[this,["Show Camonet",
{params [_this#0 animate ["showcamonetcannon1",1]]},
nil,
42,
false,
true,
"",
"",
-1,
false,
"",
""
]]
remoteExec ["addAction", 0, this];```
The error comes up with it
Oh! I used a old version of my code!
if you're putting this in object init there's no need for the remoteExec
I apolgise I'm not grasping what you're putting out, I'm putting that into my object init, and then launching the game
Idealy I'm using it in public zeus
OH! I get you, sorry! Yes, I get you, no idealy this is used in public zeus
I, read it again and, I get you I think, my bad yeah, I reunderstand, hopefully for last time, so since it's saying this, if the object is destroyed, it won't continue to run in background like I've been warned other scripts can?
I have no idea what you're trying to say.
but no, that's not what this is about.
what I was pointing out is that the first line has _this:
_object = _this; //<-wat?
and yet you're usingthisfor the action._thiswas undefined
and as I said multiple times, drop the params
it should be like this
What does the addition of the #0 do?
https://community.bistudio.com/wiki/a_hash_b
Okay I think I understand a little better what you've been trying to say
[this,["Show Camonet",
{_this#0 animate ["showcamonetcannon1",1]},
nil,
42,
false,
true,
"",
"",
-1,
false,
"",
""
]]
remoteExec ["addAction", 0, this];```
This code works for me, no errors are given to me, thank you! but you left a note next to _object = _this; //<-wat?
not sure why you're asking, sorry, I had to add that since if I removed it it wouldn't understand
```{_this#0 animate ["showcamonetcannon1",1]},```
for some reason (I'm not a scripter)
I just googled a similar issue, and added their fix
but you left a note next to _object = _this; //<-wat?
not sure why you're asking, sorry, I had to add that since if I removed it it wouldn't understand
it does. just remove it
💀
Why are you still remoteExecuting it?
If it's in the init of an object, you dont need to remote execute it
The init runs locally for every device where the object exists
If you want it to not show when the unit is dead, use the condition field with alive check
already answered
Well, the script is wrong
If you try to do both things like this, you will do neither right
[_this,["Show Camonet",
{_this#0 animate ["showcamonetcannon1",1]},
nil,
42,
false,
true,
"",
"alive _target",
-1,
false,
"",
""
]]
remoteExec ["addAction", -2, true];```
Call this and pass the object as the input
This is for use on a public zeus server?
Is the earth a ball?
Yes
Is accurate enough, where as it doesnt depict reality. You can be correct yet not accurate at the same time
anyone have a virtual garage script or smth like that?
don't script for dedi, script for the mission 😉
im spawning a bomb, and try to make it point straight at the ground. but the bomb straight up ignores the "set vector up" command
_bomb = "Bo_Mk82" createVehicle (_x vectorAdd [0,0,10]);
_bomb setPosASL (_x vectorAdd [0,0,10]);
_bomb setVelocity [0,0,-0.5];
_bomb setVectorUp [0,1,0];
diag_log ["vector up for bomb:",vectorUp _bomb];
};
do i have to wait a frame for it to have its vector up changed or sth?
yeah waiting half a second does it. now to figure out how to wait exactly one frame..
if you are running mods you should have CBA. then you can use this https://cbateam.github.io/CBA_A3/docs/files/common/fnc_execNextFrame-sqf.html#CBA_fnc_execNextFrame. With spawn it won't be exactly one frame any time.
aah cool will try that
there's no need. setVectorUp takes effect immediately
your vectorUp is parallel to the vectorDir
so it won't take effect
no. it has nothing to do with sqf.
an object needs an up and dir vector for its orientation to be determined
when you do setVectorDir or Up, it calculates the other from the current Up/Dir respectively
you should use setVectorDirAndUp instead
Its still wierd that two commands executed after eachother block eachother as if they were parallel threaded
what parallel threading? sqf is single threaded
when you create an object its dir is [0,1,0]
and your up was also [0,1,0]
dir cross up is [0,0,0] -> invalid orientation
can a note be added about how getUnitLoadout get the items order in one of the players container compared to their dispayed order in the inventory @winter rose ?
everything inside the players uniform/vest/backpack (even including other containers) except for weapons follow the same order as described in the array loadout, which they return back to top when in the array they are listed as the last indeces, following the order noted in loadout array. The same happens when you use SetUnitLoadout, the items will follow the same order in the inventory display as how they have been set in the lodout array with the exception of weapons, which will go to the top of the list.
This is related to what leopard suggested me to do yesterday, as I noticed an "offset" in a code related to the inventory display.
Maybe this is common knowledge, just suggesting it to be sure.
#community_wiki is a thing, y'know :-p
but yeah can be done
my b! But appreciate it, thanks!
I will add it to https://community.bistudio.com/wiki/Unit_Loadout_Array, if you don't mind
Hello, I would like to create a custom icon on the map which I can also see on the minimap. With "drawIcon" I can display it on the map but not on the minimap, so I tried it with "createMarkerLocal". I only managed to display them on the map and minimap with standard markers or with the help of my own addon. But there is the problem that all players need the addon to display the icon correctly, which I want to avoid. As far as I can tell, it works in KOTH somehow that non-standard markers are displayed on the map and minimap.
drawIcon should work on the minimap too
how did you try it?
Is there anyway to hide parts of the Aircraft carrier? Specifically the control tower?
depends. I think the control tower is one with the deck
but anyway, the carrier has multiple parts
you can try your luck with hideObject
it's a variable. don't remember its name. see the init function of the carrier's base
i will look into it. Thank you.
Ah, I think I found my mistake, I use "findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw",...", but I have to do it twice once with id 12 and once with id 133. Would that be correct or? Or is there a better way?
that or just add one EH
Thank you!
and once with id 133
its control ID might be different tho
Is it possible to enable the weapon selection panel for vehicles that don't have weapons (e.g Caesar)? (I added weapons to said vehicles using addWeaponGlobal)
I have to ask, are the items at the end of the array listed as first items in the UI?
well, let's go to #community_wiki to talk about it @kindred zephyr 🙂
Question is anyone here familiar with JBOY giants script? If so, anyone got it to work?
my sound isn't found
class CfgSounds
{
sounds[] = {};
class Helo1
{
name = "Helo1";
sound[] = {"Helo1.ogg", db+3, 1.0, 10};
titles[] = {0, ""};
};
};
player setPos (getMarkerPos "AB");
playSound "helo1"
it's played by a .sqf that teleports a player the market
what did I do wrong?
nvm
I had it under /*
