#arma3_scripting

1 messages · Page 753 of 1

keen trout
#
params ["apple", "pear", "nut"];
#

in file 2?

fair drum
#

no. they can be literally whatever you want, just don't forget the _ before each one

keen trout
#

but they can just be the same variable

#

?

#

or no

fair drum
#

sure if you want to name it the same thing

#

i'm trying to show you a concept

keen trout
#

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

fair drum
#

incorrect

keen trout
#

uh oh

fair drum
#

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

keen trout
#

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

fair drum
#

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

keen trout
#

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];

fair drum
#

that should be fine unless you are accidentally overriding your variable on the way down there

keen trout
#

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?

fair drum
#

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

#

to send the whole thing

keen trout
#

okay

#

its either something up with my variable's or sending the variable into another sqf anyways

fair drum
#

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

keen trout
#

so would i just stick the params inside the event handler?

fair drum
#

no

#

remove the stuff from initplayerlocal, its not needed

#

and ill show you

keen trout
#

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

fair drum
# keen trout basically i'm trying to have a system were different players will have the same ...
//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];
    };
}];
keen trout
#

oh wow thats very clean

keen trout
#

is it this?

#

is that the key

little raptor
#

just because isPlayer is true doesn't mean it's THE player

little raptor
keen trout
#

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

fair drum
#

i mean you could, most things are possible. but thats for you to figure out and try first

torpid quartz
#

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

steel fox
#

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

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
fair drum
#

@torpid quartz use "TicketsSpawn" for your template to subtract on respawn instead of death.

spark turret
#

is there a way to get the actual car object a unit is embarked on, instead of the driver/group leader?

little raptor
#

wat? vehicle returns the vehicle

faint oasis
#

hi, can we moveTo a vehicle ? because moveTo a unit work but not a vehicle.

little raptor
copper raven
faint oasis
little raptor
faint oasis
#

oh on a unit too ?

#

ok i will try then

little raptor
#

the vehicle

faint oasis
#

yeah but actually i tried on a man

#

and it doesn't work on a man

little raptor
faint oasis
#

oh ok but i said this without try because i tried and moveTo seems to doesn't work for me.

faint oasis
#

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 ?

little raptor
faint oasis
little raptor
#

there's none

faint oasis
#

oh ok

#

thanks you

clever radish
#

any way to detect if Eventhandler Fireman has silencer?

winter rose
#

yes, see here @clever radish

clever radish
spark turret
#

can i tell a car to face a certain direction?

#

without a hard overwrite

winter rose
spark turret
#

i mean setDir. i would rather command it

#

so it turns in the right direction by itself

ebon citrus
#

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

warm coral
#

does anyone have a possible way of making a unit simulated but like really fucking tiny with setobjectsclae?

hushed tendon
#

setObjectScale doesn't really work with simulated things from what I know of

warm coral
#

seen people use this but it seems to kinda just bug out

[] spawn {
    while {alive dude1} do {
    dude1 setObjectScale 0.3;
    };
};
hushed tendon
#

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

warm coral
#

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

little raptor
#

but in any case it's not supported so why bother?

warm coral
#

its simple

#

tiny toy soldier

warm coral
#

nvm figured it out

#

i take that back when he tries to move it breaks

ebon citrus
#

also, you shouldnt do this in multiplayer

warm coral
#

i tried it with every frame

#

worked so he doesnt spaz out but as soon as he moved it kinda died

ebon citrus
#

can you post the script?

warm coral
little raptor
#

wat?

#

ditch the spawn and while...

warm coral
#

aight fair enough

#
do {onEachFrame {dude1 setObjectScale 0.3;}
    };
};

so like this instead?

little raptor
#
onEachFrame {dude1 setObjectScale 0.3;}
warm coral
#

ah, my bad

#

im really bad with this shit lmao

ebon citrus
#

dont worry, everyone started there

#

if you've done this for years now and still kinda not good, then worry

#

i worry everyday

#

😐

warm coral
#

ive done it for a max of like 2 months lmao and it was simple scripts and triggers

mental prairie
#

How do I play a voiceline from the campaign?

warm coral
#

only now trying to dive in the deep end and bring the game to its limits for the memes

ebon citrus
#

the names can be found at CfgSounds

warm coral
#

doesnt say3d cause issues in multiplayer?

