#arma3_scripting

1 messages Β· Page 673 of 1

little raptor
#

yeah that's better
just use a timer

fair drum
#

something more like this?

//Run whole file on every machine's init

tag_engineCycle_heli = {

    params ["_vehicle"];

    if (!canSuspend) exitWith {_this spawn tag_engineCycle_heli};

    _vehicle setVariable ["turbineSoundPlaying", true];
    _vehicle engineOn false;
    playSound3D [getMissionPath "turbineSound.ogg", _vehicle, false, [0,0,0], 5, 1, 300, 0];
    sleep 5; //However long the turbine sound is when you want rotors to spin (probably best to overlap them with vanilla)
    _vehicle engineOn true;
    _vehicle setVariable ["turbineSoundPlaying", false];
};

vehicleNameHere addEventHandler [

    "Engine",
    {
        params ["_vehicle", "_engineState"];

        private _evaluate = {
            !(_vehicle getVariable ["turbineSoundPlaying", false]) && !(_engineState) && (speed _vehicle < 5)
        };

        if (_evaluate) then {
            [_vehicle] remoteExec ["tag_engineCycle_heli", _vehicle];
        };
    }
];
craggy lagoon
#

Would someone be able to help me with using the "disableUAVConnectability" command? I've been able to get this working if I assign a variable name to an Eden placed object. But I would like this to apply to all "B_UGV_02_Demining_F" objects that are spawned after the mission starts. While still allowing other defined players access to them.

copper narwhal
fair drum
copper narwhal
fair drum
#

if you want it to apply to every vehicle of a class, look at the function i posted above for fearmonger

copper narwhal
copper narwhal
#

@fair drum if i wanted certain vehicles to have a different sound and startup time then i guess i'd have to add a single classname to multiple iterations of your code?

fair drum
copper narwhal
warm swallow
#
if (isServer) then {
   _playerList = if (isMultiplayer) then { playableUnits; } else { switchableUnits; }; // For testing in editor mostly
   _randomPlayer = _playerList call BIS_fnc_selectRandom;

   [[_randomPlayer], "btk_fnc_MPexecVMLocal"] call BIS_fnc_mp;
};

i found this script online, can i use _randomPlayer as my target and then execVM "script.sqf";?

winter rose
#

yes…?

warm swallow
finite sail
#

_randomplayer = selectRandom _playerlist;

#

newer, faster command

warm swallow
#

oh epic

warm swallow
finite sail
#

its best to leave the isserver stuff in there

