#arma3_scripting

1 messages ยท Page 381 of 1

jade abyss
#

Why STRING?

#

Dude, String = Text

tulip cloud
#

exactly

jade abyss
#

What do you need a text for?

cunning nebula
#

probably still cleaner to use arrays

jade abyss
#

Yeah, gl... i am out... either Trolling or got 0 idea of anything

tulip cloud
#

classNameOfCrashedHeli = "B_Heli_Light_01_F" + "Crashed";
B_Heli_Light_01_FCrashed = B_Heli_Light_01_FCrashed + 1;

cunning nebula
#

setVariable

jade abyss
#

I told you that before, Justin

#

Dscha - Today at 10:02 AM
missionNameSpace setVariable [myString,"bla"];

hint newString; //"bla"
copper raven
#
missionNameSpace setVariable [typeOf (_this select 0),(missionNameSpace getVariable [typeOf (_this select 0),0])+1];
jade abyss
#

So in that case:

missionNameSpace setVariable [(typeOf _Veh), DoYourStuff];```
tulip cloud
#

thanks, I'll mess around with that.

jade abyss
#

And before you ask again: be sure what you want and make it clear for others, we can't look inside your head and know what you want.

tulip cloud
#

I normally do, It was a stretch so was difficult to explain

jade abyss
#

"I want to store the kills of a Vehicle in a Variable, wich has the same name as the Classname of the chopper"

#

maybe?

#

๐Ÿ˜‰

cunning nebula
#
_i = crashedTyoes find typeOf _heli;
if (_i isEqualTo -1) then {
    crashedTypes pushBack typeOf _heli;
    crashedCount pushBack 1;
} else {
    crashedCount set [_i, (crashedCount select _i) + 1];
}
#

that should also work and youll have all information in 2 arrays

jade abyss
#

๐Ÿ‘† Would be better, yeah.

tulip cloud
#

that is expensive on performance I believe but I'll test the performance of both.

jade abyss
#

pff

cunning nebula
#

lol

copper raven
#

is that the reason you arent using switch?

cunning nebula
#

youre not gonna have 1000 helicopters crashing per second or are you ?

tulip cloud
#

Maybe

#

maybe I want to use it for mingun firing from heli and bullets fired

jade abyss
#

This takes maybe.. hm... 0.01ms? Don't try to be smart, when you don't know the basics^^ (no offense)

#

You just end up making it harder for you

#

then setVariable is also not the best idea

cunning nebula
#

it kind of depends on how you want to read your data

#

if you want a list of all the helicopters who crashed, then use those arrays

#

if you just need to check individual helicopters against their classname

#

then the setvariable will suffice

compact maple
#

Wtf

tulip cloud
#

I would like to store them as variables and then when I go to read them then I'd collect them into an array and then display them. If I'm not mistaken you have to reconstruct an array if you manipulating it. Right?

jade abyss
#

๐Ÿคฆ

cunning nebula
#

so why not have them neatly stored in an array in the first place ?

jade abyss
#

Why? Why not store them in an array from the beginning?

cunning nebula
copper raven
#

use Tajins example, its exactly what you would want

tulip cloud
#

ah, so I can actually set the value...didn't know abou that. In the past I would deconstruct the array and make the change and then reconstruct it....

cunning nebula
#

oO

cunning nebula
#

๐Ÿ‘†

#

not only that

#

read it

#

several times

jade abyss
#

There are linkings below that lead you to "close to what you do"-Commands

cunning nebula
#

and there are many fancy things you can do with arrays

jade abyss
#

e.g.
https://community.bistudio.com/wiki/set
has:

See also:
Array
plus a
valuea plus valueb
a - b
resize
reverse
select
in
find
toArray
toString
forEach
count
pushBack
pushBackUnique
apply
deleteAt
deleteRange
append
sort
param
params
arrayIntersect
splitString
joinString```
set
#

(almost) all are related to Arrays

tulip cloud
#

I've spent over 100 hours on that site. I'm familiar with it but nothing pointed my research of arrays to set...

#

thanks @jade abyss

jade abyss
#

Then you haven't read carefully ๐Ÿ˜‰

cunning nebula
#

hmm that reminds me...

#

does the EntityKilled MEH also fire for vehicles ?

jade abyss
#

uhm

still forum
#

@candid jay yes. to your setPos on local vehicle question.
@simple solstice Yes. Can't overwrite variables that contain compileFinal'ed code.
@tulip cloud Dscha gave you the exact correct answer. Exactly what you were asking to do.
You explained what you wanted correctly right in your first question. You got the correct answer to that immediatly.
The problem is not you not formulating your question good enough as Dscha said. The problem is you not accepting the correct answer for some reason.

If you want performance best method would be to create yourself a seperate namespace (CBA) and store all crash counts as a typeof _vehicle variable inside that namespace.

real tartan
cunning nebula
#

if you already have posgreen and posred:

_posBlue = _posGreen vectorAdd (_posGreen vectorDiff _posRed);
#

btw. getPos direction seems to have some precision problems

#

or at least it seemed that way last time i used it

#

seemed to go only in 1m steps

tulip cloud
#

Thanks @still forum

#

If I want a script to fire when a player presses a hotkey, do I need a script that is constantly checking or can it be fired only when the key is pressed?

cunning nebula
#

addAction also supports hotkeys

tulip cloud
#

If I want to piggyback off an pre-existing hotkey. For instance the player presses 'R' to reload. Then it outputs "player is reloading". How can I do this? The player potentially could set the hotkey to something else. So I need to detect their hotkey and then add my additional script to that hotkey.

compact maple
#

Just use the key id

tulip cloud
#

But the player could change reload from R (19) to Q (16). I'm wondering how I would detect this change so that my script is fired by the right keypress.

copper raven
#

he just told you, either keyUp or keyDown displayEH

#

then use switch

cunning nebula
#

it has some problems with modifers though

#

hmm actually, no not really

#

unless you just use inputAction by itself inside a keydown eh

marsh storm
#

Hey guys, any idea why a CSAT VTOL would fail to take off again after executing a Vehicle Unload waypoint?

#

I have six identical ones, two just won't take off again after executing the unload

#

the other four work as expected

#

all the vehicles are successfully unloaded every time.

tulip cloud
#

Yeah, if I could just modify the reload inputAction that would be the simplest way. Then I'm not dealing with reassigned hotkeys etc.

copper raven
#

how about using reload with needReload? not sure if it would work, but worth a try.

#

and bind on R

plush cargo
#

This is a zeus question but never see anyone talking about scripting in there so posting here.
Anyone know of a way to force zeus to select select a unit?

still forum
#

#zeus_discussion
You never see anyone talking about scripting? Just read the messages right above you and you will see them.

#

You mean you want to force him to move his mouse and select someone?

plush cargo
#

yeah looking for setter.

#

I will probably have to search the units tree for the unit and use tvsetCurSel

#

is there a fnc for what the tree search bar does, or do I have to code it myself?

still forum
#

afaik it's in engine

#

so no

sullen dune
#
params ["_triggerName","_radius","_scale","_frequency"];
    _ordnanceType = ["G_40mm_HE","M_RPG32_F","M_Mo_82mm_AT_LG","Sh_120mm_HE","Sh_155mm_AMOS","Bo_GBU12_LGB"];
    _shellNumber = floor(random _scale);
    _shellName = _ordnanceType select _shellNumber;

    _myObjectInstance = _triggerName;
    _pos = getPosWorld _myObjectInstance;
    if (count(synchronizedObjects _myObjectInstance) >= 1) then {
            _objects = synchronizedObjects _myObjectInstance;
            _selectedMarker = selectRandom _objects;
            _pos = getPosWorld _selectedMarker
        };
        
while {triggerActivated _myObjectInstance} do {
    _bomb = createVehicle [_shellName,[(_pos select 0) + (_radius * sin floor(random 360)),(_pos select 1) + (_radius * cos floor(random 360)), 25],[], 0, "FLY"];
    _bomb setDamage 1;
    sleep _frequency
};
#

for some reason when _radius is below 150 bombs just kinda float in the air

plush cargo
#

maybe the "fly"

#

try "NONE"

sullen dune
#

already did, no dice

still forum
#
    _shellNumber = floor(random _scale);
    _shellName = _ordnanceType select _shellNumber;

-> selectRandom

#

with some magic to include _scale ofcause

sullen dune
#

yeah i was thinking of that too, the original script i pulled had it and i'm trying to improve it

still forum
#

That code is kinda hard to read...

sullen dune
#

code opti 101 for me honestly, first time im doing somethin like this

still forum
#

no need to use getPosWorld getPos is enough. Dunno which is cheaper performance wise though. But you don't seem to care about performance anyway.

#

As to why they float no Idea.. Does float mean they don't explode?

sullen dune
#

yeah, they just stay suspended on the air

still forum
#

any script errors maybe?

sullen dune
#

zilch, it comes up clean

#

which is why im puzzled