#

i remember it always breaking for me and had to use the cba sayglobal function

mental prairie
ebon citrus
#

you need to execute them locally (to where you want to hear the sound)

warm coral
#

ah fair enough

ebon citrus
#

the messages are defined in CfgRadio

#

remember to read the biki

mental prairie
#

okay, thanks

mental prairie
#

Like, I want to make a mission that's basically a diffrent perspective of the stratis incident

ebon citrus
#

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

fair drum
#

3den enhanced also has the cfgsentences viewer as well which is useful

mental prairie
#

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.";
    };```
fair drum
hallow mortar
#

We were doing this not too long ago and got it working. Add a @ before the a3 in your file paths

mental prairie
#

NVM

open fractal
#

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

fair drum
#

when you go to add your parameter functions, just do a switch do for the integer and convert it to the string you want

hushed tendon
#

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;

winter rose
#
_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

hushed tendon
#

Idk if I should do it like that tho...

winter rose
#

it's meh 🙃 make a function and remoteExec that

winter rose
#

so many things to check

hushed tendon
winter rose
#

and what does the error say…?

hushed tendon
#

nothing and that is why Idk what to do

winter rose
#

so you don't have an error…?

hushed tendon
#

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

winter rose
#

oh and also:

it's```sqf
[[], {}] remoteExec ["spawn"];

hushed tendon
#

[] for passing param?

winter rose
#

well, spawn is a binary command

ebon citrus
#

it takes a prefix as arguments and subfix as the code

hushed tendon
#

That makes sense

winter rose
#

<left> spawn <right>

[<left>, <right>] remoteExec ["spawn"];

hushed tendon
ebon citrus
#

similarily:
[object, position] remoteExec ["setPos"]

winter rose
winter rose
ebon citrus
hushed tendon
ebon citrus
#

i like setPos

#

because you can be imprecise with your z and it will sort of find a place for you

hushed tendon
ebon citrus
#

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

hushed tendon
#

Well thank you both for the help!

ebon citrus
#

i didnt even help

winter rose
#

takes both thanks for himself

hushed tendon
ebon citrus
#

yeah, Lou and Montana deserve thanks for this one

quasi rover
#

#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.

quasi rover
#

thx

brazen lagoon
#

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

fair drum
brazen lagoon
#

cool thanks

surreal peak
open fractal
#
"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

little raptor
surreal peak
#

Ty

still forum
surreal peak
#

Ah cool, thanks

still forum
#

though just realized it doesn't work for terrain surface names 👀

ebon citrus
#

is there a way to override the unit insignia on vehicles?

hallow mortar
#

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

ebon citrus
#

yeah, makes sense

#

better just to config out the clan selection

#

insignia can be set by script but the clan is set by engine

open fractal
#

is there any reason not to use a .jpg for setObjectTextureGlobal?

#

I'm getting what looks like compression artifacts when I convert to paa

austere granite
#

is your image power of two?

hallow mortar
#

^in pixel dimensions, e.g. 512x512, 1024x1024 etc

open fractal
#

2048x2048

hallow mortar
#

btw, jpeg is a lossy format and introduces compression artefacts on its own

open fractal
#

I should try converting from png

#

or I guess I got options from photoshop

#

I'll try converting a heavier file and come back

open fractal
#

it's because I was trying to convert from jpeg

tender fossil
#

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?

hollow thistle
#

If you think about something bigger then no, every big mission that exists seems to be written a bit differently.

tender fossil
real gorge
#

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?

open fractal
real gorge
#

Will do, thanks

lapis ivy
#

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?

still forum
#

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

lapis ivy
boreal parcel
#

hey can anyone tell me what line I would need to put in my description.ext to allow composition scripts?

fair drum
boreal parcel
#

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

fair drum
fading dust
#

hello what is best script for AI paradrop without them loosing their backpacks

fair drum
fading dust
#

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

ebon citrus
#

parachutes are just vehicles like anything else

exotic yarrow
#

what is the maximum amount of data that can be stored in profileNameSpace?

pliant stream
#

maybe back it up first though. the game will probably crash too

little raptor
#

I don't think there's a limit

pliant stream
#

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

little raptor
#

well I mean in game limit

quasi rover
#

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
little raptor
#

I think... thonk

quasi rover
#

give me more tips, please.

winter rose
#

