#arma3_scripting
1 messages · Page 94 of 1
how could anything even be scripted in OFP without "get/setVariable"
that's like the most basic most needed thing
You can script plenty of things with only missionNamespace and private/local variables. Yes, it's more limited, but y'know, it was 2001
page fixed
use publicVariable if you need
https://community.bistudio.com/wiki/publicVariable
Ah so that's where
call compile format ["%1 = %2", "MyVariable", newValue]
shit has its origin 💡
wait until he learns that isServer was actually backported in OFP 1.99! :kek:
setvar(obj, varname, varval) obj##varname = varval;
#else
setvar(obj, varname, varval) obj setVariable [#varname, varval];
#endif```
something like that i guess
#ifdef __OFP__ what?
https://community.bistudio.com/wiki/Multiplayer_Scripting#Different_machines_and_how_to_target_them may be interesting to you
safer ^^
Afaik there is no way to use #if/#ifdef to detect the difference between OFP/Arma1/Arma2
The __ARMA3__ definition was only introduced in A3, and that also only in 2020
I guess you can use supportInfo, with if in script, to compile different script files at mission start
requiredVersion won't work to detect games really.
A1 restarted at 1.0, Arma 2 restarted at 1.0, Arma 3 restarted at 1.0
You could try compiling a script, and if it fails, it contains something unsupported.
So if (isNil {compile "supportInfo ''"}) ? to detect OFP?
Ah nvm compile didn't exist in OFP, neither did isNil
Did SQF even exist in OFP? Was it all SQS back then??
call command was only added in OFP 1.85
what is the best way to add additional arguments inside BI EH's ? Using global variables not a solution
Example of a EH you want? And what arguments, you mean passing custom data to the handler?
@winter rose I found another wiki mystery.
https://community.bistudio.com/wiki/call
Introduced in OFP 1.85
But syntax one takes string since OFP 1.00 ?
Also if OFP only accepts string, shouldn't the version marker then be on the "Code" argument type instead?
Mh also call string was removed wasn't it?
this one is most likely "in OFP it took string"
looks like i have to macro everything
yes, String was removed
Well I just told you, macro won't work. There is no way to detect/switch game version via macro
hey, you want to do this project! 😄
some_arguments before EH
addMissionEventHandler ["MapSingleClick", {
params ["_units", "_pos", "_alt", "_shift"];
if (_shift) then {
[some_argumnets] call some_func;
};
}];
https://community.bistudio.com/wiki/addMissionEventHandler
has "arguments" parameter, it can be used to pass arguments
I think not all eventhandler commands have it (for example unit addEventHandler, because there you can pass it via the object)
"You could try compiling a script, and if it fails, it contains something unsupported."
or do that yeah, if it can't run getVariable then it's OFP
damn you're right. Thank you )
Well except, you cannot compile in OFP, because that command doesn't exist there
although, I am not sure now that string was removed 🙃
And that would mean you have to wrap basically every command into a script function? That would be absolutely nuts and horrendous for performance.
Unless you take bigger blocks, and write a OFP version and a Arma2/3 (where macro detection works) version
The engine function is still called "StringCall" but it only takes Code as arg
So it was switched out at some point
That change for string was done on 27.05.2005
That's when string support was removed, before that it was briefly StringOrCode
Anyway to make drones not tilt upwards when applying velocity to them?
I've tried using setVectorDirAndUp but they seem to just ignore the loop and tilt anyway
they can't "ignore" it, the loop may be wrong
for "_i" from 1 to 999 do {
sleep 0.05;
drone1 setVelocityModelSpace [0,-10,0];
drone1 setVectorDirAndUp [[0,0,0], [0,0,0]];
};};
I mean the velocity is executing so idk why the vector wouldnt
i dont understand
I'm pretty sure vector directions must have some magnitude, [0,0,0] is...no direction, which is impossible
a vectorUp requires a "1"
[0, 0, 1] is "up" (towards the sky)
vectorDir requires a facing dir, try vectorDir drone1
SQF was first introduced in Operation Flashpoint: Resistance together with the call operator in update 1.85. so i can use SQF in OFP
That would remove it from tilting up?
yes
I guess
yes
you can use SQF, just not sqf files
but mission init is in sqs
and i cant
#include "init.sqf";``` because they cant span multiple lines in sqs
here what "SQF" means is "if () then {} else {}" syntax
you cannot use multiline in OFP, unlike perhaps with some string trickery
ig the only way to do OFP compatibility is to write an external utility tool that converts from SQF to SQS and replaces everything incompatible
still no idea what you are doing btw
ah and perhaps // / /* */ SQF comments and such
still one-lined in OFP, but still :p
isnt EachFrame EH blocking in sense that no other script is run until the eachFrame code completes?
so that's a yes? ;D
"blocking" is unclear
i mean like all others scripts wait and are not processed
they don't wait
unscheduled scripts are run one after another, with no consideration for the scheduler's content
But then SQF isn't multithreaded, so it's also kinda true.
right but they dont get paused
Once an unscheduled script has been started, it runs until completion.
And you can guarantee that no other SQF is running concurrently.
this was my main concern, thx!
because they might change same scripts variables its important the order is right
The magic of proper source control 😄
Pretty sure that the guy that made that change, is still at BI
Does loadFile or preProcessFile command exit?
yes
then use that instead of #include
idk what "str"ing an include is supposed to mean. If it's something known to be strable, it's fine, but if you're trying to str the contents of the file, that's wrong
also, str is Arma 1 🤣
if the file contents are basically {code} then it's str'ing code
it does not work like that
that's loadFile to you
Like I said if it's strable it's fine
call str
#include 'file.sqf'
```assumed that `file.sqf`'s content is```sqf
hint "Hello there!";
systemChat "OK";
```would result in```sqf
call str
hint "Hello there!";
systemChat "OK";
```and it would obviously fail (besides it being multiline… also I don't know if `#include` work in SQS)
fiel.sqf is assumed to begin with { and end with }
you would then stringify code
yes
Was that available in OFP?
if only someone could have predicted that trying to accommodate OFP and A3 in the same code would cause huge problems
are we still on this
technically it is a legitimate project and fair game for discussion here. even if it is stupid
i put this in init.sqs and it worked
call (preprocessFile "init.sqf");
and OFP's str is format
hint format["%1", A];```
with length limitation
You know basically nothing about how SQF nor its Preprocessor works (you were surprised that #define and #include worked)
and are trying to take your first steps, starting a huge inter-game compatible mod that even the biggest experts would be struggling with.
Yeah.. what the heck
tbh, if you want something that will work across all games, write everything in SQS
i dont even understand the point of it regardless
like, a3 is less than a mcdonalds meal here when it does on sale
i have all arma games on steam
It's hard enough trying to make anything work consistently on A3 :P
it's about choosing between re-writing everything for the older game or making it compatible from the start. i can't foresee every difficulty ahead and it looked like a plenty of commands worked in OFP, so i chose to try making it compatible
why do you need to write anything for ofp 
did that once, for one function - wasn't so fun 😄
https://community.bistudio.com/wiki/Example_Code:_Random_Area_Distribution
also, john, have you managed to get orientation interpolation to work in mp scenarios before? if ive already asked you sorry, memory loss isn't doing too well 🙃
setvelocitytransformation seems to have the same lack of interpolation as addtorque 
setVelocityTransformation
Interpolates and applies PositionASL, velocity, vectorDir and vectorUp to the given object based on the interval value.
no?
has exact same appearance as using addtorque for me, velocity gets interpolated by engine because of velocity property, orientation is just a property with no interpolation
i think biki probably referring to command interpolating the values based off interval too
and… what do you hear by that?
i dont understand the question
orientation is just a property with no interpolation
do you mean by that "setVelocityTransformationdoes not interpolates vectorDir/Up?
if not local, no
#define setvar(obj, varname, val) obj##varname = val; hint format["%1 is set to %2", #obj###varname, val];
#define getvar(obj, varname) obj##varname;
setvar(Car,_spd, 12);
_test = getvar(Car,_spd);
hint format ["Test is %1", _test];
doesnt interpolate between network updates
this works in OFP, namespace is emulated as part of var name
plz ignore the music i need it to play else my hearing aids disconnect from my computers bluetooth and crash arma (server-authoritative, using addtorque, looks identical to svt)
can you post the code again?
yes, will sqfbin it again
Movement (shouldn't be too relevant):
https://sqfbin.com/iyamowivenihahuzeniq
Orientation:
https://sqfbin.com/jifuqahelugeficezesi
the exact same shuddering motion happens regardless of if its setvelocitytransformation or just setvelocitymodelspace + addtorque
yes, all run at once -- some code is noted out and idk if sqfbin is highlighting it properly
it doesn't no but if I had to put my finger on why it doesn't work, then I'd say that's the problem
you're only supposed to use svt
not setVectorDirAndUp
here's a question for you: does unitCapture work fine on your server?
if so, the problem is not svt
and it shouldn't be
that command is designed to have interpolation (both in SP and MP)
im using addtorque instead of setvectordirandup, had also used just svt and used the orientation equation to update variable that svt oriented by
let me look at how to use unitcapture one sec
Previously had been setting ([_dir, _up] apply {_ship vectorModelToWorld _x}); as variable in the ship then reading in the svt in _moveShip
basically just record a heli/plane while doing all kinds of crazy turns...
as in with BIS_fnc_unitCapture? 
yes
also, to clarify -- this looks smooth on local machine regardless of what it is, but non local see it like this
well the local machine doesn't have any latency
ya
so it's moot
like I said when you use setVectorDirAndUp you remove the interpolation
i wasnt using it at the same time as svt tho 
you said "all run at once "
meant all the functions, not all the code
but fn_orientShip was writing to kjw_capitalships_neworientation variable or something similar, svt was taking from that
not a clue what this means
had to respawn after if that means anything
it copies the motion data to clipboard
My "main" display is black. I can see chat, menu and hints. I can hear sounds (eg when I shoot my weapon) but I have no 3D graphics.
I suspect that the "main" display is faded to black. Is there any code I can run to fade the 3D-Graphics back in?
and you just paste it into a file and pass it to unitPlay
e.g [bla, loadFile "data.sqf",...] call BIS_fnc_unitPlay
I don't remember the args so check the wiki
nothing was being copied 🙃
i'll try again but had tried 3 times
oh, record in sp and play in mp? 😅
yes
you want #arma3_config
thanks
works fine, smooth flight
spawned unit in with zeus, used setOwner to transfer locality to server then ran it
so issue is in your code like I said 
but its the same issue with addtorque and svt when i dont setdirandup anywhere else 
in that submarine even a physx obj?
... then maybe the problem is attaching it to another object with slower simulation or something
nope, it happens when i detach/delete it
isnt smooth, is juddering in places
oh, just found out something else now
I mean the submarine itself 
further away from camera the more its juddering
what about the plane?
plane i'll test
plane is smooth, have also tried dropping it from different distances from zeus after setting ownership to server, is still smooth
what simulation does the submarine use?
shipX
only reason its on there for that clip is its easier to see the juddering getting worse
same thing happens for the box
what if you created a new vehicle using planex (or airplanex, whichever it was) simulation?
that is my absolute last resort as itd be harder to modify the handling of it afaik?
wat?
you can use whatever controls you want
mine are reading out of simple af config values
actually here's another question
try recording the movement of the submarine, see if it jitters again
as opposed to the obj its attached to?
while using it in SP normally
I mean record it, then play it
like the plane
basically one of these is the problem:
- your svt parameters are not consistent
- the vehicle simulation is not fast enough
- you're doing something that messes with the interpolation
would those cause issues in dedi as opposed to everything else?
well they could cause problems in MP compared to SP
dunno any specifics about dedi
my current guess is 1
this doesnt happen in lan but theres no latency there
surely that'd be consistent at all distances though? 
well by MP I mean a second client observing what's happening on another computer
maybe 
for now the submarine recording test is the best way to go
actually play the plane data on the submarine
because if you record the submarine while moving it with your code it doesn't tell us anything
ive already deleted the plane data 
give me a sec though as forgot to record on the same terrain so its just made the sub disappear
if you use clipboard history you might still have it (Win+V)
give me a few then
😱
ok ill test the sub play on dedi then ill re-record plane and do that
how odd
wut? is that the plane data?
thats sp recorded data for it spinning on the spot
then I'd say something's wrong in your code?
anyway rn I'm mostly interested in the plane data
ya i'll go record that now
juddering in places there
however is somewhat smooth?
well yeah it looks better than what you had
anyway it's not smooth
so the problem is also the sim
i wonder if svt doesnt interpolate if interval is 1? 
so you'll have to make your own vehicle config
presume i cant just use this system on that vehicle too
iirc besides sim you also have to change their typicalSpeed and some other thing related to size
so theres no one size fits all solution for that either for each ship? 
where's typicalSpeed? cant see in cfgvehicles 😅
imo now try to move the plane with your submarine code
or even the rotation code
good idea
I guess maxSpeed?
not sure if it affects it
probably
looks similar to this when using the plane oddly 
i.e direction reverses at some point when you get further away
and then just stops eventually
although... it appears smoother? nope
then the problem is your code for the most part
so I guessed right
well you must use svt
addTorque is madness
must as in i should do or thats what i am running rn
i am very desperate
yeah the former
when i had done it i was using interval of 1 every time, should i change to 0.5 or something? need "live" movement so cant really go 0-1 interval all the time
Someone put some cute code into Antistasi with addForce that gives vehicles a bit of recoil when you fire attached statics from them. Trouble is that if you get a long frame it just nukes the vehicle.
i did 1 before and same issue was happening
however i wouldnt be surprised if 1 caused engine to ignore interpolation
use 0.999 😛
i hate this so much
I hate it too
thanks for the help though 😅
oh you don't mean the font 🤣
i get to find out next wednesday if i use it because i have brain damage or if i use it because im just weird 😟
but the brain damage would explain all this code
time to battle with tcadmin once again
I re-read SVT docs and now i don't see its pros 
for this, its engine level pros with how the command is handled i think
otherwise if it was just a wrapper for setvelocity etc i wouldnt be using it
though it is nice for easy use in mission making for using stuff as doors that shouldnt be used tbh
I re-read again and it still looks like "linearly interpolate between those 3 pairs of vectors with X ratio"
it is 🙂
however stack it and stuff (move the destination with it as well) and you have different interpolation
I re-read again and it still looks like "linearly interpolate between those 3 pairs of vectors with X ratio"
it doesn't use lerp for orientation
it uses slerp
but also the command doesn't just magically move your vehicle like setPosXXX
it issues an engine-level movement, like the vehicle's natural movement
what I mean is that it's not instant
ah
wut
i.e. even if you use an interval of 1, the command doesn't just setPos you
it "predicts" your move. dunno how to say this exactly
Huh, i actually need yo test it then
it might setPos you on the first point tho
not sure about that one
but anyway, the game keeps several movement states, and interpolates between them to generate smooth motion
(so that it doesn't have to simulate stuff every frame and save performance)
this command uses those (maybe pushes to them or something, don't know the exact details)
no worky 😦
deleting submarine reveals box is doing same thing, just kept the submarine so you can see it better
that is with this
well yeah like I said it makes no diff
I mean this
imo just take a look at unitPlay
the function might be using something that is better here
e.g. vectorDirVisual vs vectorDir
or getPosASL vs getPosWorld
unitPlay does use svt
I mean it might use different getters
tho I think for that you should look at unitCapture
unitPlay just uses the values
yeah, unitcapture uses vectordir, vectorup and getposasl
getposasl vs getposworld has made no diff to me before
then the problem is the calculations
I think the problem is that your interpolation duration is too short
i.e. instead of using an interval of 1 every frame, try to predict the movement using exact equations, and adjust the interval accordingly
and svt across frames having predicted movement? 
kinda
I don't know what equations you currently use for movement
as in what's "controlling" the movement
and what the equations of motion are
but you need well defined pos, vel and acceleration for this to work properly
for xyz movement, its just get ships position in a second according to velocity, take difference between that and current position and multiply by diag_deltaTime
...orientation has no diag_deltatime in it
i didnt write the orientation function because its beyond my knowledge, ampersand did iirc
all of this is just spaghetti to me
only problem is with orientation, not xyz movement too -- that was fixed a few days ago
🧠 make authority only network-transmit control points (including target time), get actual movement with svt in pfh on client
that means nothing to me, if youre talking about a node-based movement system (player clicks and ship goes towards there) i had done that originally but:
a) maintaining speed was a pain in the balls
b) it was really shit
could the issue be with lack of diag_deltatime in orientship? 
well you need accurate motion equations like I said before
inb4 steering behaviors
orientation motion is far beyond my calculus ability 
already done that with controls scheme lol
nah, i'm talking something like this series: https://www.youtube.com/watch?v=OxHJ-o_bbzs
It’s finally time for me to tackle a JavaScript (p5.js) implementation of the “arrival” steering behavior from Craig Reynolds’ 1999 paper Steering Behaviors For Autonomous Characters! Code: https://thecodingtrain.com/tracks/the-nature-of-code-2/noc/5-autonomous-agents/4-arrive-steering
🕹️ p5.js Web Editor Sketch: https://editor.p5js.org/codingt...
he is saying words i do not understand them
is it possible to disable ambient sound for a particular fence object (i mean the rattling sound)?
Land_BackAlley_01_l_1m_F to be precise
Is it possible to find out which enemy units has already detected a player? Like getting an array of unit names? I think that it would be possible with loop in which you would call "targets" function on all the enemy units in the level and looking for the name of the player in those arrays, but it seems too complicated. Is there any easier way?
And second question is? Is there any way how to know if the player was seen when he was detected? I think that when the knowsAbout value is <= 1.35, then he probably only heard the player but not seen.
You can use knowsAbout instead of targets if you want a simpler check.
but otherwise you're on the right lines.
So theres probably no function like Player isDetectedBy ... returns ai1, ai2, ai4
Nope.
A very basic example:
allUnits select { _x knowsAbout player > 1.5 };
(does not consider enemy vs friend)
there's units opfor
knowsAbout is more persistent than you might expect. In any sort of fight it'll escalate to 4 and then stay there for ~5min, even if the unit loses track of the target.
Yeah XD I measured it already
hence people will sometimes use the fancier commands like targetKnowledge to filter that down.
I will also need the target age value, and that is shown, to my knowledge, only in the "targetKnowledge" command, how long ago he saw me the last time in seconds.
How expensive would it be on performance, if I were calling this function every 0.5 seconds for two or three players? That means 6 times per second. With like 30-40 enemies in the game.
You can test it. Chuck some units down in the editor. Enter the code. Hit that clock button on the mid-left that I never spotted.
With one player and 30 enemies it say 0.06 ms 10 000/10 000 count
is it good bad ? XD
But if I put it there three times (3 players) it says this,
I also wonder whether setting the player's audiblecoef trait to a low value would affect even the range of the gun fire sound, or only the steps. Does anybody know?
Hey, this is my own SQF script, is there a reason as to why the sheep aren't moving? I have the line 19 "_unit = [_BK_random_pos, 250] call BIS_fnc_taskPatrol;" that should in "my theory" work on all of the groups of animals. https://sqfbin.com/mewojulicoxobahavipo this script is chatgpt free. I learned that lesson.
It's how "effective" the AI are at hearing you. A high value, is the equivalent of you walking around with a boombox alerting your position.
A low value, makes you as quiet as a mouse. But do keep in mind that the coef traits may or may not work right. Case and point the CamouflageCoef is more affected by the config values of your uniform.
Syntax:
[group, position, distance, blacklist] call BIS_fnc_taskPatrol
Parameters: group: Group - the group to patrol
https://community.bistudio.com/wiki/BIS_fnc_taskPatrol
Hey another question on textures how do I send it to a friends
If you make it a mission will be packed into the pbo
you can also run knowsAbout on a group I think, there will always be fewer groups. Fewer knowsAbout calls == runs faster
saved a bottle or 2 of xanax pills
few questions about vectordirandup i hope someone can answer:
- final number of dir does nothing, right?
- both must always have a magnitude of 1?
Z coordinate of dir is used for sure. How else would you make thing's nose point up?
uh
vectorup? 
uh, no?
guh, will mess a bit more in 3den to try figure this shit out properly
this confuses me
vectorDir is literally "which direction object's "nose" is pointing at" I'm confused about what's there to be confused about 
why not just roll pitch yaw 
ok, so
vectorDir:
[eastness, northness, upness]
vectorUp:
[90deg rollness, ??, ??]
vectorUp: [eastness of up, northness of up, upness of up] 
who on earth at bohemia decided on this
how can an up be east
oh, rolled to the east
the other two i do not understand
that's pretty standard (and arguably the most understandable) way of dealing with orientations
you'd hate roll/pitch/yaw as soon as you try to rotate your object around arbitrary axis 🙃
why must you hurt me in this way
i thought the magnitude was supposed to be the objects scale 
at this point you may ask for direct transformation matrix access already 
you are speaking gibberish to me
(i am going to continue to try avoid vectordirandup) (it does not work)
need to pull most of the code out of that though just to change the final line which isnt too helpful 
and my variables arent straight in roll/pitch/yaw either, theyre like 0-1 variables or some shit because of how amp did it 🙃
needs to be relative to the object's rotation which is the majority of the headache here
so pitch up needs to do yaw if its roll is 90 degrees for example
it is
then why is it ~1.7 
"no, calculus has failed you!"
i think i am understanding now
i need to _orientation vectormodeltoworld _x then subtract current position to get roll/pitch/yaw relative to object then just use BIS_fnc_setObjectRotation? 
if object is banked 90 degrees then pitching 100 degrees up should be same as putting 100 degrees yaw on the object
because i am smooth brain and cannot grasp vectordirandup
so just use the result of it in the svt
do you know how a cartesian coordinate looks like?
yaaay, #arma3_3dmaths
Hey all. I'm looking for a way to get ai spawned groups to stop and throw smoke when a helo is within X meters. Any ideas
yeah that. and then there's z that points upwards (following the right hand rule)
if you attach those coordinates to an object, y is dir and z is up
x can be measured using right hand rule : y * z, so it's not needed
the right hand rule confused me but i think i understand it somewhat now
what about vectorUp though? 
uhhhhhh
youve lost me now, why is there 3 coordinates for the axis? 
some random image from google
by z I mean a vector called Z
btw this one uses Y for up but the point still stands
im sat behind my screen making some very confused faces right now
which part is confusing?
how on earth dir and up become 3d world vectors
dir and up are the Y and Z vectors on that object above
vectorDir is, basically, a coordinates of point 1 meter directly before your nose when you're at [0,0,0] coordinates 
hang on im going to put an arrow and another object down at 0,0,0 and see if that helps
i think i understand vectordir now
vectorup is still confusing
vectorUp is coordinates of point 1 meter above your head when you're at [0,0,0] position 
Hello guys
I have a question about arma 2
How to disable magazine icon in arma 2 ace mod when reloading? I can change it to icon or text when reloading
I has searched the configs but no success
Bump (badpokerface.gif)
well you can just make a loop like so:
[] spawn {
while {true} do {
_leaders = groups west apply {leader _x} select {vehicle _x == _x};
{
if (time < _x getVariable ["smoke_cooldown", 0]) then {continue};
_helis = _x nearEntities ["Helicopter", 300];
if (west countSide _helis > 0) then {
_x setVariable ["smoke_cooldown", time + 60];
_smoke = createVehicle ["SmokeShellBlue", ASLtoAGL getPosASL _x];
};
} forEach _leaders-allPlayers;
sleep 5;
}
}
you can try disabling its simulation
or replace it with a super simple object
Disabling the simulation didnt work for some reason
Ill try the simple object tho, thanks
my wonderfully complex self teaching methods
you would have to ask ACE, see their Discord in #channel_invites_list
ok i understand how the variables work, just dont know how i'd go about modifying them for what im doing without converting them to pitch/yaw/bank
rotation matrices for example
never learnt matrices 
or quaternion but I doubt you know that one 
hamilton is a play isnt it
you just multiply it by a vector and it gives you a new vector 
uh
i thought it was the big
0 0 0
0 0 0
0 0 0
thingy
it is
youve lost me there then
e.g. rotation about Z axis is:
_mat = [
[cos _a, -sin _a, 0],
[sin _a, cos _a, 0],
[0,0,1]
]
and if you do (which looks stupid in SQF):
flatten (_mat matrixMultiply (_vec apply {[_x]}))
you get the rotated vector
https://en.wikipedia.org/wiki/Rotation_matrix#Rotation_matrix_from_axis_and_angle
and that's a matrix for rotation about arbitrary axis
i assume _a would be how far you're rotating about that axis? 
so then i just modeltoworld that, right? 
but you don't really need this stuff for what you do as far as I can tell
im just trying to rotate a mf and not have it stutter in mp 😟
what is _vec there? current position? 
ah
position is not important in rotation unless you do not rotate around your [0,0,0]
so I just need to take pitch, roll and yaw and then shove them into the matrices and somehow make those into vectordirandup and then modeltoworld it? 
let me take a look at your code again before I say anything
but anyway:
somehow make those into vectordirandup
you already have those tho
first you get the full rotation matrix
then you multiply it by vectorDir and up and you get the new ones
yeah I know it's still up on sqfbin
yeah, just wanted to make sure 😅
but i have 3 numbers to convert into 2 vectors, no? 
well you're rotating 1 object
so those 3 angles become one rotation matrix
and get multiplied by dir and up (and side, but again that's redundant, because right hand rule gives you that) the same way
so i assume i wouldnt just be straight up using roll pitch yaw as _vec? 😅
no those are angles
im confused what this means
you can use them to calculate that big matrix
oh, they all become one matrix? 
alpha beta and gamma
it's one matrix
oh so yaw matrix is multiplied by pitch matrix is multiplied by roll matrix? 
then I'd feed object's current vectordir and current vectorup into this as _vec?
yep
okay then modeltoworld those? 😅
but not sure if that's the problem in your code
roll is 2d in modelspace. New modelspace vectorUp would be [sin _rollAngle, 0, cos _rollAngle]. So _veh setVectorDirAndUp [vectorDir _veh, vectorModelToWorldVisual [sin _rollAngle, 0, cos _rollAngle]]; should apply the roll relative to model?
no they're already in world coords
alternative way is this yes
but needs to be pitch up makes object pitch up in modelspace rather than worldspace else you'd be rolled 90 degrees and have some fucky shit, no?
you can just use that matrix in model space
and it gives you the new dir and up in model space
which you can vectorModelToWorld
im confused what this means
i think i understand what leopard is saying now
oh so i just modeltoworld the resultant vectors as pitch roll and yaw are provided in modelspace?
each column of that matrix is the new side (x), dir (y) and up (z) after applying those rotations
im somewhat confused by what is actually a column and what is not in that instance but i think i can figure it out
if you use the new image for caluclations, you already have the vectors
so no need for matrices
the column is the vector. it's just rotated
[
x
y
z
]
oh roger
i think i understand it now
e.g side vector (in model space) is:
[cos a * cos b, sin a * sin b, - sin b]
which you need to vectorModelToWorld
ya i understand it was just reading it wrong
i dont need to have side in the matrix though do i?
no
you need the dir and up
and you don't need the matrix anymore
just a reminder
is it not more convenient to keep the calculation in a matrix?
well in SQF it just looks weird 
using those vectors directly might also be faster
fair enough lol
//BIS_fnc_transformVectorDirAndUp
#define R_YAW [[cos _yaw, sin _yaw, 0], [-sin _yaw, cos _yaw, 0], [0, 0, 1]]
#define R_PITCH [[1, 0, 0], [0, cos _pitch, sin _pitch], [0, -sin _pitch, cos _pitch]]
#define R_ROLL [[cos _roll, 0, -sin _roll], [0, 1, 0], [sin _roll, 0, cos _roll]]
params [["_vectorDirAndUp", [[0, 1, 0], [0, 0, 1]]], ["_yaw", 0], ["_pitch", 0], ["_roll", 0]];
_vectorDirAndUp matrixMultiply R_YAW matrixMultiply R_PITCH matrixMultiply R_ROLL```
private _dir = [
cos _yaw sin _pitch sin _roll - sin _yaw cos _roll,
sin _yaw sin _pitch sin _roll + cos _yaw cos _roll,
cos _pitch sin _roll
];```

so run the function that's pre-written by KK in modelspace, convert the result to worldspace, done 🙃
this does look very silly in sqf
you need * between those
oh ofc
private _dir = [
cos _yaw * sin _pitch * sin _roll - sin _yaw * cos _roll,
sin _yaw * sin _pitch * sin _roll + cos _yaw * cos _roll,
cos _pitch * sin _roll
];
private _up = [
cos _yaw * sin _pitch * cos _roll + sin _yaw * sin _roll,
sin _yaw * sin _pitch * cos _roll - cos _yaw * sin _roll,
cos _pitch * cos _roll
];```

