#arma3_scripting
1 messages Β· Page 215 of 1
i'm afraid to type anything now: π
lol don't be
just kidding π
then mb for taking it seriously, I just wanted to calm everything down and leave to stones unturned. cheers
see i'm 64 and i forget things sometimes: thats my bad
i guess that could be a good thing
but i only see the good in people: i try to stay away form the bad π
it's not that you forget things, at your age,it's really hard to learn new things (brain's physiology)
true that
well no matter what i'm still having super fun in Arma 3: fighting and scripting and all that stuff: WooHoo
I mean regardless of age no concept ever just immediately sticks when it comes to learning anything- not on you. Channels like this are cool because you can be young, old or anywhere in the world and talk with like minded people looking to learn. I don't have a professional background in programming or anything like that but the amount I've learned from coding SQF that can be applied even to more common languages I'd like to think has been pretty valuable. I heavily agree with Asmo that you do your best to help people around here and have, and that's what counts π
thx so much Milo
I actually learned programming from mostly Arma like did so starting from Arma 1/OFP
me too wow thats Awsome m8
i liked OFP that was cool game i loved the way the choppers flew in that game
yea those were the days but lets keep the chat related to arma 3 scripting since this is what the channel is 4
The willing to learn something new at 64 is what really matters.
Besides learning, you also help others, your contributions are really appreciated considering 99% of the people that ask for help on this channel (including me) are selfish and do not try to help others.
Most of us come from a place where people have a huge ego and you have to learn almost anything on your own (not good), there is a famous quote that I like which goes like this: βThey say I got to learn but nobody is here to teach meβ
Once you start learning and having experience, scripting becomes so easy that it feels like you were born with that knowledge, to such an extent that you canβt understand why people have trouble with the basics, making you think their questions are a βdumb questionβ
Maybe that explains it? Idk, but one thing for sure is that you are a really nice guy and your contributions are appreciated, we need more people like youπ
yes sir
Huge text and english isn't even my main language
wow thx man @radiant lark
No worries, you are awesome, hopefully I'll be like you when I'm 64
oh thx wow realy cool brother
Arma veteran β military veteran btw
me im military veteran USA Air Force
I know, and I assumed that's what McIvan meant
Yeah, I meant military veteran, considering what the game is about. I wouldn't be surprised if you guys actually paid tribute to military veterans with In-Game assets, events, discounts or whatever
yes sir thx m8
wow thx so much for all the nice things said: i really appreciate it: thx so much guys
let's not make this channel a scripter's blog and only write if you help/need help/rubberducking ok? π
ok will do thx Lou
btw i don't know what rubberducking is π
is that like ducking when someone throws rubber at you
Is there a way to do like an #include in stringtable.xml? I want to separate some parts of it into smaller files (mission config, not mod)
It was actually cool, but yeah, it eats up space in chat
yes sir sorry about that
If doing that helps you, you can create a thread, I don't think they would mind
im not sure how to do that:
Right click the message and create thread
ahhh ok cool
a used one
Do you approve of the thread thing?
yep, sure why not
lol @Lou hahahah that was funny π
rubberducking is when you explain the problem to something/someone and the solution comes to you from explaining/simplifying it
oh i see
Oh that actually happens a lot
it happens a lot
anyone?
i was hoping maybe someOne could give some ideas on how to do it better
negative! as far as I know
ACE is a mod π yea
Since it's an XML file you could maybe try XInclude (https://en.wikipedia.org/wiki/XInclude) but absolutely no guarantee Arma will support that
Dedmen plz fix
There are like tons of templating languages one could use instead.
Why do you want to split it though. Just use a container tag. That way you can fold everything else and concentrate on that part.
it doesn't
No
No

Yeah I'm already using it, it's not a simple mission, it's liberation, it has a lot strings already
i was thinking of making my own killfeed of the players and thought that at first the vanilla message needs to be blocked in "HandleChatMessage" EH and then send my custom one via customChat channel. or is there another way?
What's the most reliable eventhandler to put on a projectile that returns when it hits a vehicle? Been using HitPart, but while on server it seems to be a bit unreliable.
What kind of projectile? Because you can get multiple hits with explosive based projectiles.
Ballistic direct hit, want to avoid using explosives cause that may trigger too much.
I do a combination of server and client. The following handles explosions as well to get on the first hit. But I'm also doing this on objects that don't have hitparts like vehicles do, but you can have the client server idea which should increase accuracy. It is much more work though.
I'll take a look, thank you π«‘
so if i do the below then my player plays the carry animation but if i try to move my player he just slides on the ground instead of walking, any clue why?
player switchAction "grabCarry"
https://streamable.com/fgrumz
i think you need something like https://community.bistudio.com/wiki/playAction
I literally googled that xD @placid root Thanks anyway
yes i tried both and i also use the switch/playMove nothing works but im pretty sure it worked some years ago i can remember carrying a wounded in a mission and the animations worked well
humm i ran playAction from console and it worked
actually i had to move forward for the anim to play
did u try out this https://community.bistudio.com/wiki/playActionNow ?
yes he only makes two steps and starts sliding
weird
okay, if you do it with a gun equipped it does play the walking animations
but not without
Might need to do something like this maybe?
player playMoveNow "grabCarry";
player playActionNow "stop";
yes thats exactly what i did but works with a gun and not without
player switchAction "grabCarry";
player playActionNow "grabCarry";
turns out if you have no weapons then it does not play the walking animation but it plays if you have a handgun and even if its holstered
Okay was able to do it without a weapon like this. The uiSleep isn't timed exact to the animation so you'd probably have to fine tune that. There is probably a better way though that I am not considering.
player switchAction "grabCarry";
uiSleep 6;
player switchMove "";
but this resets the carrying action haha π i need to carry someone
https://streamable.com/v7zwmo
Oh huh that worked for me without sliding issues. I am not reproducing this in a plain mission so I might be trolling tho
I'll see if I can repro in an empty mission
This here #arma3_scripting message does still seem to work for me in an empty mission. Not able to get it working with a gun though now.
what i get (after the anim is played) (player playActionNow "grabCarry"):
good
you are supposed to carry someone on your shoulders like in Arma 2
I would not mind seeing this feature back in vanilla Arma 3 wink wink nudge nudge KK
still need to start the anim with W key π
finally carrying a zombie haha
https://streamable.com/elvnzs
I remember struggling with that as well. Ended up solving it with animations instead of actions:
[player,"acinpknlmstpsraswrfldnon_acinpercmrunsraswrfldnon"] call TAG_fnc_playAnimGlobal;
sleep 4;//For 'fast paced'. Try longer sleep if you wish
[player,"acinpercmstpsraswrfldnon"] call TAG_fnc_playAnimGlobal;//Skip remaining animation
And 'play anim' is quite simple:
TAG_fnc_playAnimGlobal = {
// params ["_unit","_animName"];
_this remoteExecCall ["TAG_fnc_playAnim",0];
};
TAG_fnc_playAnim = {
params ["_unit","_animName"];
//Force unscheduled environment, see Leopard20's comment on https://community.bistudio.com/wiki/switchMove
if (canSuspend)
then {isNil {_unit switchMove _animName; _unit playMoveNow _animName}}
else {_unit switchMove _animName; _unit playMoveNow _animName};
};
(I removed safety checks and irrelevant pieces from both examples, but idea stays the same)
Works with gun and you can even shoot while carry someone (which is awesome)
The trouble with HitPart is that it only fires on the shooter's client, because that's where hits are initially detected. There may not be a pure server-side solution, assuming that HitPart (Projectile) is also shooter-side (it's not documented).
Yeahh I'm using the Projectile variant of HitPart, seemed just a bit more reliable. But anything I need to actually take effect from inside, I'm firing off with remoteExec, so that should be fine no?
Not sure where remoteExec comes in.
First issue with HitPart (Projectile) is how you add it. Fired EH does work globally on the server, but it won't necessarily give you the correct projectile.
bullet simulation makes local copies of projectiles, and I imagine only the shooter-side one generates HitPart events.
So it feels like you'd have to install a Fired EH on every object on every client to pick up all the local projectiles.
Is there a way to reliably get this (where a task icon will be pushed down by a new one) vs the more common, one that prints on top of the other?
i think its false advertisement in the wiki because i never got that working π but I hope someone knows more
@thin fox Thanks for showing me BIS_fnc_showNotification a while back. Works great for what I need.
you're welcome π€
I've noticed bis_fnc_attachToRelative seems to get VERY inaccurate with editor position vs. in-game position in dedi MP when your attached object is farther away from the object it's attaching to.
Hard to tell if it's a bug or a limitation by however its coordinates are handled (floating point issue?)
I would guess that it shouldn't be floating point issue if the objects are at any reasonable distance from each other (especially if the difference is remarkably large). But who knows, maybe I'm wrong π
As an exaggeration if I attachToRelative'd something to an invis helipad that's like a kilometer away the attaching object will be absolutely incorrect by meters, plural, sometimes
Is there a way to automatically slot certain player (e.g. by profile) to slots.
I want that myself automatically slot to my names Zeus slot on lobby-join.
Found an interesting quirk. playSound will cancel out/remove a titleText Black out screen, but playSound will not effect cutText, thus letting the screen stay blacked out.
I wonder why that is?
Also what is the different in cutText/titleText. They seem do the same thing when I test them.
honestly i found that titletext/cuttext is too jank to be usable; better to just create your own display and do what you need with it because otherwise any random command might get your titleText either overwritten or stuck forever
Yikes!
like i remember a couple times doing a scripted sequence/event where i think i used the earthquake function, and ended up figuring out it was the earthquake completely removing the titletext that was meant to trigger at the same time
and then you consider other mods using various commands - yeah - it'll never work reliably
Awesome, thanks for the info!
Why do my missions show description "Search ?" in MP lobby, while other people missions show description from Workshop
Possibly a painfully simple one but a quick search and I couldnβt find an answer.
Is there a script I can put in a units config to exclude them from high command?.
Using the high command fix it mod and platoon leader redux so Iβd like to exclude support vehicles, anti air guns and artillery etc as I use other mods to control those or donβt need control of them in the AA/ AAA case.
whatcha got in the config/description?
What config? Desription.txt? I don't think there is anythig really. I would have to check it though, but I'm not on the PC right now. I think I only set some loading and overview texts in the editor.
anyone got a script or idea that disables AI helicopters following terrain? tryed flyinheigtasl but it keeps throwing error and anything else keeps making aircraft just pitch straight up
A command that throws an error means your syntax is not right. Post your code
@reef sedge what do you mean pitch straight up: ? choppers can only pitch forward or pitch backward: or pitch sideways
do you mean Hovering
you may have AutoHover on in the menu commands in the chopper
read the whole message again @pallid palm
ASL*
well if we set ```sqf
Helo2 flyInHeight 33;
flyInHeight is ATL, so if you use that then it follows terrain. flyInHeightASL is for if you don't want it to follow terrain.
oh i see ok
so are you saying if you use ASL the chopper will fly into a mountin and crash
It's not necessarily very good at it. Some maps have mountains with slopes that the AI can't adjust for.
i found if i set the the flyInHeight to like 10m ASL the chopper will pull up and avoid collisions
at any cost
even over water
like in my DEEP Diver mission on the way home or RTB as it were: We are flying at 10m ASL and we are heading right into a cliff and the chopper pulls up to any hight it needs to get over it
this is just what i have found im not saying im correct
oh and i have the Ai pilot set to Zero skill
and set to careless also: and i have the chopper set to full speed also
as a matter of fact i never saw a Ai chopper pilot: fly into a cliff or crash into cliff ever in my whole Arma gaming life: unless it was damaged π
them Ai chopper pilots are really good: even at zero skill: they can land even if they are spinning around like hell: and damaged really bad
i tested and tested and tested all this
you could kinda say i'm a bit of a chopper expert π in Arma 3 π
flying a chopper: or even scripting chopper stuff: choppers were the main reason i started playing Arma
but of course i saw all the other cool stuff also
lol i remember back in the day when Unsung came out i had to land a huge chopper in the jungle with a full team in the chopper: with 1st person lock on: and lucky i had a joy stick back then: cuz that was the hardest thing i ever had to do in Arma
if i would of crashed that chopper: and K.I.A everyone: i would of never heard the end of it π
it was like real life π
so after all that here you go π
Helo1 flyInHeightASL [standardAltitude, combatAltitude, stealthAltitude];
Helo1 flyInHeightASL [200, 100, 400];
No
In have author alone in Description.ext. There are some values like loading and overview description filled in editor, but besides that nothing. I don't see how is Workshop description related anyway. I doubt other people copy&pasted their workshop description to Description.ext
Isn't mission title not a mission.sqm thing? Pretty sure missions can have names without description.ext, though there is a chance my memory is fault.
Description.ext / briefingName
otherwise
mission.sqm / Mission / Intel / briefingName ?
yes there is like 4 places you can have the name of the mission Can have CutText name in the init.sqf
and in the Description.ext you can have the name
and 2 other places in the mission.sqm also
@hushed turtle btw is that a typo you have there ? Description.exe: should be Description.ext right ?
I'm changing text file into an executable π
ok i was thinking that
pitch backwards/up always seems to act an fly like if it was a jet, sorry on the wording ;-; i will give this a try later on so thanks
ok m8 Awsome
I've unpacked and checked some mission made by some else and they don't do anything differently, regarding mission description
And they have nothing like overview, text, author or anything like that in Description.ext
Just some text filled in editor
wow, this is some serious SQF right here
For a scam to work, shouldn't they provide a link or something ?
What is proper procedure. Can we ping "at at discord moderators"
It's provided in the pictures, do not click it
Hey! Could you take a brief look at my DMs with you? Thanks
I'm taking care of my backlog, I'll probably get to yours this week
That is the procedure yeah
No worries
You know it, every once in a while I just come up with some crazy ideas
same π‘
I've tried to copy Workshop missoin's .bin file and renamed to .pbo and place it into MPMissions in game's directory. This results in using texts set in editor.
Dunno why it displays "Search ?" rather than Workshop description in MP lobby. Linux issue maybe? That would quite unfortunate. π§
In singleplayer scenario list workshop description is displayed just fine.
Does the description perhaps start with "Search & destroy" or something like that?
& is a special character with syntax meaning in strings - it's the start of an HTML special character code, and in some contexts the game will get confused if it's followed by anything other than a valid HTML special character code
If you want to display an actual & in structured text, you need to encode it using its own HTML character code: & or &
SND!
Thanks NikkoJT for the tip, it indeed was issue with &. That being said, now it's replaced by & and both Workshop and singleplayer scenario list display & instead of &, while MP lobby displays correctly &. So, it's flipped, previously it wasn't working correctly in MP lobby, but now it's not working correctly in SP and Workshop. This game man sometimes, like it couldn't use same formatting at least.

MP lobby mission description doesn't support new lines. I guess it expects <br> tag. Oh, man...
Unless some other solution turns up, the simplest option is probably to just write and instead
That's what I did indeed 
Do you have signatures enabled...?
in arma3 do you blacklist commands client cant use?
you can yes, using CfgDisabledCommands - https://community.bistudio.com/wiki/Arma_3:_CfgDisabledCommands
thx was looking for something like that
Has anyone encountered this before?
- If I place a task module and sync to an object, I can see a 3d icon from any distance.
- If I instead script task creation with
BIS_fnc_taskCreateand useBIS_fnc_taskSetDestinationto set the 3d icon, I will not see the icon until around 50 meters.
I would expect the behavior to be the same.
Tasks can have icons set to always visible, which makes them visible even when other task is assigned
Maybe the one from module is set to always visible?
Rockin around the Arma game, let the Arma spirit ring
later on we can have some fun, and do some fi-i-ghting π
i myself never created a task via scripting i want to try that π
holy hanna that looks hard wow
well i only did tasks 1 time: in my chopper command Demo mission: so i guess its not needed
so in my (Special reload radio trigger 0,0,0) i have in the OnActivation
Local player
so in the script it targets isServer: π
and in that part of the script i have the reload Animation
but for all other players
i have in script not isServer with no reload Animation
and in that they just get the mag in their gun filled up to full capacity
that way No One going into the reload Animation: its just a work around
and? do you need help or?
local player == player,
if you are running for everyone.
So you only need check
player == p1
and if you want be sure that !isServer (avoid player check).
ok cool thx m8 Awsome
local player

i bet that is true
Man, player is always local
yeah i will change some stuff in the script and the OnActiveation as per what you guys said π
thx so much guys
lol you guys just gave me a ton of ideas π
Something I ran into recently is that if you set a task destination to a unit, it's only visible if you have knowledge of that unit.
yes i got the help thx @winter rose i always need help
Can be forced though
WooHoo it works Awsome now m8s: thx so much guys @stable dune @hushed turtle
man you guys saved me lots and lots of time π man i love you guys so much π
if you can remove the sexual con-o-ta-tions from that statement π
Interesting, I wonder why if you sync a unit with a task module, that isn't the case.
Module could be forcing it
If you create two triggers with createTrigger and name them exactly the same does that mean you have two triggers that would each do something. Or will the engine be like, no, there is already one like that.
I would guess old one would stay working, but you're not going to have any way to access it, if you overwrite all variables referencing it
You can't really do anything by scripting with any unnamed editor trigger
So it would just stay existing. But if you overwrite all references then just won't be able to do anything with it.
There are commands to find nearby objects, they may be able to find triggers too
holy shit guys @stable dune @hushed turtle it works so good: now after you guys helped me: the host can take any player slot: and do all the stuff : So Awsome: thx so much π
hello all again: so e'm i correct in saying that: the Host player hasInterface and isServer and is Local player also
im Assuming thats correct ?
oh thx m8
put this link in your favorites and check it when you have doubts about it
completed
so I am trying to play a sound when a player fall unconscious in my mission.
this script below works for when they die but I rather it work when they fall unconscious and multiplayer compatible where all players can hear when they fall uncon.
this is in initPlayerLocal.sqf btw
_unit addEventHandler ["Killed", {
[_this, {
params ["_corpse"];
private _dummy = "#particlesource" createVehicleLocal [0,0,0];
_dummy setPosWorld getPosWorld _corpse;
_dummy say3D "sound6";
}] remoteExec ["call"];
}];```
any help is much appreciated
@errant hemlock so um maybe you should use a diff EventHandler, umm cuz that's a killed EventHandler, i'm not sure but: is there any other EventHandler you could use ?, the killed EventHandler is doing its job
im not the best but im just trying to help: you said any help is much appreciated: π maybe you want a damage EventHandler
maybe something like this
_unit addEventHandler ["HandleDamage",{
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_instigator"];
//your code goes here
}];```
there must be a damage level: with a unconscious player: is that true: i never tried this so: you know
i don't do the retrieve stuff in my missions: so you know π
There's no event handler for unconsciousness despite a lot of begging.
ummm really
yes, otherwise we'd have been using it :P
So you'd either have to poll lifeState, or support each medical system specifically.
i kinda remember seeing this damage EventHandler for the retrieve stuff
but im not sure
Well, if you're writing your own medical system then you know when you used setUnconscious.
But otherwise it's a giant pain.
yeah its been tuff, the original idea i had came from an ignis video where they were playing as skeletons and when they die it would play the lego fall apart sound BUT they were using the vanilla revive system so maybe ace uncon just isnt possible? my idea was to use a clone trooper death sound for a mission I was making when players fell uncon.
it makes me think how painful it was for the KAT devs
"ace_unconscious" CBA event, fires globally.
you must be right @granite sky cuz i really don't know for sure
I'm actually not sure there's any hook for BIS revive other than replacing the functions. Nothing listed in scripted event handlers.
I did test this but it didnt work, thanks for trying though π₯²
I tried but I couldn't make much use out of it.
ok my friend
well I figured out how ignis did it anyway, they used the vanilla revive system and set the incapacitation mode to advanced. its not ACE medical but close enough
nice m8 Awsome
Allowing me to disable unconsciousness for players, otherwise it would be impossible, since there is no settings for it. π€£
the CfgDisabledCommands reminds me of BE filters, i wonder if you should use both?
Is there a script command for a vehicle weapon used by the driver to enable/disable it (stopping it from firing)?
I'm guessing not, and you have to use removeMagazines?
or removeWeapon yeah
maybe setWeaponReloadingTime for a workaround?
https://community.bistudio.com/wiki/setWeaponReloadingTime
Thanks Lou
It's pretty easy to expand on ace
Kat just does it in bad ways usually. Ace makes API for devs to add stuff and then kat just overwrites functions anyway
The Arma 3 scripting language is called SQF, right? Has Bohemia released any books on it? Or any fans?
probably not, since can be obsolete really fast... but ill be a nice thing to have, coding on paper like a real chad
Books? No.
Wiki? Yes!
i never learned anything from a book sep for Golf π
the wiki and Lou is my book now Woohoo
and other really Awsome guys
oh w8 i did learn how to fix cars from a book i forgot π
Lou is A plethora of knowledge: who needs Books π
Has anyone ever tried collating the pages from the wiki into a PDF? You know, for offline usage?
Yeah, we need a PDF textbook on the scripting languages...
Offline usage aside, my perspective is the wiki is great for novice overview of SQF and as reference material. The major challenge for people to advance learning basic application of SQF combined with either:
- general programming and problem solving with intricacies of the Arma engine
- or using an sqf "cookbook".
If someone else already know programming then #1 is feasible since they just have to learn the commands and quirks of the engine. Otherwise, the problem with #1 is that it is hard, and involves telling people they need to actually learn to program when all they want is quick script.
The problem #2 is that it doesn't really exists. Fortunately, many people are willing to "write a recipe" for people come in here with their problem.
@red beacon that would be a huge Book π
thats why Ai can't do Arma scripting Ai don't know the Arma engine
really iv been told that Arma don't use C++ or ".sqf as it were" scripting: it uses Arma scripting π
Hello, I miss something:
I define a variable into the init field of all my group leaders units in Eden (this setVariable["NA",1]) but I fail to fetch it during the mission with :
{
_val = (leader _x) getVariable["NA",0];
} forEach (groups west);
Default value 0 is returned. If I put a variableName=myLeader on a unit, I manage to get it thanks to myLeader getVariable ["NA",0];, but I want to browse all my group leaders dynamically.
Any idea?
Because _val is just a single variable, you're overwriting it with the new value on each iteration of the forEach. So the final value will be only the value for the last group in the list, which may be a group you didn't set the variable on.
Unless you mean you're actually checking it in the same iteration within the forEach, but the posted code doesn't show that π€·
ya, it is not my full code
the issue is myLeader and (leader _x) are not the same unit.
leader can change based on rank, if another member joins the group, or the leader leaves
Why do you want the variable on the leader? because there is only one per group?
Yes, in fact it contains an array with group spawning positions that I read for different stages in-game.
Then I TP all groups on their prepared positions.
In fact, if I slot mylsef into myLeader, myLeader == (leader player) returns false.
I need another strategy
store it on the group instead?
For JIP you probably also want to guard the initialization either way lest a JIP player reset the state.
ya better
Is there a way to spawn Livonian 'easter egg' tree via script commands? π€
I guess should be relatively simple with createVehicle, but how to find a classname? Or is it a complex object 'tree + decoration' ?
You mean the christmas tree?
Yeah
Afaik that is done by replacement in engine
"a3\vegetation_f_enoch\tree\t_piceaabies_2s.p3d" is replaced with "a3\vegetation_f_enoch\tree\t_piceaabiesnativitatis_2s.p3d"
You can probably spawn the latter with createSimpleObject
Yeeey π₯³ It does work. Thanks a lot π
But it's also good to read what ppl send you on wiki π
That's a great start. Thanks!
I went to school for computer science so the former shouldn't be an issue. Hell, once I start making stuff in Arma III I'll write the cookbook.
Those are better in my experience.
I wonder why player getEventHandlerInfo ["handledamage", 0]; indicates there is already one event in a new mission?
And are the default settings perhaps "BI revive is turned on"?
I am not at my PC to look at the code but I imagine any base mission just has one. I can't say I've ever shot a player and damage not been inflicted in a base mission
revive is disabled by default
A handleDamage EH is not required for damage to be inflicted.
i tried removing the EH to see if anything changes ;D it didnt
Do you have "reduce damage" turned on in your difficulty settings?
It's also possible that the BI revive EH always exists, and just doesn't do anything when revive is off
nope not reduced damage
So it's purely engine? I've never seen a mission without one
handleDamage is a method of interfering with the engine damage handling.
could be a mod π€
Yes, if you have ACE or KAT they will certainly have at least one handleDamage, and it's possible CBA provides one as well (though it's likely it doesn't do anything by default, if it exists)
* not CBA, they have the capability to do it but it's commented out for some reason
nope not a mod, i disabled all of them
Then it's probably just BI revive
Ran missionDifficulty in an empty mission and got -1. Took a look at my settings and reduced damage isn't enabled so probably isn't difficulty.
in MP theres now two of them π
π
Okay found bis_fnc_feedback_damagepulsinghandler as a variable on the player. Looks to come from BIS_fnc_feedbackInit where a handleDamage EVH is also added. Maybe from there then?
could be, im giving up because i just wanted to know the "default" EH counts
That actually would make a lot of sense- looks like pp effects from damage also appear to be applied in feedback if I am understanding correctly
Counts?
like how many EHs does player have
with player getEventHandlerInfo ["handledamage", 0];
Ah okay
@proven charm Have you tried https://community.bistudio.com/wiki/diag_allMissionEventHandlers ?
That's only for mission EHs, and there's no equivalent for object EHs
cant see handledamage in there
no worries π
whats interesting is that in MP there are atleast 2 of those EHs. in one player object
What does bis fnc feedback actually do?
I always see it appearing in profiling data for bad performance but I have no idea what it's for
I believe it's PP effects and overlays connected with receiving damage
From what I can see it is what Nikko said above- PP effects for burning, bleeding, etc if I am understanding it right
It also has effects for fatigue, and is where the dirt-on-screen effect from nearby explosions comes from
Fatigue is probably the reason it checks so often then
the second EH is coming from revive i can confirm that
It installs even if it's disabled?
revive being enabled i meant
ah ok
yes sir: i said the Wiki also in my post as well as Lou
(NOTE: Arma 2: OA/CO!) Basically, I'd like to know that as A2 is EOL since ages, is it wasted effort to try writing secure enough code in this case?
I have an autonomous team balancing system based on player scores on a server, but the problem is that after enabling it, some clients started acting weird which I noticed both because of extensive debug logging but also logging in case of potentially malicious activity, just like in this case.
In the first phase, a client sent negative score updates (even though the code doesn't allow negative scores at any stage and prints a warning if it happens despite of that). In the second phase, the code triggering score change worked only partially for some clients. In the third and final phase, some clients seemed to "mute" the whole score counting/increasing function as I could see them playing normally, but nothing was printed to logs.
It works like this on the side of the game:
- When an unit gets created, a "Killed" EH gets attached to it.
- When the unit gets killed, the EH fires and adds the score to player as follows:
if (isServer) then {
['SRVFNCREQUESTCHANGESCORE',[leader _killer_group, (score leader _killer_group) + _points]] Spawn WFBE_SE_FNC_HandlePVF;
} else {
["RequestChangeScore", [leader _killer_group, (score leader _killer_group) + _points]] Call WFBE_CO_FNC_SendToServer;
};
In vast majority of cases, the unit is not local to server, so the latter line of code gets run almost always.
So the clients seem to be able to modify the score counting mechanism even if the actual code adding the score doesn't even run on their machine.
Is it a lost battle?
you want to use this in a3?
No, in A2 instead
the killed eh is local, you cant run it locally in the server?
or it only activates where the unit is local?
It gets triggered where the unit is local
Most often it's headless client as most of the AI runs there
Hello All: do flashLights work under water:
you know the flashLight on your rail of a weapon
why not just try it?
i did and it didnt seem to work
but it was daylight out tho
maybe i just couldnt make it out or see it very well
use 3rd person lol
yes sir i did and it didnt seem to work
wait isServer is not valid for headless
Yes, that's why the latter line gets run almost always
i mean server and headless shouldt run the same code?
But in any case, the EH usually fires on another client (or occasionally server) and it still gets intercepted somehow
The mission's architecture is like that (it's legacy code from years ago by another developer)
I think it's like that also because addScore can be run on server only
stupid Net wants me to get a Mod π In Arma 3, standard flashlights generally don't work well: or at all underwater due to game mechanics (refraction, backscatter, water opacity) π
i'll do without a mod its just a matter of time π
A lot of lights in Arma don't work in daylight. Why didn't you try it at night?
-I don't know how they manipulate the scores. If they had acquired scripting access they could do much worse.
- But from a simplicity and correctness perspective, I would just sent the killed EH args to the server and let it do all the computing as a delta.
- You have two places where you could get lost update
- your spawn running multiple updates concurrently.
- Two machines each getting a local kill before scores are synced.
I'll try that, thanks π
Flashlights work underwater. There are conditions:
- it must be dark enough to actually see the flashlight; it won't be visible in daylight
- you must be in a configuration that allows you to have your weapon out while swimming, e.g. wearing a vanilla Wetsuit
- the vanilla flashlights have quite poor range and the light may not be noticeable if there's nothing nearby to shine it on
copy that thx m8
thx you for the reply
well i was only just under water near the surface of the water: im going to try it way deep in the water and see if i can " see the light": no pun intended π
its really dark at -100m in the water
i may have to do the sunOrMoon thing
This thing lights up ground and objects kilo meters away, yet under water it only really works for 100 meteres or something. It works the same, it's just visibility under water is limited even with incredible light for some reason.
private _reflector = createVehicleLocal [ "#lightreflector", [0,0,0], [], 0, "CAN_COLLIDE" ];
_reflector attachTo [ player, [0.0, 0.15, 0.15], "Head", true ];
_reflector setLightColor [1, 1, 1];
_reflector setLightAmbient [1, 1, 1];
_reflector setLightIntensity 5000;
_reflector setLightConePars [60, 10, 1];
_reflector setLightDayLight true;
_reflector setLightVolumeShape ["a3\data_f\VolumeLightFlashlight.p3d", [1, 1, 1]];
_reflector setLightAttenuation [6, 0, 0, 4.31918e-005];
_reflector setVectorDirAndUp [ [-0.35,1,0.2],[0,0,1] ];
reflector = _reflector;
wow Awsome m8 holy
Can see using camera from sky that entire terrain under water is lit, but once under water visiblity is limited regardless
copy that thx m8
In fact can see water being lit from above, ground only if close enough
i see: Awsome stuff
man you are really on that good wow
that really looks like it will work Awsome m8
thx so much
Does anyone know why my addon builder packages an empty PBO? I've been having this problem for about 5 days; it returns a message saying it was packaged, but when I open the PBO it's empty, only containing a "config.bin" file.
What are you packaging?
Addon builder by default won't copy in many file types.
Including SQF, amusingly.
This is a sound mod for my Altislife server and another for configurations.
Well, you see in options there's "list of files to copy directly"...
If a file isn't in that list and isn't something that gets binarized then it won't be included in the addon.
I don't know what gets binarized aside from config.cpp.
of corse it all should be in the same folder right or
Subfolders should work.
I forget what happens if you untick binarize.
Maybe then it still automatically includes files that would have been binarized.
Maybe using setAperture command can make it a bit brighter
ok cool i'll look into that thx
I doubt that, it's not light problem. Visibility under water is limited artificially
It's like a fog
lol fog of war lol
@tough abyss Whats it about?
I made a trigger for a MP Mission to create a few interactions for some objects when a player reaches a town, and it works mostly fine on a local server, but when I tested it on the actual server, it create the interactions twice. Anyone has any ideas why? I keep getting my wires crossed with the whole local vs global execution
Trigger has an any player present condition:
["scripts\investigationStart.sqf"] remoteExec ["execVM"];
The Sqf uses BIS_fnc_holdActionAdd to create the interactions
[ // Crashed Helo
objWreck,
"Recover Black Box",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_search_ca.paa",
"_this distance _target < 10",
"_caller distance _target < 10",
{},
{},
{
taskGasCounter = taskGasCounter + 1;
publicVariable "taskGasCounter";
["Intel added!"] remoteExec ["hint"];
[
"task1",
[
"Search the town for survivors and clues to what happened.",
format ["Investigate GRIMM: %1/4", taskGasCounter],
"mkrGrimm"
]
] remoteExec ["BIS_fnc_taskSetDescription"];
[
player,
[
"intelGrimm",
[
"Black Box",
"The helicopter was shot down from an unknown location. The crew didn't survive the landing."
]
]
] remoteExec ["createDiaryRecord", 0];
if (taskGasCounter >= 4) then { ["scripts\investigationEnd.sqf"] remoteExec ["execVM"]; }
},
{},
[],
10,
300,
true,
false
] call BIS_fnc_holdActionAdd;
It only duplicated the interaction on the object when I wasn't the host
You want to look into targets parameter of remoteExec
https://community.bistudio.com/wiki/remoteExec
right now you globally execute that on every machine including the server
guess that's the reason (without seeing the rest of the code).
That's basically all really, just repeat the function call for another 3 objects lol
So, should I exclude the server to stop it from duplicating it?
Got it, I'll try it, thanks
Good evening. Got what may be an easy question. I'm working on a course of fire with pop up targets, but I'm having trouble getting a script or code together that reads all my targets are down and changes the state of my task to succeeded.
nearestObjects?
I have the targets in an array, so how do I get a trigger or task to read them in their down animation? Or would I need to set the down animation as a variable and use getVariable?
Not quite sure how to utilize them. I understand how to use the animateSource ["terc", 1] to get the popup targets to lay down as soon as I jump into mission from the editor. Does animationState work as returning the value of the state the targets are currently in?
That can do it
is it possible to pre-made path for ai helicopter, so it would copy the things that player did before 1:1?
i mean like imagine: you "write" smhw all your button pushes, so the bot heli pilot would copy moves from file in the scenario, just which u did while "writing"
https://community.bistudio.com/wiki/BIS_fnc_unitCapture
It's not possible to record and playback inputs, but it is possible to record and playback positions, which for helicopters can get you close enough if you don't look too closely at the movement of the flight controls.
thanks, ill try
Here is what I am trying out, but it keeps kicking a generic error at _state == 1
missionNamespace setVariable ["noPop", true];
private _target = [target1];
_state = animationState target1;
waitUntil {_target findIf {_state == 1}}; {titleText ["Succeeded", "PLAIN"]};
I'm using a single target to start small, but want the array to be able to expand if needed and the title text as a place holder for setTaskState
animationState
Returns the name of a unit's current primary animation.
-> Return Value:String
And find if -> code: Code - code defining an element to find, processed element can be referenced within the code as _x
And you can check waituntil it find unit from array of units with correct animation state.
It returns -1 if nothing is found.
What you want get from unit? correct animation? or something else?
@proven osprey βοΈ π
if you want check xx units state is xx state ,
private _units = [target1, target2,target3];
private _animationState = "amovpercmstpsraswrfldnon"; //just for example from wiki
waitUntil {sleep 1; _units findIf {animationState _x == _animationState} != -1;}
titleText ["Succeeded", "PLAIN"];
I need to get the correct animation, which for the popup targets is "terc" 1. the laying down position after getting hit
@stable dune Thanks, ill play around with that and see what happens, but probably wont get back to it till much later.
sourcePhase is defined in config, animPhase is defined in the model.cfg
2 things. Can I get metadata of sounds, and 2, selectRandom would select ANYTHING in the array, right?
playSound3D [getMissionPath (selectRandom _RCHT_Christmas_Music),(missionNamespace getVariable _this)];
- Yes
What do you mean by the "metadata"
I.e. just what are you trying to get
Also are you prefixing a local variable for some reason?
was curious for potentially displaying song names. Wondered if I could get it from the file's metadata x3
And- what about a local variable?
You can read them from CfgMusic
Nothing wrong with local variable. It's just rare to see them prefixed. Global variables should be prefixed by TAG, but there is no need to do that with local ones.
Could anyone write me a simple script that would place a line of explosives (maybe satchel charges as example) from 40m to 200m in front of a player-controlled vehicle?
Either all detonated together by player useraction, or set-off immediately as they are spawned/placed.
VEH --- 40m --- EXP - 20m - EXP - 20m - EXP - 20m - EXP .... to 200m
40m in front of vehicle on the ground is just _vehicle getPos [40, direction _vehicle]
Forgot to mention, it needs to work in MP. I'm just horrible at scripting, so don't want to put it together myself. π
private _unit = player;
private _vehicle = vehicle _unit;
for "_i" from 40 to 200 step 20 do {
private _pos = _vehicle getPos [_i, getDir _vehicle];
_pos set [2, 0];
private _bomb = createVehicle ["DemoCharge_Remote_Ammo", _pos, [], 0, "CAN_COLLIDE"];
_unit addOwnedMine _bomb;
};
satchel class: SatchelCharge_Remote_Ammo
Oh that's amazing, thanks so much! I'll try it out straight away.
_unit addOwnedMine _bomb; => triggerAmmo _bomb; for instant explosion
_unit addOwnedMine _bomb; => _bomb spawn {sleep 5; triggerAmmo _this}; for delayed for 5 seconds
That's so cool, works beautifully. Thanks again. π
Hmm, I wonder what the locality of addOwnedMine is
I guess only one unit can own each mine, so it might be GA/GE.
I would infer server-only? Pretty sure the game only network updates entities based on type and distance, so a player-local client that has moved away might not even have accurate enough entity info to ensure triggering. Then again there is nothing that says the server can't trigger the mine directly even if not local.
I am trying to spawn camo net over vehicle, everything ok but its 1 meter above the ground. How to make it to touch the ground ?
private _rveh = selectRandom
[
"I_Truck_02_ammo_F",
"I_Truck_02_fuel_F",
"I_Truck_02_medical_F",
"I_Truck_02_box_F"
];
private _obj = createVehicle [_rveh, uberPos, [], 40, "NONE"];
private _camo = createVehicle ["CamoNet_INDP_big_F", _obj, [], 0, "CAN_COLLIDE"];
To count position one meter downwards:
getPosATL _obj vectorAdd [0,0,-1]
I don't understand why it's one meter above the ground though. It supposed to get spawned by default on the ground, if height above ground is zero.
yeah, but probably it spawns at the level of the model center of the vehicles ... π€·
It's supposed to use PositionAGL, when you provide object as position
"NONE" tends to spawn vehicles slightly above the ground IIRC.
So then when you create the camo net using that position it's also above ground.
the camo net is above the ground, not the vehicle
Yes, but the vehicle was at that point.
Vehicle is physically accelerated and falls on the ground
You're creating the camo net where the vehicle spawned, not where it ends up.
Then it would place camo net correctly if he just set height to 0 above ground
If you have a hardcoded position then it'd make sense to just use that for both objects with CAN_COLLIDE.
maybe if place the camo net then the vehicle ?
Assuming that the position has Z=0.
position is not hard coded
What's it from?
its everywhere but in players base
uberPos = [KIB_centerMapPos, 0, 4000, 0, 0, 0.3, 0, ["player_base"], []] call BIS_fnc_findSafePos;
No nearest-object checking so I guess you do need to use NONE on the vehicle.
Could just wait for the thing to drop and then place the camo net.
Anyone know how to make flyInHeight work for values >10 meters?
I thought it was low values that were broken.
Anything greater than 10 and the heli hovers up to like 50
Oh, you mean <50
Yeah
That's Arma Ai π€
yes, this could be ... testing immediately
nope ... still the same π€
try:
_object setPosATL [getPos _object # 0, getPos _object # 1, 0];
_object setVectorUp surfaceNormal position _object;
@queen cargo Besides using commands like doStop - you could try setting the AI group to Danger mode - this will break the AI's will to maintain formation, but you have the obvious downsides of them going prone, etc. I guess maybe you can combine that with the 1.56 (near future) disableAI "COVER" feature....but this would be a long shot tbh
tripod mod + bulge mod? 
doing both already @thin pine ... sadly .. the result still is not looking promising
Care to share what your need for it is? π
compiled sources are not available yet
but i could provide it
((updated just now))
I was more on about like....English wise. My C knowledge is in rookie stage and reading all this source code to find out what the goal is would take forever, haha π
Naw I was more like - are you trying to make AIs breach buildings separately or something? Like why do you need them to break formation I wonder
that what you see there is basically the source of an Insurgency like mission
--> AI spawns dynamically in buildings and is supposed to either stay there or seek for the player
when they are trying to maintain formation ... then they always try to re-formate
causing em to move out and clunch up ...
If AIs are in buildings and they have the doStop order - they won't regroup into formation AS long as the leader's behaviour is COMBAT
and I'm assuming that ain't working?
its more that they stay stationary ...
all the time
never seeking for the player
even if they know his position
doMove ain't working huh?
would work
but it would require me to have specific AI behaviour ocmpletly scripted into
which is not intentional
Oh like that, I get it. You're trying to invoke the default AI behaviour
A question; are they entirely stationary? e.g. not even moving to cover?
yup
@crude barn Hay can you explain more about when this is happening: and what's going on in the mission: cuz i can make a chopper Hover at 2.1m or 1.8m, if you can explain the situation: im sure i can help you
how about; after they detect danger, make the unit doMove to his own position and then make sure he's in combat mode (if not already)
according to doMove wiki; After reaching his destination, the unit will immediately return to formation (if in a group);
That may break the 'doStop' order
But it'll be difficult to achieve what you want if you're not separating the groups...goodluck though π - that is, if my suggestion doesn't work
@thin fox works perfectly, thank you π»
does anyone know how to place more than 250+ units?
According to the BI wiki, apparently its a known bug: https://community.bistudio.com/wiki/flyInHeight
β- when altitude is greater or equal 10, collision avoidance will maintain priority and the rotary airframe stays around 20~35 meters ATL, depending on nearby objects.
- when altitude is lower then 10, for example, 9.99999, it seems that collision avoidance is disabled and the airframe will maintain the desired ATL.β
What exactly is wrong in this script because I can not understand what the ingame warning is pointing at
`_triggerActivated = _this select 0;
if !(player in (list _triggerActivated)) then
{
exitWith {};
};
playSoundWarning = true;
sleep 7;
if (player in (list _triggerActivated)) then
{
player setDamage 1:
};`
It tells me it's at line 4, "Error Missing ;"
even though I already have that after my exitWith and the if statement
exitWith requires the if condition on the left
I don't know, but are keeping them in individual groups? There is a group limit per side.
ok
player setDamage 1: to player setDamage 1;
oh damn, thank you
ok but that still don't explain to me (what and when and where) you are trying to use the chopper
what did you want: for the chopper to achieve:
i have not seen any bug with a chopper in all my years
if you can tell me exactly what you want the chopper to Do: then i can help you m8
the only thing i'v seen is if you get to low: the Gear wants to come out like your landing
so in that case i use the Humming bird: cuz there's no gear on that chopper
Thanks once again! I was able to bring the system back to life and it's working very well now π And if the possible cheats appear again, I'll still have tricks in my sleeve π
okay, im trying to make a script where a unit when it takes damage and rather than it taking damage it is subtracted from a seperate variable pool. It's gonna be in the innit of the unit, which might also be a player, so what Im trying to do is this so far
this createVariable ["VamHealthStat", 100]; this addEventHandler ["HandleDamage" , { params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitPoint", "_instigator"]; createVariable ["VamHealthPre", VamHealthStat]; VamHealthStat = VamHealthStat - _damage; if (VamHealthStatPre > 0) then { setDamage this 0; VamHealthStat = VamHealthStatPre; } else { this sideChat "I can't take any more...";} }]
I can tell Im messing something up here but I can't see what
my head hurts
It's saying Im missing a ; but ik there's something else Im missing
createVariable doesn't exist? What are you even trying to do with it?
!sqf
```sqf
// your code here
hint "good!";
```
β turns into β
// your code here
hint "good!";
I smell Chat GPT
setDamage this 0; should be _unit setDamage 0;
Yes
I think you don't even need it at all here.
What should I be doin instead?
They do, they said they wanted a separate health pool variable
Yeah, so I can call on it for some other stuff, like the message I stuck in to make them aware of losing that extra health.
I am trying to some extent to replecate the "Tachanka" and "juggernaut" compositions, but only what I actually need from it.
and also, making it myself.
Yeah the first one, I was looking at the second.
this addEventHandler ["HandleDamage" , {
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitPoint", "_instigator"];
setVariable ["VamHealthPre", VamHealthStat];
VamHealthStat = VamHealthStat - _damage;
if (VamHealthStatPre > 0) then {
setDamage this 0;
VamHealthStat = VamHealthStatPre};
else {
this sideChat "I can't take any more...";}
}]```
This is what I have after fixing the set variable
VamHealthStat and VamHealthStatPre are never defined either.
If they're supposed to be per-vehicle vars then you'd need to read them with getVariable each time the EH runs.
Yeah that was the goal, but idk what I need to put to define them, I thought that's what setVariable did
It does but you never read the value.
You want something like:
private _health = _unit getVariable ["VamHealthStat", 100];
_health = _health - _damage;
if (_health > 0) then {
_unit setDamage 0;
_unit setVariable ["VamHealthStat", _health];
} else {
_unit sideChat "I can't take any more...";
};
Healh typo in line 1
so what is this doing
private _health = _unit getVariable
Is this EH for person or vehicle?
person
GetVariable checks the unit for the given variable (VamHealthStat in this case), and the array version lets you set a default if the value isn't defined
Also it looks like you're just putting this in a unit's init box, you want a if (!local this) exitWith {}; check before you do anything so it only is added where the unit is local and not once per machine
HandleDamage doesn't run on non-local anyway though.
True, but good habit
This is not gonna work well. I worked with it recetly, "HandleDamage" EH fires several times per hit. For total damaga and then for each damaged part(head,leg)
What's the actual intention here? Generally you want to return something in a HandleDamage, otherwise you get some undefined behaviour.
would the dammage EH be better?
Depends if you want to intercept the effects or add something on top.
HandleDamage you need to use if you want to block default damage responses.
intercept until the variable of vamHealthStat reaches 0
what I was attempting to do is when damge is sustained, remove that damage from the health stat, then reset the damage state to 0 until said health stat is 0 then damage is done normally.
basically yeah, as a seperate healthpool
Then return 0 until your var reaches 0
Note that unit will be immune to any sort of damage, so no injured body parts
the reason for this is the damage debuffs that happen like slowing.
this is what I am specifically trying to avoid.
otherwise I was going to divide the damage down alot, but that still caused damaged limbs.
Also returning 0 sets units damage/damage of part to 0, so you can even heal the unit using this EH, which is about damage π
Ok, so adjustment of Dart's code:
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitPoint", "_instigator"];
private _health = _unit getVariable ["VamHealthStat", 100];
_health = _health - _damage;
if (_health > 0) then {
_unit setVariable ["VamHealthStat", _health];
} else {
_unit removeEventHandler [_thisEvent, _thisEventHandler];
_unit sideChat "I can't take any more...";
};
0;
I assume you only want to print the chat once.
Yeah
Theoretically if they're at that point one or two shots is just gonna kill em as they're down to normal health.
so it might not matter as much
You might want to only reduce health if _selection == "" (general damage). Probably works ok either way just with different numbers.
It's still Arma-calculated damage not base weapon damage so it'll be affected by armour and location.
Other route is that you work from the projectile type.
so private _health is setting a variable of _health to 100, but atp what is the point of the name part of the getVariable? Is that extra or am I missing something.
The EH doesn't have direct access to your variable.
You have to read it from the unit, do the calculation on it and then write it back.
_health is just a temporary variable where we do the calculation.
_unit getVariable ["VamHealthStat", 100]; returns the variable from the unit if it exists, and 100 if it doesn't.
ahhh okay, so in the EH _health is a temporary variable, VamHealthStat is the variable outside of the EH?
So you don't need to set the variable before the loop.
Okay I see what you're saying I think
Variables set on objects are persistent. They don't go out of scope and get deleted like local variables.
_health is set to VamHealthStat, or 100 if VamHealthStat is not yet defined, then used for calculating in the EH, then VamHealthStat is updated to what _health is for following use
yes
You could use a global variable instead and then the code would be simpler, but that's pretty nasty and wouldn't extend well to multiple units.
would this have any issues if I were to have this assigned to a unit interacting with an object later?
Rn Im just setting it in the units init but.
As written you'd want to add the event handler to add the effect.
If it's something that's supposed to recharge then you'd want to tweak things a bit.
Theoretically with VamHealthStat I should be able to change that with another EH correct?
From anywhere
Can VamHealthState be called from other innits? I thought it was only per unit?
Other inits can technically access other units.
You'd just need a way of referencing the unit that wasn't this
It is per unit, but as long as you have any variable referencing the unit, you can then use it with getVariable/setVariable
Yeah I shouldn't, just had me worried for a sec, thought you were saying the VamHealthStat would be shared by every unit using it.
That code is logically a one-shot though. It adds the EH to create the shield and removes the EH when it returns to zero. Changing the value of VamHealthStat won't have an effect if the EH isn't running.
So in init you could do TAG_myUnit = this; and then you can use TAG_myUnit anywhere. For example
I see.
Each object has it's own variables
Does it not call on VamHealthStat when for _health? Would that not then be either 100 if VamHealthStat wasw not yet set, or whatever VamHealthStat is at the time of the EH?
Either the code needs to change, so EH does nothing when VamHealthStat is zero, but EH stays. Or add the EH again
does GetVariable work for private unit variables? I thought it was a HashMapObject thing
...what
Global, local, private doesn't matter
it doesn't?
that's why I was thinking dammage might be the better EH over handleDamage or whatever the other thing was using.
getVariable dates back to ancient Arma.
Not sure which one. I haven't been around for that long :P
so when it's called it instead sets damage to 0, and does nothing if VamHealthState is greater than 0
getVariable works on all the same
No, HandleDamage is the only one that intercepts, so it's ideal. You'd just need to write slightly more complex logic if you wanted a rechargeable shield rather than a one-shot.
not rechargable as in it recharges, just has a way to replenish yes.
Maybe I should get some other more basic scripts under my belt before tackling this lol.
That is weird and kind of defeats the purpose of what private is, but oh well woulda been useful to know in the week I spent on ARMA 3 scripting
If it won't do anything when VamHealthState is greater than zero, then unit will take damage. It needs to return number, which will be then applied to unit as damage
SQF is not OOP and private is not same thing as private in OOP
_number = 0;
if (true) then
{
private _number = 100; // new _number var is declared for this scope and it does not overwrite one from parent scope
};
This all private does int SQF
oh okay I get what you're saying, handleDamage just doesn't do damage unless you tell it to upon EH
Not returning anytihng may lead to weird behaviour
that would be alot lighter weight.
I mean, could just return 0 until VamHealthStat is 0 then return what the damage would have been right?
Im probably not but still
Yeah just return the _damage param then
I know about scope, the thing is GetVariable on wiki and no where else suggests you can get private variable from a different script
private var is local var
Huh, okay. Im taking a break for now, my head hurts. Im scared that I've kinda set my sights on making an actual mod that's way more complicated than just this when I feel I have the skills to start.
You can't access local var from different script
then why use _unit GetVariable?
get's the variable named from the unit for the EH to use I assume.
Do you have any other reference to _unit other than _unit?
There's my point, you have a reference to object, sounds like OOP to me
Object in this case is person, it's not object in context of OOP
Have you ever written an OOP language? :P
You can't create classes in this language
object in this case is just another script
You can't setVariable on a code object.
as in the litteral thing right
see this message
as I understand it getVariable is getting a seperate variable, not part of the unit, that is assigned to the unit for use by the EH right?
It's highly implied that you private variables are only local to the script in the Wiki, then you go on discord and somebody just tell you to get an object reference and call GetVariable on it
Now there are things called "logic objects" that exist largely to do setVariable/getVariable on without having too much overhead, but they're still things.
You must admit it's pretty jarring
Stuff like tress, houses, vehicles, people are all objects. We can assing variables to them using setVariable and read them using getVarible. But these variables are all public. Really they are just global variables, available only in certain namespace(object's namespace)
I mean, jarring like how one word might sound like another in another language, but mean something else entirely.
It might be the same sounds, but it's not the same thing, it's a different language.
It's only jarring because that word already means something for you.
Arma documentation overloads a lot of words even within Arma. Like "global" for both network-global and namespace-global.
the word global scares me, and client, because they use it for so many different things.
Probably just a me thing but still.
This sort of linguistic conflict is never really addressed. You just gotta read enough shit to figure it out for yourself.
I'm quite happy to see we're getting something much better new Arma titles
Im just worried we're not gonna be seeing as much stuff that transforms the game in a major way as we do in Arma 3, though that might just be for now with Reforger.
Things are gonna improve and Reforger is just tech demo for it. Before Arma 4 comes out
I just hope we can do bigger (litterally) stuff with 4. Big ol vehicles were always a want for me in Arma 3.
I'd rather we could do a bit less but it all works.
but what's probably gonna happen is less stuff that still doesn't work :P
My dream of character creation, and dice rolling, in arma 3 will become reality mark my words.
So is there a difference between
private _myVar = "blah";
this SetVariable("myVar", "blah", false);
tbf Arma 3 was super thin on modifiable character stats.
_myVar would be temporary right?
Like we wanted to do more with roles in Antistasi but there just isn't much there.
if this runs in init field, then _myVar is local var for that init field
Also your setVariable syntax is wrong, needs [] not () on the right-hand params.
so it will die after init? setVariable is the proper way to couple data with object?
yeah, as soon as that code scope ends, the variables disappear into the void.
the goal was originally to have a layer over top when I had soemone helping me, create a character with stats, roll dice, and other things, then build off that. Essentially it would have been two forms of combat where in normal gameplay you had abilities and other things, and in "scene" it was a more traditional kind TTRPG style. It actually was working too, but then he just disappeared.
rather than forcing more in, it was connecting two layers where we could, what little we had done people ate up.
You can see my confusion, I thought there was no way to couple data with objects without using a HashMapObject
Now myVar = "blah"; will persist, but it's unrelated to the object. It's equivalent to missionNamespace setVariable ["myVar", "blah", false];
this I did know
I thought same for a long time 
HashMapObjects are just a language thing. They're not directly related to real A3 objects either.
I wish Variables section on wiki mentions GetVariable and SetVariable but it does not
More like a chunk of data+code that you're passing around.
I understand this too
I some older code I still have array of hashmaps with groups and some related variables. Had no idea I could add these vars directly do the groups π
Small one: you have a _bigArray that contains 5 elements. You want a _smallArray that contains only the Nth first elements of _bigArray (let's say the 3 first ones). How to do it short&clean?
thanks, I forgot this select form.
There are a lot of them :P
true.
I was about to suggest to hard copy the array and then resize, but select is most likely better π
Well yes, you can do substring exactly the same way... who would have thought, that select can do substrings
yeah, sometimes you remember the function for one or two convenient use-cases, but forget about the ones you don't use very often.
oh good at least some other people forget: just like me: thx m8 π
I've met little to no people that know how to script in SQF without looking at wiki / google
The most remarkable guy is an Ukranian guy named Demellion, he is out of Arma but the guy was brilliant, his Arma 3 playtime is around 18000 hours
But let's be honest, that's just the people I get to get around with, on this channel you will find plenty of smart people
I don't think there's a programmer in the world who never looks up anything.
Yeah facts, you always have to look up things
Good day. Is there a way to delete custom player waypoint via script? π€
The one created by 'shift+LMB' on the map
can someone help me download KP liberation
There is not.
You can turn it off in the difficulty settings (must be done by the server, can't be changed by the mission) or use example 4 from https://community.bistudio.com/wiki/onMapSingleClick to block its creation (assuming nothing else wants to use onMapSingleClick), but there are no commands to directly manipulate it.
That's a pity, but thank you for answering π
Greetings.
I've been trying to do a Zero Gravity Script.
I've achieved to move the player in space relative to it's ModelSpace, I also have momentum, to imitate a vacum.
But I have a problem, because I use setVelocityModelSpace, when the player move the camera, the velocity with it.
Honestly I don't know how to resolve this.
I still wish to take into account the players view to move the player relative to it's view. But when the player doesn't increase it's velocity, I just want it to continue regardless of the players orientation.
There is the code :
player setPosATL ([0,0,10] vectorAdd (getPosATL player));
player setVariable ["ar_velocity", [0,0,0], true];
[{
params ["_args"];
_args params ["_unit", "_lastRun","_velocityUnit","_accUnit"];
private _delta = cba_missionTime - _lastRun;
private _velocityUnit = _unit getVariable ["ar_velocity",[0,0,0]];
_velocityUnit params ["_vX","_vY","_vZ"];
private _unitMass = getMass _unit;
if(inputAction "TurnRight" > 0 )then{_vX = _vX + 5 * _delta};
if(inputAction "TurnLeft" > 0)then{_vX = _vX - 5 * _delta};
if(inputAction "MoveForward" > 0)then{_vY = _vY + 5 * _delta};
if(inputAction "MoveBack" > 0 )then{_vY = _vY - 5 * _delta};
if(inputAction "HeliCollectiveRaise" > 0)then{_vZ = _vZ + 5 * _delta};
if(inputAction "HeliCollectiveLower" > 0 )then{_vZ = _vZ - 5 * _delta};
private _force = [_vX, _vY, (_unitMass * _delta * 9.8) + _vZ];
systemChat str _force;
_unit setVelocityModelSpace _force;
_unit playMove "asdvpercmstpsnonwrfldnon";
_unit setVariable ["ar_velocity",[_vX,_vY,_vZ],true];
_args set [1, cba_missionTime];
}, 0, [player, cba_missionTime]] call CBA_fnc_addPerFrameHandler;
There is a shortclip of the issue (I can't post directly on discord, the file is too big)
https://www.youtube.com/watch?v=1tt4b7MVkuk
What about setVelocity? https://community.bistudio.com/wiki/setVelocity
I've used setVelocity, the problem with it is that it only moving on the x and y axis not relative to the player. If I go left while i'm facing south for exemple. Then from my perspective I will go right
Or setVectorDirAndUp https://community.bistudio.com/wiki/setVectorDirAndUp
Yeah, you need to do the conversion math with it
Yup that's where i'm stuck.
aaahhh i thought that was it. Sadly vectorModelToWorldVisual do the exact same things as setVelocityModelSpace. I think I'll have to learn Vector Math again....
I think you can use setVelocity that utilizes the return value from vectorModelToWorldVisual.
So essentially you can do the initial (relative) calculation in the model space, then convert it to world space with the vectorModelToWorldVisual and apply the result with setVelocity
(If I got it right but it's something like that anyways) π
So I need to redo my Calculation to make it relative to the player.
I think you're already doing that
Because if I understand my own code It's doing it relative to the world no ?
I think the use of setVelocityModelSpace actually makes it model space
(Kinda what the name of the command implies) π
player setPosATL ([0,0,10] vectorAdd (getPosATL player));
player setVariable ["ar_velocity", [0,0,0], true];
[{
params ["_args"];
_args params ["_unit", "_lastRun","_velocityUnit","_accUnit"];
private _delta = cba_missionTime - _lastRun;
private _velocityUnit = _unit getVariable ["ar_velocity",[0,0,0]];
_velocityUnit params ["_vX","_vY","_vZ"];
private _unitMass = getMass _unit;
if(inputAction "TurnRight" > 0 )then{_vX = _vX + 5 * _delta};
if(inputAction "TurnLeft" > 0)then{_vX = _vX - 5 * _delta};
if(inputAction "MoveForward" > 0)then{_vY = _vY + 5 * _delta};
if(inputAction "MoveBack" > 0 )then{_vY = _vY - 5 * _delta};
if(inputAction "HeliCollectiveRaise" > 0)then{_vZ = _vZ + 5 * _delta};
if(inputAction "HeliCollectiveLower" > 0 )then{_vZ = _vZ - 5 * _delta};
private _force = [_vX, _vY, (_unitMass * _delta * 9.8) + _vZ];
systemChat str _force;
_force = vectorModelToWorldVisual _force;
_unit setVelocity _force;
_unit playMove "asdvpercmstpsnonwrfldnon";
_unit setVariable ["ar_velocity",[_vX,_vY,_vZ],true];
_args set [1, cba_missionTime];
}, 0, [player, cba_missionTime]] call CBA_fnc_addPerFrameHandler;
``` Try this
I've tried this. it's exactly what setVelocityModelSpace is doing. I think it use vectorModelToWorldVisual under the hood.
Did you use vectorModelToWorldVisual or vectorWorldToModelVisual? (Just to make sure)
vectorModelToWorldVisual
If i use vectorWorldToModelVisual with setVelocity it inverts it by 90Β°. That's funny xD
I wonder why it takes the camera rotation into account when there's nothing about it in the script
Actually wait
I think it's something like this that happens. (Sorry for the really bad drawing)
The problem is that it does't take into account the orientation of the player so when I press W to go forward, it goes forward on the Y Axis (The red one) while I look at the east of the map)
What if I calculate a vector relative to the player but add it to a vector relative to the world ?
Actually, you could start with the initial value of [0, 0, 0] and then do the calculations with delta from that value. So e.g. if character has turned 45Β° to the right from the starting value, you calculate the delta between that and the starting value, and then apply the force... I think? (Should open editor to test these π )
Yes, just like that
So keep the final vector value in world space the same when player is not applying any force. For this you need to calculate the "delta" between camera/model space and world space on every frame
or maybe I can do that the "bad way" get the angle of the player and change the signs of the calculation depending on the angle. It's going to be a big code and a bit dirty to do that, but could work.
As a rule of thumb, the world space vector should change only when player applies a force
I think I get what you are saying. The thing is, how could this be done ? i'll have to calculate the force in each condition.
what's the problem with vectoModelToWorldVisual?
oh is it cause velocity is kept from all the inputs?
so you do arcs with the character movement
player setPosATL ([0,0,10] vectorAdd (getPosATL player));
player setVariable ["ar_velocity", [0,0,0], true];
[{
params ["_args"];
_args params ["_unit", "_lastRun","_velocityUnit","_accUnit"];
private _delta = cba_missionTime - _lastRun;
private _velocityUnit = _unit getVariable ["ar_velocity",[0,0,0]];
_velocityUnit params ["_vX","_vY","_vZ"];
private _unitMass = getMass _unit;
if(inputAction "TurnRight" > 0 )then{_vX = _vX + 5 * _delta};
if(inputAction "TurnLeft" > 0)then{_vX = _vX - 5 * _delta};
if(inputAction "MoveForward" > 0)then{_vY = _vY + 5 * _delta};
if(inputAction "MoveBack" > 0 )then{_vY = _vY - 5 * _delta};
if(inputAction "HeliCollectiveRaise" > 0)then{_vZ = _vZ + 5 * _delta};
if(inputAction "HeliCollectiveLower" > 0 )then{_vZ = _vZ - 5 * _delta};
private _force = [_vX, _vY, (_unitMass * _delta * 9.8) + _vZ];
systemChat str _force;
_force = vectorModelToWorldVisual _force;
_unit setVelocity _force;
_unit playMove "asdvpercmstpsnonwrfldnon";
_unit setVariable ["ar_velocity",[_vX,_vY,_vZ],true];
_args set [1, cba_missionTime];
}, 0, [player, cba_missionTime]] call CBA_fnc_addPerFrameHandler;
Did you try this?
Yes, you already gave me that code. It's doing the same as setVelocityModelSpace. ^^
Ok, just wanted to make sure π
Lets say I look north and go forward.
I have a velocity that's positive (relative to me and the world, because I look north)
But the second I look south my velocity is inversed (Without changing the velocity) now I go forward but south. Because relative to the player the velocity hasn't changed
If I go at a velocity of 10m/s
If I look north, relative to the world I go [0,10,0]
If I look south, relative to the world I go [0,-10,0]
While relative to the player I always go [0,10,0] whatever the orientation
Just by looking in a different direction the velocity relative to the world changes.
you should be converting the vector delta's to visual world space and adding them instead of converting _force back to world visual space every frame, velocity should not be converted in frames and stay in world space
I don't think I understand. I shouldn't convert in the PerFrameHandler ?
_force = vectorModelToWorldVisual _force;
_unit setVelocity _force;
This is a problem in the loop, you are transforming your velocity on every frame back into camera space
if(inputAction "TurnRight" > 0 )then{_vX = _vX + 5 * _delta};
if(inputAction "TurnLeft" > 0)then{_vX = _vX - 5 * _delta};
if(inputAction "MoveForward" > 0)then{_vY = _vY + 5 * _delta};
if(inputAction "MoveBack" > 0 )then{_vY = _vY - 5 * _delta};
if(inputAction "HeliCollectiveRaise" > 0)then{_vZ = _vZ + 5 * _delta};
if(inputAction "HeliCollectiveLower" > 0 )then{_vZ = _vZ - 5 * _delta};
You want to convert the vector additions here to visual world space, instead of transforming the entirety of _force
Ah, yes! Would've taken some time for me to figure it out π
you can continue setVelocity _force but do not do any transforms on it, it stays completely in world space the entire time inherently
player setPosATL ([0,0,10] vectorAdd (getPosATL player));
player setVariable ["ar_velocity", [0,0,0], true];
[{
params ["_args"];
_args params ["_unit", "_lastRun","_velocityUnit","_accUnit"];
private _delta = cba_missionTime - _lastRun;
private _velocityUnit = _unit getVariable ["ar_velocity",[0,0,0]];
_velocityUnit params ["_vX","_vY","_vZ"];
private _unitMass = getMass _unit;
private _xDir = [1, 0, 0];
private _yDir = [0, 1, 0];
private _zDir = [0, 0, 1];
if(inputAction "TurnRight" > 0 )then{_vX = _vX + (5 * _delta * _xDir)};
if(inputAction "TurnLeft" > 0)then{_vX = _vX - (5 * _delta * _xDir)};
if(inputAction "MoveForward" > 0)then{_vY = _vY + (5 * _delta * _yDir)};
if(inputAction "MoveBack" > 0 )then{_vY = _vY - (5 * _delta * _yDir)};
if(inputAction "HeliCollectiveRaise" > 0)then{_vZ = _vZ + (5 * _delta * _zDir)};
if(inputAction "HeliCollectiveLower" > 0 )then{_vZ = _vZ - (5 * _delta * _zDir)};
private _force = [_vX, _vY, (_unitMass * _delta * 9.8) + _vZ];
// all additions on force are already in world space
systemChat str _force;
// _force = vectorModelToWorldVisual _force; removed, never transform
_unit setVelocity _force;
_unit playMove "asdvpercmstpsnonwrfldnon";
_unit setVariable ["ar_velocity",[_vX,_vY,_vZ],true];
_args set [1, cba_missionTime];
}, 0, [player, cba_missionTime]] call CBA_fnc_addPerFrameHandler;
not correct yet need visual space
Why try to multiply a single value with a vector ?
_delta in this context is the deltaTime.
I think my lack of understanding comes from that. Because for me the delta was the deltaTime and not a difference between vector.
We need the visual transform for the increment, but I have confused myself atm
@dark viper Would this work too?
player setPosATL ([0,0,10] vectorAdd (getPosATL player));
player setVariable ["ar_velocity", [0,0,0], true];
[{
params ["_args"];
_args params ["_unit", "_lastRun","_velocityUnit","_accUnit"];
private _delta = cba_missionTime - _lastRun;
private _velocityUnitDelta = [0, 0, 0];
_velocityUnitDelta params ["_vX","_vY","_vZ"];
private _unitMass = getMass _unit;
if(inputAction "TurnRight" > 0 )then{_vX = _vX + 5 * _delta;};
if(inputAction "TurnLeft" > 0)then{_vX = _vX - 5 * _delta};
if(inputAction "MoveForward" > 0)then{_vY = _vY + 5 * _delta};
if(inputAction "MoveBack" > 0 )then{_vY = _vY - 5 * _delta};
if(inputAction "HeliCollectiveRaise" > 0)then{_vZ = _vZ + 5 * _delta};
if(inputAction "HeliCollectiveLower" > 0 )then{_vZ = _vZ - 5 * _delta};
private _velocityDelta = [_vX, _vY, (_unitMass * _delta * 9.8) + _vZ];
_transformedVelocityDelta = modelToWorld _velocityDelta;
_oldVelocity = player getVariable ["ar_velocity"];
_newVelocity = _oldVelocity vectoradd _transformedVelocityDelta;
_unit setVelocity _newVelocity;
systemChat str _force;
_unit playMove "asdvpercmstpsnonwrfldnon";
_unit setVariable ["ar_velocity",_newVelocity,true];
_args set [1, cba_missionTime];
}, 0, [player, cba_missionTime]] call CBA_fnc_addPerFrameHandler;
(Edited the script like 10 times, so test with the current version just to make sure) π
Just tried this code. I think the velocities are a bit high π .
I don't think it would work
you need to reset _vX, _vY, _vZ to 0 between frames if you want to add it like that
I'm doing that I think?
What does _delta = cba_missionTime - _lastRun; return (on average)?
whatever the frametime is
Yeah but like the actual value
private _velocityUnitDelta = [0, 0, 0];
_velocityUnitDelta params ["_vX","_vY","_vZ"];
vx, vy, vz stores the force and you load it into the delta every frame, so you actually add the force to itself 1/frametime times per second and it will be exponential
Don't they reset with the first line in your reply?
Listen imma be honest I'm straight winging it in this chat right now I haven't actually coded much ARMA 3, but no, you init the variable to [0, 0, 0] but you load the vx vy vz that is saved in to it, so not really
Oh sorry it's not the same code I used, I do the [0,0,0] outside the frameHandler
finally i realized why i am confused
we need vectorModelToWorldVisual
vectorModelToWorldVisual xDir // yDir // zDir
player setPosATL ([0,0,10] vectorAdd (getPosATL player));
player setVariable ["ar_velocity", [0,0,0], true];
[{
params ["_args"];
_args params ["_unit", "_lastRun","_velocityUnit","_accUnit"];
private _delta = cba_missionTime - _lastRun;
private _velocityUnitDelta = [0, 0, 0];
private _vX = 0;
private _vY = 0;
private _vZ = 0;
private _unitMass = getMass _unit;
if(inputAction "TurnRight" > 0 )then{_vX = _vX + 5 * _delta;};
if(inputAction "TurnLeft" > 0)then{_vX = _vX - 5 * _delta};
if(inputAction "MoveForward" > 0)then{_vY = _vY + 5 * _delta};
if(inputAction "MoveBack" > 0 )then{_vY = _vY - 5 * _delta};
if(inputAction "HeliCollectiveRaise" > 0)then{_vZ = _vZ + 5 * _delta};
if(inputAction "HeliCollectiveLower" > 0 )then{_vZ = _vZ - 5 * _delta};
private _velocityDelta = [_vX, _vY, (_unitMass * _delta * 9.8) + _vZ];
_transformedVelocityDelta = vectorModelToWorld _velocityDelta;
_oldVelocity = player getVariable ["ar_velocity"];
_newVelocity = _oldVelocity vectoradd _transformedVelocityDelta;
_unit setVelocity _newVelocity;
systemChat str _force;
_unit playMove "asdvpercmstpsnonwrfldnon";
_unit setVariable ["ar_velocity",_newVelocity,true];
_args set [1, cba_missionTime];
}, 0, [player, cba_missionTime]] call CBA_fnc_addPerFrameHandler;
Better now?
player setPosATL ([0,0,10] vectorAdd (getPosATL player));
player setVariable ["ar_velocity", [0,0,0], true];
[{
params ["_args"];
_args params ["_unit", "_lastRun","_velocityUnit","_accUnit"];
private _delta = cba_missionTime - _lastRun;
private _velocityUnit = _unit getVariable ["ar_velocity",[0,0,0]];
_velocityUnit params ["_vX","_vY","_vZ"];
private _unitMass = getMass _unit;
private _forwardDir = getCameraViewDirection _unit;
private _upDir = vectorUp _unit;
private _rightDir = _forwardDir vectorCrossProduct _upDir;
private _resultVec = [0, 0, 0];
private _speedScale = 5 * _delta;
_resultVec = _resultVec + (inputAction "TurnRight") * _speedScale * _rightDir;
_resultVec = _resultVec + -(inputAction "TurnLeft") * _speedScale * _rightDir;
_resultVec = _resultVec + (inputAction "MoveForward") * _speedScale * _forwardDir;
_resultVec = _resultVec + -(inputAction "MoveBackward") * _speedScale * _forwardDir;
_resultVec = _resultVec + (inputAction "HeliCollectiveRaise") * _speedScale * _upDir;
_resultVec = _resultVec + - (inputAction "HeliCollectiveLower") * _speedScale * _upDir;
systemChat str _force;
_unit setVelocity _resultVec + _unit velocity; //maybe
_unit playMove "asdvpercmstpsnonwrfldnon";
_unit setVariable ["ar_velocity", (_unit velocity),true];
_args set [1, cba_missionTime];
}, 0, [player, cba_missionTime]] call CBA_fnc_addPerFrameHandler;
Edited now, fixed a command. @dark viper I think vectorModelToWorldVisual expects object as argument
dunno what to give it, just whatever this object is should be fine right?
Just keep them as is (in the model space) and transform the resulting vector with vectorModelToWorld
we definitely the player object or whatever's model space
this is standard
yeah _unit was being used originally
How would I do the *_xDir ? You have define _xDir as a vector while _vX is a single value and not a vector.
BotSturmTruppen attack again? π
player setPosATL ([0,0,10] vectorAdd (getPosATL player));
player setVariable ["ar_velocity", [0,0,0], true];
[{
params ["_args"];
_args params ["_unit", "_lastRun","_velocityUnit","_accUnit"];
private _delta = cba_missionTime - _lastRun;
private _velocityUnit = velocity player;
private _velocityUnitDelta = [0, 0, 0];
private _vX = 0;
private _vY = 0;
private _vZ = 0;
private _unitMass = getMass _unit;
if(inputAction "TurnRight" > 0 )then{_vX = _vX + 5 * _delta;};
if(inputAction "TurnLeft" > 0)then{_vX = _vX - 5 * _delta};
if(inputAction "MoveForward" > 0)then{_vY = _vY + 5 * _delta};
if(inputAction "MoveBack" > 0 )then{_vY = _vY - 5 * _delta};
if(inputAction "HeliCollectiveRaise" > 0)then{_vZ = _vZ + 5 * _delta};
if(inputAction "HeliCollectiveLower" > 0 )then{_vZ = _vZ - 5 * _delta};
_velocityUnitDelta = [_vX, _vY, (_unitMass * _delta * 9.8) + _vZ];
_velocityUnit = _velocityUnit vectorAdd _velocityUnitDelta;
_velocityUnitWorldSpace = // do the conversion here
_unit setVelocity _velocityUnitWorldSpace;
systemChat str _velocityUnitWorldSpace;
_unit playMove "asdvpercmstpsnonwrfldnon";
_unit setVariable ["ar_velocity",_velocityUnitWorldSpace,true];
_args set [1, cba_missionTime];
}, 0, [player, cba_missionTime]] call CBA_fnc_addPerFrameHandler;
Better now?
In my script I don't know where it's defined at. It should really be a vector though, it was confusing me too much
Even if it's vector why would a multiplication by 1 change things ?
Oh maybe it behave like "mask" to change only the value needed ?
Like a mask is a decent way of thinking about it.
We need the orthonormal basis of the model, and each input is only responsible for 1 of the basis axis of movement
this might work
I think there's still a bug there, I'll give up and go test these in the editor π
saving everything in model space is convenient
Oh no I think you have the problem where your input will not be relative to the camera, aka tank controls
Yes, I'm trying to fix that but I haven't taken a course in linear algebra so I'm starting to get stuck here π
I had to come help you guys when you started talking about doing manual angle subtraction and additions to calculate the correct vectors
doing good for the world in ARMA discord
I have an array of various ground vehicles that can be loaded VIV, and a landing craft that can load vehicles.
I'm trying to parse down the list to vehicles that can, in this moment, be loaded.
Srd_Var_VehicleList select {(craftName canVehicleCargo _x) == [true,true]}
just throws a Type Array error.
Well I'll will take a look deeper a bit later in the day. I've been on this issues since this morning and I think I need a break xD.
Thanks to the both of you. Your help has been invaluable.
player setPosATL ([0,0,10] vectorAdd (getPosATL player));
player setVariable ["ar_velocity", [0,0,0], true];
[{
params ["_args"];
_args params ["_unit", "_lastRun","_velocityUnit","_accUnit"];
private _delta = cba_missionTime - _lastRun;
private _velocityUnit = velocity _unit;
private _velocityUnitDelta = [0, 0, 0];
private _vX = 0;
private _vY = 0;
private _vZ = 0;
private _unitMass = getMass _unit;
if(inputAction "TurnRight" > 0 )then{_vX = _vX + 5 * _delta;};
if(inputAction "TurnLeft" > 0)then{_vX = _vX - 5 * _delta};
if(inputAction "MoveForward" > 0)then{_vY = _vY + 5 * _delta};
if(inputAction "MoveBack" > 0 )then{_vY = _vY - 5 * _delta};
if(inputAction "HeliCollectiveRaise" > 0)then{_vZ = _vZ + 5 * _delta};
if(inputAction "HeliCollectiveLower" > 0 )then{_vZ = _vZ - 5 * _delta};
_velocityUnitDeltaModelSpace = [_vX, _vY, (_unitMass * _delta * 9.8) + _vZ];
_velocityUnitModelSpace = // Convert _velocityUnit from world space to model space here (with matrix multiplication I think?)
_velocityUnitModelSpace = _velocityUnitModelSpace + _velocityUnitDeltaModelSpace;
_velocityUnit = // Convert _velocityUnitModelSpace to world space here (matrix multiplication as well here)
_unit setVelocity _velocityUnit;
systemChat str _velocityUnit;
_unit playMove "asdvpercmstpsnonwrfldnon";
_unit setVariable ["ar_velocity",_velocityUnitWorldSpace,true];
_args set [1, cba_missionTime];
}, 0, [player, cba_missionTime]] call CBA_fnc_addPerFrameHandler;
How about now π
== cannot compare array. Use isEqualTo
Yup, just remembered that existed X_X
Now I just need to figure out why the 'fill with troops' section is picking one type and sticking with it.
Go, my knoble headed army!
I think this one was closest, just change private _velocityUnit = velocity _unit
do _velocityUnitDeltaWorldSpace = _unit vectorModelToWorldVisual _velocityUnitDeltaModelSpace;
_unit velocity is already in world space I think
Like this? ```sqf
player setPosATL ([0,0,10] vectorAdd (getPosATL player));
player setVariable ["ar_velocity", [0,0,0], true];
[{
params ["_args"];
_args params ["_unit", "_lastRun","_velocityUnit","_accUnit"];
private _delta = cba_missionTime - _lastRun;
private _velocityUnit = velocity _unit;
private _velocityUnitDelta = [0, 0, 0];
private _vX = 0;
private _vY = 0;
private _vZ = 0;
private _unitMass = getMass _unit;
if(inputAction "TurnRight" > 0 )then{_vX = _vX + 5 * _delta;};
if(inputAction "TurnLeft" > 0)then{_vX = _vX - 5 * _delta};
if(inputAction "MoveForward" > 0)then{_vY = _vY + 5 * _delta};
if(inputAction "MoveBack" > 0 )then{_vY = _vY - 5 * _delta};
if(inputAction "HeliCollectiveRaise" > 0)then{_vZ = _vZ + 5 * _delta};
if(inputAction "HeliCollectiveLower" > 0 )then{_vZ = _vZ - 5 * _delta};
_velocityUnitDeltaModelSpace = [_vX, _vY, (_unitMass * _delta * 9.8) + _vZ];
_velocityUnitDeltaWorldSpace = _unit vectorModelToWorldVisual _velocityUnitDeltaModelSpace;
_velocityUnit = _velocityUnit vectorAdd _velocityUnitDeltaWorldSpace;
_unit setVelocity _velocityUnit;
systemChat str _velocityUnit;
_unit playMove "asdvpercmstpsnonwrfldnon";
_unit setVariable ["ar_velocity",_velocityUnitWorldSpace,true];
_args set [1, cba_missionTime];
}, 0, [player, cba_missionTime]] call CBA_fnc_addPerFrameHandler;
It's almost working
this would be like in total:
_velocityUnitDelta // model space
// [ 0, 0, 0] default, input adds axial value
// W is orientation in world space for the unit
// V is rotation matrix (orientation for camera)
//
// transform would be V * _velocityUnitDelta // ModelToWorldVisual
// or W * _velocityUnitDelta // ModelToWorld
// over simplified because, _velocityUnitDelta starts as fresh orthonormal basis
// a single rotation can go to World or WorldVisual
// there would be concatenated inverses, depending on what's going on
// add one of
_unit SetVelocity _velocityUnit + ( W * _velocityUnitDelta) // _unit ModelToWorldVisual
Got it working, only the anti-gravitation force is not correct
if you mean the _vZ component, yes I know, I didn't know if the person wanted it to be world Z or camera Z
idk anything about the physics stuff of Arma
if(inputAction "HeliCollectiveRaise" > 0)then{_vZ = _vZ + 5 * _delta};
if(inputAction "HeliCollectiveLower" > 0 )then{_vZ = _vZ - 5 * _delta};
I thought you mean this part though
The problem not doing the relative transform on the input vectors is that, you can't mix model / world /visual inputs now. They all go through the one transformation together
Only the gravity counter is bugging out, otherwise it works
The exact script is this: ```sqf
player setPosATL ([0,0,10] vectorAdd (getPosATL player));
player setVariable ["ar_velocity", [0,0,0], true];
[{
params ["_args"];
_args params ["_unit", "_lastRun","_velocityUnit","_accUnit"];
private _delta = cba_missionTime - _lastRun;
private _velocityUnit = velocity _unit;
private _velocityUnitDelta = [0, 0, 0];
private _vX = 0;
private _vY = 0;
private _vZ = 0;
private _unitMass = getMass _unit;
if(inputAction "TurnRight" > 0 )then{_vX = _vX + 20 * _delta;};
if(inputAction "TurnLeft" > 0)then{_vX = _vX - 20 * _delta};
if(inputAction "MoveForward" > 0)then{_vY = _vY + 20 * _delta};
if(inputAction "MoveBack" > 0 )then{_vY = _vY - 20 * _delta};
if(inputAction "HeliCollectiveRaise" > 0)then{_vZ = _vZ + 50 * _delta};
if(inputAction "HeliCollectiveLower" > 0 )then{_vZ = _vZ - 5 * _delta};
_velocityUnitDeltaModelSpace = [_vX, _vY, (_unitMass * _delta * 9.8) + _vZ];
_velocityUnitDeltaWorldSpace = _unit vectorModelToWorldVisual _velocityUnitDeltaModelSpace;
_velocityUnit = _velocityUnit vectorAdd _velocityUnitDeltaWorldSpace;
_unit setVelocity _velocityUnit;
systemChat str _velocityUnit;
_unit playMove "asdvpercmstpsnonwrfldnon";
_unit setVariable ["ar_velocity",_velocityUnitWorldSpace,true];
_args set [1, cba_missionTime];
}, 0, [player, cba_missionTime]] call CBA_fnc_addPerFrameHandler;
``` Indeed, getMass returns 0 and it makes the anti-gravity fail
To add to misunderstanding, after research I believe ModelToWorldVisual is not related to the player camera transform
does anyone know why radioChannelAdd fails sometimes at mission start? it seems if called too early it fails and I tried radioChannelInfo to check if the channel is created/ready but nothing useful there
my code looks something like this:```sqf
waituntil {!isnull player};
waituntil { sleep 0.1; !isnil "kfChannelId" };
kfChannelId radioChannelAdd [player];
We should use
getDir camera
vectorDir camera
vectorUp camera
instead
this explains a lot of my confusion on why we were using the laborious WorldVisual transforms instead of accessing the camera orientations directly
Question about MP-sharing variables with getVariable/setVariable[].
Today I try to ensure that I do missionNamespace setVariable["VAR",val,true]; enough in advance to ensure that all clients can get the last value with a missionNamespace getVariable["VAR",default] but it is sometimes complex.
Is there any equivalent of missionNamespace getVariable["VAR",val,2]; to say 'ensure you get the value from the server before reading it' ?
I would like to "pull" vars instead of "push". Much convenient model.
and if you're curious the transform matrix operations would be
//InverseCameraTransform = (Camera Orientation inverse * Camera translation(position) inverse)
InverseCameraTransform * ModelToWorldTransform * object
// object to camera relative space
But we don't actually need that for anything we can apply everything directly in world space to everything, that's just rendering trivia
You would have to remote execute some code, which would then make server to publish the variable
How? remoteExecCall don't wait right?
maybe check nil ```sqf
waituntil { ! (missionNamespace isnil "VAR") };
BUt I don't know if NIL is the latest correct value or not.
I would like to know why playMusic fails sometimes on first use in mission
I have like boolean to know if I am in warmup, or mission already started.... so true or false are both acceptable... only the server knows which value is correct.
so you suggest to have one-time variable for all of them. Not perfect, but can work.
Remote exec to the server to publish variable and wait for change
again, how I know that I don't have to wait anymore on the cli machine?
Only the server who is my single source of trust knows that.
I think what @proven charm said is the correct solution to what you're asking. An example of this can be found here #arma3_scripting message
The idea is you're waiting until you've fetched the expected value(s) from server
yes, with one-shot variable only, this way you know that nil means unset...
because CLI know that NIL means not fetched.
client machines
Ah okay sorry wasn't following
Do you have a bunch of variables are you are setting at a time outside of one batched remoteExec?
I have a dedicated server, who drives the workflow and know in which stage we are currently etc.... then JIP and standards cli must read the right value....
like CURRENT_STAGE=3 needs to be propagated for example
CURRENT_STAGE=2 is also a valid value.
4 too.
Ah okay. So your method of transferring all of this data to client is via JIP?
not only, for everybody.
So globally for all clients in mission?
I mean, I would like on a client, to be able to pull a variable from the server, whenever it makes sens on whatever cli.
Despite wiki calling addPublicVariableEventHandler depracated, it look usefull in this case
https://community.bistudio.com/wiki/addPublicVariableEventHandler
to "pull" vars you have to use remoteExec + a promise model
you send something to the server via remoteExe with a unique ID for your message on your machine, the server sends a response, and you do something based on server's response + message ID
Makes sens.
timestamped or whatever transactionnal
No feature into the SQF by default to do it right?
it can just be an incremental number π€·ββοΈ
No feature into the SQF by default to do it right?
the ID?
the remoteExec is just:
//client
[data, id] remoteExecCall ["my_fnc_serverBlabla", 2];
// server
params ["_data", "_id"];
_res = _data call my_fnc_blabla;
[_res, _id] remoteExecCall ["my_fnc_clientBlabla", remoteExecutedOwner];
// client again
params ["_res", "_id"];
_request = requestHashmap get _id;
// ....
(the request can contain a callback for example)
as soon as it remains unique and identifiable, yes
That is what I was kinda trying to explain but perhaps I was poorly with the sandwhich code example I gave earlier here #arma3_scripting message. Especially for the case of client initialization in an MP mission, it can be super helpful to have all of that down to one remoteExec from server, as then you can combine network calls and also order specific variables or tasks.
because you know there are the two ways: even the server pushes values to cli, or better for asynchronous things, cli pull themselves from the server when they need.
if you only do one message at a time you don't even need an ID (e.g. in this case you're just doing staging but you only need 1 message)
Today I try to ensure that I do missionNamespace setVariable["VAR",val,true]; enough in advance to ensure that all clients can get the last value with a missionNamespace getVariable["VAR",default] but it is sometimes complex.
I don't see the point though? If you are having trouble with the client getting the value early "enough in advance" with the server pushing the values, I don't see how that solve the problem of them getting it in time with a pull model.
I don't get it. I have globalVars like [HAS_WARMUP_STARTED, HAS_MISSION_STARTED, CURRENT_MISSION] for example. Possibles values are [false,true,4]
The server pushes with broadcast flag into the setVariable[myArray]
It is buggy, sometimes cli don't do the right stuff and so on so I need a try catch to locally execute again the right stuff on cli when needed. To do it properly, I need a fresh copy of myArray from the server.
(to create the diary corresponding to the right mission etc...)
From the cli, I can have a wrong copy like [true,false,3]
I have no idea that these values are wrong on the cli.
in this case you don't need setVariable. the server can remoteExec a function on the client and send the data + what to do with it
in push model yes
If you remoteExec a function multiple times. Don't JIP clients execute just the last call?
BUT it is buggy
With 60+ cli there are always guys who do not execute it well.
this is why I implement the try-catch triggered on the cli
Having public variables for things like mission state isn't a bad way to go. I honestly prefer it over remoteExec & JIP. Having a singular file though that executes on client at start of mission is a good way you can make sure things are executing in the order you're intending and that you're batching network
It seems like you have separated your "transitions" from your data, if as you say the client has wrong data, but know they need to "transition" but are missing the right data from the server.
Many problems disappear when they are combined, into say CBA-style events or perhaps remoteExec with JIP
if the remoteExec JIP id is the same, yeah iirc
yes. So I can always do a remoteExecCall from the cli... that broacast again the variables from the server.... on the cli I do a fucking sleep 3; to ensure reasonably that the server had the time to send data... but looks crap.
If he remoteExecs function, which just changes variable, then I don't see why he couldn't just remoteExec it for JIP too and that just fixes the problem
JIP isn't bad but I do personally try to tend to stay away from it since I feel like it can be cumbersome to track JIP ID's and that the ordering can be kinda weird
That might be kind of a hot take tho
beacause you are in push model, and it is buggy again.
With dozens of client, there are always network issues
So for instance, it looks like you have an active "mission state" that can change. So you need relevant data to be attached to the transition (another name for event). So something like:
[["MISSION_STARTED", ["ALL", "RELEVANT", "DATA"]] remoteExecCall ["TAG_fnc_ActiveMissionState", 0, "TAG_JIP_MISSION_STATE"];
Plus that you can only assign one remoteExec to one JIP ID is a major
for me
?? Only one per JIP ID surely?
ah that, well yeah
I am terrible at explaining things- apologies
During all "states changes" driven by the server, I have many things to execute on cli, like local markers, diary, mass teleportation to new spawn position, loadout restore, invincibility during briefing, then I remove all of these when it is finish etc....
I have guys who disconnect.... reconnect...
I guess then do what Leopard recommended
some guys don't but are not TP for example, so I need a loop to check if their location is good, if not I redo the TP etc...but I need the right CURRENT_MISSION to read the right spawn location...
to be clear: push model from the server works very fine.... with 6 cli. Server just do [CURRENT_MISSION] remoteExec["cliWarmupStart", -2, true]; and this is it.
With 60+, issues happen.
VEH are destroyed, some are created for the current mission... lots of networking in all directions. It may explain that some cli just don't run the cliWarmupStart well.
In cliWarmupStart could you not just have a variable like clientSessionLoaded = true; that you set at the end of the file- then for other files that are running on initialization do a:
waitUntil {
uiSleep 0.01;
!isNil clientSessionLoaded
};
To verify the player receives all necessary data prior to mission start?
Obviously less preferable to have waitUntil logic throughout various mission scripts. Would be preferable to have all of that stuff combined into either one script or in cliWarmupStart. If I am understanding what you're describing correctly
The issue if clientSessionLoaded = true; has been set on all the cli for the warmup of mission 2. Now server is launching warmup for misson 3... 2 cli have the wrong value, but clientSessionLoaded =true.
I mean you can use a pull model, it is just much less efficient, and requires you to basically do "callback" style handling.
[CURRENT_MISSION] remoteExec["cliWarmupStart", -2, true]; To be clear this will run not just for Mission #2 right, now and for future JIPs, with true as the JIP flag it will run again on all later missions. So when you reach mission #4 then all JIPs would run 1,2,3,4.
ya. Which can be an issue. This is why I usually don't use JIP flag, but instead I am reading the [HAS_WARMUP_STARTED, HAS_MISSION_STARTED, CURRENT_MISSION] vars to do only what makes sens to the current situation inside initPlayer.sqf.
Or you can, but put a big if() at the beginning that skip the process if the parameter does not match the CURRENT_MISSION, this way [1|2|3] cliWarmupStart will do nothing.
Two possible implem.
But again, my point here is not JIP. I know how to do it.
Question is more how people do with massive MP to get reliable variables from the srv when they need on the cli side.
There is no problem with reliable sync. All the push based approached (setVariable, publicVariable, remoteExec) does it. Pulling the data is basically asking the server to push it to you.
What you have is some lack of ordering and processing or something else.
Our server runs a lot of people at a time and a remoteExec file along with init scripts and publicly broadcasted variables works for us
We don't have multiple missions we run at a given time, but there are a lot of different events happening at a given time that we have to keep track of
srv exec drives. So for example:
srvStartWarmup = {}; will do a lot of things like putting the right VEH etc... and also triggers the cli exec with a [mission_num] remoteExec["cliStartWarmup",-2];. The cliStartWarmup will generate the diary for example... which requires the right "sequence" because if the srv has not finish with the VEH creations, the cli will write the wrong VEH in the diary...
So the whole sequence has to be "rigid and sync".
This is why I need pull from the cli, but if no one uses it, fair enough
Well, don't trigger the cliStartWarmup until the server has done the necessary thing ?
What do you want to pull from the server? Whether it is ready?
Ya. the cliStartWarmup also TP the player to the next spawn. Imagin it fails. (the player was still on a previous mission veh, so the TP fails)
I want to do a scheduled retry just in case the sequenced exec has failed.
Here I know now, since some buddies were not TP because of that, there were ejected from the VEH at his deletion, but they missed the TP. (deletion into a spawn{} in // and cli executed before)
So I have a fix now.
But whatever the next bugs, I would like to do such retries from the cli as safe-guard.
Useful for the cli where it fails, the JIP etc...
Okay, well, as for pull'ing you need
- Make a request identifier
- Store anything anything you want to do after (the continuation), plus any needed variables in scope, into some object (hashtable) under identifier.
- Send request to server for data, including variable name, and your request identifier.
- The sender will send back the response and your identifier.
- In your handler you retrieve the continuation code and the stored variables, and in the continuation code you load the reponse and store data into variables again and continue.
As for try-catch, ignore the commands named that. You will have to detect that yourself.
But do understand that in the push-model all we do is:
- Push infallible transitions
- At the right time, sequenced in the right order (yes obviously this not fully trivial).
yep. in that case, most spawn{} completion must be waited before moving on.
I would be OK with that if on such call:
missionNamespace setVariable ["ATMTK_CURRENT_STAGE",_stageIdx, true];
We could do something like
waitUntil { broadcastDone "ATMTK_CURRENT_STAGE" };
just to ensure that all cli have received the update. Caus' except crappy "sleep + fingers crossed", I don't see how I can move on with a rigid sequence workflow.
Without, it means something like while(functional condition is not OK) {sleep ;} on all cli to synchronize, which is obviously complex.... for nothing.
I sorta see where you are going, but I just can't imagine a situation where the server would wait back on the client.
And if the clients are going to sleep anyway until condition, why trigger it before?
This is why most of scripts go with the crappy "sleep+fingers crossed"
or CBA event driven as a best alternative, somethig I should consider too I guess.
I mean "CBA-style" just doesn't do this, IME... It is "atomic transitions" driven by handling code running unscheduled. The events handles strict transitions, the "atomicity" of handlers ensure not conflicts.
There is hardly any spawn to be found in such a code base.
The main challenge is ensuring JIP data is ready, and to handle the "joining-transition" atomically.
Although entirely different from what you guys are talking about- I am really excited for the script promises that are coming in 2.22
Should reduce the amount of waitUntil that is really necessary for things
Is that the one that allows you to queue further code to run on a spawned script? I guess it nice, but as I said hardly matters for me because there is hardly any spawn or execVM to be found... Maybe the server is running one or two, but it is the "controlling" machine, so there is no synchronization problem there.
Yea it is :)! We have a bunch of places where we spawn things so I have a feeling it's gonna be super useful for us. I think our largest use is gonna be for event handlers where we spawn things but I imagine there are gonna be other cases for things I haven't even thought of yet when I get to kinda practice and play around with it
holy shit i think i finaly got this radio trigger stuff right: i had to make it like it was in OFP
I would like to learn whatever you've figured out. If you don't mind 
You need third parameter false for trigger to be created locally, otherwise it would be global
In createTrigger
can you show me
he means this when you create trigger via script and not via eden editor:
https://community.bistudio.com/wiki/createTrigger
createTrigger [type, position, makeGlobal]
O I C
by default trigger is global.
No need for double quotes
oh shit lol ok
wait
i always need help π
Since it's inside "", then you need to use ''
ok
Apostrophe '
ah ok
Also I don't see any global execution. You just remote execute one function on the server
that because there a Animation in my script
Like this:
['SFA_fnc_playerReload', 2]