still forum
#

add systemChat's all over your code and then just see what happens

kindred lichen
#

Lol, this is my script... You're spawning the bombs in the air, with no velocity.

sullen dune
#

yeah i was bored and thought i'd pick it up to see what i could do -w-

still forum
#

Gravity usually takes care of adding velocity

sullen dune
#

yeah that

kindred lichen
#

Idk, it works for me. I set damage to 1 on the booms so they blew up right away.

#

@sullen dune work on a script that makes thrown satchels spawn a "land_ww2_crater_sand" object when they explode.

sullen dune
#

i have seen too much in arma to know what would happen by doing that

#

engineer throws satchel, tiger tank suddenly clips with spawned crater and flies upward at mach 8 in a fiery explosion

kindred lichen
#

Making an Omaha beach mission, and I want people to be able to sort of spawn cover by throwing bombs to make craters to hide it.

#

The beach is really flat and open, and there's just a certain point where you die if you take that extra step forwards.

sullen dune
#

spoilers

#

alright, fixed it with a hacky solution

#
params ["_triggerName","_radius","_scale","_frequency"];
    _ordnanceType = ["R_TBG32V_F","M_Mo_82mm_AT_LG","Sh_155mm_AMOS","Bo_Mk82"];
    _shellNumber = floor(random _scale);
    _shellName = _ordnanceType select _shellNumber;

    systemChat 'Shell selected';

    _myObjectInstance = _triggerName;
    _pos = getPosWorld _myObjectInstance;
    if (count(synchronizedObjects _myObjectInstance) >= 1) then {
            _objects = synchronizedObjects _myObjectInstance;
            _selectedMarker = selectRandom _objects;
            _pos = getPosWorld _selectedMarker
        };

    systemChat 'Position selected';

while {triggerActivated _myObjectInstance} do {

    _posX = (_pos select 0) + (_radius * sin floor(random 360));
    _posY = (_pos select 1) + (_radius * cos floor(random 360));

    _bomb = createVehicle [_shellName,[_posX,_posY,0],[], 0, "NONE"];
    systemChat format ['Bomb spawned at %1',position _bomb];
    sleep _frequency;
};
#

for ref

candid jay
#

Continuing yesterday's discussion... I'm trying to move an object from A to B back and forth in a straight line, and want this to run in MP

#

I can change the model properties if needed, right now it inherits from ThingX

#

setVelocity does nothing, well it does give it a little push but then it settles

#

setPos is probably unsustainable in MP

#

setVelocityTransformation doesn't move the object

#

yeah we talked about it yesterday

austere granite
#

maybe addForce could do it

#

spaming setPos in MP isn't smooth

lone glade
#

addForce is an impulse

austere granite
#

otherwise there's no option that would properly work in MP. What is it for exactly? If you only need direct local effect you could try local setpos

candid jay
#

right

#

local setpos and setdir is my current way to go

#

and a periodical info message from server with coordinates

#

to sync

austere granite
#

yeah, do that thing with creating local object and attachTo with that is probably your best bet if you want it to be smooth in MP

candid jay
#

one question though

#

if I have point A and B

#

moving from A to B

#

what is the easiest way to get the coordinates in-between

lone glade
#

vector calculations

candid jay
#

yes

lone glade
#

there's simply no other way around

candid jay
#

vectorWorldToModel?

lone glade
#

can't remember which vector commands do what right now ๐Ÿ˜„

#

I only remember the axis ones

austere granite
#

if the direction doesn't change you could even just the alternative getPos syntax

#

_object getPos [_dir, _distance] (or the other way around?)

lone glade
#

distance heading

candid jay
#

dir changes

#

i will need to setPos and setDir in a loop

lone glade
#

also why didn't they make a whole other command for relPos

candid jay
#

so on every iteration i need to compute the pos

lone glade
#

nah

#

alternative getPos syntax

#

instead of, you know, make variants of relPos for all the getPos commands

#

so:
relPos
relPosASL
relPosWorld

#

the stupid thing is that bis_fnc_relPos has a different output than the alternative syntax of getPos

#

yeah, noticed that when taking the camera calculus from arsenal

candid jay
#

still bothered that I can't use velocity logic on a custom vehicle

#

that would just sync automatically

#

the baloon is just a thingX BTW

austere granite
#

i bet that alternative syntax fucks up anyway with pitch/bank? ๐Ÿ˜„

lone glade
#

doesn't matter

#

nope, 3D

candid jay
#

fuck I can't get the starting point of this setPos computation in between 2 positions while keeping a steady velocity

lone glade
#

but it shouldn't matter, it's taken from model center

candid jay
#

it's actually a triangle and not all sides are even

lone glade
#

model center does not change

#

it's either that or the center of boundingBoxReal, don't think there's objects with different values for those tho

#

ah, that'd be too practical

still forum
#

Or just #Intercept it and read bounding box directly from Model ยฏ_(ใƒ„)_/ยฏ
Like I kinda did for Advanced ballistics to do stuff

lone glade
#

i've finished the french and english strings for arsenal rewrite ๐Ÿ˜„

still forum
#

Directly from model

#

not via script

#

ACE also had code to directly read p3d's. Until I removed it like.. last week or so..
But it's still in repository history

#

dunno

#

Couldn't you.. instead of the box and intersection thingy..
Just use lineIntersects script?

lone glade
#

fn_boundingBoxWorldRealRealest

still forum
#

Just use model center and go to each side till no intersection anymore.. And then try to draw a full box using lineIntersects with a cm space between each line

lone glade
#

modelToWorldWorld ๐Ÿ˜„

still forum
#

Would probably take a couple minutes using SQF.. But #Intercept

lone glade
#

not only that but some bounding boxes are bigger on purpose IE: tonks turrets

still forum
#

That would be alot easier in Intercept think ๐Ÿ˜„

#

Everything is easier in Intercept
#StartDiscussionNow!

#

The channel description doesn't say "No advertising" ๐Ÿ˜„

lone glade
#

plus the channel message makes no sense huehuehue

austere granite
#

even == true would fail ๐Ÿ˜„

#

isEqualTo true ๐Ÿ˜„

lone glade
#

cmon' i'm sure you can make this worse

still forum
#

That's actually quite good

cunning nebula
#

seems legit

subtle ore
#

Ouch

still forum
#

And all possible combinations are true.
Although I prefer a #%1 for the last format string

candid jay
#

I can't seem to find a way to compute the position between two points (3d) and specify a velocity somehow to use setPos

still forum
#

position between 2 points?
p1 - (p1 - p2)/2

candid jay
#

no

#

I want to move between A and B

#

let's say that I setPos on an object every 0.01 seconds

still forum
#

jup

candid jay
#

how do I compute setPos so that it takes 10 seconds to go from A to B, as an example

still forum
#

velocity is in meters/second

candid jay
#

yes ๐Ÿ˜ƒ

still forum
#

distance/10 gives you distance that you need to travel every second to reach target in 10 seconds.. -> velocity

candid jay
#

yes but in 3d

lone glade
#

that's what vector commands are for

still forum
#

No difference in 3D

lone glade
#

no difference in 2D or 3D

candid jay
#

oh you do the same on each axis?

still forum
#

just that distance is a 3D vector instead of 1D

candid jay
#

i understand that but I can't seem to see how to

sour saffron
#

depends on parabola or direct

candid jay
#

no parabola

#

direct

still forum
#

vectorMultiply by 0.1 == distance/10

sour saffron
#

then as told already

still forum
#

distance and direction you can get by targetPoint-startPoint.

#

(target-part) * 0.1
and that gives you the amount and direction you need to move every second

candid jay
#

ok will try looking into that

sour saffron
#

pos is returned in x,y,z so from the two positions calculate from x and y fiddderence = distance

candid jay
#

i hate vectors ๐Ÿ˜„

still forum
#

The formulas are all the same as with only 1 dimension

#

Just do it with 1 dimension.
And then just replace the numbers by 3D vectors and the vector math script commands (Because Arma is to dumb to ARRAY * ARRAY) Hm.. #Intercept

candid jay
#

oh I see

#

so first manually compute X Y Z differences

#

and then I can move to the vectors which should be just the same

still forum
candid jay
#

that seems to be an odd function, i'd figure the math is easy for that

#

maybe I'm misunderstanding it

still forum
#

minTo is start position
maxTo is end position
minFrom is 0 maxFrom is 1

#

and then value is just between 0-1 of how much distance you traveled

candid jay
#

ok

still forum
#

Sadly that only takes single numbers not vectors

candid jay
#

thank you ded

still forum
#

so you need to do it for x,y,z seperately

candid jay
#

will try

#

yeah so I might as well do the math and then switch to vectors as you originally suggested

#

will see

#

BTW I was considering to use an agent

#

then make it invisible

#

and attach my object to it

#

that should probably do all of the syncing for me in MP

#

might still be clunky

#

isn't there a vehicle of some sort

#