this looks horrible
so then I'm just multiplying the two vectors together?
no
i.e vectorDir * _dir for new dir
you vectorModelToWorldVisual both of them and setVectorDirAndUp the result 
they are the new _dir and _up in model space, after being rotated that much
so those _roll _yaw _pitch you wrote are actually deltas (_droll, _dpitch, _dyaw)
yeah they are in the code, i dont understand how they're deltas though as you dont feed the original in?
oh ofc
modeltoworld guh
as in "rotate this much degrees/radians from the current orientation"
original orientation is taken care of by modelToWorld
this does look suspiciously like what it was before though 
it is wrong tho 
your _dir and _up are already in world coords
as far as I see in your code
aren't your roll pitch stuff in world?
aren't _dir and _up pure trigs in the screenshot, though?
e.g. when you provide a yaw of 90 degrees, you face west right?
no theyre just like 0-1 values
which screenshot?
in previous code providing [0,0,1] would make it turn until eased back down by regular breaking
which is just the variable being taken back down by a different script (fn_turnShip on the sqfbin)
this screenshot, uncommented part
pure trig = modelspace from current rotation, ja?
ok then I guess it's in model then
well yes which is why I said let me look at your code
I don't know what the problem is exactly
but if it looked ok before, then that part was not the problem
except old code seemingly tried to do rotations in worldspace (which doesn't end good) 
its working though the controls are a bit fucked right now, going to test on dedi in a few
i.e clearly something is different to before
so I don't fully understand your code, but it seems you do this:
- user provides input
- you set the new target orientation and target speed
- you use those to generate motion
yes
so if i do
_ship setVariable ["KJW_CapitalShips_TargetVelocity",[0,500,0],true]; it will make the ship accelerate up to 500ms forwards or its max speed, whichever is lower
similar principle is done for ship turning
the odd part is this also reversed the direction ships are flying in for some reason
i.e theyre all going backwards now
eventually ™️
this game engine will not beat me
I guess your directions were reversed
still juddering 🙃
well yeah that part's not the issue
the actual motion is
most likely velocity vector
what about the plane?
exact same thing
inb4 it's setVectorDirAndUp fighting with setVelocityTransformation for orientation authority 🤣
im not using setvectordirandup
only initship there runs on the server and that runs once to init the ship
and the rest of them also only run once
have also str the function on the server to check and it was updated properly
would vectordirvisual have any difference? 🤔
it does but I don't think you should use it with svt
but still worth trying
yeah probably worth giving it a shot on the off chance
but fairly sure this is just no interpolation being done by the engine
oh ofc i can only use dirvisual on the old positions 
possible that could still have an impact tho, ill test
what happens if you walk on the aircraft carrier deck when it's flying
is the interior a static object located at [0,0,0]
trying to come up with a clever pip solution so you can see outside it on the static ship but that can come after it works in mp first
no, [0,0,10000]
but otherwise yes
smoothly landing/taking off with vtol is quite easy
just have a handful of bugs that need sorting
but its all useless if this doesnt work first so
i'm yet to perform one experiment... i attached houses to NPC heads with a high offset and made them (houses) fly, and wanted to see what happens if i'm inside such house as it moves
in A2 there's a cargo parachute, and when my character transforms back to human from crow form, if there's such a parachute in its path to ground, it blocks the character's movement
even tho the parachute's moving
arma moment
i'm yet to nail a landing on it to try to walk on the parachute
what if you try this:
#community_wiki message
that ones too slow I think
let me make some adjustments
are you sure your movement is happening in the same tick with rendering
no for sure
its not
setVelocityTransformation pushes stuff to queue for engine to crunch at some later frame 🤣
wasnt expecting it to work, just getting desperate lol
i have an idea how to do it now, actually. transform to crow, fly into the house, transform back to human, order the unit the house is attached to to move
or just disable battleye and run 2 clients in separate windows 
me who never enables battleye
try this with your submarine:
spd = 25;
duration = 5000 / spd;
heli allowDamage false;
timer = 0;
onEachFrame {
if (isGamePaused) exitWith {};
if (timer > duration) exitWith {onEachFrame ""};
_dt = diag_deltaTime * accTime;
timer = timer + _dt;
_d1 = vectorDir heli;
_u1 = vectorUp heli;
_d2 = vectorNormalized [sin (200 * timer), 1, cos (200 * timer)];
_u2 = [sin (200 * timer), 0, cos (200 * timer)];
_up = (_d2 vectorCrossProduct _u2) vectorCrossProduct _d2;
_p1 = getPosWorld heli;
_v1 = velocity heli;
_v2 = _d2 vectorMultiply spd;
_p2 = _p1 vectorAdd (_v2 vectorMultiply _dt);
heli setVelocityTransformation [_p1, _p2, _v1, _v2, _d1, _d2, _u1, _u2, 1, [0,0,0]];
}
the submarine itself or the logic object? 😅
I'd say the sub itself
I can try both tbf
first try it in SP to see what to expect
no restart needed
on logic object
i was going to turn the music off but for some reason its so funny like this
why does it jump when it's near the top? 
unsure, doesn't happen when using just the sub object
wut? no
is it smooth that way?
wait is this in SP?
dedi
ish, bit juddery though
think jumping is being caused by capital ships scripts tho
setting ownership to me (stops capital ships running) and running eachframe on server is smooth
yeah, spawned a box and named it heli while eachframe is on server and thats fine
so in conclusion if you provide correct values, and still use 1 for interval, the result is correct
so must be my values are still wrong 
well yeah
take a look at that script I modified (ignore how the _u2 and _d2 were calculated, that's a mess)
update the position and velocity vectors like that
see if it makes a diff
wdym? have them in the same script? 😅
forgot to disable ping mb
this just updates "KJW_CapitalShips_SVT_Rotation" variable which is then used in new svt orientation
also your dir and up must start from current vectordir and up
they do
private _rotation = _x getVariable ["KJW_CapitalShips_SVT_Rotation", [vectorDir _x, vectorUp _x]];
private _vectorDir = _rotation#0;
private _vectorUp = _rotation#1;
private _oldDir = vectorDir _x;
private _oldUp = vectorUp _x;
_x setVelocityTransformation [_newPos, _newPos, _velocityWorldspace, _velocityWorldspace, _oldDir, _vectorDir, _oldUp, _vectorUp, 0.999, [0,0,0]];```
is there any command to log a string in a server's rpt?
...could be due to the position stuff?
diag_log
yes
velocity too
thx
i swear to god if its because i dont have the old position asl there
world you mean
calculate velocity and pos like so:
_p1 = getPosWorld heli;
_v1 = velocity heli;
//_v2 = _d2 vectorMultiply spd;
_p2 = _p1 vectorAdd (_v2 vectorMultiply _dt);
well _v2 can be whatev you want
p2 is new position yes
i think i already do it like that just in reverse for p2
private _velocity = _x getVariable ["KJW_CapitalShips_MovingVelocity", [0,0,0]]; //returns in modelspace
private _pos = getPosWorld _x;
private _nextSecPos = _x modelToWorldWorld _velocity;//visualworld still untested
private _velocityWorldspace = _pos vectorDiff _nextSecPos;
private _newPos = _pos vectorAdd (_velocityWorldspace vectorMultiply diag_deltaTime);
//svt stuff begin
private _rotation = _x getVariable ["KJW_CapitalShips_SVT_Rotation", [vectorDir _x, vectorUp _x]];
private _vectorDir = _rotation#0;
private _vectorUp = _rotation#1;
private _oldDir = vectorDir _x;
private _oldUp = vectorUp _x;
private _oldVel = velocity _x;
_x setVelocityTransformation [_pos, _newPos, _oldVel, _velocityWorldspace, _oldDir, _vectorDir, _oldUp, _vectorUp, 0.999, [0,0,0]];```
if vsc helps (probably not because of my font)
try it 
oh man i just found this in the cfg transportVehiclesCount , does this mean i can vehicle1 moveInCargo vehicle2; ?
different set of commands. Related doc: https://community.bistudio.com/wiki/Arma_3:_Vehicle_in_Vehicle_Transport
why is _dt = diag_deltaTime*accTime? 
oh, just to make speeding up smooth
my only guess is my values are still wrong then
but i have no clue why
in case the user is using time acceleration
diag_deltaTime is based on FPS, not in-game time
ya i gotchu
yeah its a lack of engine interpolation not just render being slow either, just double checked the vectorup on client and its only changing in the jerks
big brain moment
calcs are wrong and game is correcting them (i think?)
pause at any point
what is wrong?
the systemchats are the values i use for the svt then the actual vectordirandup
they dont match 
couldn't be caused by a lack of diag_deltaTime stuff in here, could it? 
really cannot figure this out at all
How to combine two conditions (>0 and <=1.35) in one simple select expression here? targetedBy = units opfor select {_x knowsAbout Hardy <= 1.35 && >0};
have to do _x knowsabout Hardy > 0
properly
targetedBy = units opfor select {
private _knowsAbout = _x knowsAbout Hardy;
_knowsAbout <= 1.35 && _knowsAbout > 0;
};
you can do per group as knowsAbout is shared across group units
I have a weird question, I am curious about a way to have scripts I use alot be put into a single spot, without making them into an addon? Such as, for example (although I doubt this is possible) a folder in profile with a config file and fn_function.sqf files
use advanced developer tools and you can save them
none of my scripts are in the addon
that would require restarting the game and repacking the pbo every time i change something
I am more thinking about stuff to call from the mission. But then useable across missions.
in your init EH you can just pass the object type as parameter and call some global INIT function that from there loads an appropriate SQF etc, none of this will have to be in the pbo except for the init EH in the config
class EventHandlers
{
init = "(_this select 0) execVM 'module_framework\register.sqf';";
}; ```
Right now I have it set up to be fn_exmaple.sqf via description.ext
oh yea- so what I want, probably no
you can use filepatching
you just make a folder in your arma 3 installation folder (or symlink to there), and put your stuff there
then you can use execVM, etc. normally
filepatching?
have tried shoving all the calcs in here instead with no dice 
the problem could be how you read those values in the next frame
to calculate the new values
for example, how do you calculate the new velocity?
although, would I be able to use them like cfgFunctions useage?
although that is interesting x3
without making a mod, no
aww
new velocity is calculated by a different pfh which takes config values and adds to _MovingVelocity variable
still tho, interesting.
that's the variable that gets used in the ship movement function
oh how would it interact with MP? xD
not recommended for MP at all
orientation has KJW_CapitalShips_TargetOrientation which doesn't actually do anything
well what's the starting value tho?
wdym? in the svt? 
you need a value to start with
I mean the value that you start with and update
e.g. you take the current velocity, use acceleration to add to it, and that becomes the new velocity
kind of thing
yes thats what i do
with acceleration just being how much velocity can increase in 1 second
just get kicked from every server I join xD
although- What about a syslink in the mission folder?
well ok but do you actually use the velocity or do you use getVariable with a fake velocity?
Does that need file patching or-
that could be a problem
not sure but could
verify if velocity and your fake one are different
I mean, I can just change _x getVariable ["KJW_CapitalShips_MovingVelocity", [0,0,0]]; //returns in modelspace for velocityModelspace _x;
I don't understand the question
could I do a symlink* without filepatching
I'm using hardlinks to have same files across multiple mission folders
not sure if that's the ideal but it seem to work
they are different however thats mostly due to velocityModelspace having some incredibly small number rather than 0
ffs forgot to disable ping again
sorry
can try use velocitymodelspace instead of my fake velocity and see how that goes?
though the fake velocity is just used to tell my script what to set as the new velocity 
_x modelToWorldWorld _velocity;//visualworld still untested
wut? you do know that vectorModelToWorld exists right?
your equation is backwards. that's why
which one?
private _nextSecPos = _x modelToWorldWorld _velocity;//visualworld still untested
private _velocityWorldspace = _pos vectorDiff _nextSecPos;
it should be _nextSecPos vectorDiff _pos
yeah already reversed that
but again just use vectorModelToWorld:
_velocityWorldspace = _x vectorModelToWorld _velocity;
no
I'm confused
see what I wrote
yeah
surely though you'd have like 10000ms velocity if 10000m away from [0,0,0] that way
with your equation (the one you just posted) yeah
it's completely wrong
at least the old one just had the dir wrong
I'll use what you said though I don't understand it 
vectorModelToWorld transforms a vector
surely player vectorModelToWorld [0,500,0]; returns 500m in front of the player in world space?
interesting
i think i may be misunderstanding how the two commands work
when you transform a vector its magnitude reminas the same. it just rotates it
when you transform a pos, you first rotate the vector (so it becomes a world vector), then add it to the object's pos
doubt that's causing the issue though
well you get a thousand m/s speed vs the correct one
so it does mess up the interpolation
yeah, i mean just fixing it from what was being used before
well yeah shouldn't
i.e changing a 9e-8 to a 0
it fixes the current one
ya
have also checked vectordirvisual again and theres no difference at all
which is to be expected
but ive no clue whats going wrong here 
Thank you thank you thankyou.thank you..
I think you just solved my problem. If anything you got me alot closer to my end goal.
I'll let you know how it goes tonight when I try this
consolidatre all your eachFrame loops too
have already tried that in the past and for some reason it breaks
then your equations are wrong
both with them all in the same pfh and changing them into functions and calling them within an eachframe
it shouldn't
even just putting the orientation stuff above the move stuff caused it to just fall to the floor
even though it was svting fine
basically your loop should calculate the stuff then use them in svt:
{
_x call Update;
_x call SVT;
} forEach blabla;
yeah, i copy pasted the orientation into the top of this and it was just all falling to the floor 
submarine is still slowly sinking downwards too
then fix it
if it doesn't work then that's definitely the problem
you must calculate everything in very careful sequences
throwing them randomly into multiple per frame events is not a good idea
Hello, does anyone have the class name for the stealth black wasp and shikra that have a dynamic loadout?
I have looked into cfgVehicles West and East but no luck there
spawn them in 3den, then right click and select find in ... uhm ... something. don't remember what it was called
so i should try squish them all into the same cba pfh?
or function call out to them etc etc
not just one pfh but preferably also the same loop
so ideally don't have function calls out of it?
I don't know what you mean by "function calls out of it"
I'm gonna try that
using [_x] call KJW_CapitalShips_fnc_turnShip; which would just be the same code but not inside a pfh
I had done that before but it still broke it 
Think it might be worth just rewriting most of this into one pfh
it is yes
any way to make a button that will allow players to change sides
example you walk up to a locker "you spawn in as a civ" then you scroll wheel and it will say swich sides "bluefor" is that a thing?
I deleted your messages in #arma3_scenario
was just about to do that thanks
Nice, got the wasp and shikra to work, thanks
symlink seems to work?
I know the feeling 😄
and ofc the second i update it finally on tcadmin i notice an issue
meh, i can test turning while im at it
i have symbolic link to one folder and that works but symbolic links work only in some cases (folders)
I used hardlinks for other cases... (files)
good news it doesnt all work first time at all
so, good news is it's no longer changing how juddery it is with distance & its all in one function now
bad news is i have not got a clue how to resolve it, advice would be appreciated 😅
https://sqfbin.com/oqekekeninejogilanek
(youre welcome for the proper indentation lou)
that made me click
sqfbin gave up on you on syntax highlighting though 😄
i think its having issues on notes at the start of dumps or something
nope, it just straight up doesnt do it if i remove the note at the start either 
iirc it's related to #
it is indeed
https://sqfbin.com/inosakuwejutolusipeq
im just find and replacing # out in future then 🤷
its easy to type
@finite dirge btw any chance for a fix? (sorry about the ping)
think the issue could be to do with velocity looking like this when stationary
I didn't get what you mean
is it smooth now?
no, but the juddering doesn't get worse with distance now
i'll record a video give me a second to sort the server
whereas here you can see it gets jerkier the further the camera is from it
also instead of this whole thing:
if (_x < _currentTargetVel) then {
_newVelocityModelspace pushBack ((_currentModelVel + ) min _currentMaxVel);
} else
{
if (_x isEqualTo _currentTargetVel) then {
_newVelocityModelspace pushBack _x;
} else { //Less than. There is likely a better way to do this, however I am tired and just want this to work ffs
_newVelocityModelspace pushBack ((_currentModelVel - ((_config_Deceleration select _forEachIndex)*diag_deltaTime)) max (_currentMaxVel * -1));
}
};
you can just write:
_diff = _currentTargetVel - _x;
_sign = [1, -1] select (_diff < 0);
_dv = (_config_Acceleration select _forEachIndex) * diag_deltaTime;
_new = _x + _sign * (abs(_diff) min _dv);
_newVelocityModelspace pushBack _new;
it doesn't take into account the _currentMaxVel thing but you should not let _currentTargetVel become greater than that value in the first place
yeah moreso concerned if people set it higher than that
but I'll do that, thanks
this part doesn't make any sense to me:
{
private _turnSpeed = _config_TurnSpeed select _forEachIndex;
_newOrientation pushBack ((_x min _turnSpeed) max _turnSpeed * -1);
} forEach _targetOrientation;
you're using _x the same as speed? wut?
is targetOrientation a diff?
targetOrientation is the yaw roll pitch thing
diff being differential? I'm confused 
difference
how do you calculate KJW_CapitalShips_TargetOrientation tho?
that's just in a pfh for the pilot controls for
private _roll = diag_deltaTime *5* (inputAction "AirBankLeft" - inputAction "AirBankRight");
private _yaw = diag_deltaTime *5* (inputAction "MoveForward" - inputAction "MoveBack");
private _pitch = diag_deltaTime *5* (inputAction "HeliRudderRight" - inputAction "HeliRudderLeft");
_ship setVariable ["KJW_CapitalShips_TargetOrientation", [_yaw, _roll, _pitch]];```
but im just using setvariable in zeus
yes
well from what I see your code looks almost correct
the way you calculate velocity doesn't seem to be
doesn't seem to be? 😅
yes. using the model coordinates for calculating new velocity is not right
let me ask you another question
does the ship always move "forward"?
as in can it have velocity to the side or up (like lift)?
ah
very sane assumption/simplification if we're not intending to implement AFM for it 🙃
atm yes but it can have other velocities
i.e controlsnly have forwards
do you simulate lift?
There's not a way to check if a player is aiming down sights right?
Been looking around on the wiki but wanted to double check
aiming down as in zooming or you actually just mean aiming?
not lift as in from air resistance but i intend on having hold ctrl+shift or something to increase vertical velocity
all 3 numbers need to work
in an ideal world
but at the least forwards and upwards
well for now I'd say just use speed
still sounds like a perfectly fine arcade "physics" 
i.e. just a single component
Looking down the sight, where you get switched to first person if you're in third, etc.
as in just take #0 and #2 of the current velocity leopard?
afaik no that's not possible
but if you meant zooming you could use the FOV
though would be nice if i would be able to just have all directions of motion from the off so i never have to touch this damn function again
cameraView returns "GUNNER" if player is ADS-ing 
gunner player
try this for now:
https://sqfbin.com/guxumitibofahopeseti
just for a quick test
roger, thanks 🙂
wait let me correct one thing 😅
I forgot to move _newPosition lower 
anyway, it should work unless I forgot to edit something
i shall test now, thanks
I'm curious if it looks ok now. if it does then your velocity computation was the main culprit
and if it doesnt then we must make a sacrifice to miller
its now always going backwards and is still juddering in its turning 😅
what is _targetOrientation?
its now always going backwards
if it is it means your ship is reversed
i set it to [0,0,40]
i think so lmao i have to build them backwards and just never fixed that bug
what is _newOrientation?
I know I mean its value
ah, sub's is turnspeed[] = {0.05, 0.05, 0.05}; //Maximum turning speed. Yaw, roll, pitch.
wot. Why does shooting 3 wheels of a quadbike change its origin? (at least it moves like 1-1.5 meters down when being setPosASL'd every frame) 
it changes its land contact
try this too:
https://sqfbin.com/boxaqarehaqolodukagu
I used the matrices to rotate the dir and up
instead of vectorModelToWorld
I think that makes sense
nope, still juddering and is going forwards when unwanted 
anyone know if cheats work in mp? specifically https://community.bistudio.com/wiki/Arma_3:_Cheats#FPS guessing not just wanting to use the limit fps line and cant see it in biki for clientside launcher params and/or player.vars
anyone have an aas comp, like in squad where the "frontline is the active objective". i know its possible without much scripting, but i really dont want to do it
Is Global Exec JIP?
Depends how you do it.
for some reason i cant get this sqf file to run on pub zeus
Can you elaborate?
When you run remoteExec you can choose whether it's JIP or not.
debug console "global" button is not JIP, if that's what you mean.
ah ok then
It's just a plain remoteExec with target 0.
well, probably remoteExecCall.
As on assign objectives directly to a player based on range?