warm swallow
#
if (isServer) then {
   _playerList = if (isMultiplayer) then { playableUnits; } else { switchableUnits; }; // For testing in editor mostly
   _randomPlayer = _playerList call BIS_fnc_selectRandom;

 [[ _randomplayer = selectRandom _playerlist; 

So like this?

#

wait

#
if (isServer) then {
   _playerList = if (isMultiplayer) then { playableUnits; } else { switchableUnits; };
  _randomplayer = selectRandom _playerlist;
#

@finite sail

finite sail
#

yep

warm swallow
little raptor
#

also it never "_evaluates" (it does but wrongly)

warm swallow
#

@finite sail ok so now I have playable units and also _randomPlayer.. How do I exclude the randomPlayer. Is there something thats like allPlayableUnits - _randomPlayer?

finite sail
#

yes.. allplayableunits - [_randomplayer]

warm swallow
#

gotcha

#

also @finite sail if I want all the characters to have a random spawn should I use empty markers on each position and then use an array and also the getrandom command?

#

nevermind on the last one, apparently you can set a random start in the 3den editor. My next question in this case would be, is there a way to have all my units use all the available spawns, or would I have to have separate random spawns for each player in order to prevent them from spawning potentially on top of each other...

#

well hmmmm that wouldnt work either. It needs to be called with roundStart.sqf so I would need to use setPos

fair drum
craggy lagoon
fair drum
warm swallow
#
_pos = [allplayableunits - [_randomplayer] , 1, 150, 3, 0, 20, 0] call BIS_fnc_findSafePos;

setPos [allplayableunits - [_randomplayer] = _pos;  
#

what i have atm

craggy lagoon
fair drum
#

You want your disable uav code in that slot so it can run on every vehicle that spawns. Plus, if you named everything drone, you'd overwrite your previous drones name.

#

So take out the unit setvehiclevarname line and replace it with the disable uav code you wrote earlier (which you never posted. I'm assuming you had something)

craggy lagoon
fair drum
#

is this single player or multiplayer

craggy lagoon
#

Right now it's in single player, but will be moved to a dedi.

fair drum
#

k standby

craggy lagoon
#

Thank you very much for all your help!!

fair drum
#

should mention that all machines need CBA loaded

craggy lagoon
#

Understood, thank you. I'll let you know how it works out.

calm badger
#

rookie scripter here: how would i get a while-do loop to run in a scheduled environment? i know of no other solution besides just
[] spawn { while {true} do {

south gale
#

Need help with a small script

#

Why doesnt this work?

#

this addAction ["Teleport", {player setPos (10067,2680,0)}]

#

To add a teleport option to an object?

fair drum
#

needs to be an array

south gale
#

So how would I put that into the command?

fair drum
#

your error is that you used (), you want []

south gale
#

THANK YOU

#

You are a life saver

fair drum
calm badger
#

trying to get this to run in the init of a squad

#

spits out an error though

fair drum
#

post it

warm swallow
#

@fair drum do you know anything about multiplayer scripting?

calm badger
#
|#|sleep 1;```
#

full expression is

fair drum
#

yeah post the full thing

calm badger
#
sleep 1;  
[manteam, 1] setWaypointPosition [position alphasergeant, 0];
};```
#

ope should be 1 instead of 0 but that's not where the error is being spit out at

#

wait no its fine, the numbers are what they should be

fair drum
#

is alpha sergeant manteams leader?

calm badger
#

yes it is

fair drum
#

k

#
[manteam] spawn {

    params ["_group"];

    while {true} do {
        sleep 1;
        [_group, 1] setWaypointPosition [position leader _group, 1];
    };
};
calm badger
#

oh, thank you

#

what does params ["_group"]; do?

fair drum
#

let me type up explaination

calm badger
#

thanks

south gale
#

How do I add hideobject to the object that has the command I asked about?

fair drum
# calm badger what does ```params ["_group"];``` do?
[1, 2, 3] spawn {

    params ["_apple", "_pear", "_cherry"];

    _apple; //returns 1
    _pear; //returns 2
    _cherry; //returns 3
};

//same thing as

[1, 2, 3] spawn {

    _apple = this select 0;
    _pear = this select 1;
    _cherry = this select 2;
};
fair drum
south gale
#

Multiplayer

#

I need to make it invisible but you can still tp

fair drum
#

what do you want to make invisible?

#

the object you are adding the action to?

south gale
#

So in this case we have a box we want to put into an unopenable door to make it "openable"

#

in this case you tp and go to a bunker

#

The rest we got - just the teleport

fair drum
#

I see, so you want the door to "disappear" when activated simulating that its open?

south gale
#

No, we want the door to be interactable when it isnt - so we add an invisible box to add the teleport

fair drum
#

ohhh okay

warm swallow
#

@fair drum hey sorry was gone for a minute. So I've gotten into a rut with scripting atm. I want to have a round system, and several things I want the game to do at the start of the round.

  1. I want the game to select a random player and assign them a variable name.
  2. I want the varName guy to have several different predertimened random spawns, and everyone else gets spawned randomly across the map.
  3. Play an animation and intro screen into the round.

And then when the round ends it has to reset. I would be able to do if it was only 1 round, but since its multiple, my brain doesn't know where to start. However, I already have a script for the get random player and assign them a variable name, and the random spawns. I just don't know how to do it, could you look at/ give me advice on it

fair drum
fair drum
warm swallow
#
if (isServer) then {
   _playerList = if (isMultiplayer) then { playableUnits; } else { switchableUnits; };
  _randomplayer = selectRandom _playerlist;

allplayableunits - [_randomplayer] 

_pos = [allplayableunits - [_randomplayer] , 1, 200, 1, 0, 20, 0] call BIS_fnc_findSafePos;

setPos [allplayableunits - [_randomplayer] = _pos; 

right now im pretty sure this will move all the units outside random into the same spot :/ can I do forEach?

warm swallow
fair drum
#

your last two lines on that don't make sense

warm swallow
fair drum
#

so this is what i would do...

warm swallow
#

oof ill try to do that, is it possible to restore the addactions on objects. In the init I have the addAction and to call a script

fair drum
#

that init is run every time the vehicle spawns, so force kill it, and force respawn it

warm swallow
#

how would i do that?

fair drum
#

what kinds of actions are you adding

south gale
warm swallow
#
/* Me tring to think 
Round start Function.
1. Delete dead bodies 
2 Spawn players and generators in. give generators addAction to sqf and teleport them randomly accross map
3. assign a random player _randomplayer
4. teleport the player randomplay accross the area (Different if they are _randomplayer or not)
5. play intro text and whether they are _randomplayer or not and an intro animation */ ```
#

`Round start Function.

  1. Delete dead bodies
    2 Spawn players and generators in. give generators addAction to sqf and teleport them randomly accross map
  2. assign a random player _randomplayer
  3. teleport the player randomplay accross the area (Different if they are _randomplayer or not)
  4. play intro text and whether they are _randomplayer or not and an intro animation `
fair drum
warm swallow
#

ok Im pretty sure thats all I want done in the roundStart function

fair drum
warm swallow
#

oh and delete generators as well

#

@fair drum does it need to be a fnc or can it be a script? im not sure what the differene is

#

difference

warm swallow
#

HOLY CRAPPP

fair drum
#

and you'd just call the round end function on the server

warm swallow
#

I thought you were doing the set Random pos

#

Holy crap thank yo use much

#

what does VIP and ETC mean

#

can I dm you

fair drum
#

made an edit. vip is just what i gave the "random person" thing. ETC means etcetera

#

sure

calm badger
#

ah
pretty simple thing
what do i write in the condition of a trigger if i want it to complete only when it and another trigger's conditions are met?

#

i've tried giving the other trigger a variable name and just writing this, one

#

doesn't seem to be working though

#

is the proper format a + or something?

fair drum
#

this && triggerActivated triggerName

#

@calm badger

calm badger
#

thank you!

#

@fair drum been fiddling around with it and i keep on getting an error message

Error Missing;```
#

there is what ive gone and named my trigger

fair drum
#

this is just in the condition box of a trigger right?

calm badger
#

yes

fair drum
#

this && triggerActivated there

#

thats it

#

no calling

calm badger
#

no, i didn't add the call

#

that's what the error message says though

fair drum
#

oh okay

#

look how you spelled activated

calm badger
warm swallow
fair drum
#

anyone got an example of using both param and params together? like to validate a variable brought in with params?

tough abyss
#

what's the most feature complete text editor plugin right now? i've checked out a few for vscode but they all seem outdated

warm swallow
#

@tough abyss what plugins are you looking for? I just started with vs code with plugins and it has everything I’ve needed.

digital torrent
#

anyone know what is the problem with this script?
//
[_civ1, ["Killed",
{"A Civilian has been killed!" remoteExec ['hint']; playSound "Alarm"; _numkilled=_numkilled+1; systemchat format["%1",_numkilled];}]
] remoteExec ["addEventHandler ", 0];
//
I basically want to make eventhandler but for a dedicated server.

digital torrent
#

i am simply getting nothing

#

i dont see the hint nor the sound

fair drum
# digital torrent i am simply getting nothing
//run this on every machine, init.sqf is fine

addMissionEventHandler [
    "EntityKilled",
    {
        if !(isServer) exitWith {};

        params ["_unit", "_killer", "_instigator", "_useEffects"];

        if (side group _unit == civilian && (_unit isKindOf "CAManBase")) then {
            ["A civilian has been killed"] remoteExec ["hint", allPlayers];
            ["Alarm"] remoteExec ["playSound", allPlayers];
            civiliansKilled = civiliansKilled + 1;   //This better be defined as number somewhere before this add handler
            [format ["%1", civiliansKilled]] remoteExec ["systemChat", allPlayers];
        };
    }
];
digital torrent
#

@fair drum Hey thank for the reply.
So long story short, i want player to enter a hostile area but on temperal friendly term. Therefore those "civilian" are actually opsfor but from another "imaginary" faction/clan. However, when player shot, both the opsfor and the "imaginary faction/clan will return fire. The thing is that i want a warning only on those "imaginary" faction/clan which is technically returning fire bc they see some shooting going on.

As such, i cant use your suggested script given it is based on "side group _unit == civilian"

fair drum
#

not even gonna read that. delete it and use sqfbin.com

digital torrent
#

sorry about that. i am new to coding. so i dont know the tricks yet haha

fair drum
#

you need to make things private variables

#

stuff is getting overwritten

digital torrent
#

oh ok, with that param i assume

digital torrent
#

so if i understand correction, i will need to:

Params ["_civilianCloth","_civilianHat", etc...] ;
_civilianCloth = []//etc. being defined;

publicVariable "_civilianCloth";
publicVariable "_civilianHat";
etc...

Not sure why u you would want it private unless it is to count on server and relay result to clients? but given i want sound to be play by all player i though it should be global?

Kinda lost sorry

fair drum
#

pretty far off. i'm gonna be headed to bed soon so I can't explain it atm. be sure to look at the picture with the orange, green, blue, and purple bars...maybe tomorrow i can explain

but first, you are missing a }; at the end of your pasted code

@digital torrent

#

your if isServer then { has no closing squiggly

digital torrent
#

@fair drum oh thanks for tips

#

i will reread it

#

thanks a lot

outer fjord
#

Question regarding dairy records and use of variables.

So when defining a variable for examples

_myName = name PL;```
Then defining it in a diary record like.
```c
_myText = format [ 
 "Hello %1"
 _myName 
 ]; ```

What exactly is %1 in terms of knowing it's the _myname text? Like is it just by order so if I have multiple variables it would be %1, %2, %3 ect?
warm hedge
outer fjord
#

Ah thank you.

dusty whale
#

Is there an API for mouse-actions in arma3?

#

as in, i want to intercept player left-mouse clicks

little raptor
#

API? meowsweats

dusty whale
#

ah, sorry

little raptor
#

event handlers is what you're looking for

dusty whale
#

a script/configuration interface

#

i tried displayeventhandlers

dusty whale
#

but those dont pick up on left clicks

dusty whale
#

oh

#

onMouseButtonDown

dusty whale
#

πŸ˜…

#

onMouseButtonClick requires a control, no?

#

mouseButtonDown can be bound to display 46

#

right?

little raptor
#

afaik yes

dusty whale
#

so onMouseButtonDown would be the way to go for me

#

i want to stop the player from firing and execute my own script instead

#

CBA was a no go

#

It correctly intercepted the mouse click

#

but advanced features, such as continuous press and overriding vanilla function didnt work

#

and because there's no CBA-portal

exotic flax
#

wut?

dusty whale
#

i jsut mean that im the rodent kind of developer

dusty whale
dusty whale
#

but it doesnt intercept the action when returning true

#

damn

#

how would i prevent the player from performing the action

#

of firing a weapon, for example

#

without adding eventhandlers that fire the weapon

#

is there a config method i can use to entirely wipe out the keybind for firing weapons?

winter rose
dusty whale
#

essentially, i want to handle the firing of weapons myself

winter rose
#

(but for real though, what does it mean? ^^)

exotic flax
dusty whale
#

it means i nibble around and take what bits i find but never contribute to anything meaningful

#

wow

winter rose
exotic flax
#

Google is your best friend, if you know how to keep him/her/it happy with proper search queries πŸ˜‰

#

Same applies to Lou, just let him make a dad joke once in a while and he'll be your best friend

dusty whale
#

πŸ˜“

winter rose
dusty whale
#

πŸ˜†

#

Hi dad, im back

winter rose
#

MAKE THIS GUY A MODERATOR, QUICK! πŸ˜‚

dusty whale
#

no, please dont

#

XD

#

i said im a rodent

#

anyway, so it is kind of offtopic, since it isnt vanilla

#

but i still have the issue of CBA continuous press not working with left mouse button

little raptor
#

you can use down = hold, up = release

dusty whale
#

or firesthe script until the mouse is raised

#

correction

#

it's an optional toggle here

#

_holdKey

little raptor
dusty whale
#

i wonder why they didnt do it for the mouse

#

πŸ€” k

#

because that same function works for the mouse

#

but the continuous fire only works for the buttons

#

oh...

#

it's catching the BIOS level key-spam

#

damn

little raptor
dusty whale
#

i was expecting something more legant

#

well, looks like i'll have to make my own keybinding system for the mouse buttons

#

the continuous button isnt even true continuous

#

it is just catching the BIOS key-spam

#

so you press it first time

#

there is a short pause

#

and then it starts to spam

dusty whale
#

is there a method for making the player aim down sights?

#

i know switchCamera, but that switches too fast

#

is the smooth method somehow available?

tough abyss
thorn saffron
#

Is it possible to make an empty vehicle fire it's gun? I'm messing around with mortars and I want to have it fire "from outside" ie. with nobody in it after it was ranged and set up

little raptor
#

they have no drag

#

so you can just use the good ol projectile equation of motion

#

y = -x^2/(2v0gcos t^2) + x*tan t

thorn saffron
#

I actually made a pretty simple script that generated a range card for the Mk 6 mortar, just for giggles. I can get the exact angle the tube is set at. Thing is it won't be the same without the firing effect

little raptor
thorn saffron
#

I was thinking about it, but there is a VERY good chance he will move the mortar around. I need to check if disabling the AI targeting or something will prevent him from doing so

#

Ok, so disabling AI does prevent him from moving the mortar around

dusty whale
#

can you make it look and act as if there was no one in the gun? YES. But is the gun empty? No

thorn saffron
#

How do I add a mission event handler that runs stuff on init on anything that might spawn in the mission? I know how to do that for an addon, but no idea how to do this for a single mission

winter rose
#

What do you want to do @thorn saffron?

thorn saffron
#

Just wanted to see if you can add an init eventhandler similar to how you can do it via addon config. I think I saw that you can do some config tweaks/overrides in missions, but I'm most likely wrong.

thorn saffron
#

heh,
Anyway: is it possible to check if weapon is being loaded, or has been reloaded? canFire does not work for this.
We have setWeaponReloadingTime, but no way of checking what is the current reloading time on a weapon?

#

I realize the really dumb solution would be to just get the reload time and set variable of time + reload, but that is inelegant

thorn saffron
#

nope

winter rose
#

removeAllWeapons @thorn saffron

needReload now? πŸ‘€

thorn saffron
#

I don't want to break anything. I want to keep stuff as compatible as possible, so I will just go with variable

winter rose
#

you could check for magazine capacity vs magazine max capacity from config
and get the reloading time from weapon config yup
IDK if there is a reload EH, check the wiki perhaps

thorn saffron
#

I would still have to add some variables to track it, so I will do it the easy way: time + reload time and see if the current time is more than that

winter rose
#

I am still unsure of what you want to do πŸ˜„

#

being reloaded?

final storm
#
Reloading = false;

findDisplay 46 displayAddEventHandler ["KeyDown", {
    if (_this select 1 in actionKeys "ReloadMagazine") then {
        Reloading = true;
    };
}];

player addEventHandler ["Reloaded", {
    params ["_unit", "_weapon", "_muzzle", "_newMagazine", "_oldMagazine"];
    Reloading = false;
}];

Something like that maybe?

#

@thorn saffron

thorn saffron
#

@final storm Thanks, but the idea is that an invisible AI is firing the weapon

final storm
#

ohh its for a vehicle?

thorn saffron
#

yeah

final storm
#

oh ok

thorn saffron
#

the EH would work, but I don't think its really needed

final storm
#

so you dont need to find if its being reloaded?

#

k

thorn saffron
#

Yeah, I do want to see if it got reloaded. I need to do it as you can span force weapon fire since it does not check the reload time.

little raptor
#

not sure if that's what you want

#

but you can check when the reloading will be complete

#

also didn't you want an invisible AI thing? why not just reload it manually? (adding the magazine to the weapon yourself, and faking the reload time)

thorn saffron
#

force weapon fire only works if AI is present

little raptor
#

did I say otherwise?!

thorn saffron
#

oh, by reload I meant reload between the bullets, not just magazine reload

little raptor
#

reload between bullets can only be caught with a timer

#

there's no event handler for that

thorn saffron
#

fun fact: weaponState only works after firing something once, otherwise it returns empty stuff

#

at least when I try to use it in addAction

#

ah, I see now. If the vehicle/mortar is empty then no weapos were selected and thus you can't get info unless you specify a muzzle

fair drum
#

what is a side's equivalent of objNull/[]/""/grpNull etc?

exotic flax
fair drum
#

just trying to figure out what to put in param to expect a side

#

side grpNull returns unknown so that might work?

exotic flax
#

I would probably say sideUnknown πŸ€”

fair drum
#

hmmm yeah that might work, let me try

exotic flax
#

but I doubt it works as an expected type

worn obsidian
#

How do I rescript a unit from ind>opf?

fair drum
#

so it works

exotic flax
#

if I understand the wiki correct you should be able to use Side as a datatype

#

but if the above works it's also good πŸ™‚

worn obsidian
fair drum
exotic flax
#

no idea, never worked with sides in that manner

exotic flax
fair drum
worn obsidian
fair drum
#

possibly add a server check in there so you don't create a bunch of groups for every player that joins though

exotic flax
#

yes, although you will need to change the code to make it work (it's just an example code)

little raptor
#

and why would you want that anyway?

little raptor
#

just use isEqualType

worn obsidian
#

what would I need to edit @exotic flax

exotic flax
#

Side (datatype) vs side (command)

little raptor
#

Side is not a data type

#

it's "SIDE"

winter rose
fair drum
# little raptor wdym?
param [0, sideUnknown, [sideUnknown], 1];  //works
param [0, sideUnknown, [Side], 1]; //doesn't work

we were testing to see if SIDE could be used

winter rose
#

won't work

#

for a number, you don't put "number", you put 0

little raptor
#

plus the syntax for params requires data

#

not type

#

(type is "deduced" based on the data you provide)

exotic flax
#

expectedDataTypes (Optional): Array of direct Data Types - checks if passed value is one of listed Data Types. If not, default value is used instead. Empty array [] means every data type is accepted.

little raptor
#

it's wrong

exotic flax
#

so fix it πŸ˜›

little raptor
#

I don't have wiki access meowsweats

fair drum
#

all I know is that

param [0, sideUnknown, [sideUnknown], 1];

works as I fed it independent and it output GUER

#

so there's our answer

exotic flax
#

git -blame "Dwarden"

little raptor
#

you could also just use [west]

#

or any other side

winter rose
little raptor
winter rose
#

Dwarden: blobdoggoninjaπŸ’₯☁️ …

thorn saffron
#

How do you get heading from weaponDirection? I worked out how to get the elevation, but I just cannot get the heading

little raptor
#

angle?

#

or vector?

thorn saffron
#

angle

little raptor
little raptor
thorn saffron
#

@little raptor Oh man, thank you so much. I could not get it working otherwise

bold saffron
#

Hey guys, quick question, is uiSleep more effective in multiplayer than sleep or is there no difference?

copper raven
#

no difference

fair drum
#

if you are doing some sort of on screen text or something that relies on sleep and its being fired on the client, that its better to use uiSleep as sleep will continue if they are in the escape menu? or am I misssing something

still forum
#

no difference

winter rose
#

isn't there one think_turtle

still forum
#

The difference between Sleep and uiSleep are that sleep doesn't continue while the game is paused, while uiSleep also runs while the game is paused

#

Pause == Esc menu in singleplayer (unless you run with -noPause)
There is no pausing in multiplayer

fair drum
#

i see

still forum
#

neither of them was ever "more efficient" the only difference is that Sleep pauses when game simulation pauses

winter rose
#

wait -noPause does not cancel SP pausing; it cancel simulation pausing if the window is not focused

still forum
#

Sure?

winter rose
#

well as far as I know yes!

still forum
#

Pretty sure I could Esc in SP and it kept running in background while I used debug console

#

I always run noPause

copper raven
#

-noPause Allow the game running even when its window does not have focus (i.e. running in the background) from wiki

winter rose
#

NB: this also prevents singleplayer pausing if you are a BI employee oh that's why

little raptor
#

yeah I just tested and it does what wiki says

#

you probably play in MP ded! πŸ˜„

warm swallow
#

execVm "roundInit.sqf";

#

does anyone know why this code isn't working?? I don't understand, the semi colon is not expected in the code, but I don't know why... any help?

winter rose
still forum
clever radish
#

How do i get check if Unit health is below .25 and then trigger a cmd?

dusty whale
#
  1. have a loop that checks the unit damage on specific intervals
#

or have a dammaged EH on that unit that checks if the health is below .25

clever radish
dusty whale
#

or as we say in arma, damage is above .75

clever radish
dusty whale
#

getDammage

#

and getDammage _unit > 0.75

#

damage goes from 0 to 1

#

1 being dead

#

and yes, it IS 2 m's

dusty whale
clever radish
dusty whale
#

on another look, for your purpose handledamage might be better

#

especially if you want to override damage

clever radish
clever radish
dusty whale
#
if ((getDammage _unit) > 0.75) then {
  //your code here
};```
#

2 m's

#

you can setDamage

#

and setDammage

#

but apparently you have to getDammage

#

not getDamage

#

im only reading the biki, thought

#

feel free to correct me if im wrong

spiral temple
#

is it possible that

_crate addItemCargoGlobal ["FirstAidKit", 1000];

is not working?

copper raven
#

use setDamage/damage

#

not the misspelt commands

dusty whale
#

it's not listed on the biki

copper raven
#

damage is the getter

spiral temple
#

anytime I want to add FirstAidKit via addItemCargoGlobal it wont show up in the crate, but any item before and after it in the same script - even when I set the count lower (e. g. to 10)

copper raven
#

can you send some code?

spiral temple
#
_crate addItemCargoGlobal ["Medikit", 5];
_crate addItemCargoGlobal ["FirstAidKit", 10];
_crate addItemCargoGlobal ["Toolkit", 5];
dusty whale
#

im pretty sure

#

i think it's a magazine

spiral temple
#

I'll try it

dusty whale
#

configFile >> "CfgWeapons" >> "FirstAidKit"

#

it's a weapon

#

or not

#

there was some real overlap with these

#

some items said theyre weapons but were tools and so on

#

it's a helter skelter

copper raven
#

its supposed to be in cfgweapons

#

don't see why that code wouldn't work though

dusty whale
#

yeah

#

it could be a tool

#

ora magazine

copper raven
#

any mods? @spiral temple

dusty whale
#

the whole addWeapon/addMagazine/addItem/addTool is weird

spiral temple
#

RHS/3CB

copper raven
dusty whale
#

and linkItem

copper raven
#

maybe no space in the crate for the 10 FAKs

dusty whale
#

should still add

dusty whale
fair drum
#

setting a setVariable to public is essentially doing the same thing as publicVariable with all of its drawbacks right?

fair drum
#

like sending lots of publicVariables clogs the network

dusty whale
#

AAAAAAAAAAAAAAH, this CBA keybinding system is so half-thought

#

what if i want to catch a key no matter if shift, alt or ctrl is down

#

but if one of these is down, i dont get a keydown detection

#

aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaah

#

looks like i'll have to make my own keybinding system

#

such a shame that CBA is so useless on this regard

#

but sometimes we have to do things on our own

fair drum
#

can you use colors for systemchat?

[format ["<t color='#FF004C99'>%1 FIRING SEQUENCE INITIATED</t>", _launcher getVariable "launcherName"]] remoteExec ["systemChat", allPlayers];
#

didn't seem to work for me

#

oh i think i might have to use formatText

little raptor
sacred slate
#

how can i exec somthing if any task succeed anytime?

little raptor
sacred slate
#

no, its generated#

little raptor
#

then who completes it? blobdoggoshruggoogly

sacred slate
#

player, west πŸ˜„

#

its assigned to all playable units

little raptor
sacred slate
#

there can be demo map object, kill vehicle or man

little raptor
#

anyway, if you do, just put the code where you (or the script) completes the task

#

if you have no means of editing the task code, use a loop

sacred slate
#

oh yes, sorry. maybe i thought its a easy answer to reach all tasks globally. i use drongo map population. it has scripting wise for example: dmpAllTasks pushBack _taskInfo; but thats a bit far ahead for my knowledge. i am quite a beginner.

rose vector
#

I tried using setObjectscale in the init in Zeus. It works for a moment but the Size gets reverted after maybe 0.5 sec. Any Ideas how I can make the size permenant?

fair drum
little raptor
#

you can get it to work with soldiers too

fair drum
#

Setting the scale of actively simulated objects (Vehicles with players/AI in them) is possible, but not officially supported, you may encounter issues.

#

This command works on all objects in Eden Editor or scenario preview, but it will not save and will reset when objects get moved

rose vector
#

Is there Anyway I can skip the Attachscript part?

fair drum
#

but if its just in the editor for images, then you don't need to attach to anything since you can just force the object in the position you want?

rose vector
#

Its not for images. Its for a unit

fair drum
#

if you are actively using it in game, it literally tells you you are going to get problems

rose vector
#

I know. I thought it still might be worth a shot

little raptor
austere granite
#

its how towns are made

fair drum
#

@little raptor how do I correctly use your advanced developer tools code performance button? It only seems to ever run through a single run of it instead of 10,000. Never used the normal ingame one either.

little raptor
#

Also what kind of code do you run?

#

Note that it should not be scheduled.

dusty whale
#

selectionNames _object returns some selections that are not attainable in any of the LODs: "Memory" "Geometry" "FireGeometry" "LandContact" "HitPoints"

#

oh, those are hiddenSelections

tidal ferry
#

Is there any way to disable gravity for a player without using attachto or disabling simulation?

little raptor
#

no

#

you can also place the player on an invisible platform meowsweats

tidal ferry
#

Ohhh thats not a bad idea

little raptor
tidal ferry
#

Ngl, that would actually have some pretty cool utility for like, making planes seem like they're going a lot faster than they actually are

dusty whale
#

is there a way to force the player to keep the weapon in the raised state when walking?

#

as in, not the way where the weapon is slightly canted to the side

#

but the one where it is fully raised and aimed, but not aimed down sights

#

if you double tap C you get this mode

#

the "tactical" moves

little raptor
#

you can force it with that

#

but it's not "pretty"

dusty whale
#

πŸ˜…

#

why

#

i'll just mod my own movement behaviour

#

i already modded my own keybinds

little raptor
#

@dusty whale ```sqf
player addEventHandler ["AnimChanged", {
params ["_unit", "_anim"];
if (_anim select [0,8] in ["amovperc", "amovpknl"]) then {
if (_anim select [9,3] != "tac") then {
_unit playActionNow format ["playertact%1", reverse(_anim select [21,2])];
}
}
}];

![meowsweats](https://cdn.discordapp.com/emojis/707626030613135390.webp?size=128 "meowsweats")
tight pawn
#

Hey all. I'm brand new to arma coding and have gotten hungup on some code I'm trying to write. I need to find the config name of objects around me and add that name to a combo box. I can get the name using "typeof" but adding it is for some reason not working. I feel it's staring me in the face but I can't see it. So how would I do that with my current code?

little raptor
#

meowsweats
```sqf plz
see the pinned messages

tight pawn
#

My B, thank you

#

current code for adding things to my combo box

little raptor
#

actually I meant just add the ```sqf

#

but nvm

tight pawn
#

sorry mate still trying to get everything down

little raptor
#

and what is v_feature_153_inventory_types?

#

@winter rose
could you change this to:
#arma3_scripting message
"...if your code is too long to show in discord (more than 2000 characters)..."

tight pawn
#

so im trying to get the config names of the objects around me to display in my combobox, that variable there is where I've defined all of whitelisted objects, it's held within my init file. SO in the if satement I'm making sure that the config name of the objects around me matches one of the whitelisted config names.

little raptor
#
private _found_objets = nearestObjects [player, v_feature_153_inventory_types, 5];
    {

        //assigning the variable _x_found_objects to each item individually in _found_objets
        // temp v_feature_153_inventory_types
        private _x_found_object = _x;
        private _x_found_object_type = typeOf _x_found_object; 

        //if the object found is inside the varibale v_feature_153_inventory_types then execute code
        hint "It worked you dipshit";
        private _x_object_netid = _x_found_object call BIS_fnc_netId; 
        _ctrl_object_id = _ctrl lbAdd name _x_found_object;
        _ctrl lbSetData [_ctrl_object_id, _x_object_netid]; 
        
    } foreach _found_objets;
winter rose
little raptor
winter rose
#

I can make 2000 lines with it

#
switch (_value) do

{

  case 0:
    {
      hint "zero";
    };

  case 1:
    {
      hint "one";
    };

  case 2:
    {
      hint "two";
    };

  case 3:
    {
      hint "three";
    };

};
```etc @little raptor
#

and I don't want that, we don't want that

tight pawn
#

@little raptor Thank you, I don't know why I was doing that, think it had to do with testing early on, appreciate the tip.

little raptor
#

I'm not sure whether it matters

little raptor
winter rose
plucky nimbus
#

hello anyone here

little raptor
plucky nimbus
#

alright i have a huge problem

#

are you ready?

exotic flax
#

ready...
set...
GO!!!

plucky nimbus
#

im playing arma 2 co and im making a parachute mission with a c130 so i set a load waypoint for the plane and a get in one for the squand and sync the two then a unload way point for the plane with a eject script so far so good and the plane parachute the squad correctly but as soon as they touch the ground the squad commander starts giving orders to go back to the plain

#

plane

#

i tried getout command wont work and i tried delete waypoint script nd still wont work

willow hound
plucky nimbus
willow hound
#

I'd say add it to the eject script.

plucky nimbus
#

this script says crew and im looking to stop the squad only from getting in

willow hound
#

What does your current ejection script look like?

plucky nimbus
#

man20 action ["EJECT",plane1]; man21 action ["EJECT",plane1]; man22 action ["EJECT",plane1]; man23 action ["EJECT",plane1]; man24 action ["EJECT",plane1]; man25 action ["EJECT",plane1]; man26 action ["EJECT",plane1];

#

this one works but the squad leaders keep ordering to get back in the plane right after they get to the ground

willow hound
#
{
  unassignVehicle _x;
  _x action ["EJECT", plane1];
} forEach (units MyGroup);
```Try something like this (assuming all the `man##` units are in the same group `MyGroup`).
plucky nimbus
#

can i change my group to grp1?

#

and should i add it to eject script?

willow hound
#

You can change the group to grp1, MyGroup is just a placeholder variable name I made up.

fair drum
willow hound
#

As the name suggests, the forEach-loop executes the code within the {} for each element of a given array (in this case the array returned by units MyGroup). That saves us from having to write

unassignVehicle man20;
man20 action ["EJECT", plane1];
unassignVehicle man21;
man21 action ["EJECT", plane1];
...
```because that's always the same code, just for different units.
plucky nimbus
#

it workedπŸ˜†

fair drum
# little raptor and what is the exec time?

I'm not sure what I did but I restarted the game and did it and it did the full 10000. Sometimes I leave the game on standby while I close my laptop for the night. So sometimes I don't get a restart of the game for a few days

little raptor
#

I can only think of 3 reasons:

  1. your code probably contained errors the last time you did it
  2. the code took longer than 1 s to complete so it couldn't go past 1 cycle
#
  1. your antivirus blocked the execution of the preprocessor (the preprocessor is a separate dll)
#

btw how can I check if my extension is whitelisted by battleEye?

#

I sent a request but I don't know if they did anything about it

fair drum
#

cause I'm not sure, but I can test it real quick

winter rose
#

only one cycle in MP

fair drum
#

that could have been why come to think of it

winter rose
#

I don't know if it is linked, but it sure looks like it might be

little raptor
winter rose
#

attribute, not "just MP editor"

little raptor
winter rose
#

ah, woops then.

willow hound
#

Did you try enableDebugConsole in description.ext as well?
Maybe diag_codePerformance doesn't use getMissionConfigValue, who knows.

scarlet tangle
#

How can you setup a invade and annex server? (public vanilla) Is it allowed to use other’s pbo file and modify it? We will just give them the credit on the loading screen or in the map.

quasi sedge
#
[missionNamespace, "arsenalClosed", {
    profileNamespace setVariable ["Saved_Loadout",getUnitLoadout player];
    hint "Selected gear saved!"
    }] call BIS_fnc_addScriptedEventHandler;
player addEventHandler ["Respawn",{

        0 = [_this select 0] spawn {
        
            params [["_player",objNull,[objNull]]];
                waitUntil {sleep .2; alive _player};
                _player setUnitLoadout (profileNamespace getVariable ["Saved_Loadout",[]]);
                
        };
}];```
#

I want user "Saved_Loadout" in profile folder, not in mission, so each time when player connected to server mission, he already receives his loadout automatically

#
You'll probably find that scripted event handlers are not serialized when the mission is saved.
Which means when the mission is loaded those event handlers no longer exist.
You'll want to test which event handlers don't exist after loading the mission, then setup a way to re-add them once the mission is loaded."```
ELI5 pls ![meowsweats](https://cdn.discordapp.com/emojis/707626030613135390.webp?size=128 "meowsweats")
pulsar bluff
#

anyone done stuff with UGV functionality similar to this?

copper raven
#

also all that spawn/waitUntil stuff is useless

fair drum
#

LaserTargetE (CfgVehicles: WEST) and LaserTargetW (CfgVehicles: EAST)

I'm guessing that LaserTargetE creates a bluefor target that opfor can then target and vis versa?

copper raven
#

i'd assume so,yes

fair drum
#

hmm just running into an issue I guess. The laser target exits. The rhino can pick it up, laser guided artillery can pick it up, but the VLS can't pick it up on its own at all. It can pick it up if the rhino exists next to it though.

copper raven
#

πŸ€”

#

maybe has something to do with the datalink stuff?

fair drum
#

not sure. if i manually lase the target, it shows up for the VLS to lock on, it just doesn't pick up any of the script created targets

copper raven
fair drum
#

im currently looking through zeus enhance's github trying to find out how they did it with their create target and artillery fire mission commands but its all messy as I don't understand any of their script macros to find my answer

#

reportRemoteTarget being the key I think

#

yup just messed around with it, thats the key command

thorn saffron
#

Ok, so I have a script that allows you to fire a mortar from outside. It works in SP, but in MP it does not fire. I was able to kinda hotwire it using console and global exec to get it to fire.
How do you properly set up the remoteExec for a global exec, at least for the BIS_fnc_fire?
What I currently have is this:
[[_arty, _muzzle], BIS_fnc_fire] remoteExec ['call',0];
And that does not cause the mortar to fire in the end. And yes the _arty and _muzzle are properly defined.

cosmic lichen
#

Don't remote exec

#

Same with

_triggerDude remoteExec ["deleteVehicle", 0];
winter rose
#

@thorn saffron πŸ”¨ πŸ˜„

thorn saffron
#

hey, without it the AI didn't get deleted

#

[_arty, _muzzle] call BIS_fnc_fire;
Didn't work either

thorn saffron
#

other fire commands are not as good as the AI is unable to fire the weapon using the player fire modes and having it to fire in AI fire modes resets the mode for the players, with is a bit annoying.

willow hound
copper raven
#

[[_arty, _muzzle], BIS_fnc_fire] remoteExec ['call',0]; pls never execute like that, you're sending contents of BIS_fnc_fire to every client

cold glacier
# pulsar bluff anyone done stuff with UGV functionality similar to this?

Don't know if anyone else has done it, but they're probably just setting the player as the unit inside the UGV. Every UAV has a special unit controlling it. You can insert a normal AI (which is weird, don't do) or a player inside there and directly control it, I think (it's been a while since I tried this). Just have to do it with scripting commands. Can also use remoteControl

thorn saffron
copper raven
thorn saffron
#

it didn't work when I used [_arty, _muzzle] call BIS_fnc_fire;

copper raven
#

maybe try providing turret?

#

[_arty, _muzzle, [0]] call BIS_fnc_fire; (implying its gunner turret)

thorn saffron
#

[_arty, _muzzle] call BIS_fnc_fire;works fine in SP, also there is no place for defining a turret

#

my bad, there is a turret path stuff

copper raven
#

well if it works in SP, providing a turret won't change anything

thorn saffron
#

πŸ€” Maybe I could try changing the ownership of the _triggerDude dummy AI that fires the gun

copper raven
#

it says that the vehicle doesn't have to be local to the machine that runs the function(so not a locality issue), sooo, don't know why it wouldn't work in mp πŸ€”

thorn saffron
#

Ok, the thing is its not a function that is run serverside: the idea was for it to be a local mod. So I'm executing the whole firing function locally

#

And now the AI does not use proper fire mode even in SP, it just kinda broke πŸ₯²

copper raven
thorn saffron
#

tried all kinds of the fire commands

copper raven
#

what vehicle specifically?

thorn saffron
#

mk6 mortar

#

_triggerDude forceWeaponFire [_muzzle, _aiFireMode]; does not work
[_arty, _muzzle] call BIS_fnc_fire; works, but the AI always fires in close/burst1 fire mode, even though yesterday it worked fine for the fire mode

little raptor
#

that's what the function uses for vehicles

#

useMagazine action

#

_firerer
meowsweats

thorn saffron
#

well now the I just cannot get the AI to fire in correct fire mode at all

thorn saffron
#

Ok, _arty fire [_muzzle, _fireMode,_magazine]; seems to be working

dusty whale
#

sort is broken

#

it doesnt do anything

#

i tried with [2 ,1 ,2] sort true

#

BIS_fnc_sortNum works

winter rose
#

Because if you simply wrote that, you may want to read the doc again

little raptor
#

it's a "literal" (temp value)

#

it gets destroyed as soon as it's sorted

#

try:

#
_arr = [2 ,1 ,2];
_arr sort true;
_arr
winter rose
#

Heyyy, leave him some mystery!

#

Anyway, plz check before saying it's broken @dusty whale πŸ˜‰

little raptor
#

I see you're doing it my way! πŸ˜„

#

my old way at least! πŸ˜„

#

some people found it annoying so...

winter rose
#

I do it only when people complain :p

#

Otherwise I explain the steps ^^

dusty whale
#

i had an actual value

#

but it wasnt working

#

but as soon as i switched to the bis function it worked

little raptor
#

it works just fine meowsweats

#

I literally used it 10 mins ago

dusty whale
#

i was using it like this:

switch (_moveKeys sort true) do {
...```
in a switch case
#

and i was getting nothing

little raptor
#

I guess you have to do it as Lou said

#

read the wiki

dusty whale
#

WHY IS IT MADE THAT WAY

#

This will modify the original array!

#

NOTHING IN THIS GAME WORKS THAT WAY

#

WHY IS IT THIS ONE SCRIPT COMMAND THAT WORKS THIS WAY

little raptor
#

set, pushBack

#

append

#

insert

#

etc

dusty whale
#

pushback and the rest are assignment commands

#

but why does the sort assign to the original array?

little raptor
#

because it's cheaper

#

if you actually need a new array just make a copy

little raptor
dusty whale
#

im not doing that

little raptor
#

like C++

dusty whale
#

im sticking to the BIS function

#

because that atleast works according to standard

#

if you have to make a notification saying "this modifies the original array" then MAYBE people weren't expecting it to

#

and MAYBE you have established a standard people assume you to abide to

#

why is this so hard with Bohemia?

#

always

#

πŸ˜…

little raptor
#

even C++ does that

#

Β―_(ツ)_/Β―

#

as I said it's cheaper

wraith cloud
#

? it's not exclusive to SQF lol

dusty whale
#

but then there are many things SQF does but C++ doesnt

#

i have a valid point

fair drum
#

Ngl, sort got me the first time like this as well.

dusty whale
#

if you need to remind people that it modifies the original array

#

then maybe people werent expecting it to

#

im going to stick to BIS_fnc_sortNum

#

because i need the original array unmodified

#

and im not going to start playing with extra arrays

#

BIS_fnc_sortNum is just more convenient

little raptor
# dusty whale BIS_fnc_sortNum is just more convenient

/************************************************************
    Sort Numbers
    Author: Andrew Barron, optimised by Killzone_Kid

Sorts an array of numbers from lowest (left) to highest (right).
The passed array is modified by reference.

Example: [9,8,7] call BIS_fnc_sortNum; //[7,8,9]

This function uses the quick sort algorithm.
************************************************************/

/// --- validate general input
#include "..\paramsCheck.inc"
paramsCheck(_this,isEqualType,[])

_this sort true;

_this
#

it just sorts the original array

#

and returns it to you

dusty whale
#

i get away with writing less stupid code

#

i want sort but i want it to return the array

hardy vector
#

Hello everyone,
I posted this in #arma3_questions but I was told it belonged here. I'm trying to make a script that adds jamming to the game via a script. I've found this link to someone who made a script like this (http://killzonekid.com/arma-scripting-tutorials-how-to-override-lmb/) but when i try the script even with the edit (this is the script I'm using https://pastebin.com/kJpzKPhp) I can't get it to work like I want to. The problems I'm having is that every time you reload it says Unjammed, the fact that you need to reload to unjam the gun instead of an action, and if you switch to a secondary without reloading/unjamming the pistol is also jammed. I have a little experience with scripting but nothing like this. I've also been trying to change the player tags in it to this tags so that only the player with the script is affected but I can't get that to work either. Is there anyone who can help me and knows if it is even possible like I want it to.Thanks in advance.

little raptor
hardy vector
#

Thank you for the advice. I will try it.

#

I got it to work as an action

#

Turns out I made a mistake when I tried it earlier

#

what do you mean with an array of jammed weapons

little raptor
hardy vector
#

player addAction["Unjam", {
hint "Un-Jammed";
allowFire = True}]

little raptor
#

that's not what I meant

hardy vector
#

what did you mean then??

little raptor
#

currentWeapon _unit in (_unit getVariable ["jammed_weapons", []])

#

instead of allowFire, use that "jammed_weapons" array

#

when a weapon gets jammed, add it to the array

#

when it's unjammed remove it

hardy vector
#

Oooooh like that

little raptor
#

and that code is what you should use instead of isNil "allowFire"
(you'll have to define _unit first; check the wiki page for addAction)

hardy vector
#

okay

#

I thought you meant that to resolve the weapon switching problem and still use allow fire for the rest

#

I will try to alter the script

hardy vector
#

I understand that now

#

I saw it as two seperate things

hardy vector
#

I've been trying that and how do I remove the variable Jammed weapons

#

for the action

#

player addAction["Unjam", {
currentWeapon _unit in (_unit removeVariable ["Jammed_Weapons", []])
hint "Unjammed"}]

#

This is what I have now but I suspect removeVariable is not a real command

little raptor
#

meowsweats
for jamming:

player addEventHandler ["FiredMan", {
    params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_vehicle"];
        if (random 1 < 0.05 && {_ammo = _unit ammo _weapon; _ammo > 0}) then {
          _unit setAmmo [_weapon, 0];
          [_unit, [_weapon, _ammo]] spawn {sleep 0.001; _this#0 setAmmo _this#1};
          _unit setVariable ["jammed_weapons", (_unit getVariable ["jammed_weapons", []]) + [_weapon]];
        };
}];
#

for unjamming:

_unit setVariable ["jammed_weapons", (_unit getVariable ["jammed_weapons", []]) - [currentWeapon _unit]];
dusty whale
#

is there a function to set camera pitch and roll?

little raptor
#

I told you to use it instead of isNil "AllowFire"

little raptor
#

unless you mean player camera

#

in which case no

hardy vector
#

I thought it was the command that adds it to the array

little raptor
#

(it can be modded tho)

dusty whale
#

and yes, i committed

little raptor
dusty whale
#

nope, a created camera

little raptor
#

or a camera you created?

#

then use setVectorDirAndUp

dusty whale
#

i see

little raptor
#

@hardy vector ```sqf
player addEventHandler ["FiredMan", {
params ["_unit", "_weapon", "", "", "_ammo"];
if (random 1 < 0.05 && {_ammo = _unit ammo _weapon; _ammo > 0}) then {
_unit setAmmo [_weapon, 0];
[_unit, [_weapon, _ammo]] spawn {sleep 0.001; _this#0 setAmmo _this#1};
_unit setVariable ["jammed_weapons", (_unit getVariable ["jammed_weapons", []]) + [_weapon]];

    _unit addAction ["Unjam", {
        params ["_unit", "", "_actionID"];
        _unit setVariable ["jammed_weapons", (_unit getVariable ["jammed_weapons", []]) - [currentWeapon _unit]];
        _unit removeAction _actionID;
    }, [], 7, true, true, "", format ["currentWeapon _target == '%1'", _weapon]];
    
};

}];

player addAction ["", {
playSound3D ['a3\sounds_f\weapons\Other\dry9.wss', _this select 0];
}, "", 0, false, true, "DefaultAction", "currentWeapon _target in (_target getVariable ['jammed_weapons', []])"];

hardy vector
#

is that the complete script??

little raptor
#

yes

hardy vector
#

thank you very much

royal basin
#

I'm trying my hand at some light scenario making and I want to make a trigger that sets it so when every opfor character within a 500m radius of a trigger is dead, that triggers a 'win'. How do I do that?

hardy vector
royal basin
#

Oh, there's an "end scenario" module. That's neat.

hardy vector
#

by type: end 1 should be a mission accomplished screen

hardy vector
#

I owe you one

dusty whale
#

is there a way to get the player weapon's muzzle position?

little raptor
dusty whale
#

damn

little raptor
#

there are ways to approximate it

dusty whale
#

i was thinking about a matrix transform

#

because i can get the weapon direction

#

and the weapon position

#

dont even have to be amtrix, tbh

#

vectormultiply is enough

#

but matrix is easier

dusty whale
#

i just want to draw a line from the player's weapon

#

like lasertag but drawline3d

little raptor
dusty whale
#

how do i get a memory point of a proxy

little raptor
#

not the gun itself

dusty whale
#

the memory point of the proxy

#

good, BUT, it's offset

little raptor
#

no the player's mempoint for the gun

#

there are separate mempoints for every different weapon

dusty whale
#

what im currently doing:

onEachFrame 
{ 
 _beg = player modelToWorld (player selectionPosition ["proxy:\a3\characters_f\proxies\weapon.001","memory"]); 
 _endE = (_beg vectorAdd (eyeDirection player vectorMultiply 100)); 
 drawLine3D [ _beg, _endE, [0,1,0,1]];
};```
little raptor
dusty whale
#

but this is OFF by a wild margin

little raptor
#

what you just said

#

"proxy:\a3\characters_f\proxies\weapon.001", blabla

dusty whale
#

that's off

#

it's not at the muzzle

little raptor
dusty whale
#

or even near it

#

but i cant add the length of the wepaon to it because it's not the first memory point

#

these proxies have 3 vertices

#

which one i get is up to chance

#

selectionPosition doesnt return the vertice i want it to

#

what it returns is dependent on which order the vertices were in when the model was binarized, it seems

#

and it's not the weapon position

#

but just happens to be one OFF the barrel to the front and a bit down

#

this is the whole issue with the selectionPosition

#

when there are more than just 1 vertex in the selection, it depends on luck which one you get

#

and by luck i mean on BIS models

#

since we dont have any input on how those are done

little raptor
#

like I said it's an approximate

dusty whale
#

but i need exact figures

#

im trying to make a dynamic camera mod

#

and i need to get the position the player is aiming at, so that i can target it with the camera

#

and draw a crosshair there

warm hedge
#

Use attachTo

dusty whale
#

not good

#

if i want it to change pitch as the player aims their weapon up and down, i need to attach it to a bone and take that bones transform

#

which means im also getting weird pitches and angles and banks

#

since most bones in arma 3 are not level

#

and i want this to be a more dynamic camera

#

so that i can move it around objects and such in real time

warm hedge
#

That's why I said use attachTo

dusty whale
#

at the same time having it center at whatever the player is aiming at

dusty whale
dusty whale
#

this whole story

#

if i attach the camera to the player bones, lets say head, the camera angle and pitch get warped

#

i cant change it, because it gets overwritten every frame

warm hedge
#

followBoneRotation: Boolean - (Optional) follows the memory point's rotation (if attached to one) Since Arma 3 v2.01.147011

dusty whale
#

THIS EXACT THING

#

it causes the issue

#

because i am not only following the bones pitch and direction, but also its bank

#

and the bank keeps putting the camera in weird angles

#

if i dont followBoneRotation to the bone, then i dont get the pitch, only the direction

#

the path of least resistance is to get where the player weapon is aimed at and use that information to draw my crosshair and target the camera at it

#

but i cant get where the player wepaon is aimed at

#

because i cant get the muzzle position

#

the best accuracy i can get is OFF by 1.2m at 15m straight wall

#

that's like an extremely curved barrel

warm hedge
#

tldr. Not even sure what exactly was the result, but hey I just tried this and worked perfectly fine, if I get the question properly: sqf player enableMimics false ; private _cam = "logic" createVehicleLocal [0,0,0] ; _cam attachTo [player,[0.3,-0.3,0],"head",true] ; _cam switchCamera "INTERNAL" ;

#

(Except when look up/down somehow)

warm hedge
#

I don't

dusty whale
#

see the bank?

#

how the camera is banked to the right?

#

and how aiming is extremely wonky

#

try it

warm hedge
#

Try what?

dusty whale
#

try that script

warm hedge
#

Which?

dusty whale
#

and try to aim with it

dusty whale
#

do i need to draw you a horizon on that image?

#

and then draw an angle between the horizon and the image frame

warm hedge
#

I thought you're just making a cinematic, but you're trying to use this in an actual gameplay?

dusty whale
#

the player camera should be level with the horizon

#

yes

#

why would i draw a crosshair for a cinematic?

little raptor
dusty whale
#

i cant bank it

warm hedge
#

Why?

dusty whale
#

because it's attached to the bone

warm hedge
#

You can

dusty whale
#

so the bank gets overwritten by the engine

hardy vector
dusty whale
#

im half ready to ditch controlling a player and controlling an AI instead

little raptor
#

won't work on AI

hardy vector
#

so if i set a unit to playable in the editor and a player plays as tat unit it will work

little raptor
#

depends where you add the script

hardy vector
#

in the object init

little raptor
#

just use initPlayerLocal

hardy vector
#

okay

#

will do

#

thank you

little raptor
hardy vector
#

how do you mean

pure socket
#

Does anyone know where jumping out of a car while driving is set to avoid damage?

dusty whale
#

cant someone confirm?

warm hedge
#

How did you do that? In Eden Editor?

dusty whale
#

as killzonekid said in the comments

#

running it in spawn scope is fine

hardy vector
little raptor
#

Β―_(ツ)_/Β―

hardy vector
#

will try it

#

thanks for the help

little raptor
#

you'll have to spawn it

#

(use the scheduled exec button)

dusty whale
#

as KZkid said

#

in the comments

#

weaponDirection is inaccurate

#

it does NOT point where the unit weapon is pointed

#

only roughly there

#

and "roughly" is 7m off at 100m distance

#

in terms of weapons, this is pretty bad

#

cant get camSetTarget to work

#

even with committing

#

it wont follow the vehicle i tell it to

#

and by follow i mean the camera wont turn to face the target

little raptor
dusty whale
#

im firing 7.62x51 at zeroing of 300m

#

and im looking at the angle of the weapon

#

comparing that to the angle of weaponDirection

#

and these 2 lines should NEVER cross

#

but they do cross

#

and quite soon

#

it's not a mild inaccuracy

little raptor
#

angle of the weapon

angle of weaponDirection
weaponDirection IS the angle of the weapon blobdoggoshruggoogly

dusty whale
#

angle of the weapon to the visual examination

little raptor
#

no it's not

dusty whale
#

screenshot time?

#

anyways

#

i cant get my camera to target

#

i am using camsettarget

#

but this seems to have no effect whatsoever to the camera

#

and yes, i am committing

little raptor
dusty whale
#

now the camera issue

#

the camera is not locking to a target i give it and commit

#

what gives?

#

can someone try out if targeting a created camera still works?

#

because i cant get it to work

#

oh ok, so camera target isnt even meant to make it look at that thing

#

how DO i make a camera look at a target?

#

or do i just have to work out the trigonometry myself?

#

this doesnt work

#

_camera camPrepareTarget player; // a camera will automatically target the human target's face

winter rose
#

can you please stop saying "it doesn't work" on first look? πŸ™ƒ
there is more than meet the eye πŸ™‚

heady quiver
#

init field of a vehicle:

[this, 1500] call carIsBuyable;
carIsBuyable = {
    params['_car', '_price'];
    _description = format['Unlock for €%1', _price];
    _car addAction[_description, {
        params ["_target", "_caller", "_actionId", "_arguments"];
        if([player] call HALs_money_fnc_getFunds >= _price) then {
            [player, -_price] call HALs_money_fnc_addFunds;
            _target setVehicleLock "UNLOCKED";
            _target removeAction 0;
             { [west, 'HQ'] sideChat format['%1 just purchased a car for €%2', name player, _price]; } remoteExec['call'];
        }
    }];
}

Can anyone explain to me why this is not working πŸ€”

dusty whale
robust tiger
#

camSetTarget does work with cameraEffect but you don't want that I don't think

dusty whale
#

i want a camera to follow a target

dusty whale
winter rose
winter rose
dusty whale
#

i was about to make a political comment about there on systems that dont work yet people dont complain, but wrong chat

winter rose
#

yeah, wrong chat.

dusty whale
#

my hypothesis is that it doesnt work

#

happy now?

winter rose
#

show your code

heady quiver
dusty whale
# winter rose show your code
A3RPG_CAMERA = "camera" camCreate (ASLToAGL eyePos player);
switchCamera A3RPG_CAMERA;
A3RPG_CAMERA camSetTarget player;
A3RPG_CAMERA camCommit 0;```
fair drum
#

Setting cam target on player works. I did it yesterday

robust tiger
#

it does not work with switchCamera

fair drum
#

Don't use switch camera

#

Use cam effect

#

External and back

dusty whale
#

how does that make sense?

#

why can i switch to a camera

#

using switchCamera

#

but the camera works

#

but it doesnt

#

πŸ€”

robust tiger
#

it was made back in OFP days

#

or so the wiki says

dusty whale
#

what functionality do i give up by using cameraEffect as opposed to switchcamera?

winter rose
#

switchCamera is for object's view camera
cameraEffect is for cameras

dusty whale
winter rose
#

because that's what cameras are, cinematic cameras

dusty whale
#

what if i dont want a cinematic camera

#

i want a viewport

winter rose
#

then you play with remoteControl and switchCamera

little raptor
#

and where did you define that function

heady quiver
#

Not getting the action to the vehicle.

#

init.sqf

dusty whale
winter rose
#

just stop

little raptor
heady quiver
#

aaah fuck

dusty whale
heady quiver
#

how would i solve that πŸ€”

heady quiver
#
class CfgFunctions
{
class bsTag {
        class buyShop {
            file = "functions\filename.sqf";
            class vehicleIsBuyable {};
      };
};
};
#

[this, 1500] call bsTag_fnc_vehicleIsBuyable;

#

Like this? πŸ€”

winter rose
#

(don't put SQF in config)

little raptor
#

forward slash meowsweats

heady quiver
#

lmfao

little raptor
#

(or maybe it doesn't matter ?!)

heady quiver
#

this part class buyShop { <-- category its required?

winter rose