that's what she said

little raptor
quasi rover
#

It doesn't work. I couldn't delete the marker with 'delete'key, even though I put channel and creator arg.

winter rose
#

it always depends on the arguments…!

winter rose
#

(unless Arma 2) (where profileNamespace doesn't exist)

pliant stream
#

profileNamespace does exist in A2OA

winter rose
#

ah, OA perhaps indeed! I only remembered it being introduced with TKOH 🙂

tender fossil
#

@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?

winter rose
tender fossil
#

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?

stray flame
#

hey

#

is there a way to make a hold-action repeatable?

#

or even addaction

hallow mortar
#

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]

stray flame
#

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

hallow mortar
#

What command are you using to play the video?

stray flame
#

play = ["Video_feed1.ogv"] spawn BIS_fnc_PlayVideo;

hallow mortar
#

That function has local effect so it shouldn't affect other players unless you go out of your way to remoteExec it

stray flame
#

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

stray flame
#

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

granite sky
#

Join them to a group of a different side.

stray flame
#

Any recommended methods?

#

I want them to stay as that side afterwards

#

So respawn shouldn't reset it

fair drum
#

does setWaypointLoiterRadius use flyInHeight or flyInHeightASL?

little raptor
fair drum
little raptor
fair drum
#
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.
little raptor
#

that one doesn't create new groups

little raptor
drifting portal
#
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
}];
};
drifting portal
#

_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

little raptor
drifting portal
#

inside the EH?

#

Anyway to not make it global?

little raptor
drifting portal
#

good

#

I will try and give feedback

little raptor
#

_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?

drifting portal
little raptor
drifting portal
#

its a bomb don't want it to explode or have collision of any sorts

hallow mortar
#

If you're trying to create a visual-only bomb, you should create the bomb's model as a Simple Object

drifting portal
#

I'm using this for zeus

#

pub zeus

drifting portal
little raptor
drifting portal
hallow mortar
drifting portal
little raptor
little raptor
drifting portal
#

we can join a VC

#

if you want to

#

I can show it

little raptor
#

if it works then blobdoggoshruggoogly

drifting portal
#

do you know of any "Rearm" event handler?

#

when the object rearms it runs a code

hallow mortar
#

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.

drifting portal
drifting portal
#

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

hallow mortar
#

Remind me why you're doing this instead of using the actual pylons system

drifting portal
#

cessar

#

will this work?

hallow mortar
#

maybe

radiant siren
# drifting portal cessar

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?

radiant siren
# drifting portal 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

drifting portal
# radiant siren myObject addEventHandler ["Reloaded", { myObject hideObjectGlobal true; ...
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;
radiant siren
#

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

drifting portal
drifting portal
#

so EH is not being called

