#arma3_scripting
1 messages ยท Page 665 of 1
yeah, i was trying to avoid that
but if it comes down to it i'll just delete the weapon aswell
Potentially looking for setWeaponReloadingTime?
thanks for the help
that only affects reloads between rounds
not magazines
Ahh
i had a similar issue aswell, that's the only solution i found, it's clunky but gets the job done
is there anyway to get rid of this choppy running in unitcapture recording? my first idea of a solution would be to have humans playing instead of relying on unitcapture?
BIS_fnc_unitCapture is for air vehicles and should appear smooth?
it doesnt, unfortunately
what are you doing exactly?
removing the weapon from the turret
removing all magazines
adding the magazine i want
adding the weapon
the gun muzzle also flashes very briefly
i figure that's a side effect of removing and adding the gun
hmm just tested again on the tigris titan missiles, works fine
vehicle player removeMagazinesTurret ["4Rnd_Titan_long_missiles_O", [0]];
vehicle player removeWeaponTurret ["missiles_titan_AA", [0]];
vehicle player addMagazineTurret ["4Rnd_Titan_long_missiles_O", [0]];
vehicle player addWeaponTurret ["missiles_titan_AA", [0]];
Hey guys i'm facing an issue with a function i'm trying to implement via scripts.
The idea is a set of 'lockers' which players can only access if their UID matches that defined by a script and a marker.
In my init.sqf I have
[] execVM "scripts\cages\b70a.sqf"
[] execVM "scripts\cages\b71a.sqf"
[] execVM "scripts\cages\b71b.sqf"
Then three separate scripts named 'b70a.sqf','b71a.sqf','b71b.sqf' which look like this
private _myWhiteList1 = ["id1"];
while {true} do
{
{
if (!(getPlayerUID _x in _myWhiteList1) && (_x inArea "b70a")) then
{
_x setPos getMarkerPos "cageteleport";
};
} count allPlayers;
sleep 0;
};
private _myWhiteList2 = ["id1"];
while {true} do
{
{
if (!(getPlayerUID _x in _myWhiteList2) && (_x inArea "b71a")) then
{
_x setPos getMarkerPos "cageteleport";
};
} count allPlayers;
sleep 0;
};
private _myWhiteList3 = ["id1"];
while {true} do
{
{
if (!(getPlayerUID _x in _myWhiteList3) && (_x inArea "b71b")) then
{
_x setPos getMarkerPos "cageteleport";
};
} count allPlayers;
sleep 0;
};
So far testing shows that the script works fine if there is just one working, but as soon as another is added they all stop functioning (Tested in SP & MP)
yeah, works for me on the titan too
let me try this script on the tank
Nope
doesnt work for the tank
which tank and what ammo
here:
vehicle player removeMagazinesTurret ["24Rnd_120mm_APFSDS_shells_Tracer_Red", [0]];
vehicle player removeWeaponTurret ["cannon_120mm", [0]];
vehicle player addMagazineTurret ["24Rnd_120mm_APFSDS_shells_Tracer_Red", [0]];
vehicle player addWeaponTurret ["cannon_120mm", [0]];```
slammer
params ["_whitelist", "_area"];
while { sleep 0.1; true } do
{
private _playersInArea = allPlayers inAreaArray _area;
{
if !(getPlayerUID _x in _whitelist) then
{
_x setPos getMarkerPos "cageteleport";
};
} forEach _playersInArea;
};
```you can simplify it
[[_id1, _id2], "b70a"] execVM "areaTeleport.sqf";
@winter rose do you think the over complication is causing the non-functionality?
Thanks btw, ill try that
I have no idea why it stops and it should not
yeah its odd, it works perfectly if theres only one of the scripts being called, as soon as the second goes in it stops
was using for ground units/infantry
How do i play a series of multiple animations together smoothly?
playMove
that delay is from reloading the round
wouldnt setWeaponReloadingTime remove it?
because it doesnt
so it cant be reloading the round
vehicle player setWeaponReloadingTime [player, "cannon_120mm", 0]; after it seems to work
i'm running vehicle player setWeaponReloadingTime [gunner(vehicle player), currentMuzzle (gunner(vehicle player)), 0.0]; which doesnt
basically the same, just more general purpose script
currentMuzzle won't work because you're on MG when you run that script
atleast in slammer
๐
yeahhhhh
youre right
big dumb dumb
thanks for the help
really appreciate it
np^^
โค๏ธ
@winter rose so like 'man1 playmove 'insertanimhere'; playmove 'insertanimhere'; playmove 'insertanimhere'; etc?
man1 playMove "..." every time
Just to clarify @winter rose should the ID array i.e. _id1 etc. work with player uid? So
[[_id1, _id2], "b70a"] execVM "areaTeleport.sqf";
would become
[[84754837538534, 34543534355434345], "b70a"] execVM "areaTeleport.sqf";
https://community.bistudio.com/wiki/getPlayerUID is a string, so ["84754837538534", "34543534355434345"]
man playmove ''; in different triggers? tried that alongside using the countdown/timeout timer, to no avail, its not smooth, there is a choppy transition @winter rose please advise
@winter rose Alright pal, thank you ๐
man playMove "anim1";
man playMove "anim2";
man playMove "anim3";
// or
{ man playMove _x } forEach ["anim1", "anim2", "anim3"];
and if there is a "twitching" AI movement, try disabling AI with man disableAI "move"
sorry for butting in on the convo but would you guys know if it is possible to prevent a player changing weapon attachments in the vanilla inventory but still allowing something like the ace3 interaction menu to change attachments? If so would it be done using an eventhandler of some sort or how would i begin?
@copper narwhal It should be possible.. You can first create an event handler , check if player has opened inventory, when opened, retrieve the attachments first and create a while loop till inventory is closed, check continuously the weapon attachments, if anything modified, change them back according to the retrieved attachments?
@winter rose Hey thats great, thanks so far, but it seems as though some animations wont play after other specific ones (e.g 'loop', or 'terminal'), is this right?
would the loop cause some performance issues if a lot of people had their inventories open at once ๐ค if i was to hide the attachment box from appearing on the inventory GUI would that work also or would people still be able to attach using right click as that would only stop the image of the attachment appearing?
And, guys, how do i an activate a trigger, but delay it (e.g 15 seconds) so i can set up the camera ready to record? (tried radio delta, countdown/timeout 15 seconds, but that doesnt work)
@copper narwhal That is indeed the better solution regarding user experience. People will still be able to attach stuff using right click. That is what will be annoying if you take the GUI modification approach. You ll need to prevent a lot of stuff..
As for the performance part.... if code is on client side(which should be in this case), every man computes for himself for their own opened inventory, so ' a lot of people opened inventory ' is not a case to worry about. And a single while loop wont hurt you at all, let alone it is not even run always but only while inventory is opened. :)
Either way, you ll need to implement what I said because, iirc, even taking a weapon mod from ground is automatically adding to your primary weapon if there is space. Although not sure what exactly you are up to, so maybe u do not need.
in that case i think ill go with the check if player has opened inventory, when opened, retrieve the attachments first and create a while loop till inventory is closed, check continuously the weapon attachments, if anything modified, change them back according to the retrieved attachments method ๐ค
If you manage, better do it the way you called. Because without any information on UI side, players may not understand why attachments cant be added to weapon.
Funny issue. If a vehicle collides with something, the gunner will no longer take lookAt commands
even if AUTOCOMBAT is disabled in the AI
the reason why im doing this is because infistar is being a pain and blocking the function of a mod when using the vanilla inventory but not when using the ace interaction menu surprisingly
the thing you collide into also needs to be a wreck of sort
even if the combat state is set to careless
even if i repeatedly set it to careless
the ai returns to the default gun position
setBehaviourStrong doesnt help either
doWatch is too slow
there is considerable lag compared to lookAt
doWatch has the same issue
and it doesnt matter if the thing you crash into is an enemy tank
but if it's a dead tank, then it triggers the AI to just look forward
ONLY dead vehicles do this
empty vehicles are fine
scratch that
empty vehicles do the same
if it's Civilian units, then there is no issue
let me set blufor and opfor friendly
see what happens
DoTarget works for me for giving suppressive fire
ill give it all a try and see how it works, thanks ๐
yes, you should use _out versions instead of _loop
now there's considerable lag in aiming
with both lookAt and doWatch the AI pauses for a moment before fixing the vertical allignment
is it ranging?
and can i tell it to not do that?
i've set aimingSpeed to 1
I made a nasty workaround
{car forgetTarget _x}foreach (car targets [false]);
group car setBehaviour "AWARE";
car dowatch getpos player;
?
problem is now that the AI is supposedly doing ranging
or something like that
the horizontal aiming is immediate
but the vertical lags behind
I'm not 100% sure what the issue is. Could you tell me what is the goal here? I missed it ๐
@winter rose thankyou so far sir, heads up, gif coming your way soon, take cover ๐ , last question, how do i delay a triggers activation? need to get the camera setup in position ready to record, prior to triggers actions being played out
[] spawn { sleep 10; /* stuff */ };```
[] spawn { sleep 10; /* stuff */ }; (Whats this stuff stuff all about?)
before, what is immediate
in the "stuff" part, what is to be delayed
10 being the delay (in seconds)
hint "triggered!";
[] spawn {
sleep 5;
hint "waited 5 seconds";
};
the trigger has a fair few lines of animation code in the on activation field, so, what do i do?
https://imgur.com/VMxsYkS is as far as i got, sorry
place your lines in place of the stuff thing!
wrap them with the spawn {}
i think i got u
@winter rose if im triggering you will ask someone else, sorry but what is easy to you is very tough for me, still dont get it, but thanks for trying
/* code that is to be triggered immediately */
[] spawn {
sleep 10; // this is the delay
man playMove "thing1";
man playMove "thing2";
man playMove "thing3";
};
```no pb on my side no worries
tell me if I am unclear
spawn creates a new script where you want use sleep (you cannot use sleep in a trigger's code)
hey how do you do that crop screenshot thing again? got an error msg
Windows+Shift+S, or printscreen+paste in mspaint
(How i put my code in, in on act):
[] spawn {
sleep 10;
man1 switchmove "thing1";
man2 switchmove "thing2";
man3 switchmove "thing3";
{man4 switchmove _x } forEach ["thing4", "thing5", "thing6"];
{man5 switchmove _x } forEach ["thing7", "thing8", "thing9"];
};
comments don't work in those boxes
@copper raven what? i dont understand what youve just said
remove the //
right lol
talking about comments why don't we have a preprocess <STRING>?
Because game crashing preprocessor. And in general no
writes sqf preprocessor in sqf
https://imgur.com/OHCSi27 'On Activation: Type Script, expected Nothing'
Im having a issue trying to pull a specific phrase from a string.
Is there any way to pull "CargoTurret" from a longer string of "Dfljlekwfadfskljflksjef/adshflksejflsakdjf/hsdflksjflejkf/CargoTurret/dslfjksdlfjas/CargoTurret/alkdfjalsdkjf"
and count the number of times it occurs?
there are lots of options to filter by characters or elements
but does not seem to be a way to pull by specific words
and count them
any ideas?
think we've had something similar in the past
uh
#arma3_scripting message perhaps that?
modify it abit, you might not want it returning an array if you don't care about where exactly they occur
yeah i saw that on the wiki
but i cant seem to figure out how to apply it to my problem
as the wiki does not really explain what each part of it is doing
use #perf_prof_branch, its a age old bug thats recently been fixed
e.g count (["Dfljlekwfadfskljflksjef/adshflksejflsakdjf/hsdflksjflejkf/CargoTurret/dslfjksdlfjas/CargoTurret/alkdfjalsdkjf", "CargoTurret"] call _fnc_findStringsInString)
@glass zinc
ok will give that a try
I never thought it was a bug...
wonder what would happen if you did 0 = compileFinal "" before the object init is ran xD
would break so many missions
would not attribute the value to 0 afaik
in Arma 2 and before you could do true = falseโฆ
Thanks again guys @still forum , @winter rose; will send following into #perf_prof_branch see if can get an answer
(because even when on act is stripped down to below, still receive same error message: 'On Activation: Type Script, expected Nothing')
[] spawn {
sleep 10;
man1 switchmove 'Acts_CivilTalking_1';
man2 switchmove 'Acts_CivilListening_1';
};
yes the bug is that you cannot return any value.
_stuff = [] spawn { will trigger a second bug, that will cause the script to not return a value
spawn returns a "Script" value, thus bad
have the AI aim at a spot immediately
currently it aims at the position in horizontal axis immediately, but the vertical axis takes quite long
have submitted relevant info message into #perf_prof_branch as best as my knowledge allows me to, thanks again
Huh?
I meant you should use perf_prof branch (the branch, not the channel), not post there about a bug thats fixed on the branch
*Seeking clarity: oh so youre saying i need to read through the #perf_prof_branch (this link is the branch right? https://forums.bohemia.net/forums/topic/160288-arma-3-stable-server-200-performance-binary-feedback/?do=getNewComment) to find the already fixed answer/solution, via the branch link not discord channel? my brain is only working off literal concrete thinking right now, my bad
Change your steam branch for Arma 3 to profiling. Look here for more info:
https://community.bistudio.com/wiki/Arma_3:_Steam_Branches
Just go to Arma 3 >> Properties >> Betas and input the password CautionSpecialProfilingAndTestingBranchArma3. Then you can select the profiling beta branch in the dropdown. Test your script after this.
yes. If you use the branch that'll fix the bug for you
@cold mica Thankyou sir just the answer was looking for/needed lol, my head couldnt compute what dedmen was saying and nearly exploded lol, Thanks @still forum for bearing with my lack of understanding
my server needs to be restarted each 4 hours or so. i have a working script but it's time for improvement.
so far, my best bet is to have a looong uisleep 14400;
is this a crime?
related: i want to cancel. my best idea so far is to terminate a waiting script, using something like:
_wait = [] spawn {sleep 1440};
//on certain condition
terminate _wait;
is this another crime?
is this a crime?
no, having a longuiSleepis not a crime.
is this another crime?
meh and no, no biggie. the usual structure for this would be
private _wantedTime = time + 14400;
waitUntil { sleep 0.5; time > _wantedTime || condition1 };
// ...
Is #include case sensitive?
@winter rose that second waitUntil IT'S a crime xD. no need to check time each half frame if event is going to be in 4hours!!!!
it's half a second
what is your use case?
my server needs to be restarted each 4 hours or so
I mean, what is condition1 ^^
Arma's filesystem is case insensitive
well...restarting might be delayed/canceled...and that's what i havent tried yet...
lets suppose restart is set in 4 hours, and im in the middle of my assault. a simple "delay 1 hour" could work.
i have 2 approaches in mind:
use uisleep+terminate and reschedule restart to the new time (quiter dirty)
keep waiting until the old time and wait again (as the new restart time has changed)
KIWI_SERVER_RESTART_TIME = 14400;
waitUntil { uiSleep 1; time > KIWI_SERVER_RESTART_TIME };
```and in another file```sqf
KIWI_SERVER_RESTART_TIME = KIWI_SERVER_RESTART_TIME + 3600; // adds one hour```
you can sleep and check every minute if you prefer ^^
Some things I've noticed using doWatch and the like:
- Using a position instead of an object won't have the gunner wandering around (When he targets something, he's not really aiming at the unit but its last known position. If you've ever played Arma on recruit with an AI squad leader you'll sometimes notice the target icon is not on the unit's actual position and wanders a lot without direct LOS)
- Disabling the AI "TARGET" and "AUTOTARGET" might help, preventing the AI to "override" your commands
TARGET AND AUTOTARGET are disabled and i am using a position
with both lookAt and doWatch
doesnt matter
@winter rose but that sucks!...
acording to documentation waituntil checks every frame...that's useless. it might be much better (optimized) to just sleep 14400!
already have a draft i have to test...but this code seems much cleaner
let me try it and i'll come back
waituntil checks every frame...that's useless
not when a(ui)sleepis in it
also,
Premature Optimization is the root of all evil
knuth!
Yes!
I wish i could solve this
๐
but it looks like i'll have to abandon this idea
the AI refuses to cooperate
i wish there was just a way to tell the AI too aim their gun at stuff without all this extra
i've disabled every single bit of the AI i can
and it still goes wondering off with the aim
it's unresponsive at times aswell
why is this game like this?
why are there like 50 scripting solutions to one problem but all of them are broken
One solution is occurring to me right now. Disable the AI's "TARGET" and "AUTOTARGET" and manually with a script set the gunner's direction vector
what would that kind of script be?
as far as im aware of, you need AI to set the direction of a vehicle's turret
you can rotate the turret without AI
but you cant elevate it
I posted something similar earlier with the setVelocityTransform command, except you would do it manually and only with dir vector
no, but what i mean is that there is no command to set the weapon direction of the AI
please prove me wrong and say there is
there is no command to set the weapon direction of the AI
correct
the turret of a vehicle is not an object
https://community.bistudio.com/wiki/weaponDirection
Alternatively, you can get turret and gun angle in degrees using animationSourcePhase or animationPhase commands
but the gunner is
you cannot setVectorDir a turret
ok, it worked on the hunter
can i use animateSource to set the elevation of a gun?
it does not work on the tank, my bad
i can calculate the correct degree, but if im not able to, i wont even start
i think i can
need to try this in practise
if i can, then i'm neutering the AI the rest of the way
this is going to be so annoying to script in sqf
time + 120 works. i guess serverTime+120 too. are there any functions to add time? eg: systemTime+120
wha'?
vehicle player animateSource ["mainturret", 1]; doesnt seem to work
(vehicle player animationSourcePhase "mainturret"); returns a coherent number
that solves it
no overriding animation source
lol.
servertime=time in seconds since server started=>number. if I add 120 is like adding 2 minutes (future time when the server will be restarted)
seems I cant easily add minutes to systemTime. is there an "add_seconds_to_time(systemTime,120);" ? i dont hink so
one more broken solution to add to the pile
it's VERY interesting that BI cant expose a command to the script that would be able to animate the turrets of vehicles
How old is this feature? Like 20 years?
granted, sqf hasnt existed for the entire duration of Arma
was not a huge priority until very now
for most of its life though ๐
i suppose
but it's still a bummer
well, atleast the AI simulates the average soldier perfectly
disagreeable at best
well, 16 hours of that down the drain
not really, but why would you need systemTime ๐
if you really want precision use https://community.bistudio.com/wiki/diag_tickTime, but you don't need that for a 4h restart thing
only because the AI cant work with me
i think you'll get the idea
PMCES_set_restart = {
systemchat format ["%1",_this];
systemchat format ["%1",time];
_r=time+_this*60*60;
systemchat format ["%1",_r];
_remaining_time=_r - time;
systemchat format ["%1",_remaining_time];
//...
};
4 call PMCES_set_restart;
wont time work on server side?
...i dont understand. sorry.
reason to use diag_tickTime instead of time?
microsecond precision ๐
for a 4h restart? not needed xD
correct ๐
for display, though, it might be another trick
but you can also do a countdown, e.g restart in 2h, 1h, etc
sure...but that v3.0 xD
well, countdown is easier than converting time array
sometimes i wonder why some things in arma were made the way they were made...๐คทโโ๏ธ
I'm using the Vehicle Respawn module in a mission, and I want to empty out the vehicle's inventory and give it a custom inventory after it respawns, but don't know how. Any help?
I was thinking of something along the lines of placing
execVM "vicInv\RU_vic.sqf";
in the Vehicle Respawn "Expression" field, and that file would contain
clearWeaponCargoGlobal _this;
clearMagazineCargoGlobal _this;
clearItemCargoGlobal _this;
_this addItemCargoGlobal ["rhs_10Rnd_762x54mmR_7N1",14];
_this addItemCargoGlobal ["rhs_30Rnd_545x39_7N10_AK",30];
_this addItemCargoGlobal ["rhs_45Rnd_545X39_AK_Green",7];
_this addItemCargoGlobal ["rhs_GRD40_Red",7];
_this addItemCargoGlobal ["rhs_VOG25",7];
_this addItemCargoGlobal ["rhs_mag_rgo",20];
_this addItemCargoGlobal ["rhs_mag_rdg2_white",20];
Obviously the problem here is that I can't use _this or the old vehicle's variable name.
the problem here is that I can't use _this or the old vehicle's variable name
you can, if you provide the vehicle as an argument
Module says that passed arguments in expression field are [<newVehicle>,<oldVehicle>] so by doing clearWeaponCargoGlobal _this select 0; it should hopefully work, right?
yes?
Just tested and it works! Thanks Lou.
AI gunner of vehicle doesnt take any lookAt commands if you bump into something with the vehicle
instead, reverts to a forward looking position
despite being entirely disabled
apart from "WEAPONAIM"
because i need that for lookAt
why is this AI so broken?
FSM is disabled too
so it should not be doing ANYTHING
any idea what's causing this behaviour?
same behaviour persists even if the vehicle and crew are set to not take any damage
I dont know anymore
that's the problem
AI need TARGET and AUTOTARGET to aim properly
there's a video to the issue
^^
on that clip, only the scripts in the debug console were run
disableAI was untouched
i was told previously to disable target and autotarget
should i make a bug-report of this?
or is this intended behaviour?
im not using target, im using lookAt
as featured in the video
and "target" is not disabled in the video
can we address this?
is this a bug or a feature?
ยฏ_(ใ)_/ยฏ
I don't think the current devs will bother with the AI either way
The "AI devs" are gone
hmm...second time i crash arma
whats the proper way of exiting a function?
exitwith{}; shouldn't work?
exitWith exits the current scope
you can still report it. that was just my "experience" with previous AI bug reports
PMCES_set_restart = {
systemchat format ["%1",_this];
systemchat format ["%1",time];
_r=time+_this*60*60;
systemchat format ["%1",_r];
_remaining_time=_r - time;
systemchat format ["%1",_remaining_time];
//...
if(isNil "_myvar") exitWith {}; <-----------this seems to crash
};
1 call PMCES_set_restart;
Why is support for one game dropped when the other game isnt out yet?
i guess you can try manually setting the turret direction or something like that(would be hard to detect when you should actually do that), that looks like just some regular arma ai weirdness
there is NO WAY to manually set turret rotation
it's not dropped, the majority of the team has just moved to other projects
^
i'm just really frustrated at this point
because of how much i did to try and make it work and it gets destroyed by this bug
/"feature"
@dusty whale does lookAt just stop working completely?
once you bump into something, yes
running the command again doesnt help
the AI just flatout ignores it
what about doWatch?
script is on the video
^
you just run "execVM"
i didnt
that was there from previous test
i deleted that and ran the script i wrote
doTarget?
needs a target
glanceAt ๐
but also nothing prevents you from creating an invisible object
no change
the AI refuses any and all commands after you bump into something
it nicely keeps the gun level to the front, though
setBhevaiour doesnt help
systemchat format ["%1",_remaining_time]; prints 5
uiSleep _remaining_time;
error generic error in expression ?
probably uiSleeping in unscheduled
in debug console...
yes debug console is unscheduled
that's not beneficial for this purpose
but it is a good point
how long did it take?
sleep will work?
maybe it can help debug the issue
oks
[parameters] spawn {script}
its a function...so [parameters] spawn {call function}, isnt it?
didn't count, just fast forwarded 4x
@dusty whale using a fake target works just fine
as for lookAt:
after some time it works again
as sharp. said
30 seconds flat
for which command?
doTarget
copy
do you have CBA?
use this
_target = "CBA_O_InvisibleTarget" createVehicleLocal ASLtoAGL getPosASL player;
createVehicleCrew _target;
gunner vehicle player doTarget _target;
he won't stop aiming according to my tests
messing with https://community.bistudio.com/wiki/disableAI doesn't give any results ๐คท, doTarget with a fake target like said above is your best bet
it may also work without createVehicleCrew
since the simulation for that object is of "TankX"
and it has a high cost
can someone point me in the direction of what i would need to do to get the class/type name from a terrain object .p3d name.
typeOf
that works on terrain objects?
but some terrain objects have no type
rgr
works on all objects
doesnt work
ok, now it works
the AI also finds it fun to engage it with fire
not ALL of them
but most
some terrain objects dont have a type
try without crew
no reaction
you have to reveal the target first
so typeof does not work on the terrain object which is a fence. so any idea how i can get the class name from the .p3d name? i know the fence exists in the props so it is an object with a class name
scan cfg with the model name
i did
yeah im new i dont know how to do that. do you have alink i can get started with?
the gunner registers the contact but doesnt actually turn to face it
_target = "CBA_O_InvisibleTarget" createVehicleLocal ASLtoAGL getPosASL player;
gunner (vehicle player) reveal _target;
gunner (vehicle player) doTarget _target;```
@copper raven thx mate
it's gonna be expensive, might wanna consider caching
then idk
any ideas?
PMCES_set_restart = {
systemchat format ["%1",_this]; //<----------first time invoked it says 1, but on recursive call it also says 1! (although it may be null)
//...
call PMCES_set_restart; //<-this call is also showing "1" ???
};
1 spawn { call PMCES_set_restart; };
setUnitCombatMode "BLUE"; and the AI will target but wont fire
it won't fire at anything
i dont care
i'm simulating my own firing already
animating the gun barrel and doing the flash
aswell as spawning the projectile
but this is satisfactory
call uses parent's _this
another option?...params["_x"] ?
no
on recursive call it also says 1
what did you expect?
but anyway, you have to pass new args to the call
spawn or [] call
if you want it to change
this works smoothly so far with the edits
Thank you!
โค๏ธ
@little raptor thank you leopard, i mean
i quoted myself there by accident
so it needs to have a crew
now it travels a bit
THE AI has a hard time keeping track of the target
๐
but i'll look after that tomorrow
doTarget tooltip in the debug console says "unit doTarget position" despite the fact that doTarget doesnt take a position, but an object or an array
how do I refer to an object that I haven't made a reference to in the editor in the debug console without being physically present? Say I want to destroy an object X setDammage 0 what would take the place of X? Usually I would do cursorObject but that requires to be present and looking at it
you could e.g grab it with a nearestObject command
that gets me something like 21c272cc080# 1780805: ah64d.p3d
yep, that's the object
how do i use it in a script?
getPos 21c272cc080# 1780805: ah64d.p3d
doesn't appear to work
save it into a global
str cursorObject //Can return something like "21c272cc080# 1780805: ah64d.p3d"
```Because it's just the string representation of your object.
myObj = nearestObject [...]
I see
https://community.bistudio.com/wiki/Variables
You might want to catch up on some reading ๐
thanks ๐
this works
if(!foo) exitwith {};
but how can I do something like:
if(bar) then {
//...
//...
exitwith {}; <-------------------------exit/end script here
};
sorry, but I dont get it. (spanish native :S)
would a "false" do the trick?
to give some context:
PMCES_set_restart = {
if (isNil "_foo") then {
if (isNil "_bar") exitwith {};
//doC
} else {
//Already waiting and minutes given -> update and exit
if (!isNil "_bar") then {
//doA
//doB
//exit <------------this is what i want, for cleaner code
};
};
//...
};
[1] spawn { call PMCES_set_restart; };
I'm gonna come back with my favorite doWatch ๐
After the AI successfully acquires it with doTarget you could do a while{true} loop with doWatch. Like so:
watch_script = [] spawn
{
while{true}do
{
_unit doWatch (getPos _target); //argument as position seems more reliable than object; emphasis on 'seems'
sleep 0.05;
};
};
Then you could terminate that with:
terminate watch_script;
_unit doWatch objnull;
while true loops should always have a sleep
doWatch fails if you drive into a wall
its nonsense to call doWatch a hundred times every frame
well it's a workaround for hard to crack problem
see breakOut/breakTo wiki pages
im using doTarget already
and it works ok
this is just so stupid in general
please expose something that i can use to set the rotation of the turret
just animateSource is enough
i'll work out the math
because working with the AI is the bane of all existence
thats a goto...a cat just died
no.. not really
Is there any way to create a new inventory item?
scripting, no
if (true) exitWith {}; //IMHO better than goto, but killed a cat anyway
Hi guys, why does my a jet take off when its linked to a CAS Bomber Support ?
can I get an script handle within the script? like using _this ?
there is nothing wrong with goto
you can tell me what is wrong with it
its only unstructured if you can't make it be structured
switch is basically subset of go to, do you hate it too?
yes, if you write bad code its bad code
goto its the proper way for spaghetti code...and people who use it (except for switch), will met satan in hell ๐
anyway...going back for my fusillini code...i have a long running sleep and i want to cancel it.
AFAIK, terminate supports spawn handles...
can that handle be linked somehow to _this? can i make "terminate _this" ? (not doing the exit, just for another crappy code)
you canโt
when you add slip the script is rescheduled for the time after sleep
this is why you canโt sleep less but likely more
so the script is on hold and will not respond to terminate unless it is simulated
Guess no body knows ๐ฆ
so...
PMCES_set_restart = {
systemchat "hello";
sleep 14400;
};
_handle=[1] spawn { call PMCES_set_restart; };
sleep 10;
terminate _handle;
wont terminate until sleep 14400 ends.
script wonโt run?
my bad...i mean, it will not terminate "immediatly", but only when sleep ends
is that right?
depends on what is before sleep
if it has to suspend before sleep it will terminate before sleep
updated, for better understanding
terminate will stop your spawn before the long sleep ends yes
also how do you know it doesnโt terminate until after sleep?
...sorry for my english...but aren't u guys saying opposite answers?
Why
_handle=[1] spawn { call PMCES_set_restart; };
instead of
_handle=[1] spawn PMCES_set_restart;
?
if you keep on changing question
wrong. Immediately is correct, immediately when you execute the terminate
it that work, i didn't knew. i'll fix it ๐ thx
that would't make sense. If you want to terminate a sleep, from within the sleeping script..
Your script is sleeping, it can never get to execute "terminate" while it sleeps
ill try to explain the best i can
i scheduled a server restart in 4hrs, so instead of checking periodically, my script will sleep 14400
if someone wants to "cancel" or change restart time, it could "terminate" the previous process(sleep) and run another
yep. and you can do that with terminate like you posted above
//serverinit.sqf or whatever
PMCES_set_restart = {
systemchat "hello";
sleep 14400;
};
_handle=[240] spawn { call PMCES_set_restart; };
//someone wants to reschedule
terminate _handle;
_handle=[120] spawn { call PMCES_set_restart; };
local variable obviously won't work, but yes something like that you can do
ok, perfect...now, the initial question was
if theres a way to get handle within script, in order to change PMCES_set_restart to set "global_handle"=this
how about
global_handle =[120] spawn PMCES_set_restart;
Or how about reading the wiki?
_thisScript
Thats exactly the answer to your question.
If you don't ask what you wanna ask then its hard to help
AND I'M MUCH APPRECIATED FOR YOUR PATIENCE๐
what i was thinking was about the scope of the handle
the restart script is inside initserver.sqf or whatever
but the "cancel" this restart and reschedule is going to be used from console/debug while playing
so i have to rewrite PMCES_set_restart to terminate older handle and register the new
like a global variable...
yes
missionNamespace setVariable ["pmces_next_restart_handle", _pmces_next_restart_handle];
would that be the correct approach?
just store handle into global variable at the beginning of yur PMCES_set_restart
terminate (missionNamespace getVariable ["PMCES_restartHandle", scriptNull]);
PMCES_restartHandle = _thisScript;
...
PMCES_set_restart = {
if (not isNil "global_handle") then { terminate global_handle; };
global_handle = _thisScript;
sleep 14400;
};
How's that?
global_handle = _thisScript;
that's what i was looking for. your 3 answers toghether
@still forum yes, terminating a global variable
@unique sundial yes, using _thisScript
@crimson walrus you summarize, but i love u too
thank u...going to try it rn.
Okay...lets check for QA/advices:
PMCES_set_restart = {
//Schedule next restart to PARAM minutes from now.
params["_minutes"];
private _pmces_next_restart_handle = missionNamespace getVariable "pmces_next_restart_handle";
//It's already waiting?
if (isNil "_pmces_next_restart_handle") then {
//Not waiting and no minutes given -> nothing to do
if (isNil "_minutes") exitWith {};
//No, but minutes given -> Start waiting
//systemTime doesn't allow to easily add minutes. Using time
_pmces_next_restart_time = missionNamespace setVariable ["pmces_next_restart_time", time+_minutes*60];
//Register handle
missionNamespace setVariable ["pmces_next_restart_handle", _thisScript];
} else {
//Already waiting and minutes given -> update and terminate older
if (!isNil "_minutes") then {
_pmces_next_restart_time = missionNamespace setVariable ["pmces_next_restart_time", time+_minutes*60];
terminate _pmces_next_restart_handle;
missionNamespace setVariable ["pmces_next_restart_handle", _thisScript];
};
};
//So far ready to wait or restart
private _pmces_next_restart_time = missionNamespace getVariable "pmces_next_restart_time";
//systemchat format ["_pmces_next_restart_time: %1 and now: %2",_pmces_next_restart_time, time];
//Wait until restart time
if (_pmces_next_restart_time > time ) then {
private _remaining_time = _pmces_next_restart_time - time;
uisleep _remaining_time;
diag_log "PMCES Restarting in 2 minutes...";
//TODO hint vs BIS_fnc_showNotification
uisleep 120;
[] call PMCES_set_restart;
} else {
diag_log "PMCES Restarting...";
//TODO hint vs BIS_fnc_showNotification
//TODO restart;
};
};
[60] spawn PMCES_set_restart;
you know that you do't need the getVariable/setVariable right?
Please use sqf highlighting
!code
```sqf
// your code here
hint "good!";
```
โ
// your code here
hint "good!";
pretty hard to read that mess above
dint know sqf highlight. thanks!!!
if i knew it, i woulnd't have probably used it. please, consider this code is run from a file, but invoked from console too
you can edit your posts
and you are restarting even though the time is not up?
...sorry...too many questions and didnt understand them. :S
on first run, last line start the first restart schedule (1hour)
if someone invokes another thing, it would be overwritten and a new start is made. previous is terminated
the wait its just an sleep and a final recursive call
PMCES_set_restart = {
//Schedule next restart to PARAM minutes from now.
params["_minutes"];
terminate (missionNamespace getVariable ["pmces_restart_handle", scriptNull]);
pmces_restart_handle = _thisScript;
// wait until restart
sleep (_minutes-2)*60;
diag_log "PMCES Restarting in 2 minutes...";
//TODO hint vs BIS_fnc_showNotification
sleep 120;
diag_log "PMCES Restarting...";
//TODO hint vs BIS_fnc_showNotification
//TODO restart;
};
[60] spawn PMCES_set_restart;
how about just that?
assuming your minutes are always bigger than 2
let me read, understand and probably cry...
BUT i dont want to check if i need to restart every 2 minutes. dont need to...
Your code maybe does that, mine doesn't
why did u write:
terminate (missionNamespace getVariable ["pmces_restart_handle", scriptNull]);
whats the scriptNull? where is that initialized? its like a default param=nil?
isn't missionNamespace setVariable needed to make the script handle global?
pmces_restart_handle = _thisScript;
its default value, and its a null script
"isn't missionNamespace setVariable needed to make the script handle global?"
No. I told you that above. You don't need that
global variables and missionNamespace are the same thing
then why not:
terminate (getVariable ["pmces_restart_handle", scriptNull]);
? (or even simpler, idk)
f**k
ok...now, should I start crying now, here...in front of everyone...or can I go to the corner and cry alone?
no you should spend the time to read the wiki instead
do you really think I would have been able to do the shit I did without reading? xD
The worst scripts I've seen so far are mostly people copy pasting stuff together, not knowing what they are even doing besides "uh, it just works"
its my second "working script"...and im afraid to QA the first
Hi folks,
I'm trying to use createVehicleLocal to make a "#lightpoint", but have encountered trouble in multiplayer.
My script fails to make the light when hosting the mission on a dedicated server, but succeeds when hosting locally.
I use an addAction prior to creating the light, and the action consistently shows up in both situations, so I know it's not a locality issue with createVehicleLocal.
Google had some mention of the command being disabled for security reasons - any thoughts?
itโs not disabled unless it is disabled by mission maker
Would help if you actually post some code.
// executed using [_buyStationObject] remoteExec ["item_fnc_buyStationAddAction", 0, true];
private _buyStation = _this select 0;
_buyStation addAction
[
"Open Buy Station",
{
[] spawn item_fnc_buyStationMenu;
},
nil,
1.5,
true,
true,
"",
"true",
6,
false,
"",
""
];
private _brightness = [16, 12, 10, 8, 6] select ((round (daytime - 12)) min 4);
private _light = "#lightpoint" createVehicleLocal (getPos _buyStation);
_light setLightBrightness _brightness;
_light setLightAmbient [0, 1, 0];
_light setLightColor [0, 1, 0];
_light setLightDayLight true;
_light setLightUseFlare false;
_light setLightFlareSize 0;
_light setLightFlareMaxDistance 0;
_light setLightAttenuation [1,6,6,0,0.25,1.75];
``` I'll just repost it here
@crimson walrus Check the pinned post to find out how to post code properly
I'll also note that daytime is always between 12 and 24
Have you tried for testing with createVehicle?
nope, thought lights had to be made locally. I'll give it a shot.
Basically, just remove all code and just try to make it appear, then go on from there. Could be something with the settings for the light.
It does work fine when hosted locally
[16, 12, 10, 8, 6] select ((round (daytime - 12)) min 4);
maybe daytime doesn't sync up fast enough with the client and this tries to select a negative number?
it's remoteexec'd once from the server
or is that light part of the create shop function?
do what R3vo said, createVehicle and see if it works
if it does but not with local version, please make a ticket and ping me with link
Can I get some help with this proof of concept? Its a simple scoreboard formatted as a hint.
private _headlessClients = entities "HeadlessClient_F";
private _humanPlayers = allPlayers - _headlessClients;
onEachFrame {
{
_playerName = name _x;
_playerScore = _X getVariable ["score",0];
_hintLine = format ["\n%1 - %2", _playerName, _playerScore];
} forEach _humanPlayers;
_hintArray = [];
_hintArray pushBack _hintLine;
hintSilent format _hintArray;
};
I know it won't work, obviously
for every player, I need a new line in the hint with the _hintLine = format ["\n%1 - %2", _playerName, _playerScore]; formatting
_headlessClients = entities "HeadlessClient_F";
humanPlayers = allPlayers - _headlessClients;
onEachFrame {
hintSilent ((humanPlayers apply {format ["%1 - %2", name _x, _X getVariable ["score",0]]}) joinString toString [10]);
};
how are you so good at this
I'm not even sure if it works 
also, note that it is very slow
you shouldn't do it every frame
I'll do it every 5 seconds, just to avoid the fading effect
does it work tho?
nah, syntax is iffy
19:23:00 Error in expression <%2", name _x, _X getVariable ["score",0]}) joinString toString [10]);
};
>
19:23:00 Error position: <}) joinString toString [10]);
};
>
19:23:00 Error Missing ]
working it out
yeah
I left out a ] (format)
while {true} do {
_headlessClients = entities "HeadlessClient_F";
_humanPlayers = allPlayers - _headlessClients;
hintSilent str ((_humanPlayers apply {format ["%1 - %2", name _x, _X getVariable ["score",0]]}) joinString (toString [10]));
sleep 1;
};```
That's what I got to work
prob don't need the str
no
but thank you for sharing your genius
np
I'm looking for that wiki page with the fancy structured hints but I can't remember where I found it
you mean hintC?
or just structured text?
I'm already there haha
already started whiping up some code
something like this?
_headlessClients = entities "HeadlessClient_F";
_humanPlayers = allPlayers - _headlessClients;
_separator = parseText "<br />--------------------------------------------------------------<br />";
_txt1 = text ((_humanPlayers apply {name _x) joinString (toString [10]));
_txt1 setAttributes ["align", "left"];
_txt2 = text ((_humanPlayers apply {_x getVariable ["score",0]}) joinString (toString [10]));
_txt2 setAttributes ["align", "right"];
_structuredText = composeText [text "Chickens Killed", _separator, _txt1, _txt2];
hintSilent _structuredText;
The name works, but the score shows any
I did end up getting it to work with createVehicleLocal. I had the server calculate the brightness and send it as an argument, and also added a 1 second sleep before creating the light.
Thanks for the help
is there a way to detect if an object can take damage?
isDamageAllowed
@little raptor I don't fully understand what the purpose of joinString (toString [10])) is
adds nextline between each element
so that isn't going to work with the new revision
also it seems that enableEnvironment [false, true]; will also prevent new ambient life from spawning via script
while {true} do {
_headlessClients = entities "HeadlessClient_F";
_humanPlayers = allPlayers - _headlessClients;
_separator = parseText "<br />--------------------------------------------------------------<br />";
_composedTextArr = [text "Chickens Killed", _separator];
{
call compile format ['
_txt1_%1 = text (name _x);
_txt1_%1 setAttributes ["align", "left"];
_txt2_%1 = text str (_x getVariable ["score",0]);
_txt2_%1 setAttributes ["align", "right"];
_composedTextArr append [_txt1_%1, _txt2_%1];'
, netId _x
];
} forEach _humanPlayers;
_structuredText = composeText _composedTextArr;
hintSilent _structuredText;
sleep 1;
};```
what's the point of the call compile format?
so dumb question, if i want to to call for all vehicles/weapons/gear for a store script how could i implement that?
You could do a config dump, but it's a bit risky because config can have a lot of minor variants and hidden stuff that you might not want to put in your store
If you really don't want to manually make a list, you could try making an Arsenal with all the stuff you want, and then reference it using one of the getVirtualArsenal[stuff] functions
But making a deliberate and considered list, one item at a time, is probably the best way
See pinnes messages for Dialog
Hello everyone! Hope everyone is having a great day. So I have a question and I am looking for someone who can help me solve this problem. I'm looking for maybe a mod or a unit randomization guide. Perhaps, as in the example, there is a rifleman who sometimes wears a hat, helmet, uses other weapons, ammunition, or other equipment.
Use cba init eventhandler, then run a script that selects randomly from arrays of equipment
Thats how i do it.
How do I make an AI go to the nearest player in the 10 meter radius?
1/ get the nearest player
2/ order to move
3/ ????
4/ profit ๐
which step is the issue? ๐
I use the following code to get the nearest player position and move:
_nearestPlayer2 = _nearestPlayer select 0;
_ai moveTo [getPos _nearestplayer2];
yes, but objects of type "player" do not exist; it must be a class ๐
so it would be a near entities, filtered by a select { isPlayer _x } ๐
okay, so once I get a classname of entities, I filter them all by select { isPlayer _x }, and I'm good to go?
yes
I recommend filtering by CAManBase, or usingโฆ allPlayers select { _x distance _myObject < 10 }
In that case, I think I should replace nearestObjects with nearEntities
or allPlayers?
it's a list of all players ๐
ah wait you want the nearest
private _closePlayers = allPlayers select { _x distance _theObject < 10 };
if (_closePlayers isEqualTo []) exitWith { hint "no one here"; };
hint "hey, someone here! getting the closest";
// filter by distance
// pick the first one (closest)
// move
_nearestPlayer = _nearestPlayer select { isPlayer _x }
_nearestPlayer = selectRandom _nearestPlayer
_ai moveTo [getPos _nearestplayer];``` What I came up with.
don't forget to check if the list is not empty
okay. Thanks!
Does anyone happen to know how exactly the allowFleeing-command operates? Like what does a cowardice-value of e.g. 0.25 actually mean? (Hopefully not that a quarter of the men is just going to run at first glance of an enemy...)
allowfleeing 0; means they will never flee
@vague geode check https://community.bistudio.com/wiki/fleeing
if I had to guess I'd say it's the ratio of the number of men left in a group to the number of enemies!
at least that seems to have some effect
or it could be the aggregate percent of suppression for all team members
all I know is that the more suppressed and outnumbered a group is, the more likely they are to flee
The page explains it actually
If the group losses by injury/damage or death/destruction are higher than the max strength, multiplied by leader's courage or allowFleeing level , then the group will start fleeing.
So it's just a multiplier of some sort
Does anyone know why Hardware3 setPos getPos HardWare3Pos2 works, but
GeneratorVillage setPos getPos GeneratorVillagePos1 does not? It says "Generic error in expresion"
Are all four objects?
Yes
Now it does because you added it one hour and 15 minutes after I asked the question.
But now I have a followup:
If the group losses by injury/damage or death/destruction are higher than the max strength, multiplied by leader's courage or
allowFleeinglevel , then the group will start fleeing.
But if that's the case 0 should make them always flee and 1 should make them take a stand no matter what but according the old version of the page it exactly the other way around.
Also the the infantry's armour just their health?
PS: I would add the note from the old version of the page as well since it shows you which effect increasing/decreasing the value was.
Could it be that GeneratorVillage has an object attached to it? (BIS_fnc_attachToRelative;)
GeneratorVillagePos1 seems like a pos
at least that's what the name says
also what is GeneratorVillage? we don't have a "village" object
Now it does because you added it one hour and 15 minutes after I asked the question.
Not really. There was a link in the desciption saying "More info here"
It is not. It is a pillow. "village" is the var of the object
what
check what they are
execute:
[typeName GeneratorVillagePos1, typeName GeneratorVillage]
in debug console
then paste the result here
no var names in editor
It is a CUP object, btw
["OBJECT","BOOL"]
The class name of the object is "PowGen_Big_EP1", but because I've got multiple of them I have set a variable name being "GeneratorVillage" It should work as I have done the same with Hardware3
but it doesn't as you see.
Just double check your var names. Nothing else we can do here
The object attached to generator got variable GeneratorVillageSwitch with init 0 = [this, GeneratorVillage] call BIS_fnc_attachToRelative;
I just tried in VR and it works. Every code being the same as well as the var names.. weird
Found the problem. I had a trigger condition named GeneratorVillage. Thanks for the help
is there a way to force the player to freelook? can you simulate keypresses?
nope
Hi guys how would i constantly check (or every 10 seconds) if [0] call BIS_fnc_countdown has reached 0.
I was thinking a EH but not sure if there is something like that.
waitUntil {sleep 10; ([0] call BIS_fnc_countdown == 0)};
Why tho?
or
_serverTime = serverTime;
_countDown = 50;
waitUntil {sleep 10; _serverTime + _countDown >= serverTime};
It is known when a countdown reaches 0
Because i am working on a secure area mission and once the timer reaches 0 i want the mission to be completed and all remaining AI to be removed.
or killed.
The question is why check evry 10 seconds?
uhm
Just spawn a script and
sleep _countdown;
//Delete stuff
When you know when the countdown ends
<-- this would be usefull

This what I meant 
#loop
could i somehow display car stats, like an ai is driving a car and i as player need to know which parts of the car are red, or yellow
(this is a race mission and i wanna have car degradation in play, and you'd have to call the ai to the pitbox to repair the car and change wheels and so on, but the players need to know how the car is actually doing)
@cosmic lichen One problem the timer start when WEST unit steps in a trigger.
[300] call BIS_fnc_countDown;
oke ๐ฆ
trg2 setTriggerStatements ["this", "
'Enemies are moving into the area...' remoteExec ['systemChat'];
[pos, 25] call spawnPatrolUnits;
[300] call BIS_fnc_countDown; <-- Remove this for?
deleteVehicle trg2;
", ""];

The display part is up to you
but for knowing how it's doing you can use getAllHitPointsDamage _veh
oh god im gonna have to make a gui arent i..
softly fuck
yeah, like thats what i want
just be able to see that like..car stats you usually get but when youre outside of it..
do you know how to just use the ingame gui? or should i ask in #arma3_gui
@cosmic lichen can you please help my with it ๐ ?
trg2 setTriggerStatements ["this", "
'Enemies are moving into the area...' remoteExec ['systemChat'];
[pos, 25] call spawnPatrolUnits;
// Start timing for 5 minutes <---
deleteVehicle trg2;
", ""];
๐ค
so wait you want it just to do a timer and when the timer runs out delete the thing?
When the timer runs out i will perform a couple of things yes.
sleep
can't do that
oh oka
I do know but you should ask there anyway
Cuz i am in a setTriggerStatements
spawn
setTriggerStatements can handle sleep as well if you use spawn (except for condition of course)
trg2 setTriggerStatements ["this", "
'Enemies are moving into the area...' remoteExec ['systemChat'];
[pos, 25] call spawnPatrolUnits;
null=[]spawn {
sleep 60;
'4 minutes remaining...' remoteExec ['systemChat'];
sleep 60;
'3 minutes remaining...' remoteExec ['systemChat'];
sleep 60;
'2 minutes remaining...' remoteExec ['systemChat'];
sleep 60;
'1 minute remaining...' remoteExec ['systemChat'];
sleep 60;
[player call BIS_fnc_taskCurrent, 'SUCCEEDED'] call BIS_fnc_taskSetState;
{ player say2D 'cp_mission_accomplished_1'; } remoteExec ['call'];
'Mission Completed ($2500).' remoteExec ['systemChat'];
[2500] remoteExec ['updatePlayerMoney'];
deleteVehicle trg2;
};
", ""];
Is there a way to script a one time check of a players mods then let them join the server?
not sure which channel this question is most appropriate in
it works ๐ ty
https://community.bistudio.com/wiki/activatedAddons
But then you have to know the specific addon name. For example, ACE has like 20 addons inside of itself as a mod.
hmmmm
okay I see the issue
cause this array would be massive
have to check against 100 addons but I only want it to run 1 time
_loadedMods = getLoadedModsInfo;
would this not work better?
i mean you can use keys right?
yup, the array is massive lol. you could. I like activatedAddons when I have to pull out a specific addon, like ace medical.
I want to set up a whitelist for mods that might not be on the server
client side mods that are on my approved list
i see
so an easy way to do that
is to just add the keys of the mods to the server, but not the actual mod itself
so if you look in the mod folder, there is usually a folder called keys
it is a bisign key
okay I follow
that needs to go in the keys folder in the server root
yup
yea thats much easier XD
the only mods that are forced are the ones that are loaded on the server. all other standalone keys allow mods that are optional
Thanks I appreciate that
and these keys they don't change if say the mod is updated?
the activatedAddons method is for things like say... i make a mission with standard arma, but I want to make it compatible with ACE Medical, so I would have a fsm that changes the game state if ace_medical is in the activatedAddons array.
yes, if the mod is updated, the keys get updated too typically, its up to the mod maker. So you got to be on top of that.
is there a getRelPos but which takes a vector direction instead of compas direction?
vectorFromTo?
thank you!
i would use weaponDirection, but it's inaccurate ๐
so i have to play around a bit
is there an internal function in arma to find a point at distance along a given line or should i just calculate it myself?
there is, but can't remember it
oh, damn
into the BIS-functions i go
oh cool, there's matrix multiply and transpose functions here
not what im looking for today, though
does this actually work`?
https://community.bistudio.com/wiki/BIS_fnc_runLater
who needs timers when you have this
wait, does it just call a timer internally
i'll just call BIS_fnc_lerp on the 3 points
cant be asked to look deeper
never mind
for future reference, it's https://community.bistudio.com/wiki/BIS_fnc_interpolateVector
lucky you, because I had this in mind ^^
https://community.bistudio.com/wiki/BIS_fnc_getLineDist
[[0,0,0], [10,10,10], 1, 0.5] call BIS_fnc_interpolateVector
this gets you 5,5,5
I usually multiply a normalised vector, does the job ^^
which is the middle point along that line
i didnt check what the command does under the hood
you wanted a distance, here you have a percentage
that's true
but i know what the distance is
because i know the components
so i can figure out the appropriate percentage
but can i just multiply my position vector with the normalized direction vector
and get it that way
i love how some of the selection names are in middle-european gibberish and some are english
-english +Western-European gibberish
debatable
for the record, the language is Czech
yup
BIS_fnc_interpolateVector is inaccurate
๐
it ends up a bit below from where it's supposed to be
but only at longer distances
of course, number precision
don't use that 
oh, alright
what do you reckon?
you can try:
- vectorMultiply
- vectorLinearConversion
Hey guys, im trying to play the executioner/victim kill animation (via trigger>radio delta), ('Acts_Executioner_Kill', ''Acts_ExecutionVictim_Kill')
but the executionerkill anim unit tries to holster his pistol first which ruins the timing of the two animations which should play at same time, Had tried 'this disableai anim' in the (executioner) units init field, to no avail/effect, how to fix?
Same issuer with vectorLinear
can you take a look at this script?
im not sure if my math is correct
arrow2 = "Sign_Arrow_F" createVehicle [0,0,0];
addMissionEventHandler ["Draw3D",{
private _end = [0,0,0];
private _ins = lineIntersectsSurfaces [
AGLToASL positionCameraToWorld [0,0,0],
AGLToASL positionCameraToWorld [0,0,viewDistance],
player,
vehicle player,
True,
1,
"FIRE"
];
private _start = vehicle player modelToWorld (vehicle player selectionPosition ["konec hlavne", "memory"]);
if (count _ins > 0) then {
_end = ASLToAGL(_ins select 0 select 0);
} else {
_end = positionCameraToWorld [0,0,viewDistance];
};
drawLine3D[_start, _end, [1,0,0,1]];
private _perc = 100/(_start distance _end);
private _pos = vectorLinearConversion [0,1,_perc,_start,_end,True];
arrow2 setPos (_pos);
hintSilent str(_pos);
}];```
the arrow should be along the line, but it isnt
this is done with a smaller
look at a hillside and see the arrow go and do its own thing
don't use setPos
getPos
position
visualPosition
getPosVisual
noob question here, if i want to run this code in debug consul in game, what should i change? assuming i have named one object of the target group as A.
_localityChanged = _someGroup setGroupOwner (owner _playerObject);
what am i allowed to use?
anything but setPos
whichever you're most comfortable with
I personally recommend ASL
switchMove
i tried first setPosASL
makes no difference (ofcourse converting the AGL coordinates to ASL)
also, why not use these commands?
they use AGLS format
which simply put are not convertible or compatible with any other command
they should be used in special places
roger
anyway, even with converting the AGL to ASL and using setPosASL, it fails the same way
the arrow is not at the path of the line
the coordinates get scewed by vectorLinearConversion
i'll try flipping some numbers around
๐
what is _perc?
unimportant
it doesnt actually change the accuracy of the result
it's what i use as the percentage distance
the problem is not the math, nor accuracy
it's just a visual error
try this:
arrow2 = "Sign_Arrow_F" createVehicle [0,0,0];
addMissionEventHandler ["Draw3D",{
_p1 = eyePos player;
_p2 = AGLToASL positionCameraToWorld [0,0,1000];
private _ins = lineIntersectsSurfaces [
_p1,
_p2,
player,
vehicle player,
True,
1,
"FIRE"
];
// private _start = vehicle player modelToWorld (vehicle player selectionPosition ["konec hlavne", "memory"]);
if (count _ins > 0) then { _p2 = _ins # 0 # 0;};
drawLine3D[ASLToAGL _p1,ASLToAGL _p2, [1,0,0,1]];
private _perc = 100/(_p1 distance _p2);
private _pos = vectorLinearConversion [0,1,_perc,_p1,_p2,True];
arrow2 setPosASL (_pos);
hintSilent str(_pos);
}];
in other words, it's drawLine3D that's causing the "error"
not vectorLinearConversion
It's most definately not
demonstrate to yourself by doing drawline3d to end and _pos
those lines should not diverge
but they do
they do diverge
trust me
i can send you the math
independent of arma 3
your p1 is wrong
it NEEDS to be the muzzle of the vehicle
hintSilent str ((_start vectorFromTo _end) vectorCos (_start vectorFromTo _pos))
not the eye position of the player
youre using wrong values
the starting position of the vectorLinearConversion is the muzzle of the vehicle not the eye position of the player
private _start = vehicle player modelToWorld (vehicle player selectionPosition ["konec hlavne", "memory"]);
what I said is based on your own code
my code says that the start is the muzzle position of the vehicle
it's not a visual error
I'm talking about this:
#arma3_scripting message
i have another arrow being set at the _end location
and the ray from the muzzle goes directly to the root of the arrow
do you check that visually?
so it's not a visual error
listen to the end, please
then i set the second arrow to the position give by the vector conversion
then i draw a line to the location of the vector conversion from the same starting position
and the lines diverge
i should be seeing 1 line
but im seeing 2
VERY clearly 2
again, don't check visually
further evidence is the muzzle device of the vehicle
i have another script set a target at the position of the arrow
send me the code
i'll prove to you it won't diverge
yes
arrow2 = "Sign_Arrow_F" createVehicle [0,0,0];
arrow3 = "Sign_Arrow_F" createVehicle [0,0,0];
addMissionEventHandler ["Draw3D",{
private _end = [0,0,0];
private _ins = lineIntersectsSurfaces [
AGLToASL positionCameraToWorld [0,0,0],
AGLToASL positionCameraToWorld [0,0,viewDistance],
player,
vehicle player,
True,
1,
"FIRE"
];
private _start = vehicle player modelToWorld (vehicle player selectionPosition ["konec hlavne", "memory"]);
if (count _ins > 0) then {
_end = ASLToAGL (_ins select 0 select 0);
} else {
_end = positionCameraToWorld [0,0,viewDistance];
};
drawLine3D[_start, _end, [1,0,0,1]];
private _perc = 100/(_start distance _end);
private _pos = AGLToASL(vectorLinearConversion [0,1,_perc,_start,_end,True]);
arrow2 setPosASL _pos;
arrow3 setPosASL AGLToASL _end;
drawLine3D[_start, ASLToAGL _pos, [1,0,0,1]];
hintSilent str(_pos);
}];```
picture for illustration: https://ibb.co/3k4Dvmb
add this:
hintSilent str ((_start vectorFromTo _end) vectorCos (_start vectorFromTo ASLToAGL _pos));
it'll be 1
therefore no divergence
that still doesnt change the fact that the arrow nor the line is along the start-end line
but they are not
that much is obvious
look at the picture
you cant credit that much divergence to a "visual error"
do you want them to be aligned visually?
or mathematically?
what is your end goal?
i want the red arrow to be along the path of the start-end line
currently it is not
hold on
i'll post an exhibit video
so that you can see the issue
here you go
this is impossible
it can't be the same code
are you sure it's actually the same code?
you see how the target strays from the line when the line extends too far
yes, it is the same code
want me to walk it all the way from main menu?
no
yeah, youre right
it's elevation that breaks it
so there must be one of the aslagl conversions
that im not doing right
but im not sure which one
it's not that either
really?
it's probably positionCameraToWorld
no, it's not
positionCameraToWorld is only used to find _end
both the _pos and _end lines use the same position
so it wouldnt matter what positionCameraToWorld gives
they use the same value
positionCameraToWorld can be whatever
because vectorLinearConversion and the non-linear conversion lines both use the same _end
so it wouldnt make a difference
even if the error was in positionCameraToWorld
which it isnt
are they in the same vertical plane or not, it's really hard to see
theyre not
couldn't you just cut the _start to _end vector and use that?