that doesn't consider physx

still forum
#

๐Ÿ˜ฎ .. Yeah... That could work.. But.. ugh...

candid jay
#

yeah I know

#

a stupid vehicle object that syncs already like players

sour saffron
#

a mosquito ๐Ÿ˜ƒ

candid jay
#

that is always local

sour saffron
#

i used flys for such things

candid jay
#

i was being serious lol

#

WAT

sour saffron
#

my first ever rope in MP was a seagul

candid jay
#

is a seagul sync'ed in MP?

sour saffron
#

any Ai can be if configged correct thing is to make the mechanic smple

#

you will have to check i didnt make it since 2007

candid jay
#

I wonder how setDriveOnPath could be used then all of this would be easy

sour saffron
#

well it is a linear path you need , always same ?

still forum
#

setDriveOnPath is AI based... I don't think you should trust AI with anything.

candid jay
#

lol

sour saffron
#

why not grab a bunch of co - ords and then place in ana array and then setpos _X

lone glade
#

unless setDriveOnPath works on agents don't use it

candid jay
#

of course DB that's what it's all about

#

but in MP setPos is going to be shitty as hell unless done on local objects that then you need to sync somehow

sour saffron
#

maybe attach to an animated vertex ?

still forum
#

just sync by CBA_missionTime

sour saffron
#

point the model then animate

still forum
#

and setPos in PFH ^^

sour saffron
#

how far is the distance to travel ?

candid jay
#

PFH?

still forum
#

Per frame handler - Each frame

candid jay
#

yeah

#

ok so

#
  1. understand how to compute positions with velocity
#
  1. use CBA_missionTime
still forum
#

CBA_missionTime because it is synced between everything. So you have the same value over all clients & server

candid jay
#

well it's the same as serverTime, no?

still forum
#

no

#

serverTIme has some... weirdness...

candid jay
#

there ya go

#

ok I have enough food for thought

#

thank you dedmen

#

but I will try to use a MOSQUITO or similar first lol

somber chasm
#

hey, I'm new(ish) just never got really advanced into scripting in general, but I have two questions.

#

does anyone have an earplugs script that is binded to a key that i can use or rebind.

still forum
#

Do you have CBA?

somber chasm
#

yes

still forum
#

That's quite easy then

subtle ore
#

its always this earplugs bullshit

somber chasm
#

lol and death screams I need

subtle ore
#

Or something with item shops

still forum
#

Do you have ACE? If yes then that just got harder.. If you don't want to use the ACE earplugs

somber chasm
#

no ACE

subtle ore
#

ACE earplugs come packed with ear wax

lone glade
#

well, better start learning how to make those earplugs script because they take 3 fucking lines

sour saffron
#

there is a standalone earplug script on armaholic

#

no need to tie to updates

subtle ore
#

Using others work is mainstr3am Deanos

#

Bad practice for a beginner

sour saffron
#

lol

lone glade
#

I just find it mind boggling tbh

sour saffron
#

you seriously saying Ace and CBA isnt reforamtted code from single addon makers ?

#

haha

#

well now i think i heard it all

still forum
#

Yes.

sour saffron
#

bull

still forum
#

It actually is.. A lot of ACE was written specifically for ACE

sour saffron
#

macros and defines do not hide originality

still forum
#

or AGM or CSE

sour saffron
#

SPooner stuff still there mine and al simmmonsstuff still there etc etc

lone glade
#

hahahahahahahahahahahahahha

sour saffron
#

haha

lone glade
#

no

#

no it isn't

sour saffron
#

mind blowing

#

yes it is

lone glade
#

just check the commits

still forum
#

Dude.. The full history is literally there.

#

You can go back 3 years and watch every line of code get written one by one if you want

lone glade
#

oh god, all those by commy2 huehuehue

sour saffron
#

pricnicples are all there and again back to the original point : since day 1 all addon makers and mission makers look at others code to learn

still forum
#

Yes. And then make their own code. based on the principles they learned

sour saffron
#

its ok to mock but first principle must be , stick to facts

lone glade
#

you're the one who provide none tho

still forum
#

If you start writing code that isn't based on SQF syntax and how SQF works... Your code won't work.

sour saffron
#

so back to original statement to the newb : there is a standalone code on armaholic

#

problem here is you are blinded by a linear mentality of new kid on the block cannot possibly have a new and or correct point of view , unfortuantely its cot condusive to progression

#

bullies

#

you try to be intelectual bully lol

lone glade
#

..... it's still 3 lines of code max

#

if it was a garrison script or some more complicated stuff, yes

still forum
#

You are telling someone that he is a "newb" and probably to dumb to make something himself and instead go to armaholic to fetch something ready-made.
And trying to tell us we bully?

sour saffron
#