#
_this addEventHandler ["Reloaded", {
    params ["_unit", "_weapon", "_muzzle", "_newMagazine", "_oldMagazine"];
    (_unit getVariable "Lefakebomb") hideObjectGlobal false;
    systemChat "CHECK";
}];
wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```

// your code here
hint "good!";
drifting portal
steel fox
little raptor
#

this is in a vehicles Init?
if so this is correct

steel fox
#

One of the things I will keep mixing up I geuss

steel fox
#

Just test the Reloaded EH on its own to verify your use case before testing the whole code.

drifting portal
#

can't think of any

drifting portal
drifting portal
#

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

gaunt phoenix
#

please help 😦 init.sqf not found

open fractal
#

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

gaunt phoenix
#

i have a bigger problem

#

😭

#

i have a bigger problem

open fractal
#

idk man im up to something pretty big

gaunt phoenix
#

extDB3: Error with Database Connection

gaunt phoenix
#

@open fractal please help me my friends

open fractal
#

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.

gaunt phoenix
#

ok i got everything connected

#

but its not working

#

extDB3: Error with Database Connection

#

everyonne please help my

sturdy mica
#

Need help setting up a ai unit to fire artillery

sturdy mica
warm hedge
#

If you want us to figure it out, need to write what's the code you use, or you get nothing

gaunt phoenix
#

please help me

sturdy mica
#

I figured it out I had one number off

gaunt phoenix
#

extDB3: Error with Database Connection

everyonne please help my

copper raven
#

no one will be able to help if you don't give any code/context

fair drum
#

which command do i use to set a turret's aim point, even if its a player?

fair drum
#

can slave a tv turret with it

fair drum
#

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

little raptor
#

drawIcon3D has no limit

fair drum
# little raptor no
// 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

little raptor
#

it's related to the size you use

#

not drawIcon3D itself

#

also this is wrong:

private _delta = (player distance _pos) / hyp_iff_multi;

winter rose
#

try 1 instead of 1 * _delta

little raptor
#

you should use the inverse of distance

fair drum
#

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?

little raptor
#

e.g. selectionPosition or modelToWorld

fair drum
#

hmmm good point. let me try something different

little raptor
#

I know for a fact that drawIcon3D has no limit

winter rose
#

or the unit gets hidden perhaps? even though I don't think it would have an impact on selectionPosition

little raptor
#

no a hidden unit is still there meowsweats
afaik selectionPos and modelToWorld can't be the problem either

#

I've used them forever

winter rose
#

yeah, I don't see any issue from the code either ^^'

fair drum
#

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...

winter rose
#

« don't sleep and code »\®

#

how many stupid mistakes did I make while scripting tired
or obvious flaws missed

copper raven
#

thinking about something
writing something completely different, not related to anything you were thinking
😄

versed widget
#

does lockTurret command works with ai only ? 🤔

winter rose
clever radish
#

How do I remove an HoldAction temporarily?

warm hedge
#

Add a boolean or some variables to the conditions and make the condition false using the variable

quartz blade
#

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

winter rose
#

well this should not happen, unless you are a civilian unit to begin with

quartz blade
#

and when I die and I respawn it changes to civ

warm hedge
#

Sounds like you're just playing a badly made mission?

winter rose
#

default respawn does no such thing

quartz blade
#

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?

warm hedge
#

No. setSide won't work like that, nor for units

quartz blade
#

What can I use for units?

warm hedge
#

There's nothing

winter rose
#

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

quartz blade
#

Yeah right. Okay, thank you for the answer!

onyx pendant
winter rose
quartz blade
#

@winter rose I found the mod! It was a mod that makes soldier surrender after some damage etc

winter rose
#

aaaah, indeed, it might interfere!

drifting portal
#

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?

winter rose
#

most likely in CfgMagazines then CfgAmmo

drifting portal
#

for example the model of weapon called Twin_Cannon_20mm

drifting portal
drifting portal
#

but thats just a magazine

drifting portal
drifting portal
winter rose
#

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)

ivory lake
#

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

drifting portal
#

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

winter rose
#

no no problem at all? you were looking for something and we tried to help

drifting portal
#

nah not about that I probably made you worried about your skills lol

winter rose
#

oh no, I know I don't know poop about models and configs don't worry at all 😄

flat stratus
#

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

little raptor
fair pilot
#

How do i go about calculating a vector perpendicular to a vectorUp of an object?

winter rose
#

Maths

little raptor
pliant stream
#

there is an infinite number of such vectors. in fact a vector is perpendicular to an entire plane

little raptor
#

infinite planes

pliant stream
#

true

#

there is one such plane that goes through the object's origin 😛

fair pilot
#

Well i need to calculate a new vectorDir based on vectorUp of an object

little raptor
#

as Untelo said there are infinite ways

pliant stream
#

do you have an azimuth

little raptor
#

perhaps you should explain what you're trying to do and how's the new dir related to the old one, etc.

fair pilot
little raptor
#

so you're trying to rotate the object around its up?

pliant stream
#

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

fair pilot
little raptor
#

with vectorUp = [0,0,1]
why not use setDir?

#

since you also have an azimuth

fair pilot
#

Because it overwrites vectorUp

little raptor
#

but you just said vectorUp = [0,0,1]?

winter rose
#

in the same way

little raptor
fair pilot
#

Yep

winter rose
#

as in, setDir + setVectorUp I think yes (what you said)

fair pilot
#

I think

little raptor
#

so have an angle right? (angle of rotation)

#

or a second vector?

fair pilot
#

I have an angle in degrees and vectorUp

little raptor
#

you can use BIS_fnc_rotateVector3D to rotate the vectorDir + setVectorDirAndUp

fair pilot
#

Thanks i will try it

little raptor
#

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

winter rose
little raptor
#

I don't believe in them 😛

winter rose
#

HERESY!!

clever radish
#

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];                
};
wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```

