#arma3_scripting
1 messages Β· Page 320 of 1
idk c++ is pretty easy... who doesn't know c++
and if the only language you know is sqf then chances are you're such a shitty programmer that you should go learn a couple real languages anyway
yeh it's pretty disorientating going from any other language > sqf
@vapid frigate and @pliant stream, both true.
But C++ is not really a scripting language. Unless there is support for the std, etc, it is not really pleasant to script on it.
i'm guessing that's the point.. it can be compiled
so you don't have all the overhead of sqf reading your scripts constantly
scripting is dumb anyway... static typed compiled is much better
If it is C++/CLI as speculated (and seen), that may serve help for those wishing to have a more comfortable introduction, despite the views of C++ programmers on it
"scripting is dumb anyway... static typed compiled is much better" no
""scripting is dumb anyway... static typed compiled is much better" no" yes
ok
I don't get this fascination with dynamic typing... moving something that could be done at compile time to runtime and for what? Better performance? Think again. Easier development? I don't think so... if your compiler doesn't know the types of objects all it can really do is spell check.
"It ain't what you don't know that gets you into trouble. It's what you know for sure that just ain't so." - Mark Twain.
You know for sure that static typing is better; it just ain't so. To disprove a positive statement, I only need to give you one counter example. Python or R for statistical analysis.
Neither static or dynamic is better; they are used to leverage different tradeoffs.
short question can i give a building some thing like a "laser marked " emission? its for a simple MP mission
@thick sage go on then, explain how python is objectively superior for statistical analysis to any conceivable statically typed language.
the fact is the more the compiler knows about your code the better it can analyze and optimize it and help you.
@hoary sentinel IIRC theres a laserTarget object you could spawn for example on top of the house
as I understood the docu. the laserTarget is for a unit the shall mark tagets, or am i wrong?
theres the command, but i think theres also an object with a similar name you can create with a script
LOL, sorry Untelo, but I will not lose my time on that.
okay then
why are you trying to look at languages like X is superior to Y
languages are tools. choose the right one for the job
and as far as statistical analysis goes, R is the one to use. and it's not statically typed
i have no clue.. hes the one that started bringing up specific languages
i was just talking about static vs dynamic typing in general
well, that was my point from the start, @rancid ruin, "Neither static or dynamic is better; they are used to leverage different tradeoffs"
i agree
and i know it's fun to bash SQF, but if the end goal is to script for arma 3, then SQF is the best language to use π
right tool for the job, etc
only by virtue of being the only tool available
soon you can theoretically code in whatever language you want once Intercept is done π
wait and see what happens with dayz and arma 4....there will be a severe lack of mods because people will have to learn a more difficult language
and/or better quality ^^
maybe, maybe not
yes but it will also weed out the idiot script kiddies
if the end goal is for people to make things to enable them to have FUN in a video game, who cares how it's achieved? i think there is real value in something like SQF
you're not working at google, you're making missions for a fucking game lol
totally agree @rancid ruin, great comment
so fuck quality of code then eh
no need to be all elitist and protective over your code
we're here to have fun, are we not?
yes fuck quality of code, doesn't matter if the end result is fun
personally i don't find either dealing with shit code, or playing a buggy/laggy game very fun but to each his own i suppose
i remember people going through rocket's dayz mod code and ripping in to him. but he's driving a maserati and those nerds aren't.
so you're commending a guy that makes a mod and when it becomes popular makes big promises only to take the money and gtfo?
i'm saying there's a man who brought fun to millions of people, using SQF and arma 2, that's all
i thought the point was for us all to have fun and not try our hardest to rip each other off
and anyway... how is writing or learning to write good code not fun?
i'm talking about the end result. players don't give a fuck how well something is coded if they're having fun, and rightly so.
in my experience they do give a fuck about how well the game works though, and that's a direct result of how well it's programmed
well, the grass is greener on the other side. i've had like 10 years of fun out of arma games, played 100s of mods made using a shonky scripting language. maybe if they'd used java i'd have played more fun mods, maybe not.
years of collective SQF knowledge will be made obsolete as soon as they change language. maybe for the best, maybe not. but we're still here enjoying the game so it's OK ππΏ
tbh there's not that much to sqf
Not that much? In theory maybe... But not in reality.. There are many quirks and weirdnesses/bugs
and most don't even seem to know or understand them
How can I do it correct: _SomethingRandom = a specifically map maker;
wat
maybe just _marker = "your_marker_name";
@tough abyss No unfortunately
Is there a way to access a file throug a script wich is somewhere on the arma server and not in the mission.pbo ?
@bleak schooner remoteExec for requesting, publicVariableClient for sending the file back to the client requesting
alt. remoteExec for sending it back too
Actually call compile preprocessFile "ID_Admin.txt"; was, what I was looking for
ID_Admin.txt is a script? π€
honestly if it's on the server why not just use an extension?
good man @bleak schooner wants https://forums.bistudio.com/forums/topic/175660-tutorial-server-side-scripting/
my script with trigger isnt working on my server
Elaborate please @clear carbon
my trigger on my server is not working this is my mission.sqm https://pastebin.com/LYqaCjdf and this is deatharea.sqf https://pastebin.com/8GBK0qeP
when i walk in that specific area nothing happens
Lemme get on my pc so that I can actually read those. Gimme a bit
π
Is there any script that can teleport player from place A to place B, just like BF4 elevators.
setPos
thx
what a complex script
got help from 7erra
@bleak schooner assuming that you want an admin panel ... you are doing no good and one will abuse it
client-side checking if one is admin or client-side execution of stuff is a horrible thing that you should not do
rely on server safety above client safety
always expect the player to be a hacked client
Hi there, is there any command or way to disable the drone radar and sensors? I tried: _vehicle setVehicleRadar 2;
_vehicle setVehicleReportRemoteTargets false;
_vehicle setVehicleReceiveRemoteTargets false; but enemies are marked on the radar :/
does anyone know how the "reveal marker" map function works in the campaign?
like when you zoom in the map at camp maxwell
Hey guys, does anyone know of any other way of getting variables active in missionNamespace other than allVariables?
why do you need another one? allvariables does exactly what you asked?
You could detour all functions that can set variables by making your own hack and record these calls... You could use intercept and just call hookFunction("setVariable",detour) ... You could find the offset of missionNamespace in memory and manually traverse the hashmap...You could use getVariable with default value to bruteforce all variable names... But why would you do such a thing if you can just call allVariables...
Yeah... what's the point? @SimZor#5644
In my description.ext I want to #include a file from a pbo file. But it's not working : #include "\pbo_file\test.hpp" Do you know why?
either the path is incorrect, or the pbo is not loaded
@vapid frigate, @still forum, @cerulean whale; Well I wanted to know if that would be sufficient enough to use that in CfgDisabledCommands so a hacker won't get my secret variables
ah ok, i don't know of any other way, but i imagine it wouldn't be too hard to find the list in memory
Ye that of course
Theres taekwondo
does anyone know how to find nearby ladders? nearestTerrainObjects/nearObjects/nearEntities gives me nothing
Arent they part of the actual building?
probably
they're in the config but i'd like to distance check
using it with action just teleports the ai
@rotund cypress With battleye enabled?
What do you mean? @still forum
If you have battleye enabled on whereever you want to protect your variables?
Of course I have battleye enabled
Then CfgDisabledCommands should surfice
You mean since it will be harder for them to hack memory?
yeah
Well.. going KernelMode is the only BE workaround that I know atleast. And people who can do that... Can do whatever they want not just fiddle with your variables
do players in spectator slots count to allPlayers?
I created static weapon with "creteVehicle" and gunner with "createVehicleCrew" command, but createVehicleCrew has no return value. Is there a way the crew get no damage?
Its not actually a playable unit, but allPlayers should include yes @delicate lotus
set allPLayers in debug console while someone is in a slot and try
okay ^^
@quasi rover mortar doesn't have "crew" defined
just spawn a whatever faction unit and move him to crew position
oh didn't read it properly.. apparently the crew thing is working fine
The static weapon was HMG and GMG. and when I use the createVehicleCrew, the crew is gunner of the weapon.
yup it works like that
almost.. allowDamage instead of enableDamage π
thx, I'll try it.
@fallow radish
this addEventHandler["Respawn",(group this) setVariable ["GAIA_ZONE_INTEND",["2", "MOVE"], false];
(group this) setVariable ["mcc_gaia_cache",true, true];
Eventhandler accepts CODE or STRING.. you passed neither of those.. CODE is wrapped in {} and STRING is wrapped in ""
You passed the return value of setVariable. Which is nothing
@cedar kindle you could try scanning the buildings for ladder climbing addactions
I forgot the specifics but it should be possible
Look around their config, youll get a modeloffset and apply that with a modelToWorld
I created USS Freedom, its turrets and crew with creteVehicle, attachTo and createVehicleCrew command by script, but the turret head is moving without imtermission. so the fire accuracy rate is low. what did I do wrong? https://youtu.be/Vuif9cd3ks4
thanks nick
ok thanks for that @still forum
Hi. I am making two different variations of the same aircraft. 1 with fueltanks and the other with missile pods. I know of two ways to do this.
-
include both(fueltanks and missilepods on top of eachother) and use a script for each variation to hide a selection.
-
make them as seperate objects and use a script with attachTo for each of them.
which solution is best performance wise? or is the difference insignificant?
Hey guys, does anyone know if there is any big difference between using ctrl or rsc? as in ctrlMap or RscMap
Rsc is a Display. ctrl is a control inside the display
I mean like
some bohemia displays has
ctrlText
some have rscText
I.e. eden just uses ctrlText, ctrlStatic etc etc
Other displays mostly use RscText, RscMap etc etc
Anyone succesfully disabled teleporting on mcc? module doesnt work, ```SQF
MCC_t2tIndex = 0;
MCC_teleportToTeam = false;
MCC_alwaysAllowTeleport = false;
Anyone know how to set a cooldown for a repeatable trigger after activation?
I mean did you try the cooldown attribute?
there is only timeout and countdown
i did an easy fix but not what i really wanted
just made the trigger huge and gave it a time out. problem is its repeatable and every player that enters will set it off
if there is a cooldown attribute im not aware of it
depending on what you understand with cooldown, either timeout or countdown does the trick
(likely timeout)
either way those two functions will activate the trigger once conditions are met. The problem is once the trigger activates(after conditions met) there is no way to delay a repeated activation of the trigger via cooldown or sleep unless you script it in. I just don't know how to do that.
is there no timestamp function or something like that?
can you reset a trigger using a script?
because then you could place a second trigger with a countdown which activates the other one
just script it
set a global var with the time and check if x time has passed since last activation
might even be able to set the var locally on the trigger object/logic/thing
I know what he could do
he could do a check for a variable which gets reset by a script which uses sleep
no π
um why not?
do whatever works π
personally I'd rather do time checks than sleeps
opinions and stuff
the problem with time is that its not always correct
wut
which one?
All of them
they are irrelevant in this case
is there a script function to get the real world time?
No.
There are Extensions for that
oh okay
so extensions. alright ill try browsing through the libraries. thanks guys
will lbData index start from 0?
@little iris don't, the extensions mentioned above are completely unrelated to what you wanted ^^
[thisTrigger, thisList] call {
private _trigger = param [0, objNull];
private _list = param [1, []];
if (diag_tickTime >= (_trigger getVariable ["trigger_time", 0])) then {
_trigger setVariable ["trigger_time", diag_tickTime + 30];
// do your stuff
};
};
put something like that to the activation field
30 is your cooldown in seconds
didn't test it so it might have some errors ^^
I guess you could also add it to the condition field Β―_(γ)_/Β―
holy shit, addForce and addTorque commands!
probably not what you're hoping they are for, but maybe.
i hear rumors of 'canopies'
well maybe they finally came around to it? https://feedback.bistudio.com/T82565
also that would seem awefully contrived to use addForce and addTorque for something that is not force and torque related ...
https://gyazo.com/bf86acf48d8349729fe2f07da6ec527a From ACE Slack.
i would imagine like most things, it can be used for a number of things.
lol, unless it ends up being one of those things you can't. because it's 'purpose' built. π
The toFixed alt. syntax is neat
Anyone know if onMap mission eventhandler will trigger when GPS is opened?
it won't
Added: New directionModelToWorld, directionModelToWorldVisual, directionWorldToModel, and directionWorldToModelVisual script commands ```
Neat!
setforce/settorque ?
hm, alternative to setVelocity? oO
reyhard mentioned it being used for canopies, i assume the ejection cycle. hinted at things perhaps also working for turret popoffs. so meh, i'd like to think it'll work elsewhere. i haven't even had a chance to look or tinker with the latest update.
I got alot of ideas, what to do with it
this is what i was hinting at earlier, but im fairly optimistic this time around.
Β―_(γ)_/Β―
yeah there was only setVelocity so no way of adding pitch / yaw velocity without doing it instantly with setVectorDirAndUp / setDir
seems the second point array in addForce is the application coordinate in world space and the first one is the amount of force in world space
someone awake? π
Definitely not
Any ideas about turret's head banging? Aircraft carrier was create by "createVehicle", turret created by "createVehicle" and "attachTo" and crews created "creatVehicleCrew". https://youtu.be/Vuif9cd3ks4 π¬
that is very weird
does it do the same thing if you place the turret(s) through eden?
also post the full script I guess
its caused by "attach to" script. For some reason the static turret AI spazzes out when attaching their weapons to something
Is is possible to make a player auto run without mods?
well I think thats a bit hard but you could always set a desired velocity
That doesnt trigger any animations though, including the running animation. Its virtually impossible to do in vanilla properly
play the walk/running animation and use animchanged to repeat it
That could work actually, ill give it a test later
player addEventHandler ["AnimChanged", {
player playMove "amovpercmrunslowwrfldf";
}]
this works
just make it interruptable
Cheers mate!
Here is the simplifed code, turret's head banging on USS Freedom. Actually no crew by "createVehicleCrew", no head banging. and it's okay, no head banging if I place the turrets through Eden. @halcyon crypt
Any ideas?
_carrier = createVehicle ["Land_Carrier_01_base_F",getMarkerPos "uss_freedom_marker",[],0,"None"];
_carrier setPosWorld getMarkerPos "uss_freedom_marker";
_carrier setDir 90;
[_carrier] call BIS_fnc_Carrier01PosUpdate;
_turrets = ["B_SAM_System_02_F","B_AAA_System_01_F","B_SAM_System_01_F","B_AAA_System_01_F","B_SAM_System_02_F","B_SAM_System_01_F","B_AAA_System_01_F"];
_turretsData = [
[[30.3,175,21.47],0],
[[47,-0.05,19.81],90],
[[24.8,-115,18.39],90],
[[-29.3,-105.5,19.35],270],
[[-29.3,-100.8,21.11],270],
[[-39.3,178.5,21.62],0],
[[-16.85,188,12.96],0]
] ;
{
_x params ["_pos","_dir"] ;
_class = _turrets select _forEachIndex ;
_turret = createVehicle [_class,[0,0,0],[],0,"CAN_COLLIDE"] ;
_turret attachTo [_carrier,_pos] ;
_turret setDir _dir ;
createVehicleCrew _turret ;
} forEach _turretsData ;
@austere hawk mentioned above that attachTo is the cause
Yes, any other solution?
hmm I guess you could just spawn the object at the correct position
without attachTo
since the carrier doesn't move anyway
_carrier modelToWorld _pos
for the position
I think
_turret setPosASLW (_carrier modelToWorld _pos) should be it i think
Thanks, it'll be a clue for coding. @vapid frigate @halcyon crypt @austere hawk π
I need help with an Arma3 Altis life server. Is there anyone out there ?.
@tough abyss Whats up?
I attached to MK49 Spartan to a C-130J but for some reason they are behaving dump and not shooting like they do on the ground. Does attachTo affects the AI in any way?
ah I know why @indigo snow If I enter the uav terminal I'm not able to target the enemy shikra, instead the c-130 is targeted where attached. I guess thats the problem
How would one get the offset of object 1 based off of object2 (Center / [0,0,0] ) I tried modelToWorld on both objects and then going through a process to subtract the values and that didnt work unless im doing it wrong ?
Im pretty sure i had the wrong idea on how to do it.
The alternative getPos syntax?
Ill take a look now one sec, Thanks
Dont think that would work as i need the offset of obbject1 in relattion to object2 to give the attachTo offset
i found somthing KillzoneKid posted awhile back which i think is what im looking for
Tried (OBJ1 modelToWorld [0,0,0]) vectorDiff (OBJ2 modelToWorld [0,0,0]) ?
Thats what KK did so yea think thats my solution Thanks π
would require more work though as it gives the same effect as my method but instead not 18 lines its 1 lol
But hey now atleast i know about vectorDiff for the future xD
when a client disconnects, will units spawned on his machine be always handed to the server or to someone else? maybe closest other client?
units disconnecting will not spawn and if he had previous units they have to transfer
can you elaborate? "have to transfer" - do you mean they will because they need an owner or you mean it has to be done manually?
i mean spawned ones using createUnit or createAgent
ok thx. that makes sense. saves me some debugging
Is the clientID of the server hosting the mission 0?
[(random 60),(random 1)] remoteExec["setGusts",0,true];
[(random 60),(random 1)] remoteExec["setRain",0,true];
[(random 60),(random 1)] remoteExec["setOvercast",0,true];
is this anything wrong with this code?
Nevermind π
Yep, that's why I said nevermind. My brain is so wack - no sleep π
Wow, that's serious mind fuck.
So, in theory. I could make super stringy looking rain? π
I'm telling you: it's all mindfuck. That's interesting, time to test! π
@tough abyss I've heard you say that setOvercast can be quite buggy at times. How would you recommend using it properly? Does it work okay with transitions? Or does forceWeatherChange need to be used with it for it to take effect properly. From my experience the transitions arent usually very accurate
Cheers for the detailed response. @tough abyss I might just us use forceWeatherChange for setOvercast but for the other commands such as setRain/setFog/setWind etc use transitions. Im sure that would work fine?
Has anyone used the instigator argument in HandleDamage? Not sure if I should use it over the source parameter for detecting who the killer is
isn't that parameter new? so yeah probably not many people have used it yet
you could do some pioneering research right now bro, make a name for yourself
afaik they added it just for that cause, finding out the killer
Yeah I might as well just do some testing with it.
it's pretty easy to stitch all the related handleDamage events back together... a set always begins with part "" and each event is raised synchronously and back to back
what you can do is give the object which damage you're tracking two array variables: dmgsets and curset
dmgsets stores all damage sets. curset stores the current damage set
on each "" event you add curset to dmgsets and start a new curset. then at at the end of the frame you can handle all sets in dmgsets as well as curset, and clean both
can you use #define in sqf scripts?
ofcourse
cool
it's pretty limited compared to CPP though
also can cause crashes at least in A2 if used wrong
dunno if they fixed it later
I only play A3 ^^ and I also dont mod
how is it limited?
thought it was near identical.. only things i've had not work was fine in sqf but not cpp
iirc you can't pass function macros as parameters
passing too few or too many parameters (can't remember which) would crash the game without any clear errors
no variadic macros
# in macro expansion i think had some issues
also, while it's not directly related to macros, #ifndef and #else are horribly broken
commy the MacroMasterβ’ will appear soon if you carry on like this
macro master eh? i wonder...
they're literally not broken and is used often
really? maybe they fixed it in A3
how are they broken?
#ifndef X
#ifndef Y
systemchat "1";
#else
systemchat "2";
#endif
#else
#ifndef Z
systemchat "3";
#else
systemchat "4";
#endif
#endif```
let me go and try see what happens
what are you high
The only broken macro thing I ever noticed was TFAR stuff. But that's also kinda macro hell. creating 1k classes using nested macros
of course they work in CPP
what does that even mean? arma C preprocessor?
Arma only has one preprocessor
config.cpp / description.ext
well when i say CPP i obviously mean C preprocessor
i don't
yeh nested #ifs don't work in arma's preprocessor in cpp files or sqf files
it says so on the wiki (i tested as well) https://community.bistudio.com/wiki/PreProcessor_Commands
i don't know where you're getting your information but nested #ifdefs work perfectly fine...
it says IFDEFs cannot be nested, as the preprocessor will generate an error if the outer definition doesn't exist.
and is correct
so they'll work.. but only if the outer one is true π
Mikero also reported nested ifdefs broken
hmm
you're right
i thought it was only nesting inside #ifndef and #else blocks that was broken
so it's even more broken then
well, crap. I have been spending my time parsing nested #ifdef...
nested ifdefs are not a problem. If you pack your addon with Mikero
And not use them in sqf. Which armake will probably also fix. I hope.
So.. Depends on packer.
can't fix the game with tools... they'll be broken in sqf no matter what
i guess 1999 czech republic had no internet to download libcpp with
Β―_(γ)_/Β―
No. Tools that preproc SQF before packing.. would fix the sqf.
you mean break the sqf?
no.
sqf being preprocessed at runtime is very useful though
so in my view preprocessing at build time is breaking it
Well.. defines in includes packed into the pbo are not gonna change after packing
no, but the pbos can change
Invalidating bisigns. And.. stuff
what are you on about
why would the signatures be invalid?
i can sign two different versions of a pbo with different defines can't i?
If you change the pbo after packing and repack it. You would invalidate the old bisigns
Yeah.. At build time. Meaning sqf's being preprocessed at buildtime is not a problem
jesus... in pbo A i include from pbo B a file with a bunch of macros... A doesn't know what kind of macros it's going to get from B at build time
You can't statically preproc the sqf in pbo A then ofcause.
exactly
But again that's packer/ pbo file specific.
So defines that stay in the same pbo might be preproced at buildtime
if you preprocess sqf at build time you're essentially statically linking it to an exact version of the other pbo. it's essentially the same difference as static vs dynamic lib
except it breaks if you use a different version of the pbo
it would be like statically linking to offsets in a to a specific dll, but at runtime any version of the dll might be used
in other words it would break horribly
As I said you can only preproc defines that are known to be static at buildtime. So defines that come from other pbo's shouldn't be preproced at buildtime
still doesn't fix #ifdefs
unless you only preprocess those, but leave the macros intact
i doubt such a tool exists though
i suppose it would be pretty neat
Might fix some though
For example it would fix all the macro issues in TFAR as the broken stuff is all locally defined
Armake could do it. Would require some work but is actually no problem.
I planned to use it for Arma.Studio. So you can set build-time global defines. To for example have debug builds and such
i'm using a separate my_debug addon that only has macros to enable or disable different debug features in sqf
you can just switch it out with a signed one that provides the debug features that you want
and no need to distribute debug versions of other addons for each release
You generally don't distribute debug builds anyway
is there a way to solve this problem with little scripting?
I dynamically spawn units near players but I want to replace that system with truck delivery which means that I spawn trucks full of infantry which are moving to the players to deliver the infantry. But players also have the ability to move around on the whole map so is there a way to make the AI go back into the trucks and move them again to the players?
perhaps, but with my setup you can disable all logging with 0 performance hit because they're all macros, and you can enable them again by just switching out the small debug addon
does allPlayers include people in lobby?
no because they arent a entity at that moment
ok
Wow I just wrote my own object grapper function until I realise that BIS has already one ...
@pliant stream @still forum not like it is already reported ... https://feedback.bistudio.com/T76800 + already said it in here multiple times and called for support and interest
was created back in mantis time
No doubt but it's not like they'll fix it
I got the impression that no one from 15 years ago even works on arma anymore, and knowing what the code looks like i dont blame them for not wanting to touch it
I guess using actually working open source libs was too mainstream for them
The infistar closes the "fired event handler" and the safe zone does not work. How to fix it?
@delicate lotus is it better than BIS', though?
I dunno if it even works
I just made it export
still need to do import stuff
I hope the worldToModel and modelToWorld stuff works like I think it works
revealing objects to all players speeds up the rendering process right?
what? π€
@delicate lotus why don't you take a look at the wiki? π€¦
@delicate lotus re: trucks + AI, i would just delete both and create new ones when players move far away
mmh yeah sounds like a good idea
you could be waiting for any amount of time for the AI to get their shit together
true
π€¦
i also wrote an object grabbing script before i found the BI one, welcome to the club!
@subtle ore stop with that. You are like a 12 year old who only answeres shit to all questions
@delicate lotus #offtopic_arma or I don't reply. Simple.
Oh god forbid I could help cries
you and help. Funniest joke ive ever heard xD
but I thought youd like to stop replying to me?
please, ladies
yes
π
is one of you a Life developer or something?
me? no
@rancid ruin Not a chance.
then you should both be above this petty squabbling
That was a ongoing conversation, ignore it. End.
group object, what happens if the object has no group? grpNull returned?
every unit has a group
brainless objects, like empty vehicles, will return grpNull
the group object returns an array of objects within the group correct?
or just units _unit
done, and thank you.
I totally forgot to get the direction of the objects I am trying to save
well lol
the result was quite funny tho
will a "local" eventhandler reliably fire even if the original owner client does alt+F4 or will i need to apply the EH on the server not matter what?
it wasn't reliable in the past (A2) and I doubt much has changed
k. better be safe then. thx!
after a client disconnects, the objects owned by them are always acquired by the server and when that happens the eventhandler should execute
it's not like the client sends some message to the server saying "hey i'm going away now, take these objects"
https://dedmen.de/sharex/ufLxc6OA.png Progress! I put this together in half an hour. It is really barebones.
Can I get help writing a money script that works with extDB?
what kind of money script?
you are best off trying your best, writing something really basic, or something which doesn't work, then ask here for help @reef grove
e.g you can just forget the extDB part for the time being. that will make it much easier. add DB stuff when it's working 100%
depends how you want to approach it
you could just setVariable a "money" var on to each player, then sync that to your DB every now and again
what i did for one of my missions is make custom money inventory items, that way it just ties in to my inventory saving system, for example
Start with 0 cash. You get 10,000 cash, leave, come back it will stay
I dont know how to query, insert, and sync using extDB
which version of extDB are you using?
and you already have it running successfully in a mission?
in terms of extDB
or the money?
Because I haven't started working on cash because I feel like I need to start working on that while extDB is setup
I feel like I would have to do setVariable "EXTDB:QUERY:###:###:###:ETC"
i mean do you have extDB running properly already. but yeah you should write the money system first and worry about extDB later imo
well i've some experience with SQL but never used this addon. you've read the documentation right?
are you adding this to a mission which is already using extDB successfully or are you building one from the ground up?
Nope. Im essentially creating a new RP framework for my community
I can script, I just don't know how extDB works.
The documentation isn't very understandable
mmm, when I looked at it, there are 2 ways to use it
there are provided functions which are just generic sql commands
or you write your own sql and use their custom wrapper
I don't know why, I just can't understand anything with extDB even though it seems simple. I understand MySQL
and then you are running against a remote/local DB like mysql or mariasql
I'm going to be trying to use it in a while and I looked at it, was going to run the custom sql
oh, life, i'm out then π
Function
"extDB3" callExtension "0:sql_custom:addKill:ofps_rhs_tank,deadlydays" ```
INI
```C
[addKill]
SQL1_1 = INSERT INTO tableName(className, killedByName) VALUES (%CUSTOM_1%, %CUSTOM_2%);
SQL1_INPUTS = 1-string,2-string ```
as I understand it, something like that
you create a function in INI with the custom SQL code
and you create your DB connection in a conf file
all of which you reference in your function
and you put the values you are passing that the end, which you descript the order of in the INI
hmm
inputs is the order related to the function, and the 1-datatype, the 1 ties it to the %CUSTOM_1%
is how I read it
I just guessed at how it works, but that is what makes sense
when I looked at it
and className would %CUSTOM_1%?
and killedByName would be %CUSTOM_2%
So basically
this logs that an ofps_rhs_tank was killed by deadlydays?
So I can essentially loop every minute on the client:
"extDB3" callExtension "0:sql_custom:syncData:uid,cash,bank,health,hunger,thirst"
I really don't know. I've been trying to get help specifically with extDB and haven't had any luck.
you found the documentation page right?
yea, if you run it from client more vulnerable to hacking I'd think
so you have the db connection info in extdb3_conf.ini
in SQL_CUSTOM INI you create the function with your custom SQL code
then u need to init ur DB connection
9:ADD_DATABASE:a3w
9:ADD_DATABASE_PROTOCOL:a3w:SQL_CUSTOM:sql:a3wasteland.ini
0:sql:existPlayerInfo:123123123123
their example code
so the add the DB, which is defined in their conf.ini file of db's, a3w
a3wasteland.ini is just a <SQL_CUSTOM_FILENAME>
so it has a bunch of functions I assume
they tie the DB to a protocol name
sql
and then they run the command using protocolname:functionname:value
the number in the beginning are the connection type to db
listed there
of course I haven't done it, all supposition
based on documentation
I got the database connection working
however, I think I just need to find someone to handle extDB for me
It'd be more efficient
gl
ty
Would the easiest way to set object positions compatible over both water and land be through using ASLToATL (getPosASL player) and setPosATL? Rather than checking if their position is over water or land, and then using either setPosATL or setPosASL?
If I have time in the future I will add a Lua binding for Intercept. But that's far future. I'm kinda booked for the next months I said that 24 days ago.. And now
https://www.reddit.com/r/arma/comments/6dy7vg/lua_scripting_in_arma/?sort=new
hmpf. Oops... I guess.
Is there a way to make a object only destroyable by certain weapons (explosives)?
like I want to have a radar tower but only infantry with Explosive Charge should destroy it
the HandleDamage EH would be a way to do it
really? Guess Im going to take a look at it ^^
I hope its not too complicated to do it for all the explosives added with ace
you can probably check if the ammo is typeOf "Explosive" or something
how can I return stuff?
whatever the last line of code is gets returned
With an example:
_y = {
if (_x == 2) exitWith {
100
}
} forEach [1,2,3];
_y becomes 100.
_y = call {100}
ah okay
the function BIS_fnc_taskCreate can take a side, a group, a object and a array as task target but also a boolean
I dont understand the boolean
is the boolean for mission wide creation?
Is there a way to remove the watermark people get by not having a dlc using a script?
buy the dlc?
^^ The DLC is legitmate adblock (with the exception of Tanoa)
Does it only show up when they are in one of the jets without owning the DLC?
If so, then the watermark is justified. Purchase the DLC if you wish to use it.
pay to win π
I have all dlcs except jets
I'm getting a Error missing ; error with this
_x hint "Spawn protection enabled";
Is that even close to being correct to begin with?
hint only accepts one argument on the right side. What is that _x doing there?
well I was thinking it would only display the hint to those players that are inside a trigger area
You'll have to execute it locally to the client (you want to hint on)
_x allowDamage false;
_PlayerInAreas set [count _PlayerInAreas, _x];
hint "Spawn protection enabled";
}; ```
that's the whole thing. I'd like that to be so that the "Spawn protection enabled" hint would only be shown to the players that actually are inside the area
as it is with the current form of that script the hint is broadcast to every player
Take a look at remoteExec
that seems to be broadcasting as follows: on each connected client, on first connected client, everywhere but server and so on
targets parameter Object - the function will be executed only where unit is local
That is exactly what you are trying to do here.
Combined with Array - array of any of types listed above to save performance
How would I go on referencing these objects in this case?
Do I need to type in all of the player name variables or can some common denominator handle that?
well.. you have _x right? so you already know how to get the objects inside the trigger
just use them
went with this but no positive result was given (as in no hint was shown)
['"Spawn protection enabled" remoteExec ["hint",_x];',[],100];
wtf are you doing? ^^
this (also) achieved what I was going after.
"Spawn protection enabled" remoteExec ["hint",_x];
Can I ask, is there any actual difference what style to use? Why in the first place there is so many possibilities?
what's with the <text> or 'text'
these all are as good?
No, <> is generally meant as a <fill in blanks here>
kk, and it can be used in scripts apparently then(?)
and Thank you @dusk sage @still forum @tough abyss π
Anyone with experience with extDB able to help me setup some stuff?
how can I check what uniform type a unit is wearing?
uniform UNIT
oh
yea sometimes its easy like that
I'm trying to find direction for AI vehicle spawn at random place with the area(_rad), but I got error msg, not alway but sometimes.: undifined variable: _direction. that's because the number of "_roadconto" (count _roadconto) is zero. so how to select "_roadsel" until count _roadconto > 0" ? π¬
_roads = _marker nearRoads _rad; //_rad = 300
if(count _roads > 0) then {
_roadsel = selectRandom _roads;
_roadconto = roadsConnectedTo _roadsel;
_direction = [_roadsel, _roadconto select 0] call BIS_fnc_DirTo;
};
Yes. Tanoa map.π
Thanks, Quiksilver. I'll give that a try. π
It works well, I actually spent a whole day to find this error and tried to solve it. but you did. thanks again. @tough abyss π
Wow, numbers and dot are displayed. I'll save it and study this code.
Is there a way to see the hpp file for the endgame spectator?
So uh. Seems like setVelocity in combo with ai has quite the interesting result. The plane hits the ai before they start falling π€ 15,000 km/h
@grizzled spindle if you've extracted arma to your P:, it should all be in P:\A3
How would I go about getting all of the items in the game? Such as gps, map, attachments, etc.
But not weapons, vehicles , etc.
there are commands to get the items of units and the cargo of vehicles
just count them and add them together
Huh? Im talking about using configFile to extract the items lol. Similar to how you would setup a vehicle spawner and extracting the vehicles out of CfgVehicles. I've done this with weapons, just cant figure out items.
@jovial ivy Play around with that.
_Class = "Air";
_ClassList = "true" configClasses (configFile >> "CfgVehicles");
{
_CfgName = (configName _x);
_IsClass = _CfgName isKindOf _Class;
if(_IsClass)then
{
_Scope = getNumber(configFile >> "CfgVehicles" >> _CfgName >> "scope");
if(_Scope == 2)then{diag_log _CfgName;};
};
}forEach _ClassList;```
You should adjust the CfgVehicles before using it π
Thats basically what I have. Do you happen to know the class for items?
CfgItems / CfgMagazines?
CfgWeapons
everything that can go in inventories is in CfgWeapons, CfgMagazines, CfgVehicles (backpacks), and CfgGlasses
gps, etc are in CfgWeapons
ah, yeah. CfgWeapons not CfgItems π€¦
"getNumber(_x >> 'scope') == 2 && getNumber ( _x >> 'Type') == 131072" configClasses (configFile >> "CfgWeapons");```
that should get all non handgun/rifle/launcher/binocular items
then you can check if _x >> 'InfoType' >> 'Type' is equal to one of these:
#define IIT_SUPPRESSOR 101
#define IIT_SCOPE 201
#define IIT_RAIL 301
#define IIT_BIPOD 302
#define IIT_HEADGEAR 605
#define IIT_UNIFORM 801
#define IIT_VEST 701
#define IIT_NIGHTVISION 616```
you can also check _x >> 'simulation' for "itemmap", "itemgps", "itemradio", "itemcompass" and "itemwatch"
https://pastebin.com/rdarzium that's my old but functional function for sorting everything into arrays
medical/misc/grenades/explosives are entered manually though (mainly for random stuff from mods)
Does anyone know what the undocumented variant of getUnitLoadout that takes array as argument does?
any way to get the currently set shift-click waypoint?
Hmmmm
Use the keyDown eh to detect shift+lmb
Have that pass a variable and record a time, then use onMapClick to get the data and record the time of the onMapClick
If the times are within a small period of time, say 0.01 seconds, it's safe to assume that onMapClick has recorded the shift click
Only problem is that you'll have to run it from the start of the mission
EDIT: just use onMapSingleClick's check for shift capability to record the waypoint
I'm trying to get this to execute across all players on a dedicated server when a trigger is activated.
Currently have
"scripts\python.sqf" RemoteExec ["ExecVM"]
on the trigger
The script is to add a weapon to every player when activated
if (isServer) then {
cutText ["DRAW!","PLAIN",4];
Playsound "Draw";
{_x addWeapon "RH_Python"; _x addMagazine "RH_6Rnd_357_Mag"} forEach allUnits + playableUnits + switchableUnits;
};
Nothing works on a dedicated server annoyingly, any help?
Tried changing the locality to all connected clients?
What do you mean exactly? As in using allPlayers?
When you execute remoteExec, point it at allPlayers
write a 0 as target. That will execute on all clients
yes
That doesn't work either, and reading upon the wiki for RemoteExec it says that 0 is default anyway
Toss a hint before the isServer check to see if it's firing
What i don't understand is that i've used
"scripts\scriptname.sqf" RemoteExec ["ExecVM"]
before on multiple times for many missions now and it's worked, so what would be different this time?
I'll add the hint just to see if it is actually going
Sure you put the script in the right place?
Do you happen to have a CfgRemoteExec set up for your mission
Not entirely sure, I'm helping a friend out by adding this script to his mission, it appears to use the F3 framework, which i have no experience in so maybe that's fucking it up
Id suggest finding out because it may be configured to block un-whitelisted functions/commands
Yeah i'll strip out the F3 framework and give that a shot
Id check in the description.ext of the main mission first
See if theres any references to CfgRemoteExec
i did that, didn't show anything about CfgRemoteExec
cutText ["DRAW!","PLAIN",4];```
with a dedicated server, that text won't be shown anywhere
the other part should run (on the server only)
If cutText doesn't run on dedicated servers then would it skip that part and carry on with the script to give all players the revolver?
yeah, afaik
I tried it but none of the script executes
is it just meant to work on players, not AI?
You must be doing something wrong. Try executing it in the debug console with the mission to see if it does anything
Probably something to do with how the trigger is set up
All players inside the server yeah, I did try Allplayers before but that didn't work, gonna try all other options
I'll use a hint to see if it is the trigger
"scripts\python.sqf" RemoteExec ["ExecVM", 0]
with python.sqf as
Playsound "Draw";
player addWeapon "RH_Python";
player addMagazine "RH_6Rnd_357_Mag";```
should work
That was what my original script looked like, that didn't work either, the wiki mentions that player is different for every client on a dedicated
"In MP this value is different on each computer and on dedicated server this value is null"
yeah player = your client
yep.. so those lines wouldn't do anything on the server
so you could use "scripts\python.sqf" RemoteExec ["ExecVM", [0, -2] select isDedicated] to skip it running on the server (since it won't do anything anyway)
but doesn't really matter
Okay, it's not the trigger, just put
inside the script, it's def the script then
before it does the isserver check
the script looks like the first part is designed to be run on clients, the second part on the server
yeah gonna check if there's a global command to make text appear
if you use the script i pasted it should work?
(if a hint worked)
no if(isServer)
right, so just remove the isserver, lemme see
are self made funtions preloaded into the mission? ie. if I have 1000 scripts and make them all class funtions will that be more strain than having a folder of 1000 scripts and the mission can access each as it needs?
functions are compiled at runtime.. but i don't think it's slow enough to be an issue
i think it's more efficient than loading/compiling them while the game's running
Yep, it was the if isserver fucking it up, thanks lecks, and thanks to everyone else who helped
wait you put isServer in a script which is execute on all clients on purpose
?
does that make any sense atall?
just make sure u change it to the player addmagazine instead of the loop too harry
otherwise it will run it 'from' all clients 'for' all players
(with 20 players, everyone would end up with 20 mags)
Am I trying to execute things globally twice by doing that, further? i'm not sure what you mean by that, @vapid frigate will do
If you're remote executing the script globally, it would be running the following on all players: {_x addWeapon "RH_Python"; _x addMagazine "RH_6Rnd_357_Mag"} forEach allUnits + playableUnits + switchableUnits;
Oh I see, I could of just executed it locally, right?
that loop could/should just run on the server
the other 2 lines need to run on clients
^ Or just this:
cutText ["DRAW!","PLAIN",4];
Playsound "Draw";
player addWeapon "RH_Python";
player addMagazine "RH_6Rnd_357_Mag";
yeh i pasted that earlier, just less colourful
yeah lol
π
np
if(!(isNil "unitspawned")) then {
if(unitspawned) then {
terminate _thisScript;
};
};
_markers = allMapMarkers;
_vmarker = [];
_imarker = [];
{
if(_x find "vehicle" == 0) then {
_vmarker = _vmarker + [_x];
};
if(_x find "infantry" == 0) then {
_imarker = _imarker + [_x];
};
} forEach _markers;
_lclass = "I_C_Soldier_Para_4_F";
_rpgclass = "I_C_Soldier_Para_5_F";
_rclass = "I_C_Soldier_Para_2_F";
{
_pos = getMarkerPos _x;
_grp = createGroup independent;
_veh = "I_G_Offroad_01_armed_F" createVehicle _pos;
_grp createUnit [_lclass,_pos,[],5,"NONE"];
_grp createUnit [_rclass,_pos,[],5,"FORM"];
_grp createUnit [_rclass,_pos,[],5,"FORM"];
_a = _grp createUnit [_rclass,_pos,[],5,"NONE"];
_a moveInAny _veh;
_a = _grp createUnit [_rclass,_pos,[],5,"NONE"];
_a moveInAny _veh;
} forEach _vmarker;
{
_pos = getMarkerPos _x;
_grp = createGroup independent;
_grp createUnit [_lclass,_pos,[],5,"NONE"];
_grp createUnit [_rclass,_pos,[],5,"FORM"];
_grp createUnit [_rpgclass,_pos,[],5,"FORM"];
} forEach _imarker;
hint format ["%1 - |- %2", count _imarker, count _vmarker];
unitspawned=true;
I have a problem with that script. it spawns somehow all units twice. Like there are two infantry groups per one marker but there should be only one. Why is that so?
Marker count is right because I already checked that. (There are 6 inf markers and 3 vehicles markers but 12 inf and 6 vehicles)
Also I execute the script in initServer.sqf but because I am trying to play the map in singleplayer too I add this to the init.sqf.
if(!isMultiplayer) then {
execVM "initServer.sqf";
execVM "initPlayerLocal.sqf";
};
Nothing wrong with that right?
Also the second vehicle which is spawned is not filled with units. They are outside of the vehicles.
this seems really strange
init scripts run automatically, you don't have to tell them to run
yeah but I thought the initServer and initPlayerLocal are MP only
nop
in SP you're both player and server
I did
read it again
maybe I shouldnt read stuff like that at 35Β°C
yeah I just tested the mission in MP. works like a charm
was obviously my compensating error lmao
basically, just never execute any scripts on that page manually
that's not the point of them
are both of those the script you pasted?
one is the script. the other one is the init.sqf
but my problem is already solved
k
Would anyone here know why createDialog "RscDisplayOptionsAudio"; doesn't create a working dialog. Only shows a few options that doesn't really change any audio. π€
It shows the dialog as usual, but any of the options does not work
Same goes for RscDisplayOptionsVideo
@rotund cypress how are you creating it exactly?
With the snippet above
Is there any way to filter the find the difference between a say Lmg and Sniper from the config class?
@jovial ivy CfgWeapon config entries have parents.
Look in the config viewer, they are all along the bottom. You can identify them
Got it working with some interesting code to say the least. Thanks π
showGPS false; does not work anymore. Is there a new command to disable left/right panel/minimap?
that's not a script though is it
i'm pretty sure they broke some of the map and GPS commands a few updates ago. they weren't working properly when i tested them a couple of weeks ago @frank marsh
nice, it was that connor dude who i tested it for earlier this month
i feel like i've contributed something now
Or use switch to the preset @tough abyss π€
Possible anyone would know anything of what I wrote above?
i'd guess it's a child display of the main options display. something like that
The same is with createDialog "RscDisplayPause";
@rotund cypress " i'd guess it's a child display of the main options display. something like that" - @rancid ruin
Main Options Display?
yeah i'm pretty sure some dialogs/displays are children, e.g you would need to create it's parent first
hmm
The audio options is created by default through pause menu
But the pause menu buttons does not work either when creating it
It doesn't even have an IDC @rancid ruin Not even RscDisplayOptions
So your theory probably is right
However that begs the question what the main display is
dig through the config and try to find it?
although i can't think of any reason why you'd need to open the options menu via script
you're not the same guy who was fucking with people's UI colour preferences via script are you?
Well this worked _display = (findDisplay 46) createDisplay "RscDisplayInterrupt";
What do you mean? @rancid ruin
some guy a while back thought he was clever cos he was changing the colour of people's UI to "fit in with my mission" or some shit
thought you might be trying to fuck with people's audio settings or something
that kind of stuff is out of bounds for mission makers even if it's possible, imo
I am not messing with peoples audio...I am making a custom interrupt menu...
aight i was just wondering. people try and do some crazy stuff in this channel
well, certainly not me...
it's not documented? I thought there was
loadScripts
@tough abyss loadScripts
Yep yep π
Has anyone used UPSMON before? Is it still maintained?
Before 1.70, I used the following code to give Kajman and Xi'an pilots the ability to fire Skyfire rockets.
_vehicle removeWeaponTurret ["rockets_Skyfire",[0]];
_vehicle removeMagazinesTurret ["38Rnd_80mm_rockets",[0]];
_vehicle addWeaponTurret ["rockets_Skyfire", [-1]];
_vehicle addMagazineTurret ["38Rnd_80mm_rockets", [-1]];
However, afther the dynamic loadouts was introduced, it stopped working. Now there are two magazinesTurrets for the rockets, instead of one. How should I rewrite the code to make it work?
um... use both?
I tried the following code:
vehicle player removeWeaponTurret ["rockets_Skyfire",[0]];
vehicle player removeMagazinesTurret ["PylonRack_19Rnd_Rocket_Skyfire",[0]];
vehicle player addWeaponTurret ["rockets_Skyfire", [-1]];
vehicle player addMagazineTurret ["PylonRack_19Rnd_Rocket_Skyfire", [-1]];
The pilot can now fire all 38 rockets from both pylons. But the ammo count still shows 19 on the HUD.
@stable wave Consider it may be only able to load 19 rounds?
It loads 38 rounds. When click the fire button, 1 rocket is fired from both pylons. But the ammo count is only reduced by 1. On default loadout, the ammo count is 38. One click recuces it by 2.
@stable wave Right, the max it can load would be 19. But it just allows for more to be loaded because it's forced
OK. I'll push the pbo to the server then.
looks great but I dont use It. It is maybe a bit overdosed for just some city occupied by a terrorgroup ^^
Anybody knows, where getCargoIndex gets its number from?
nvm... action ["getInCargo" seems to be borked/broken
Anyone know if passing a Nil variable to isNil will create a scriptError? I would expect isNil to return true in that case.. But knowing SQF weirdness I guess it just errors out...
Its meant to check for a nil variable, doesnt error out with nil variables
Yeah.. But you check nil variables by passing a string containing the Name of the variable
not the variable itself
i think isNil _var = error, isNil {_var} or isNil "_var" = true
That's also what I expected... Maybe Nil isEqualTo _var works...
i'm guessing that would error
you making a linter or something? isNil {_var} or "_var" works fine
No checking for a way to detect if Intercept initialized. And I'm guessing compile returns Nil when it failed to compile
I use it. For TFAR and my new LUA binding
Yes. Performance. Easier to code. Multithreading (to a degree).
I rewrote bis_fnc_ItemType to Intercept. 3x performance.
I rewrote bis_fnc_exportFunctionsToWiki in Intercept. Arma game would freeze for 10 minutes. Intercept is done in under half a minute.
What is Intercept
A big perf problem of SQF is the control flow. If statements and such. There is where the big improvement lies. The C++ Optimizer can do a lot on these.
Also SQF is looking up which function to call everytime you call something at runtime. C++ does this at compileTime and the Optimizer also goes into there and does stuff
π
@tough abyss https://github.com/dedmen/interceptTest/blob/master/interceptTest/tools.cpp#L1294 BIS_fnc_ItemType and above is exportFunctionsToWiki
wrong link
There
That's my test repo. In main.cpp there is also a bunch of TFAR code. That TFAR code is 1.6ms sqf versus 0.3ms Intercept
Yeah.. Intercept is basically C++ scripting in Arma.
Or.. With a bit on top of that LUA scripting in Arma: https://www.reddit.com/r/arma/comments/6dy7vg/lua_scripting_in_arma/
Now make java
No.
why
I don't like Java. ACE Team want's to do python. So they are probably gonna do that. If anyone want's to do Java they can also do that. But I doubt anyone will ^^
I like java. It was the programming language which introduced me into scripting and programming
Yeah I like Java as well
Then get someone who likes Java and also knows C++ to make a Intercept->Java binding
Downside of Intercept -> Opens up a biiiigggggg hole, regarding security.
You mean like. Any Arma Extension does?
Difference -> Most of those extensions are ServerSide only and restricted to specific commands.
Yeah. You can also run Intercept Serverside only.
Intercept extensions still need to be Battleye whitelisted if you run Battleye. Which you do anyway in high-thread environments
oops. ^^ Typorino
Intercept doesn't actually make it easier for cheaters. Yeah Intercept scripts don't go through Battleye script filters. But Intercept "scripts" need to be whitelisted by Battleye in that environment. So I'd call that even more secure than BE script filters.
Or what kind of security do you mean @jade abyss?
Wasn't Intercept whitelisted by BE? iirc you said something like that.
+Yeah, thats more or less what i thought. If it works like that (Whitelisting of the commands) -> okay, i was wrong =}
No. They whitelisted my script debugger. Which is much worse.
Not the same?
aye, kk
Now that Intercept is "done", dedmen can release TFAR 1.0-
I will release TFAR 1.0 when devestating bugs like "All of the sudden I can't hear someone anymore and it happens quite often" are fixed.
Hey guys, anyone know what would be the best method to find a random position on map where there is no water?
Hi guys. How can I check if one of the gunnerpositions in my vehicle is manned or not?
Commands: allTurrets + TurretUnit
If I want to search whole map with findEmptyPosition it seems to be very very slow and hang my computer π @tough abyss
To be honest, I'm not quite sure findEmptyPosition is even the command I'm looking for
Its not random at all
``[random 14700, random 16200, 0] findEmptyPosition [0, 10];
_x = random 14700;
_y = random 16200;
_z = 0;
_randomPos = [_x, _y, _z] findEmptyPosition [0, 10];
if !(surfaceIsWater _randomPos) then {
};``
Ye did something like this
if yes, pick another random position
Ye
Okey, so I have made this function ```sqf
for "_i" from 0 to 1 step 0 do {
scopeName "loopGetRandomPosition";
private _randomPos = [(random 14700), (random 16200), 0] findEmptyPosition [0, 10];
if !(surfaceIsWater _randomPos) exitWith {
player setPos _randomPos;
};
};``` However, sometimes it fails and gives me an error
Says, 3 elements expected, 0 provided
Which is strange
where can i find vehicle icons? like emblems , the ones that show in group hud when you have a member in any vehicle?
this is what i mean http://prntscr.com/febh0w
Hmm, I guess I just figured it out, π
So it returns empty array if not found π
@copper raven you mean like small icons of things like a tank or a apc or a jet?
check my screenshot, so you see what i mean, like exact emblem of it the model of a vehicle
iam making a shop, thats where i want the emblems
@delicate lotus
Is there a way to play music for only one user? So that only one specified user can here the music, so that I can start different tracks for different people?
@copper raven I dont know how but I know a script that can show you exactly how
its called VVS
i might just download a random vehicle shop/spawner from forums , and i should check the codes there
Virtual Vehicle Spawner
ye exactly
I use that script in my zeus templates
run a different track for each machines @warm thorn
getText(configFile >> "CfgVehicles" >> _class >> "picture"); @copper raven
@vivid quartz Yeah, I have already tried that. I used playMusic inside my ClientInit, as i thought this will play the music for this client. Unfortunately, every time when a new user is joining it will stop the track... playMusic "LeadTrack01_F";
wait why should it stop the music if somebody new joins?
does not make sense for me as it is local after all
@delicate lotus I will investigate this again π Thats also my mind... Dont now why. If I test it alone - everything works smooth ^^ I will run some more tests π
I put this addItemToUniform "ACE_EarPlugs"; in the init box of every player, but when anyone joins everyone gets another pair of earplugs
So, I have investigated this issue further. For the first player, everything is fine. He is able to listen to this awesome music. The other players are unable to hear the music. I use playMusic "LeadTrack01_F"; in my client init. It seems so, that the first user reserves the track and all the other users are unable to play the same track. Is there a way to solve this?
If I use move command to move a unit from a to b, but it sprints, how could i make that jog?
Ah alright, Ill use that
@unkempt spire you need to run code locally
@warm thorn if there are 2 clients on server and if you playmusic different tracks does it work then?
i think i only see this working in 1way, idk if its possible, but getting the track time played, then using playmusic again with the played time
pretty sure there's no way to play a sound from X point, you can only trigger it from the beginning
i made an audio preview tool ages ago and couldn't find a way to accomplish that
@jade abyss Thanks
Is there a way to detect when a certain function (in this case playMove, so maybe even an animation) ends? I want to create a file with a function and an array and a boolean as parameter and the function should either randomize the animations given in the array or play them in the given order.
simple example:
player playmove "AnimName";
waitUntil{animationState player == "AnimName"};
player playmove "AnimName2";
waitUntil{animationState player == "AnimName2"};
gl hf
@rancid ruin playMusic [name,time]
@jade abyss thanks!
Wait, how do I loop through an array while retrieving each element?
I'm sorry for all the questions, I'm quite new to this.
that only works for one type of audio though @vivid quartz
_array = ["a", "b", "c"];
{
diag_log _x;
} forEach _array;
//logs:
// a
// b
// c
@icy mauve
there's also for, if you want to do more arbitrary loops like "do this 10 times" https://community.bistudio.com/wiki/for
also:
Bookmark this:
https://community.bistudio.com/wiki/Category:Scripting_Commands_Arma_3
also also read this cos it explains more about loops https://community.bistudio.com/wiki/Control_Structures#Loops
also also also bookmark this so you don't write functions for something which already exists: https://community.bistudio.com/wiki/Category:Arma_3:_Functions
and this to browse by function category: https://community.bistudio.com/wiki/Scripting_Commands_by_Functionality
Bookmarked.
May someone review my code with me please?
This is "animatron.sqf": ```sqf
params ["_unit", "_animations", "_randomize"];
if (randomize) then {
while (true) {
_element = selectRandom _animations;
_unit playMove _element;
waitUntil {
animationState _unit == _element;
};
}
} else {
{
_element = _animations select %1;
_unit playMove _element;
waitUntil {
animationState _unit == _element;
};
} forEach _animations;
};
_randomize not randomize
And this is the "on activation" of a Trigger: sqf animatron = compile preprocessFIle "animatron.sqf"; animatron [crewman1, ["Acts_CivilTalking_1", "Acts_JetsCrewaidLCrouch_in_m"], true];
_randomize is local, randomize would be global
indeed, and _x instead of %1
awesome
%1 is for format commands, like
_name = "john";
_age = 25;
diag_log format ["hello my name is %1 and i am %2 years old", _name, _age];
animatron [crewman1, ["Acts_CivilTalking_1", "Acts_JetsCrewaidLCrouch_in_m"], true]; your second line looks whack
Is stuff like this not allowed in Arma?
well we'd need to know what's in animatron.sqf
but if it's a function you're trying to call, that's not how you'd do it, no
animatron.sqf is a little higher up, where you said "_randomize, not randomize"
oh yeah my bad
[crewman1, ["Acts_CivilTalking_1", "Acts_JetsCrewaidLCrouch_in_m"], true] call animatron
Hell need to spawn, he suspends
good point
Oh yes, I also don't get any errors in the Editor now anymore.
you should at least stick your functions in init.sqf because managing this will get out of hand quick
alex_fnc_animatron = {contents of animatron.sqf here}
So I moved everything now into the init.sqf
This was probably the most awesome tip I ever got.
_blah = [crewman1, ["Acts_CivilTalking_1", "Acts_JetsCrewaidLCrouch_in_m"], true] spawn alex_fnc_animatron
to call it if you've set it up like that
Self-explanatory yes, thanks.
I just get an error for missing a Semicolon somewhere
yeah i'm rusty, listen to nick
if (_randomize) then {
while (true) {
_element = selectRandom _animations;
_...```
"Error Missing ;
while {true}
don't you need a "do" as well?
also yes
there are so many words in sqf
its a keyword based language
so yea
just keep the wiki on hand at all times
missing semicolon or generic errors typically point to syntax mistakes or typos
that page on control structures explains the most important bits. once you understand those, you can fuck around with all the other functions
undefined variable in expression? Is that an error while calling or in the function?
This becomes weirder every second
same error when _randomize is true and false?
I removed all the underscores and I get a "missing semicolon" again
don't remove the underscores, they denote variables as private
post your full current scripts again
with the underscores back in
alex_fnc_animatron {
params ["_unit", "_animations", "_randomize"];
if (_randomize) then {
while (true) do {
_element = selectRandom _animations;
_unit playMove _element;
waitUntil {
animationState _unit == _element;
};
}
} else {
{
_element = _animations select _x;
_unit playMove _element;
waitUntil {
animationState _unit == _element;
};
} forEach _animations;
};
};```
alex_fnc_animatron =
you're defining your function as that code block
also
while {true} do {}
perhaps its easier if you remember functions are just a type of variable
the while needs a code block which returns true or false. if it's true, it does the thing that it "do"s π
Sorry I didn't get the last one.
while is a control structure which does:
while {this code block returns true} do {this thing in this code block}
so, while {true} do {...this stuff...}
yeah, just will never work if you use (), the condition needs to be in {}
yeah so long as the function returns true or false
obviously. That's still kinda cool.
by the way, i don't know if you want the function to do this, but it will constantly change the unit's animation. it won't wait until each animation is complete
This is not what I intended, no.
I wanted the second option, waiting untl each animation is complete
i think maybe using switchMove instead of playMove might work
if not you could just add another waitUntil, waiting until the unit's animation is not equal to the one you just played
I get another error. COme on Arma.
I mean, I created this but still....
Whatever
"General Exception in Expression" at
wait is the "|#|" the part where stuff is wrong?
ah, just noticed
{
_element = _animations select _x;
_unit playMove _element;
waitUntil {
animationState _unit == _element;
};
} forEach _animations;
in that, the _x IS the animation name
doing _animations select _x is saying "select Acts_JetsCrewaidLCrouch_in_m index from array" which will not work
select wants a number
so remove the _element line and just do _unit playMove _x
no problem bro, keep at it. it will come naturally the more you do it
try it with switchMove instead maybe
and keep the "animationState _unit == _element;" the same?
maybe this
alex_fnc_animatron = {
params ["_unit", "_animations", "_randomize"];
if (_randomize) then {
while (true) do {
_animation = selectRandom _animations;
_unit switchMove _animation;
waitUntil {animationState _unit == _animation};
waitUntil {!(animationState _unit == _animation)};
}
} else {
{
_animation = _animations select _x;
_unit switchMove _animation;
waitUntil {
animationState _unit == _animation;
};
} forEach _animations;
};
};
i renamed _element to _animation so it's a bit more readable
That gives me another "general error in exception"
at the part you gave me
the two waitUntils
sorry, i mixed up playMove and switchMove
you should be using playMove
also, from wiki notes:
This command must be executed after mission start. If you place it into init.sqs / init.sqf or in the Init field of some unit, it will not work. Just add a little delay (~0.001) and then place the command.
just found that out the hard way lol
Thank god there is AutoSave
There seems to be an "general error in exception" at waitUntil {animationState _unit |#|== _animation}; but I didn't change anything there.
And it plays the same Animation over and over again. A Randomized one indeed, but still the same one.
Hello guys, do you know why sometimes when you open the debug console you have the 2 buttons Previous and Next, and sometimes you don't have it ?