sorry but that has no pertinant p[oint to the convo

somber chasm
#

so from the basics for the Earplugs script it is a .sqf file?

#

and use fadesound

still forum
#

yep

#

that won't fade music. But fadeMusic also exists

somber chasm
#

yeah I have no idea what i'm doing so far

still forum
#

holding the key down would toggle on/off very quickly Are you sure? CBA keybind?

#

I already asked if he has CBA. And he does

#

๐Ÿ‘

#

completly forgot that these exist

#

Argh fuck off you spammer.

lone glade
#

that's the only option for that, or some very painful agent pathing

#

agent pathing is entirely different from AI pathing

#

they have no brains

somber chasm
#

i'm currently readering Fockers guide to arma 3 scripting

#

reading

#

and gonna use that earplugs script too, thanks by the way

#

to reverse-engineer too

lone glade
#

right now they just follow commands to the T

#

which is perfect for what they're supposed to be used for

#

nah, just an agent created via createAgent

sullen dune
#

I keep hearing the term agent, I guess it's like dumbed down AI?

#

i know animals are agents but nothing else

lone glade
#

pretty much

still forum
#

Agents are basically empty AI's

lone glade
#

they're perfect for cinematic stuff ๐Ÿ˜„

sour saffron
#

agents use moveto in fsm but are thick in sqf with move and domove

#

animal agents get stuck alot

#

because they cant reverse and are limited to 5 anims

lone glade
#

oh, they can also open door ๐Ÿ˜„

#

speaking of you snek

sullen dune
#

didn't they fix that?

lone glade
#

animals animations are just so fucky

sullen dune
#

it was so hilarious at one time watching a snake open the door in a session

sour saffron
#

i have just made a Manimal Hybrid for a horse i now completely understand how tard animals are

sullen dune
#

and no one believed me

sour saffron
#

funniest was fish in town , saddest was the Bi fix that ruined all ambients

sullen dune
#

that's crazy talk

lone glade
#

too bad they aren't MP synced

#

T.T

#

thefuck, civilians have the same brain components as animals

#

so, none

sullen dune
#

i agree wholeheartedly

#

as learned on qs' georgetown

#

unless he did some magic australian trickery to make civilians stand in your way 99% of the time

#

i figured as much

sour saffron
sullen dune
#

i would think they're less expensive in performance, right?

#

ohhh that's smart

#

dang

#

qs you're on a different level

lone glade
#

bunnies need full path planning, because they're terminators huehuehue

#

(or because they get stuck a lot)

sullen dune
#

viper bunny

sour saffron
#

https:

#

well trained horse is what ya need

lone glade
#

making those animations must've been a gigantic pita

#

it's already a pain in the ass without having to do the skelliboi yourself

sour saffron
#

its harder to tell it not to get in a car

lone glade
#

wait, you're using full AI on it?

sour saffron
#

yeah its a man

lone glade
#

oh god the laughs

sour saffron
#

the Bike horse is dead

lone glade
#

the "situations" it gets into must be hilarious

sour saffron
#

i wistled in a high rise other day in he walks opens door and all

#

fortnately now i can remove that from actions so maybe he/she calm down some

still forum
#

๐Ÿ™ˆ

sour saffron
#

lol lazy

lone glade
#

or it's a feature

sour saffron
#

does it have hidden other model types or is it memory points ?

#

looks like it used to have atrailer and they left somehting in there

#

could be old verts not deleted , im guessing on the size = double alamost = trailer

#

yeah i think i saw this before maybe it was VBS or wishful physx MEDIA lol

#

i remember a varaint with trailed something

#

cant it be checked in difefrent lods or am i imagining ?

candid jay
#

hi all: easiest way to convert a direction (360) into a vectorDir?

still forum
#

sin/cos afaik

#

[sin 360, cos 360, 0]

candid jay
#

awesome

#

using FPS info to compute time, hence covered distance

#

in SP now it is all good

#

I need to ensure the MP now, will do soon

tulip cloud
#

If I want to create a hint that tells the player to press 'x' to complete 'an action'. how do I look up an action and return the action key?

sullen dune
#

use the holy grail that is hold actions

lone glade
#

terriblru

#

have you seen the code of the func? it's hilarious

candid jay
sullen dune
#

im not one to pry behind the blinds

#

though i get the feeling i should if i wanna get good at this sqf thing

tulip cloud
#

I've already looked at inputAction. It can only be used to watch for a specific action to be pressed. I can't see what keys are mapped to that button using inputAction.

#

actionkeys looks like it's going to do what I want. Gotta learn how to use DIK KeyCodes.

meager granite
#

Trying to make camera follow fast moving vehicle by setting camera position each frame, always end up with vehicle (or camera relative to it) jerking back and forth a little. Is there any way you can make camera position smoothly follow the vehicle?

lone glade
#

yes

#

detach and reattach it every frame

#

that's what BIS does for the arsenal cam to smooth the movement

#

well, detach part can be ignored, just use attachTo every frame

meager granite
#

Thanks, gonna try it.

lone glade
#

i've touched up a bit BIS code and replaced the vars for the rewrite but it boils down to this for the "updating pos" part of it:

GVAR(cameraPosition)  params ["_distance", "_dirH", "_dirV"];
[GVAR(cameraHelper), [_dirH + 180, - _dirV, 0]] call bis_fnc_setobjectrotation;
GVAR(cameraHelper) attachTo [GVAR(center), GVAR(cameraPosition) select 3, ""]; //--- Reattach for smooth movement

GVAR(camera) setPos (GVAR(cameraHelper) modelToWorld [0, -_distance, 0]);
GVAR(camera) setVectorDirAndUp [vectorDir GVAR(cameraHelper), vectorUp GVAR(cameraHelper)];
meager granite
#

Hm, still can't do it. If I do attachTo every frame I get same jerkiness

#

I don't have middle object though, attaching camera to the vehicle

lone glade
#

i'm using a logic as a helper

#

GVAR(cameraHelper) = createAgent ["Logic", position GVAR(center) ,[] ,0 ,"none"];

#

it's attached to the unit / vehicle and the camera just get setPos'd depending on it's position

meager granite
#

Nope, having logic attached and then camera setpos'ed modelToWorld from the logic doesn't help, same result, camera jerkiness

lone glade
#

how often is the camPos updated? every frame?

plush cargo
#
SRTS_commandCam = "camera" camCreate position player; 
showCinemaBorder false; 
SRTS_commandCam camSetFOV 0.4; 
SRTS_commandCam cameraEffect ["INTERNAL","BACK"];
SRTS_commandCam camSetTarget dummy1;
[] spawn 
{
    while {!isNull SRTS_commandCam} do 
    { 
        _camPos = [dummy1,25,90] call BIS_fnc_relPos; 
        _camPos set [2, (_camPos select 2) + 15]; 
        SRTS_commandCam camPreparePos _camPos; 
        SRTS_commandCam camCommitPrepared 1; 
        sleep 0.025;
    };
};
meager granite
#

On Draw3d, with setPos command

lone glade
#

same here

meager granite
#

Logic is attached every frame too

#

Try having such camera on the fast moving jet

plush cargo
#

just retested that code following full speed jet works well

meager granite
#

Tried opening arsenal on jet, same camera jerkiness as I have with my script

plush cargo
#

try the above code ๐Ÿ˜ƒ

#

dummy1 is the vehicle

meager granite
#

It only appears smooth because of 1 second commit which also makes camera lag behind fast moving vehicle, you can't say have it right above it

#

@lone glade Try opening arsenal while in jet and you'll see that is it jerky as well

lone glade
#

yes, checking BIS spectator right now

#

apparently they use setPosASL

#

it's also super nicely written

#

which is very nice for once

meager granite
#

Yeah spectator seems to be following vehicle smoothly, gonna check it out

lone glade
#

it's fairly simple too

#

but I can't find for the life of me the UI parts of it with the onKeyDown Ehs

meager granite
#

nicely written indeed

#
_countW = { side group _x == WEST } count _nearEntities;

WEST in all caps triggers me though, almost looks like str west output yet it is scripting command

lone glade
#

and those brackets

#

newline for them uuurgh

#

found it, finally

#

the rest of the camera handling is in a3\ui_f\scripts\gui\rscDisplayEGspectator

meager granite
#

Still can't figure it out and recreate what EG spectator does.

tardy terrace
#

hey there , im here to ask for some assistance in firguring out what i did wrong with this script . starting at 3:37 mark i followed what was done in the video and mortars arent shooting. here is the link to the video https://www.youtube.com/watch?v=lC_Re0DEJFI

plucky willow
#

anyone know how to spawn in a custom composition?

still forum
#

@meager granite use modelToWorldVisual the non-visual commands use the last known position. The visual ones interpolate.

#

@tough abyss Did you recommend that to the other guy?
There was a guy yesterday that thought he needed to use bis_fnc_objectsmapper to place compositions which was total bullshit

distant egret
#

I created my own functions for that that uses super simple objects.

#

I got a building mapping system that has good locations for fortifications and AI positions. Also the AI positions are the right direction this way they don't look into a wall...

#

It uses modeltoworld and worldtomodel. This way it's on the exact spot I want it to be.

#

Not really.

#

I was gonna be but its doing stuff that isn't needed.

#

While objects mapper can spawn stuff anywhere my function needs a center object.

#

Uh no.

#

I've made a sandbag castle. Angles and all.

#

Worked perfect.

#

It was a perfect copy from the original one.

still forum
#

That sounds like grabbing the objects was ASL and placing them was AGL

distant egret
#

Ah I've not tested with water. Because I'm not using water a lot.

cedar kindle
#

jasper was the position the same or could it be anywhere

distant egret
#

@cedar kindle anywhere.

cedar kindle
#

mind sharing

distant egret
#

Well it's an server side mod for my unit but I don't mind sharing the idea and how it works.

cedar kindle
#

sure but if some one has already made it why invent the wheel again

distant egret
#

It's mainly used for the buildings on takistan.

#

It needs a center object, the building for me.

cedar kindle
#

yeah sounds like what i need, ive used objectsMapper and while it works itโ€™s not perfect

distant egret
#

I got a SP VR mission with all these building templates that stores it into a array that then can be used by the functions.

#

So the grabbing part is only used to make this array. As it's slow and under performed.

#

So change their positions?

#

Well the best is to remove it.

#

Yea I see.

#

You use players vision in a way to see what gets hidden away?

#

Yea

#

But you do use the players viewdistance?

cedar kindle
#

how do you select what should be a simple object or not?

distant egret
#

K

cedar kindle
#

thereโ€™s a command of some kind since eden can do it?

distant egret
#

createSimpleObject ?

cedar kindle
#

must be a better way

distant egret
#

Or you mean in the data array?

#

Well I use true/false in the array.

cedar kindle
#

no I mean how would you check that โ€œyeah this is just a sandbag, use simple objectโ€ vs โ€œthis thing has doors, createVehicleโ€

#

eden seems able to do it ?

distant egret
#

That's in the config of a ovject

cedar kindle
#

thatโ€™s not my question

#

alright cheers

distant egret
#

But a lot of objects aren't assigned to be a simple object while they should.

#

That's why I do it my self.

cedar kindle
#

why is alignment different when using simpleO ?

#

wow lame

still forum
cold pebble
#

With Draw3D, is it possible for you to use line breaks in the text element?

still forum
#

Draw3D is a eventhandler that you can do literally anything with.

#

What text do you mean? systemChat/hint/some UI thingy

cunning nebula
#

drawIcon3D i would assume

cold pebble
#

Sorry, lemme specify a bit better

#

Yeah my bad

#

DrawIcon3D

#
addMissionEventHandler ["Draw3D", {
    drawIcon3D ["", [1,0,0,1], position cursorTarget, 0, 0, 0, "Target", 1, 0.05, "PuristaMedium"];
}];
#

So using that as an example

#

If I wanted to write 'Enemy' on the line below Target, is that possible?

still forum
#

Looks like no.

#

If you read the wiki comments to drawIcon3D they say no.. but..

#

drawIcon3D ["", [1,0,0,1], position cursorTarget, 0, 0, 0, format["%1Target",endl] , 1, 0.05, "PuristaMedium"];
Try that

cold pebble
#

Nope ๐Ÿ˜ฆ

tulip cloud
#

when I'm adding a string to an array it's getting double quotes. How do I prevent this?

still forum
#

How do you add it to the array?

cold pebble
#

@still forum @tough abyss Thanks for trying, and thanks for the info, just wanted to make sure I wasn't missing something#

still forum
#

Answer is. No it's not getting double quotes. Now to find out what you are doing wrong.

tulip cloud
#

when I do diag_log currentWeapon player;
it returns "arifle_MX_F"

If I do ```sqf
myArray = [[currentWeapon player]];
diag_log myArray ;

output is `""arifle_MX_F""`
#

if I'm going through all that trouble I might as well compile so it is {arifle_MX_F}

sullen dune
#

๐Ÿค”

#

this seems like an extremely obvious question but my curiosity peeks at me

#

is there a performance difference between using if-then / switches?

#

at least on cases with more than a few checks

compact maple
#

Instead of instancing many if you CAN instance only one switch

sullen dune
#

yeah that I know, I'm just thinking about whether it's a code cleanup/formatting thing or strictly performance related

#

im trying to optimize an old mission of mine for MP play and, well, let's just say I know a whole lot more now than I did back then

tulip cloud
#

switch is micro slower

#

I had some pretty nested if statements and others hated it so I switched to switch. though performance is a deal to mean so I checked and it was neglible

still forum
#

@tulip cloud That doesn't mean it is doublequote in the array.
It is not.
@tough abyss Taking away the first and last character of a non-quoted string won't do good.

tulip cloud
#

impart your wisdom ๐Ÿ˜ƒ

still forum
#

@sullen dune Yes.
if,then is two script commands. case,: is also two. But with the switch you also have the switch script command.
It depends on what you are doing. Atleast for a switch (true) the if variant can be faster.
Check code performance guide

sullen dune
#

alright thanks y'all

#

real good help as always

still forum
#

@tulip cloud diag_log stringifies the variable before it writes it to long.
The stringification of "string" is ""string""

#

So.. No it is not adding any double quotes. In fact there are not double quotes at all.

tulip cloud
#

ok so in that case I can treat the array with strings as single quotes?

still forum
#

They actually have no quotes at all.

#

They are just strings

#

The quotes are just added so you can see that it's a string

tulip cloud
#

Thanks once again.

sullen dune
#

hmm

#

say I wanted to use a cutText to make a black screen fade-in from mission start but I have an important script that shouldn't be stopped from executing (alas no sleep between it and the script exec), would running the cutText in a non scheduled environment use a sleep only in its scope or would it delay the script being executed after it?

#

im thinking the latter but I'm not too familiar with scheduling

still forum
#

huh?

#

unscheduled scripts can't sleep at all

#

Why would cutText stop any script?

sullen dune
#

yeah I wrote before reading the wiki, whoops

#

excuse the extreme simplicity but I'm on the commute

#
titleText "hello", black,5;
sleep 5;
cutText "", fade in,0

[script exec that ideally shouldn't be interrupted]```
#

pretend that's all correct syntax for now; that's in the initPlayerLocal file for the mission - I'm trying to think of a way so that the sleep 5 doesn't delay the script exec after

#

else the point of the fade in is useless given how it's trying to hide player vision for a few seconds while the script does it's thing

still forum
#

You mean.. You want to exec the script right after the title text.
But only want to execute the cutText 5 seconds after the titleText?

#
titleText "hello", black,5;
[] spawn {
sleep 5;
cutText "", fade in,0
};

[script exec that ideally shouldn't be interrupted]

like so?

sullen dune
#

exactly so

tame portal
#

@tough abyss You can disable the corpse removal in the description.ext

cedar kindle
#

you can use removeFromRemainsCollector

tame portal
#

Or that :P

proven crystal
#

i seem to misunderstand something regarding the arguments in eventhandler "killed".
i thought
_victim = _this select 0;
_killer = _this select 1;

but both returns the victim it seems...

#

in a foreach loop on a set of units i use:


_x addEventHandler ["killed",{
                //diag_log "handeling death";
                            
                _victim = _this select 0;
                _killer = _this select 1;
                
                diag_log format ["%1 killed by %2",name _victim,name _killer];
}];
still forum
#

Did he kill himself?

proven crystal
#

no happens with several units that kill each other

#

i saw this on the wiki

#

mySoldier addEventHandler ["Killed",{hint format ["%1 was killed by %2",name (_this select 0),name (_this select 1)];}]

#

so thats pretty much the same

#

happens when they kill each other, or when i kill them...

tame portal
#

@proven crystal I've never had this issue before

#

I believe your units arent actually dying by someone else

#

What does the chat say when you kill a player

#

X killed Y? Or something like x was killed

#

You can try using the instigator instead of the killer though in most cases

#

See what that returns

proven crystal
#

so that would be _this select 2; ?

#

i happens right now when i kill those units

#

hm should i be using MPkilled?

still forum
#

Maybe.. But normal Killed should really work

proven crystal
#

"Karim Khalili killed by Karim Khalili and Error: No vehicle is the instigator "

#

so karim is the victim and i shot him

#

t triggers but returns me ninsense

#

_x addEventHandler ["killed",{
                //diag_log "handeling death";
                            
                _victim = _this select 0;
                _killer = _this select 1;
                _instigator = _this select 2;
                
                diag_log format ["%1 killed by %2 and %3 is the instigator ",name _victim,name _killer,name _instigator];
}];
#

well these are dudes that get shot

#

and the trigger does fire

#

its just that _victim and _killer both return the victim

#

and in the above the _instigator is nothing apparently

#

where it should be me

#

i figure there is also no killer which is why it returns the victim instead of a killer

#

so why the heck does it not get a killer?

#

now i was wondering... as i use this on NPCs that are handled server side, maybe locality plays a role and i should use MPeventhandler and MPkilled

still forum
#

How do you test? Shoot AI in singleplayer Editor? Shoot AI in local hosted MP?

proven crystal
#

no on server

still forum
#

I thought Killed EH only triggers where unit is local

#

so only on server then

#

Might be wrong

#

Yes it is

proven crystal
#

that would be fine in principle. There is another bit of code that adds loot to dead corpses and that works

still forum
#

Ah you are grabbing that diag_log out of server console then?

proven crystal
#

but i figure i dont get a killer returned as player is not local to server?

#

yes the line is what comes out in the rpt

still forum
#

Shouldn't be a problem that the killer is not local...

#

can you try removing the name from the script?

#

Maybe both units have the same name for some reason ๐Ÿ˜„

proven crystal
#

no im trying with several units

#

i kill about 10 and its all the same

meager granite
#

@still forum Simply using visual commands doesn't seem to be enough, camera still jerks back and forth, using non-visual commands make its it even worse.

still forum
#

I have the same problem in TFAR. Just with audio instead of camera.. I even added custom interpolation based on velocity... No joy

meager granite
#

I wonder how EG spectator does it

#

It follows fast moving vehicles perfectly smooth, no sound issues too

still forum
#

I guess.. you could just move the camera on a fixed velocity

#

and when vehicles velocity changes quickly interpolate to the new one

#

So instead of trying to hold onto it. Just move along with it.

meager granite
#

I don't see EG spectator doing any of that though

still forum
#

Or store last position and velocity. And if you detect the new position is jerking backwards just ignore it and continue with the old one

meager granite
#
    // The pivot on the target vehicle
    private _center = if (_isMan) then { AGLToASL (_focus modelToWorldVisual (_focus selectionPosition "Spine3")) } else { AGLToASL (_focus modelToWorldVisual [0,0,_height]) };

    // Set dummy location and rotation
    _dummy setPosASL _center;
    [_dummy, [_dirTemp + _cameraYaw, _cameraPitch, 0.0]] call BIS_fnc_setObjectRotation;

    // Apply location and rotation to camera
    _camera setPosASL (AGLToASL (_dummy modelToWorldVisual [0, -_distance, 0]));
    _camera setVectorDirAndUp [vectorDirVisual _dummy, vectorUpVisual _dummy];
#

Tried doing exactly the same, doesn't work as well

proven crystal
#

crap. same result with MP Eventhandler

lone glade
#

from what i've seen BIS interpolates the pos every frame

#

their lerp func is a beauty

meager granite
#

I see lerp being used for zoom only

lone glade
#

afaik the dummy is only for translations outside of follow mode

#

yep, dummy is detached in follow

meager granite
#

Added some debug outputs, camera or dummy objects are not attached to anything, camera has no velocity, dummy has some but it is set only once on view mode change

lone glade
#

"focus" is pretty much synonym to target in egspectator's case

#

the findfocus part of rscDisplayEGspectator.sqf in ui_f searches for an entity

#

also:
_focus = uiNamespace getVariable [VAR_FOCUS, objNull];

#

prepare target seems to be what's doing the camera setPos for follow mode

meager granite
#

It does it just once at start

lone glade
#

isn't the cameraTick func on an eachFrame EH?

meager granite
#

Yes, but it does set_target only when vehicle changes, not each frame

#
            if (!_targetInVeh && { vehicle _focus != _focus }) then
            {
                [_focus] call CAM_SET_TARGET;
                missionNamespace setVariable [VAR_CAMERA_TARGET_IN_VEHICLE, true];
            };

            if (_targetInVeh && { vehicle _focus == _focus }) then
            {
                [_focus] call CAM_SET_TARGET;
                missionNamespace setVariable [VAR_CAMERA_TARGET_IN_VEHICLE, false];
            };
lone glade
#

missionNamespace setVariable [VAR_CAMERA_TICK, addMissionEventHandler ["EachFrame", { [] call CAM_TICK; }]];

#

block before the one you posted calls this

case "SetFocus" :
    {
        private _newFocus = _params select 0;
        private _oldFocus = ["GetFocus"] call DISPLAY;

        if (_newFocus != _oldFocus && { !isNull _newFocus || { !isNull _oldFocus } }) then
        {
            private _allowFreeCamera = missionNamespace getVariable [VAR_ALLOW_FREE_CAMERA, true];
            private _allow3PPCamera = missionNamespace getVariable [VAR_ALLOW_3PP_CAMERA, true];

            // Make sure we can be without focus
            if (!isNull _newFocus || {_allowFreeCamera}) then
            {
                uiNamespace setvariable [VAR_FOCUS, _newFocus];
                uiNamespace setvariable [VAR_OLD_FOCUS, _oldFocus];
                ["OnFocusChanged", [_newFocus]] call DISPLAY;
            };
        };
    };
``` every frame
#

which then calls "OnFocusChanged" which itself calls "setCameraMode"

meager granite
#

_newFocus != _oldFocus

#

Seems to do it only when focus vehicle chanes

lone glade
#

what the hell update the camera movement then hm...

meager granite
#

[_focus] call CAM_PREPARE_TARGET;

#

in camera tick script

lone glade
#

so yes, cam_prepare_target is called every frame

#

and interestingly enough we come back to

// Set dummy location and rotation
    _dummy setPosASL _center;
    [_dummy, [_dirTemp + _cameraYaw, _cameraPitch, 0.0]] call BIS_fnc_setObjectRotation;

    // Apply location and rotation to camera
    _camera setPosASL (AGLToASL (_dummy modelToWorldVisual [0, -_distance, 0]));
    _camera setVectorDirAndUp [vectorDirVisual _dummy, vectorUpVisual _dummy];
meager granite
#

Yeah, posted this above, tried doing the same with my script and camera still jerks

lone glade
#

what did you use as "center"?

meager granite
#

_center?

#

Or you mean _dummy?

lone glade
#

where the dummy is placed

#

and I found your issue

#
// The distance at which to place camera from the focus pivot
    private _distance = (_bbd select 1) + _zoomTemp;
#

they interpolate the zoom and add that to the distance

meager granite
#

_dummy modelToWorldVisual [0, -_distance, 0]

#

Don't think this has anything to do with camera jerkiness

lone glade
#

BIS convert it to ASL btw

#

(the modelToWorldVisual pos)

meager granite
#

I did exactly the same

lone glade
#

but yes, the issue is most likely due to the temp zoom interpolation missing

#

it's only done for man quicksilver

meager granite
#

Nope, I just set _distance to fixed 50 value, no jerkiness either

lone glade
#

vehicles have the center of their boundingBox used

meager granite
#

I even started using camcurator and all this set of camCommand commands, still can't reproduce what EG spectator does.

#

๐Ÿค” ๐Ÿ”ซ

lone glade
#

probably missing
private _bbd = [_focus] call BIS_fnc_getObjectBBD;too

#

it's used for the modelToWorld calculations and distance

meager granite
#

It simply returns bounding box sizes

lone glade
#

well, yes ๐Ÿ˜„

meager granite
#

As I said I made _distance to be fixed value of 50, it didn't change anything, camera is still smooth

#

so its not zoom interpolation that fixes jerkiness

lone glade
#

they also have "dirTemp"

#

so they most likely do some kind of interpolation too for it

meager granite
#

It only affects camera rotation

#

And its always 0

subtle ore
#

@lone glade so quick question here you god of config returning fool. When i go to add a condition to reference the 'side' entry external to cfgweapons in the config classes condition. Ie : 'getNumber(configFile >> 'CfgVehicles' >> configName _x >> 'side) i get noting.

#

I tried just testing the side bool outisde of the configClasses condition and it definitely returns side numbers properly for each uniform / gear set

#

Even tried just counting the returned configs and checking the side with an if statement. No dice.

lone glade
#

check your quotes

#

I see a single quote before getNumber ๐Ÿ˜„

subtle ore
#

The quotes may not be accurate here (mobile) i purposely did a single quote there

#

Forgot to close it lol

lone glade
#

also, you fucked up

subtle ore
#

Should've been double in this case to start

lone glade
#

_x is the tested config entry there, the FULL path to it

#

so it's _x >> the rest

#

no need for configname

subtle ore
#

Yes but _x >> will just point me to cfgWeapons

#

I need the CfgVehicles entry

lone glade
#

wait what

#

paste me the full line

subtle ore
#

Er. One sec here

lone glade
#

you're doing "getNumber( _x >> 'side') == 'MyThing'" configClasses (configFile >> "CfgVehicles") right?

subtle ore
#

private _un = "(getnumber (_x >> 'ItemInfo' >> 'Type') == 801) && (getnumber (_x >> 'scope') == 2 && (getNumber(configFile >> 'CfgVehicles' >> configName _x >> 'side') isEqualTo _sn)" configClasses (configFile >> "cfgWeapons");

#

uhhh...that's not any better

#

_sn is the side number - > 1 being WEST in this instance.

lone glade
#

missing round bracket on the second statement

meager granite
#

So I commented out camPrepareTarget, camCommitPrepared, attachTo and detach from SetTarget and ResetTarget. Turns out these don't seem to do much, everything still works just fine and camera follow vehicle smoothly.

subtle ore
#

Acidentally deleted that bracket pasting this, figedty piece of shit.

#

So I've checked this to no end, and it doesn't seem to be working at all.

still forum
#

Are you moving the camera in EachFrame? Or Draw3D?

meager granite
#

Draw3D as well

#

I actually tried trigger's each frame, EachFrame, Draw3D, all work identical

lone glade
#

@subtle ore are you sure configName _x is the same in CfgVehicles?

#

it might also be that you can't pass args to it, I never actually checked

subtle ore
#

@lone glade Yep, 100% positive. Classnames are the same all around

lone glade
#

try to use format just in case

subtle ore
#

Okay

#

Give me an example as to how I would format this here Alganthe

meager granite
#

Add logging to each value you use and receive and you'll get where it goes wrong.

subtle ore
#

Well I am Sa-Matra, I logged each side number that is coming in with that line of command all of them were zero for the side numbers. And nothing pushed to the array returned by ConfigClasses

#

there isn't really any middle ground where I can say HA! I found a missing 'x' here and it's magically working.

lone glade
#
private _un = format ["(getnumber (_x >> 'ItemInfo' >> 'Type') == 801) && (getnumber (_x >> 'scope') == 2) && (getNumber(configFile >> 'CfgVehicles' >> configName _x >> 'side') isEqualTo '%1')", _sn] configClasses (configFile >> "cfgWeapons");
subtle ore
#

Like I said, I've already tried just checking outside of config classes

meager granite
#

Commented out all camCommand everywhere to see if it affected smoothness, it doesn't

subtle ore
#

Oh, my bad. You weren't talking to me lol

#

@lone glade I see so the whole condition then? Sweet.

meager granite
#

I did about logging @subtle ore

subtle ore
#

And a whopping zero entries returned, what he hell.

#

Ah, yeah I try and do that regardless

lone glade
#

check all brackets, discord or I might've fucked up

#

add single quotes around it

#

there

subtle ore
#

Yep I already got that fixed

#

type string exepected number..

lone glade
#

remove it then, forgot you were checking a number ๐Ÿ˜„

#

I probably thought of the side command when typing ๐Ÿ˜„

subtle ore
#

slowly rests in the ground after a truely grueling defeat

meager granite
#

I just changed preparetarget to:

    _camera setPosATL (_focus modelToWorldVisual [0,0,20]);
    _camera setVectorDirAndUp [[0,0,-1],[1,0,0]];
#

And guess what, camera is still smooth, has nothing to do with dummy, centers, attaches, camPrepareCommits

#

Yes, non-dedi though

#

Doesn't matter really

#

The issue is that I can't make my own camera that doesn't jerk

#

And now I can't make EG spectator be jerky, its always smooth

#

What black magic is this?

#

EG spectator does it with Draw3D as well

#

It has nothing to do with it, I simply set camera by fixed offset for test, it still moves smoothly

#
    _camera setPosATL (_focus modelToWorldVisual [0,0,20]);
    _camera setVectorDirAndUp [[0,0,-1],[1,0,0]];
#

_focus is vehicle itself

lone glade
#

what fucks up on yours?

meager granite
#

No idea, no matter what I do it still appears jerky

proven crystal
#

ohman that eventhandler thing is really fucking with me. i mean im not even trying anything fancy here

meager granite
#

Arsenal camera is jerky as well when it object it follow is moving fast

lone glade
#

arsenal camera was made to stay within 5 meters of the bounding box center, makes sense

meager granite
#

EG camera is smooth regardless

#

And I can't figure out what makes it smooth

#

Changed it so it would create "camera" instead of "camcurator", still smooth

#

So finally managed to break it

#

Turns out camera position update is done in EachFrame, not Draw3d

#

Apparently I used some non-working method when trying EachFrame in my script and mainly did tests in Draw3d

#

Yes there is, Draw3d is done after world simulation (or other way around?)

still forum
#

You can also execute multiple times per frame with unscheduled @tough abyss Plus.. There is only one image per frame. So you can't really update not fast enough if you do per frame.

#

Draw3D is after simulation

#

EachFrame is before

#

while loop.. I guess for loop maybe too.

peak plover
#

How do I look at the shortcuts etc. in sublime text 2

#

Like how does the F1 work with poseidon

#

so it looks up the biki

meager granite
#

Camera is finally smooth, you must update it on EachFrame

#

I mainly did it with setTriggerStatements and Draw3d before, I guess both were executed after vehicle simulation was done (and position update), resulting in jerky camera. Only EachFrame executes before any entity simulations so camera position always matches actual entity position smoothly displaying it

still forum
#

afaik Trigger is inside simulation

#

never tested that. I guess I should

cold pebble
#

Thanks, now just for the forums not to error out

meager granite
#

@still forum probably depends on trigger and vehicle creation order, if trigger simulates before the vehicle, then you can have smooth camera updates.

#

Unless they're simulated in different groups so creation order doesn't matter

#

Anyway, not a proper way of doing camera updates whatever the case.

cunning nebula
#

@peak plover top right there is that interesting menu-button which is very confusingly named "Help" ๐Ÿ˜‰

still forum
#

Most likely seperate groups

still forum
#

yes

#

but it's scheduled.. so who cares ยฏ_(ใƒ„)_/ยฏ

#

second

#

_function checks the local variable table. Which only has 3 entries I think.

#

the global variable table has hundreds

#

It get's a bit deminished because the while loop opens another scope so it has to check 2 local var tables instead of just one

#

same with _player = player or _true = true

#

and similear

#

or _whileTrue = while {true} though you probably won't use while true more than once ๐Ÿ˜„

#

just remember to always private these if you are not inside a completly new script.

#

as in. if your function get's called

#

most likely overkill.

#

There are probably easier and better optimizations possible

#

moving the serverside stuff to Intercept for example :3

#

which doesn't work for missions you redistribute

#

You can optimize your global namespace by grossly overfilling it and then emptying it again

#

stretching it out. It will stay stretched after you remove variables again.

#

but again.. overkill.

#

It is a hashtable with buckets. Finding in which bucket an element is is constant time.
But buckets may have more than one element so it has to iterate through each one till it finds the correct one

#

if you stretch it out there is less chance of multiple items in the same buckets

#

But.. If you think about that a single binary command call is 2 microseconds... And the actual finding in the hashtable is like.. half a microsecond maybe..

#

just removing one function call get's you 4x the improvement... so...

#

overkill.

little oxide
#

Dedmen, what can you do with "intercept" globally

#

All the time, i see, you speaking about it

still forum
#

In one of TFAR's highest performance functions I optimize performance by not taking any arguments and instead accessing the _this that was passed to a function 2 scopes higher up ^^

#

Everything goes to hell if someone calls that function from some other place or it might even break if someone moves it in the file it's currently in.

#

@little oxide Dedmen.
And what do you mean by "globally" ?

#

Intercept can do everything a SQF script can

#

for all.

#

not some

#

if you have a single if statement or a single variable assignment or a single script command call in your script. Then Intercept will do the same faster

#

Some things benefit more than others though.
And some things benefit so little that it's not worth the time rewriting them

little oxide
#

So if you create a "gamemode" with intercept, you can have a real optimization, can the player feel this optimization, for example at the fps level?

still forum
#

yes

#

moving the heaviest ACE modules like advanced ballistics and frag and... ugh.. Wind deflection... to Intercept you can get +10fps in some cases.

real tartan
#

How to get typeOf (_class) of unit as default parameter params ["_unit", ["_class", typeOf _unit]];. Should I use _this? I have OCD for clean code ๐Ÿ˜„

still forum
#

No that won't work

#

because _unit doesn't exist yet

#

you can typeOf (_this select 0) though

real tartan
#

yup, what is why I am asking, ( jost posted example hto

still forum
#

I prefer giving default of scriptNull and then just using isNull

#

@tough abyss https://github.com/acemod/ACE3/pull/5704
200 bullets.
SQF: 10-12ms fps drop from 50 to 35.
Intercept: 0.474ms fps drop from 50 to 45.
Couldn't even measure performance using SQF. Because it was too fast for the low precision of available using SQF commands.

real tartan
#

@tough abyss I will improve my life when I uninstall Arma 3. Thug life of programmer.

little oxide
#

@still forum that it is the best situation to use intercept, because you said that under certain conditions it was not beneficial, in which situations intercept can make a big difference ?

still forum
#

The more math and control flow you have the better. If statements, isNil checks, +/-/vectorAdd/vectorMultiply and stuff. Basically stuff that just takes 2 known variables and does stuff with it without getting any additional information from the engine.
The more you call SQF functions that are not replaceable by other means the worse.
For example vectorAdd is just math. Intercept can do that without calling SQF functions.
If you have a loadout script that basically just calls addWeapon a couple times. There is only very minor perf improvement.

#

basically everything that interacts with the engine itself. Intercept also has to call the SQF functions for that.
It is still about 2x as fast when just calling SQF functions. But that doesn't make enough difference that rewriting is worth it. atleast for me

real tartan
#

so basically you are saying use addWeapon instead BIS_fnc_addWeapon ( just example )

still forum
#

No.
Sorry I was using the word "functions" instead of "commands" ^^

#

I was talking about Intercept. You are talking about SQF.
But what you said is true yes. In Engine everything is fast. In SQF everything is slow.
Example BIS_fnc_selectRandom.
You can either call the BIS function. Which means you call into it using very slow SQF. and then go into fast selectRandom inside it.
Or you can directly go into the fast selectRandom

#

Intercept is fast because it does everything "in engine" without any actual slow SQF inbetween

#

Going from SQF to engine is also "slow".
if,then,else these are 3 engine commands. So with one if then else statement you have to make 3 "slow" calls from SQF to the engine.
As Intercept is already "in engine" it doesn't have to go that far and is much faster.
Additionally Intercept can evaluate the if,then,else by itself without calling the actual engine commands.
So it's faster at calling engine commands. And often doesn't even need to call them at all.

So by not calling a single engine command at all you already have 100% performance improvement.

#

_var = if (true || false) then {true} else {false} in SQF 4300 nanoseconds (4.3microseconds)
Intercept for the same code 1 nanosecond theoretically. Theoretically because practically the compiler will completly optimize all of that out. So theoretically 4300x speedup. But in practice infinite x speedup.

https://www.reddit.com/r/arma/comments/6zvcpj/intercept_version_090_released/dmygvyu/ Here is an example of a function that doesn't benefit much.
It basically only calls engine functions (getPos) and only has a 2x speedup

winter dune
#

does this "Intercept" works only for making addons as said in the github repo or does it work also for altis life or mods like that?

lone glade
#

HAHAHAHA

#

if you think people making altis life servers are even remotely capable of using intercept.... well I don't know what to say

subtle ore
#

๐Ÿ˜‚

little oxide
#

Intercept, can relly optimize an EachFrame EVH for example @still forum ?

still forum
#

any script

#

It is unscheduled. So using Intercept to replace scheduled functions might not be that wise

subtle ore
#

My only question is malicious use. Clients could load an addon like such?

winter dune
#

@lone glade thanks for answering

subtle ore
#

๐Ÿ˜‚

still forum
#

If you don't enable bisigns then yes. Clients could load whatever they want

#

but they can also do that without intercept

lone glade
#

but it's not intercept's fault

subtle ore
#

Gotcha, so it'd be like any other adon

#

Sweet

still forum
#

Intercept has active protection so that addon makers can prevent people overwriting their dll

#

which default Arma extensions don't even have.

subtle ore
#

Excellent. Glad to see that was something that has already been done

still forum
#

But as Intercept is open source people could theoretically recompile Intercept itself and disable these checks.. But then again addon makers can include checks in their own addons to verify that the Intercept core is valid

#

So Intercept checks if the mod is valid. and the mod checks if Intercept is valid.

#

so a malicius player would need to recompile both dll's. Which he can't if the mod dll's source isn't public.

lone glade
#

plus that'd be a lot more work compared to memory injection

subtle ore
#

Sounds like the next best thing since bread and butter.

lone glade
#

because it is ๐Ÿ˜„

subtle ore
#

:+1:

still forum
#

All the new security stuff in Intercept should've been implemented by BI for normal extensions years ago..

subtle ore
#

Surely. But it's better to have it than never

still forum
#

needing battleye whitelist is a hurdle for people if battleye is enabled.
But.. a hurdle that just needs time. You have to get your dll whitelisted. But if you do you can overwrite stuff like the ace dll's and make them execute malicious scripts at your will. if the dll is used in a way that it can do that

subtle ore
#

Yep, is there manual appeal for .dll review?

still forum
#

Battleye you mean?

subtle ore
#

Yep

still forum
#

You send them your dll. And as far as I've heard they usually just whitelist it without checking it further

subtle ore
#

Huh, that's bad.

still forum
#

They even whitelist dll's after some time if enough people try to load it. Without anyone needing to request whitelisting.

lone glade
#

wasn't there some manual whitelisting done at the start?

subtle ore
#

At what start?

#

Beginning of a3?

lone glade
#

when battleye was introduced.

still forum
#

I guess so

subtle ore
#

Battlefield 2....?

still forum
#

wat

lone glade
#

to arma 3, not when BE was created

#

and afaik .dll whitelisting became a thing much later

still forum
#

I think that was only added when BE went kernel-driver

lone glade
#

yep, just checked, 1.46

subtle ore
#

BattleEye was a anti cheat for bf2 originally iirc

still forum
#

No.. Punkbuster.

#

That was when I stopped hacking. Or shortly after that. Their system was incredibly dumb back then and very easy to circumvent.

subtle ore
#

Third party dedmen

lone glade
#

still punkbuster

#

hell, BF3 also used it

subtle ore
#

What does third party mean to you both?

#

punkbuster is what dice used

#

Some communities started using be

#

if i remember correctly

still forum
#

True

#

I'd link the wiki but linking to cheat sites not allowed

subtle ore
#

ย Starting out as an external 3rd-party anti-cheat for Battlefield Vietnam, first versions were quickly released and it rapidly gained first acknowledgement. In early 2005, it was integrated in the first professional leagues. Due to request by the community, BattlEye was then ported to Battlefield 1942 and again used by some leagues.

subtle ore
#

Lovely

#

Can cfgDisabledCommands allow only server execution

still forum
#

pew pew pew
runs around with imaginary guns shooting into the sky

subtle ore
#

Hey Dedmen quit using your water pistols

#

Ugh, wtf.

still forum
#

So... All it does is prevent you from compiling scripts that use disabled commands?

#

Meaning you can just compile from editor into uiNamespace successfully. And then just call the earlier compiled function?

subtle ore
#

My god, what is the point...wtf.

#

Still could be better.

still forum
#

With Intercept you can really block the commands by redirecting them to your code.

#

And you can enforce Intercept usage clientside by just moving parts of your scripts into it.

#

If only Intercept was reliable, easy to download and battleye whitelisted.

#

Almost done with the first part. Second is easy to do.. Third I have no idea.

subtle ore
#

Intercept, not. Reliable?

lone glade
#

as in bug free*

  • may still include bugs
still forum
#

It doesn't work with latest prof v7 on x64. because one adress changed

#

already wrote code so it can detect that in the future and fix itself. Didn't test that yet

subtle ore
#

Are you the base of those irobot bots in the future Dedmen?

#

Rewriting itself to kill

still forum
#

they didn't rewrite themselves

#

that was the master mind thingy

subtle ore
#

Meh, it's been so long since i watched it

still forum
#

I actually have a product here that was made by iRobot

subtle ore
#

Heh.

thorn saffron
#

Is it possible to change exterior camera position during the game with scripts? I know you can do that via config, but its set when game loads. I wonder if it would be possible to have shoulder switching for over the shoulder camera (from deadfasts mod)

subtle ore
#

Yes @thorn saffron

#

createCamera

#

switchCamera

#

cameraView

#

attachTo

#

Etc

thorn saffron
#

Yeah, but you loose all the crosshairs, ballistic computer etc. if you switch to some other camera. At least I think so

subtle ore
#

Create the controls / displays required then

#

It may be that you need to sort of "rebind" controls with a ui event handler

thorn saffron
#

oi, would that mean I could get 3d person CCIP for planes?

subtle ore
#

Sure could

thorn saffron
#

๐Ÿ˜ฎ

subtle ore
#

There were ccip scripts before ccip was in the game. So all, very very possible.

thorn saffron
#

I want to use vanilla CCIP, vanilla stuff works the best

#

only I want to see it in 3rd person/external view

subtle ore
#

Yep. Possible.

thorn saffron
#

๐Ÿ˜‚ How then? Where should I start looking?

subtle ore
#

Ui_f pbo? Functions? Not too sure on that one

lone glade
#

CCIP? gimme 5 minutes

#

huh, that's weird, it appears that it's not in ui_f

subtle ore
#

Show off

lone glade
#

nvme ssd + everything ubined -> super easy to find stuff

subtle ore
#

Heh.

#

HDD peasent

icy raft
#

Question time! How would you go about detecting the mouse going to the borders of the screen? I want to recreate the clasical RTS camera movement (left border moves the camera to the left, right to the right etc.). I thought about making 4 transparent controls at the borders, but maybe there's a better way?

lone glade
#

@icy raft you'd use an onMouseMoving EH, screen pos relative to the parent control is returned in it

#

or even onMouseExit with a control that covers all the screen bare the screen edges

icy raft
#

Could I use Display 46 with that?

lone glade
#

also @thorn saffron I checked and those "MFDs" are actually images being layered on top of the current cam, it's all config based

#

@icy raft you'd have to create a new control for it but yes

icy raft
#

Yeah, that's the aproach I mentioned, but I was lazy as hell with making controls

#

LOL

#

I just realized the best way

#

"onMouseMoving" EH

#

that was what i was looking for

thorn saffron
#

@lone glade Including the lead indicator we had some time before the sensor update?

lone glade
#

@thorn saffron that's engine side afaik.

thorn saffron
#

fuck

#

that is one of the things I was after

#

I wanted in 3rd person

#

@hasty violet Would you happen to know how to swapn some buildings and AI to garrison them. I was trying to make a randomized MOUT training scenario using DAC

lone glade
#

ACE3 has mine in it now

thorn saffron
#

Nah I would just settle on DAC spawning random buildings. I'm no scripter

candid jay
#

does anyone know how to make a player enter an object that has a cargo proxy in it

#

i mean the typical proxy used in vehicles that you can use the moveincargo function

#

itโ€™s an object that is not driveable

thorn saffron
#

you mean by scripts or what?

candid jay
#

yes

#

iโ€™m trying to understand how to use proxy cargo from script

#

i guess with moveincargo

#

but maybe something is missing from the config.cpp

thorn saffron
#

disable model on some vehicle and use attachto and move player into cargo of that hidden model vehicle?

astral tendon
#

Do you guys know how do i group objects (not units) and give it a varible to be deleted later?

lone glade
#

you can't group objects

astral tendon
#

something similar?

lone glade
#

put the list of objects in an array and go through it later

astral tendon
#

i mean, we are talking about ALOT of objetcs

lone glade
#

yeah, and the array limit is around 10 000 000

astral tendon
#

๐Ÿ™„ nevermind.

astral tendon
#

i found a easy way

#

```{deleteVehicle _x}forEach synchronizedObjects test;````

wispy lynx
#

Trying to spawn a vehicle via .sqf, can spawn the vehicle fine, on designated road section, but when I try to orient the vehicle using roadsConnectedTo and getDir, I get undefined variable error message?

if (_mapVehicleProbability > random 100) then {

_spawnCenter = (_this select 0);

_vehTrigName = missionNamespace getVariable str _spawnCenter;

_mapSelectVehicle = _mapVehicleList call bis_fnc_selectRandom;

_mapVehicle = _mapSelectVehicle createVehicle (getPos _vehTrigName);

_roads = (_vehTrigName nearRoads 30) select 0;

_roadConnectedTo = roadsConnectedTo _roads;

_connectedRoad = _roadConnectedTo select 0;

/*_mapRoadDir = [_roads,_connectedRoad] call BIS_fnc_DirTo; // TRYING BOTH WAYS TO GET DIR, BOTH WAYS PRODUCE SAME ERROR */
_mapRoadDir = _roads getDir _connectedRoad;

_mapVehicle setdir _mapRoadDir;

_mapVehicle setPos [(getPos _mapVehicle select 0)-4.5,getPos _mapVehicle select 1, getPos _mapVehicle select 2];

};

Any ideas?

still forum
#

maybe the road is not connected to?

wispy lynx
#

Seems to be happening in places where there are multiple road sections.

still forum
#

Maybe the road is not connected to anything?

#

There being multiple "connected" roads doesn't mean they are connected.

#

you should add some diag_log's to debug that

wispy lynx
#

How could I check something like that?

still forum
#

add diag_log's to debug that.

wispy lynx
#

Showing my deep ignorance in scripting; How do I use diag_log's?

still forum
#

if you have written that script you already know enough to use it

#

Just print out your variables and see if they are all like what you expect

wispy lynx
#

K, I'll check it out. Thxs

wispy lynx
#

Can you give me an example of how to diag_log the variable? I added "diag_log _mapRoadDir;" , found my .rpt file, and the results returned is: Error position: <_connectedRoad; How can I get more information about the error?

barren magnet
#

diag_log _connectedRoad;

#

Or in general diag_log anything;