// your code here
hint "good!";
clever radish
winter rose
winter rose
craggy lagoon
#

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.

fair drum
craggy lagoon
fair drum
# craggy lagoon Ok ok so this could be done with the getvariable then. Could you please give me ...

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;
fair drum
tender fossil
#

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?

little raptor
#

sqf commands are operators

#

e.g. when was the last time you saw 1 +?

#

so _something count is not valid either

tender fossil
#

Ahh, it's on the wrong side of variable 😄

little raptor
#

yes, just like any other operator

tender fossil
#
while {count (missionNamespace getVariable format ["daylight_arrFishSchools%1", _species]) < 10} do {

There we go

#

Brainfart #158329

#

Thanks 😛

tender fossil
#

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?

digital wasp
#

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..

digital wasp
#

thanks

tender fossil
little raptor
tender fossil
#

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

little raptor
tender fossil
#

Thanks for your input! I guess the KOTH way would be an option as well to avoid profileNamespace cluttering

drifting portal
#

how do I rotate a simple object?

little raptor
#

like any other object

#

setDir/setVectorDir/setVectorDirAndUp

drifting portal
#

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

grim ravine
#

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?

winter rose
#

but it looks like a config issue

grim ravine
#

That is the log notlikemeowcry

winter rose
#

remove half your mods, check if it happens again, if so remove half of that, etc

grim ravine
#

Alright, was hoping there was a nice easy way to do it 😦

little raptor
#

vectorFromTo is meaningless

grim ravine
drifting portal
cursive tundra
#

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'"];
winter rose
cursive tundra
#

how do i escape the " so that it works, if thats possible?

copper raven
winter rose
#

yep

'my "quoted" string'
// or
"my ""quoted"" string"
#

(as you already did for the hint)

cursive tundra
#

Thanks guys, fixed it, now the error is gone 🙂

fair drum
#

how do you guys like to organize long multiline string statements?

winter rose
#

it's not even sarcasm, long strings belong in a stringtable
if you set a looong trigger statement, better script the solution anyway

fair drum
winter rose
#

I always internationalise ("make translation-ready") my missions

fair drum
# winter rose definitely yes

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?

winter rose
#

VSCode 😅

fair drum
#

does it have a built in one? or are you actually typing out all these containers?

winter rose
#

I believe you can directly make "Project" → "Key", no need for architecture

#

I use containers to split briefing, UI, conversations etc

lapis ivy
#

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.

winter rose
#

@open fractal better moving as you will have answers there 😉

open fractal
#

👍

fair drum
#

@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?

winter rose
#

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";

wind hedge
#

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

#

?

ebon citrus
#

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

lapis ivy
#
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?

winter rose
#

You can use getMissionPath more directly btw

lapis ivy
#

How?

winter rose
lapis ivy
#

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.

winter rose
#

yeah, but you don't want to tell a client that is a km away from the shoreline "hey, play the shore sound"

ebon citrus
#

Say3d is a good way to do that too, you can set a amximum distance

lapis ivy
#
playSound3D [getMissionPath "" + "sound\coast.ogg", coast1, false, getPosASL coast1, 4, 1, 600] remoteExec Call;

This may not be entirely correct?

ebon citrus
#

If your misison has a lot of static sound sources, i recommend running them client side from a trigger that enables/disables them

lapis ivy
#

I don't need to disable until the end of the mission. That is, they should always be on the mission.

ebon citrus
#

There are plenty of examples. Try again and if it doesnt work/you dont understand, come back

#

I recommend say3d over playsound3d

lapis ivy
#

I'd love to, but I can't test it in multiplayer right now.

ebon citrus
#

You dont need to

lapis ivy
#

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?

winter rose
#

scripting and say3d locally

#

…as we say :p

lapis ivy
#
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?

ebon citrus
ebon citrus
#

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

lapis ivy
#

Okay, but what about the players who joined after the start of the mission? Will they be all right?

winter rose
#

yes

lapis ivy
#

Ok

#

thx

ebon citrus
lapis ivy
#

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];
ebon citrus
#

Init.sqf executes on all systems

winter rose
#

and fix that getMissionPath!

ebon citrus
#

Use if hasInterface then to check for player clients

winter rose
#

(also, I believe say3d takes a relative path)

winter rose
lapis ivy
ebon citrus
winter rose
#

ah true :p

ebon citrus
#

🔨

#

Here

winter rose
#

ouch heeey

ebon citrus
#

If you need it

lapis ivy
#
if (hasInterface) then { 
   Say3D [getMissionPath "sound\coast.ogg", coast1, false, getPosASL coast1, 4, 1, 600];
};

Right?

#

in init.sqf

ebon citrus
#

Read the description and see the examples

lapis ivy
#
if (hasInterface) then { 
   Say3D [getMissionPath "sound\coast.ogg", coast1, false, getPosASL coast1];
};
ebon citrus
winter rose
ebon citrus
#
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. ```
lapis ivy
#

I have Description

#
class CfgSounds
{
 sounds[] = {};
 class Coast
 {
 name = "Coast";
 sound[] = {"sound\coast.ogg", db+10, 1.0};
 titles[] = {};
 };
}
ebon citrus
#

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

lapis ivy
#

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?

ebon citrus
#

Move the logic

#

I would still use 2d sound with fade for this

#

But it's your funeral

#

Move the logic instead

lapis ivy
#

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?

ebon citrus
#

If you want it to play at specific points, get the closest point to the player and place the logic there

winter rose
#

well, players' PCs

ebon citrus
#

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

lapis ivy
#

I roughly understand how it is, but I don’t understand how to implement it at all.

ebon citrus
#

Just make sure adjacent markers are always closer to each others than others

lapis ivy
#

That is, when the player is near the shore, the sound will follow him?

ebon citrus
#

So be mindful of the coast-shape

ebon citrus
#

Or is it some kind of ambient gunfire from a lansing party?

lapis ivy
#

Sounds of waves.

ebon citrus
#

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

lapis ivy
#

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.

ebon citrus
#

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?

lapis ivy
#

I'll take a screenshot now.

ebon citrus
#

For 3d, you want to be kind of accurate with the location

ebon citrus
#

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

tough abyss
#

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?

rare flame
#
[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.

open fractal
warm hedge
#

Because say2D does it in 2D space, not 3D

#

Also what he said. Your syntax doesn't seem good

rare flame
#

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.

open fractal
warm hedge
#

"player" is a string, player is an object (which should be there instead)

rare flame
#
[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"

warm hedge
#

"player" is a string, player is an object (which should be there instead)

rare flame
#

And will the sound move away from the player?

warm hedge
#

Note the quotation marks

#

I never tried this syntax so can't really say

rare flame
#

Ok, thanks.

tough abyss
#

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 ?

winter rose
#

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
tough abyss
#

sorry for the ping and once again thanks for the help 👍

granite sky
#

@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.

scarlet flume
#

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

winter rose
kindred zephyr
#

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

little raptor
#

although idk how would i go on modifiying the _foerEachIndex haha
_forEachIndex + 1...

kindred zephyr
#

Im already doing that to fix the offset

#

😄

#

just wanted to check why it would offset

little raptor
#

also:

lbText [ctrlIDC _control, _selectedIndex]
you can just write _control lbText _selectedIndex

little raptor
#

see what the list box already contains

kindred zephyr
little raptor
#

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

kindred zephyr
#

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?

little raptor
#

¯_(ツ)_/¯

kindred zephyr
#

this happens for every weapon in them, thats why i mentioned being a very specific problem haha

spark turret
#

how do i translate a vector3 into a compass direction?

little raptor
#

atan2

spark turret
#

cool thx

quasi rover
#

Why the damage value of damage _obj is different from the MP EventHandler "MPHit" damage?

open fractal
#

they're just different

radiant siren
quasi rover
#

Mmm.. thx, they are just different.

tough abyss
#

Yup

wind hedge
still forum
#

AI commands are generally local arg

wind hedge
#

Like can I use it on a addEventHandler "HitPart" or it has to be run where the Ai is local?

wind hedge
#

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

tough abyss
#

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?

open fractal
#

what do you want it to do and how are you using it

tough abyss
#

It shows text on the screen and darkens it, as well as deals damage and throws the player out of the transport.

open fractal
#

and I presume it's not doing that?

#

where are you putting it

tough abyss
#
        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';";
        };
tough abyss
open fractal
#

!code

wicked roostBOT
#
How to use SQF syntax highlighting in Discord

```sqf
// your code here
hint "good!";
```

// your code here
hint "good!";
open fractal
#

can you fix your code block

tough abyss
#
_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"];
        };
    };
}];
open fractal
tough abyss
#

Yes

open fractal
#

and the eventhandler is added in the editor?

tough abyss
#

Yes

open fractal
#

then player is either the host player object or objNull if it's a dedicated server

tough abyss
#

When used via target in zeus, everything works.

open fractal
#

on a dedicated server or on your machine?

tough abyss
#

dedicated server

open fractal
#

used via target
what does this mean?

tough abyss
open fractal
#

I see, so you are adding the eventhandler globally

#

what is the issue specifically? are you trying to make it work from the editor?

tough abyss
#

When I add it to the config, it doesn't work.

open fractal
#

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];
}]
};
tough abyss
#

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];
}]
open fractal
#

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
coarse dragon
#

Alive gos into conditions doesn't it?

ebon citrus
#

Define your functions there

#

execVM is slow and prone to exploitation

tough abyss
#

Can you give an example?

ebon citrus
#

Also, remember that init runs for every client where the unit exists

open fractal
#

functions are really nice once you set up the library

open fractal
coarse dragon
#

So Alive gos into conditions in a trigger? Not currently on and it's bugging me

tender fossil
ebon citrus
#

Use the functions library

tiny idol
#

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.

open fractal
#

can you be more specific

tough abyss
#

@tiny idol like ace carry and a holster script?

tiny idol
tiny idol
open fractal
#

can you clarify are you not using ace?

#

because what you're describing is built in

tiny idol
open fractal
#

I think you'll have to write that yourself

#

i can list some commands that might help

tiny idol
tiny idol
tiny idol
#

woooooo thank you very much, I'm going to watch this thank you again

tough abyss
#

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

open fractal
#

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

tiny idol
open fractal
#

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

rose steeple
#

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?"

ebon citrus
#

What Leopard said

rose steeple
#

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

little raptor
rose steeple
#

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?
little raptor
#

that was all of it

rose steeple
#

I'm quoting the error

#

Sorry I probably should have said that, I assumed it'd come out as "ah yeah"

little raptor
#
_object = _this; //<-wat?
[this,["Show Camonet",
    {_this#0 animate ["showcamonetcannon1",1]},
    nil,
    42,
    false,
    true,
    "",
    "",
    -1,
    false,
    "",
    ""
]]
remoteExec ["addAction", 0, _this];//<-wat?
rose steeple
#

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!

little raptor
rose steeple
#

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?

little raptor
little raptor
rose steeple
# little raptor it should be like this

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

little raptor
#

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

rose steeple
#

💀

ebon citrus
#

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

ebon citrus
#

Right, then what is this for?

#

That's not a valid parameter

little raptor
#

that was just for testing I guess

#

in init

#

¯_(ツ)_/¯

ebon citrus
#

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

little raptor
#

this isn't correct either

#

-2
should either be 0 or [0,-2] select isDedicated

ebon citrus
#

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

floral sierra
#

anyone have a virtual garage script or smth like that?

spark turret
#

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..

steel fox
spark turret
#

aah cool will try that

little raptor
little raptor
#

so it won't take effect

spark turret
#

Ah good to know thanks

#

Wierd sqf behavior at its best..

little raptor
# spark turret Wierd sqf behavior at its best..

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

spark turret
#

Its still wierd that two commands executed after eachother block eachother as if they were parallel threaded

little raptor
#

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

kindred zephyr
#

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.

winter rose
kindred zephyr
#

my b! But appreciate it, thanks!

real epoch
#

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.

little raptor
#

how did you try it?

sudden yacht
#

Is there anyway to hide parts of the Aircraft carrier? Specifically the control tower?

little raptor
#

but anyway, the carrier has multiple parts

#

you can try your luck with hideObject

sudden yacht
#

@little raptor Any idea how i can find the part names?

#

easily?

little raptor
#

it's a variable. don't remember its name. see the init function of the carrier's base

sudden yacht
#

i will look into it. Thank you.

real epoch
# little raptor how did you try it?

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?

real epoch
little raptor
drifting portal
#

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)

winter rose
winter rose
cobalt path
#

Question is anyone here familiar with JBOY giants script? If so, anyone got it to work?

modest temple
#

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 /*