#arma3_scripting
1 messages Β· Page 100 of 1
is it true that init.sqf is always executed after all init EHs at the mission start?
https://community.bistudio.com/wiki/Initialisation_Order
According to this, looks yes
What "normal" programming language would people consider is closest to sqf?
Any general programming language similar to SQF would have been strangled at birth.
Depends on why you are asking
At least it is not 01010110100110 thingy
@grizzled cliff interesting, abusing locations as sqf namespace. But that could confuse some scripts which rely on locations or do i miss something?
Oh absolutely, I was just curious
Not trying to write other code in sqf or anything, was just wondering what people thought
Hmm yes, I will write my sqf code in binary
What could go wrong 
I feel like you'd have to go back a way to find an interpreted language where the primary data structure is an array.
VB? :P
i find a lot of sqf actually quite nice
the engine it is for, however, not so much
looking at the biki for sqf to enfusions language makes me sad for a lot of things i liked going
is A4 not gonna have sqf?
and at this point what i've seen of enforce looked like triple the code for half the effect compared to SQF, tbh </shitpost>
We can now write long code as the big guys π¬
Hello,
I just had a quick question how i would script an AI Drone to act like a suicide drone?
My current setup is that i have put a marker on the tank i want it to fly into, and on the drone itself i have put this doMove (getMarkerPos "Marker1");
Then i have a trigger that has this setup:
((uav1 distance marker1) <= 70);
On Activation
[uav1, 0, "ATL"] call BIS_fnc_setHeight;```
the drone approaches the tank but then steers off anf flies to the end of the map
does it require to be explicit?
read the biki article lambda linked
a lot of the nice bits of sqf are going
readability through the floor in exchange for being 40x faster(?) in an engine that is theoretically better than rv4 but i am yet to have a single compelling argument made for switching to it
and thats from the pov of someone who spent 6 months writing a movement system within sqf only for it to be totally fucking useless in mp bc the engine has no angular velocity commands so does not interpolate it -- enfusion has had those commands from day 1 and i still dont want to touch it
Also no more mixed type arrays lol π
Its just a matter of practicality against performance really, people that have a more serious background on coding will have an almost seamless transition, and with the time, the enscript wiki will become more fleshed out to the point in which we can rely on it as we do for A3. If it makes it order of magnitude faster, I don't mind being left out in the dark for a bit until someone does some sort of "friendlier integration" more akin to A3 current sqf
I just want more documentation on the classes so I don't have to trial and error to find what the heck things do
I really appreciate a lot of the small things, granted the first time I had heard of it was quick look on the wiki just now.
Stuff like typed and case-sensitive variables will also just make people write "better" code.
Also never understood why vectors in A3 were [X, Z, Y]
case sensitivity can go suck my fucking nuts
its horrendous and serves zero purpose
aside from stopping people do mYVaRIabLEnaME at which point stop trying to read their code its a pointless exercise
Yeah
typed variables is also dreadful and i hate it
i dont give a shit about what the variable was before i want to overwrite what it is now
private _var = _unit getVariable ["variablethatisnotabool",true];
if (_var) exitWith {}; //variable undefined, cheap exit.```
BRILLIANT!
At that point just use isNil, sure it's clever but why?
isnil is an extra command
bad.
(though granted more readable, but just macro it)
#define EXIT_IF_UNDEFINED(param1) if (##param1##) exitWith {}
private _var = _unit getVariable ["variablethatisnotabool",true];
EXIT_IF_UNDEFINED(_var);
//my code below```
perfect and you dont have to always remember pissing isnil taking a string
(this is one of many instances where this is useful)
Never really forgotten that isNil takes a string, but I guess?
I do like the nicer syntax in Enfusion
if (someVar == null) { return; };
Although the alt syntax seems a bit odd, since you're basically just checking it like a bool
i am going to macro == to isEqualTo
if i ever work in enfusion (never)
i also HATE return commands theyre so stupid
what else are you going to do if theres nothing there
?
Most of the programming I do in more C# or Python, so I'm much more used to == than having to run a command
But nothing's stopping you
== not as readable
if (myvariable isEqualTo "string") then {code} is just the most readable you can get
== is like half-century-old convention and pretty readable 
the word equal is 7 centuries old and very readable
anyone have a script where walls close in.
like a hallway that keeps shrinking
hello does anyone know of a working script for a server to warn, and eventually kick a player for being afk?
need 2 things for add action to stay to vic after it dies and and for warlords the independent faction to be playable faction.
Have to disagree.
a == b is coming from mathematics, with single = being reserved in most languages (whilst one like sql does not and hence uses = for comparison)
IsEqualTo is a mythic thing that may be lexically more readable, but from the point of actually being readable, == or in that respect = is more readable. We are not writing poetry here but mathematical equations
i personally write all my sqf code in haiku format
I do have to agree to this tho, case sensitivity makes no sense... Until pike matchbox is a concern, but that can be solved with limiting the availability of characters valid
maths being more readable isnt a bad thing either
isEqualTo is easier to not have to think about what every single character means and just reading the code
which is one of my favourite parts of sqf
if you are reading a competent scripters code, it is extremely readable once you get the basics down
Incorrect. Your brain is not really reading but rather interpreting pictures.
IsEqualTo is actually much slower than == in your brain
versus most other languages which are bloated with type definitions etc etc etc
it is not in mine, i have to consciously think == means comparing equivalence
words mixed with maths stuff is a big confuse
I mean, math is a language that's meant to be read?
yeah, which is all mathematical notation
rather than a weird blend of the two like _word == value
be consistent with it
I promise you it does. Just as analog clock gives you a better feeling of what time it is.
That is just a scientific fact
digital gives me a better feeling because i dont have to sit there going hmmm how many minutes left
Type definitions also serve an important purpose: fail early
rather than analog having to be interpreted
yes i can concede type definitions have their use i just love sqf not having them
im not supposed to be thinking about developing im meant to be on a break but here i am defending sqf
what has my life come to
And "words" are math
OK, usually you will write e instead of epsilon, but behind all of those fancy equations is math.
Sqf is math down to it's core, with every "command" actually being an operator
if (value isEqualTo othervalue) then {do this} else {do that}; is just pure english
SQF is a great language worth defending. Just that the points you made are not that great π
and can be read as a completely valid sentence
That is true, but again, not a valid point against the =
It also will not magically teach people to code because it is English (because it is not... What are those curly things doing and why is the stuff between then and if in ()?)
yeah, im not saying its magically making it easier to code
like, _this params ["_proupu", "_pwuepouqe", "_pwoeiqpipmpa"]; what the fuck
but it benefits from being able to just look at it and understand what is going on with using a lot less energy actually understanding what you are reading because its more close to just... sentences
Long story short for enscript is: it is a different language with pros and cons
Sqf is great with pros and cons
But == > IsEqualTo and macros can go to hell
i fucking love macros
mostly because of organisation i dont have to remember what project name is etc
(mistyping KJW_MedicalTreatment instead of KJW_MedicalExpansion has caused me a lot of headache over the past few days so i just macrod it)
in my defense
i was also overwriting ace_medical_treatment functions
A death spiral of confusion and an easy path to obfuscate your code for other people. If thst6is your definition of great then yes, very great
Macros won't protect you from that
You are still at mercy of typos
yeah they will because COMPONENT is now always the correct thing
yeah when initially setting them up
once youve done that then its solved for the entire project
and if you want to change it, just change it in one place too π
the common macros like GVAR() and QFUNC() etc are also easy enough to understand once you get the hang of it
G = General
E = External
Q = Quote
QQEGVAR => Quote Quote External General Variable
easy
g may mean global ive never looked
No, always
There is no benefit of writing that, ****** GVAR(xyz) thing (and the corresponding cba group) over ace_whatever_xyz
Not even readability is a pro point because the former obfuscates what you are doing and always requires additional context to understand.
You are also never going to rename ace to totally_not_ace and moving script files from one "component" to another breaks the entire code.
Reality of things here is: it is just a way of making code look more "professional" and "complex" then it is for no reason but internet swag
Probably enough hot takes for a single day
you dont need that additional context for modifying it, thats the whole point -- GVAR(xyz) is just the xyz variable for whatever module you're working on, no need to think about it
of course anyone who wants to hook into gvar(xyz) does need to understand it yes
but from a development pov having recently switched to macroing variables like that it solves a ton of headache
we will have to agree to disagree regardless
GVAR is not just xyz
like X39 said you are hiding what it actually is
GVAR expands to TAG_Component_xyz
which breaks if you try to use that variable in another component, hince EGVAR(component,xyz)
Also, if we are talking about SQF replacements... Let me plug my project lol
https://github.com/killerswin2/RVCSS
No need for SQF when you have C#!!!
There also is sqc π
(alt syntax)
okay can anyone tell me how to make independent freidnly in warlords
https://community.bistudio.com/wiki/setFriend
Make sure to do it both ways
Don't they fetch locations from the map?
When are we joining forces and make SQC#?
HEY ANYONE GOTTA BLAACKLIST LAYING AROUND FOR ALL VANNLIA WEAPONES
No allcaps, thanks
if you can elaborate i might be able to help
The intention here is to create a new AI unit and assign it to another human player - presumably in a separate group.
Is this an anti-pattern and is the better approach to script the newly-created AI unit to 'follow' the player instead? And is 'follow' possible in the commands?
how do i use a trigger on only the unit that enters. cant fund any examples online
tldr player enters trigger, only him gets hint.
Player in thislist as condition
Just checked, forcedDifficulty changes difficulty but not missionDifficulty
C#... Arma 3...? 
@tough abyss for warlords to need to bla klist everything but the spe gear for the arsenal im use the the warlordsint module so idk how I will do that.
Make a whitelist, much easier
nah
But "CSharp2SQF" is an option π
(which kinda would be like some old project of mine but more mature)
Any possible way to get Jet countermeasures /Chaff more brighter and last longer in Editor?
yes i know but removes a lot of the headache that rapidly changing between projects has
i used to make the mistake of confusing projects very often
How can I set my dedicated server so that it tempbans anyone for 12 hours if they die?
I'm running an antistasi dedicated server - the theme is you only get one life (per day). Hence the automated 12 hour tempbans.
The dedicated server is with armahosts.
Additionally, is it possible for an admin to unban someone in case they die from a bug?
I have no coding experience at all so I may have more questions trying to figure this out!
Not sure if there is a scripted unban way
https://community.bistudio.com/wiki/serverCommand
This is the way. I would say just show βyou cannot join for n hoursβ screen and lets the player nothing is a good way
inb4 12 hour kick timeout
Thanks, I'm going to try and figure this out after I get back from work! It's also possible to let that black screen automatically expire after 12 hours right?
coming back into scripting, is there a way to monitor the amount of kills an ai gets?
Like the goal is for an ai to get more health, move faster etc whenever they kill something
Figured it be like an eventhandler thing
because theres things for being hit and killed, but not for killing
like firing would be close, but not every shot is a kill
FiredMan EH + HitPart EH on the projectile
Alternative approach is adding Killed EH to every unit
Yea thats what i was thinking
Thank you, i was more or less wondering if my train of thought wasnt like completely off haha
A killed EH would be sick though
Could even do HadleScore actually
Totally underrated opinion.
Function names can already be cryptic as-is, macroing them it's just harder for anyone else that is not the owner, which if its the case that they intentionally do it, good for them I guess?
Worst thing about macros is that you can't paste the code into the debug console.
i paste the script component include
but its shrimple
func(yourmum) is fnc_yourmum.sqf in the same pbo
else it tells you where to go
good thing about Enfusion is it doesn't let you macro
LOL
yet another reason i will not move to enfusion
hi guys! I have a question. How to hint a message when hovering over a marker in map?
Yes
I sold my soul and my time
Yo how could I merge two variables like
private _player = name player; // imagine player name is Nav
private _prrt = _prrt + _player; // how to get _prrtNav?
and if its not possible is there any way around?
missionNamespace getVariable ("_prrt" + name player)
Normally these days you are better off making a hashmap than doing this stuff, although there are special cases.
yeah but what would i have to type to use this variable? i'd have to type _prrtPlayerName?
private _weirdName = "_prrt" + name player;
if however you want the content of the _prrt var, use _prrt without quote
You should probably describe what you want to put in this variable and then people will tell you better methods :P
private _str1 = "ABCD";
private _str2 = name player; // e.g "Nav"
private _str1n2 = _str1 + _str2; // "ABCDNav"
private _other = "yolo" + _str2; // "yoloNav"
hmm, can you even set local vars on missionNamespace...
_bb = "Land_TripodScreen_01_large_F" createVehicle position player;
_bb setObjectTexture [0, "#(argb,512,512,1)r2t(playerrtt,1)"];
private _playerrtt = "_prrt" + name player;
{
cam = "camera" camCreate [0,0,0];
cam cameraEffect ["Internal", "Back", "_playerrtt"];
cam attachTo [player, [0.18,-1,0.18], "head"];
cam camSetFov 0.7;
} for allPlayers;
Well this is the script so far, I'd like it to automaticly creates a screen behind all player with a livefeed of their shoulder on it. The livefeed works well but I don't really know how to like make it work so i'm trying schtuff but I'm running out of ideas...
How do you debug/diagnose your code when playtesting? My current method is to print events and values into the system chat. What are the other options, ideally visible right in the game?
You can draw what you like with cutRsc or other UI functions. I'm normally more inclined to spam diag_log and read RPTs on the fly, as for most things the progression is more important than the state.
@storm crystal "playerrtt" here isn't a variable, it's just a text string used as a reference.
So you'd just build the texture string with something like this:
_texstring = "#(argb,512,512,1)r2t(" + (name player) + ",1)";
setObjectTexture is local effect though, so the code won't work.
Affichage icone grade matricule
params ["_from", "_to", "_t"]; // array [0,0,0,0], array [0,0,0,0], float
_r = (_from select 0) + ((_to select 0) - (_from select 0)) * _t;
_g = (_from select 1) + ((_to select 1) - (_from select 1)) * _t;
_b = (_from select 2) + ((_to select 2) - (_from select 2)) * _t;
_a = (_from select 3) + ((_to select 3) - (_from select 3)) * _t;
[_r,_g,_b,_a];
};
if (hasInterface) then {
addMissionEventHandler ["EachFrame", {
{
private ["_offset", "_xdist", "_iconSize", "_colour", "_rankIcon", "_rankTitle", "_name"];
if (side _x == side player) then {
// height offset
if (_x == vehicle _x) then {
_offset = ((_x modelToWorld (_x selectionPosition 'head')) select 2) + 0.4;
} else {
_offset = 1;
};
_dist = _x distance player;
//
_xdist = _dist / PX_TAGS_VIEW_DIST;
_colour = getArray (configFile/'CfgInGameUI'/'SideColors'/'colorFriendly');
_colour = [_colour, [255,0,0,1], damage _x] call PX_fnc_LerpRGBA;
_rankIcon = [_x, "texture"] call BIS_fnc_rankParams;
_iconSize = 1.0 - _xdist;
if ((cursorTarget == _x) && ([objNull, "VIEW", objNull] checkVisibility [eyePos player, eyePos _x] > 0)) then {
_rankTitle = [_x, "displayNameShort"] call BIS_fnc_rankParams;
_name = format["%1. %2", _rankTitle, name _x];
drawIcon3D [_rankIcon, _colour, [visiblePosition _x select 0, visiblePosition _x select 1, (visiblePosition _x select 2) + _offset], _iconSize, _iconSize, 45, _name, 2, 0.03, 'PuristaMedium'];
} else {
if (_dist < PX_TAGS_VIEW_DIST) then {
_colour set [3, 1.0 - _xdist];
drawIcon3D [_rankIcon, _colour, [visiblePosition _x select 0, visiblePosition _x select 1, (visiblePosition _x select 2) + _offset], _iconSize, _iconSize, 45, "", 2];
};
};
};
} count playableUnits - [player];
}];
};
Hi everyone. I have this script, showing the rank icon and the player's name. I tried to hide the rank icon and just keep the name without success for now. Have you an idea ?
ik i'll remoteexec after, firstly doing sp compatible
@orchid dagger Isn't that what it does in the target-obstructed case?
oh wait, you want to show the name and not the rank...
I think you just use drawIcon3D with an empty string for the icon name.
yeah, see example 2: https://community.bistudio.com/wiki/drawIcon3D
What would be the easiest way to hide a (base game) action?
There's these examples on the inGameUISetEventHandler wiki page, but I was hoping to actually hide the action rather than just overwriting it.
inGameUISetEventHandler ["Action", "if ((_this select 3) isEqualTo ""xyz"") then {true};"];
The condition isn't passed, otherwise I could just set it to false
There is no easiest way to do that, or to be more exact there is no way to do that
Certain kinds of actions can be prevented in various ways (lock to prevent getIn/Out, lockInventory to prevent inventory, the building door lock variable, using a dummy simple object instead of an interactive item, etc) but there's no way to actually remove an engine-controlled action.
Thanks ! 
Didn't think there would be, but wanted to check anyways, thanks π
[cam, [0.75]] remoteExec ["camSetFov",0,true];
``` anyone knows why this isn't working?
camCreate creates local objects.
even if its remoteexec?
Put all your camera stuff in a local function and remoteExec that. Each client will maintain their own variables locally, removing the problem
* by "local function" I mean "operates locally" not "only defined locally on the sending client". Use cfgFunctions
or just publicVariable the function before running it with remoteExec π
I'm working on adding an inventory item to let players carry small amounts of fuel around with them. I've thought of a couple ways to do it but wanted to throw some stuff out to see if there was potentially a better way to do it.
One way I had thought of doing it was having multiple items for different sizes, and then whenever a player picks up X amount of fuel it would either round to the nearest item or give them several items to roughly equal the right amount (haven't decided on which way if I did do it that way).
It'd be great if I could just assign a variable to an inventory item, but sadly can't do that (at least as far as I can tell from looking at setVariable
It's been a thing for a while
made them a magazine
yea? i saw them on embeds, but not in the comments
It was only enabled in ~50% of servers as a test, but it's pretty much enabled in most servers now
Why a magazine specifically?
Can you set the amount of bullets in a mag?
its a little annoying, since its not simple as an object, but more eficient than setvariable.
Immersion cigs do it in their mod with the packages of cigarates
yep
and made 1bullet = 1 liter, or less.. it depends, it need to be an integer
Oh nice, I wasn't sure if you could do that
Is there just like a "setAmmoCount" command?
I looked at the config for immersion cigs and they have like every single base arma addon listed in their required addons...
yes that is convention
Why...
unless theyre doing all of them instead of the loadorder addon
Only mention of "load" is "a3_supplies_f_heli_slingload"
I've never seen a single mod ever do that (not specifically the DLCs)
you don't need to, its just safer to
you havent looked at many decent mods then
putting loadorder in the requiredaddons is convention because you dont want the game to load halfway then start loading your stuff that relies on base game stuff
i ussualy use only the things i need, i wast aware of the convention lol
Alright I get the loadorder one specifically, but every addon?
every addon is stupid just replace with loadorder
tho immersion cigs is quite old iirc so may be before the convention came about
It will be nice to have this on the https://community.bistudio.com/wiki/CfgPatches page @winter rose
(sorry for give you more work)
lou doesnt actually believe in cfgpatches
What is the maximum distance for Remote controled units? because after a certain distance the unit stops responding.
inb4 draw distance
is it possible to increase it?
Anyways, seems like immersion cigs just removes the old magazine and adds a new one with one less bullet, which is simple enough
yea, just remove "bullets" or "add" according the need.
Although since empty magazines are automatically removed, I guess I'd need an item for an "empty" container item?
unfortunatly the unit does not respond
yea, or 1 = 0
i'm controlling the vehicle with remoteControl command
Yeah but figured the bar showing for something that should be "empty" feels odd
yea... far from perfect, but if its a 100 bullets mag, and only 1 is left, the bar is almost empty.
unless there is a way to dont lose the mag when its empty
all comands on remoteControl are local, so... if setviewdistance <bigger radius> im not sure con can be solved
If you addMagazine an empty it mag it seems to stay, even when moving to/from different inventory containers
I think just having a normal item would be easier, especially for saving loadouts
its the same, when you save an loadout, all mags are saved too, with current bullet ammout , so...
Yeah but if you grabbed a new one from an arsenal it'd give you a full mag, unless you could make a "preset" magazine with no ammo in it, and have to make sure it just doesn't get deleted
you can also config empty mags to stay in your inventory, their removal comes by default activated so just change that?
regarding arsenal, i dont think you can actually place emtpy magazines in it
So yeah I'd need to do a separate item as the empty can
when the ammo count is 1 or 0 the bar on the left you mentioned should not be visible, alternatively you can config it as an item instead of a mag, only for the empty one
That's what I was planning on doing
when the ammo count is 1 or 0 the bar on the left you mentioned should not be visible
It's still visible when at 0
(what info?)
I think he means the correct load order addon for vanilla dependencies.
"A3_Data_F_AoW_Loadorder", last I heard
yeah it's weird that it's mentioned in the class inheritance page 
So if I wanted to get the inventory of each box in a trigger area
and lump them into an array
how do I finish this code
{ AllCrateInventories append getItemCargo _x } forEach ??? in campTriggerArea
(given that AllCrateInventories is an existing array, usually empty)
nearSupplies
I guess 
well your syntax is still wrong
but I think nearSupplies is the fastest way to get the boxes
I don't think that returns what I want it to return
oh wait
no it does
hm
I really want "any non-player inventory including vehicles"
Hi, is there a way to make AI units avoid friendlies in line of sight (between them and enemy)?
Im using a vehicle "unflip" script on my server - But i just reazlied players can unflip a vehilce as long as theyre pointed at it from any distance.
How can i adjust this to only work if you are within 3 meters of the flipped vehicles? Or better yet only show the option IF the vehicle is flipped?
((!isNull _target) && {alive _target} && {_target distance player < 3} && {_target isKindOf 'Landvehicle' || _target isKindOf 'Air' || _target isKindOf 'Ship'})
Is there a away to get the code of draw3D EH's like we can do with addactions/holdActions ?
Inb4 people start flipping the planes in the sky
xD i was thinking the same, from my experience if any air vehicle in arma 3 is flipped it simply explodes
Very much appreciated, thank you!
if you want to check if it's upside down, then checking if the Z component of vectorUp should work.
(vectorUp _target)#2 < -0.9``` will generally be upside down vehicles
Lol sometimes the MQ-harpy would flip when they spawned on an aircraft carrier so I assumed air would work
Thank you, I will include this
may be worth fiddling with the threshold, since < -0.9 is certainly upside down and 0 should be on it's side so there's room in between for choosing
Ok i'll play with it i've noticed the BTR's tend to lay on their sides
good luck! make sure to check on slopes since vectorUp is world coordinate relative
Hey i have another question if you are able to help or give any advice. I'm currently searching for a script to drag wounded (downed) players. I would like to avoid integration of ACE/PiR
I am researching but figure i would ask since you're here 
just for players?
Yes
There's a simple one in Antistasi that you can take. fn_carry.sqf
but I think they're all copied off each other. The secret sauce is just the animation states to use.
The Antistasi and ACE ones both jam up if you ADS after starting the drag, for example.
just ask, don't ask to ask.
A lot of people can, ask directly
outta curiosity, has anyone got experience using buttons to turn on/off UI elements, especially in particular to main menu edits? trying to add elements to the main menu with the hopes i can toggle it back off (theoretical for now)
thank you
I find it a bit weird that addMagazine has the alt syntax to give a magazine with X amount of ammo but addMagazineGlobal does not
Not really an issue, just thought it was strange
The Module ModuleSpawnAIpoint_F i noticed you can sync it with a trigger, allowing ai to begin spawning. Any idea what script is being used to turn it on and off?
Me again. Scripts on server tend to stop working after 2-3 hours. Does this mean there is an issue?
They are fine when mission restarts
Probably, unless you put some sort of "stop running this script after X amount of time" in there
What scripts, is it every script on the server that stops working or just a specific one(s)?
First test of that and it certainly could've gone better
No clue what the item on top is, nothing is returned from items or magazines
Question i have a object that is moving really fast. And i want to attach sound to that object. What would be the best way for me to do that so that people on the ground have a clear sound of a object comming in ?
playSound3D with a big area?
Another way (if you didn't want to put the sound in a loop and sleep) would be to make an invisible "fountain" object and attach it to the vehicle
Have it working now (or well this part of the whole system), but I can't seem to figure out what this mystery item is
Where is the maximum distance defined and is it possible to increase it?
Yea the problem with a playSound3D that i found is if you want to increse distance you have to go trough all the other optional parameters, like soundPosition. But if i enable sound position then it will create a sound on a position that object was when when i ran the command. But it wont continue updateing the position. (even if i put getposASL _soundSorce in soundPosition). I manage to get it to work with say3D tho. Just dame doppler effect man.
while { _shouldPlaySound } do
{
private _pos = getPosASL _yourObject;
playSound3D [_yourObject,..., _pos];
sleep _soundLength;
};
Figured it out, part of the logic was wrong so it was trying to add an item as a magazine
That will create multiple sound positions. Basicly you would have mutiple sounds playing at diffrent positions.
@tulip ridge after a couple hours. Ram caps out and generally scripts stop work.
Sounds like either the server doesn't have enough memory or a script is going wrong and using a lot more than it should
It will generally degrade in performance the more workload.. players, scripts.. ect..
The longest we ever had a working running server run is 24 hours.. that was with only 7 people joining and very limited activity and time.
After that scripts stopped working.
Yeah, it would create the sound at the object's position, wait X amount of time, and then create a new sound
If the sounds are "overlapping" in a way you don't like, you can increase the amount of time you sleep for.
Or could use a fountain object (like the windmills, AC units, etc, basically a static object that plays sound), hide it, and attach it to whatever object you're using
Your best bet is find a way to save information after an hour and have the mission restart, or have it load a continuation into a new mission.
Sounds like the server's specs might not be up to par, maybe try in #server_linux / #server_windows? (depending on the OS)
I wish you guys luck =}
Its only the 2 that i added - Which is a vehicle flip script and a script to remove some trees in an area
They are very simple ones as well
You'd need to send them, either uploading the files or just copy/pasting
If you copy/paste just remember to use !code formatting
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
Also you can just hide terrain objects in the editor, there's a hide terrain objects module
Question is there a quick way for me to get magazines for all the Missiles in game. From all vehicles and on foot ?
Could just do configClasses (configFile >> "CfgMagazines) and check if they inherit from the base missile (don't know the classname off the top of my head)
This is how the KP Liberation mission checks for everything
private _weapons = [];
private _magazines = [];
private _items = [];
private _backpacks = [];
private _configClasses = [];
private _type = [];
{
_configClasses append (
"
_type = (configName _x) call BIS_fnc_itemType;
(getNumber(_x >> 'scope') isEqualTo 2) && !(((_type select 0) isEqualTo '') || ((_type select 0) isEqualTo 'VehicleWeapon'))
" configClasses _x
);
} forEach [
(configFile >> "CfgWeapons"),
(configFile >> "CfgMagazines"),
(configFile >> "CfgVehicles"),
(configFile >> "CfgGlasses")
];
private _classnames = _configClasses apply {configName _x};
Thank you. Very much.
Here's the 2 I've added.
https://sqfbin.com/anoledelafimowabiqiv
https://sqfbin.com/exoyunavuhicomacaqiw
It was foolish to say only 2 becuase its a warlords mission and I think its script mayhem and this might be why some scripts are lost. I think some packets are getting lost between server and client creating an issue where when a player is in the game for 4+ hours these 2 scripts stop working.
My 2 scripts execute locally initplayerlocal
Hello all.
I have a question.
Is it possible due to some conditions or triggers to change the skin / model of the character? For example, by activating through menu. And that this happens directly during the game.
One of my friends said that it is impossible.
Thanks for answer.
It's possible to use setFace to change a players face
Yes
https://community.bistudio.com/wiki/setFace should do it
Given that the first one uses this and the second uses cursorTarget, I think you're missing critical information about how and when these scripts are supposed to execute.
First script says it should be placed in the init of an invisible helipad (although any object would work), so you should definitely not be putting it in an initPlayerLocal.
I'd assume you can edit the init (in CfgVehicles >> object >> EventHandlers >> init) of objects in mission config but I'm not 100% sure.
Second script could probably just be made into an addAction
You can't modify cfgVehicles in mission config outside of a very specific case for sound sources
The init it's talking about is likely to be the object's Editor init field, not its init event handlers
The init it's talking about is likely to be the object's Editor init field, not its init event handlers
I know, I meant calling the script in the init event handlers
Is it still not possible to lock a Bargate? https://feedback.bistudio.com/T118301
I can't test it right now, but if it's not possible you can disable its simulation to stop it being opened.
I'm not sure how much you'd gain from locking it though, since you can just crawl under it (maybe vault it too).
But still useful for vehicles π
As some of you previously said, I think it's linked to the DrawIcon3D
I don't think the bar gate is as physically strong as you're expecting :U
just edit action condition
?
referring to bar gate
You can only do that if you're making a mod. If you're just making a mission, that's not an option.
Isn't there a setting in DUI squad radar (assuming that's the mod you're using in the screenshot) to remove the rank icon?
Nevermind, it's in ACE Nametags
is there any specific reason why hidden vehicles are "frozen", when set to hideObject true?
i remember a time where it was possible to drive while the vehicle was hidden (i could be wrong idk)
I'm not sure how well thought out any of that stuff is.
what programming language does the game use??
SQF Misunderstood question
Internally, something beginning with C. For us, SQF.
how did u misunderstood it
so i am probably out of here since i only know python and lua
Were you asking about Arma's internals or what users (us) write code in?
us
Then yeah, sqf
It's a fairly idiosyncratic language but not complex.
i was searching abt it and it looks like C# and lua
does anyone have experience making whole gamemodes, if so i would like to hire someone to make one for my server
ask in #creators_recruiting
thanks
I'm having some issues with uiontexture, I'm applying it to units, and the game seems to forget what the display is supposed to look like and turns black or just doesnt load correctly to begin with.
Ive done strenous testing to see if I can find a particular thing that causes this, but I cant. However it seems to be more likely to happen when other displays are being updated, or when the player zooms in (idk lol).
Ive checked and when it displays as black the controls exist and are valid and the text of the image control on the display is correct.
^A note with this, when I request that text of the control with ctrlText the display updates and becomes no longer black. Without me using displayUpdate or anything.
This has been tested on other systems and other graphics settings with the same results. I'm starting to think its a bug with the function or something...
If anyone has any suggestions or ideas to share that would be greatly appreciated! Thankyou
Modifying some code from another mod (with their permission), essentially it's a couple of scripts to let you remote control a unit. It had some issues that I wanted to fix for my own use case.
Rough break down of the code:
- Scroll wheel action to control unit
- X conditions are checked every two seconds, if true, stops remote control
- Player is alive, unit is alive, etc. etc.
- Scroll wheel action to stop controlling unit
Works fine; except for if the player dies while remote controlling it.
If the player dies while remote controlling the unit:
- The camera remains focused on the player's old corpse, requires entering/exiting zeus to refocus it on newly respawned unit
- You only have partial control of your new respawned unit
- Can open inventory
- Can zoom in/out
- Can switch from FPV/TPV
This is the code responsible for switching control back to the player's unit
// _caller is the unit (player) who activated the action to start remote controlling
// _target is the unit being remote controlled
if (cameraOn != (vehicle _caller)) then
{
// Reset camera view to player
(vehicle _caller) switchCamera cameraView;
};
objNull remoteControl driver _target; // Reset control
player remoteControl _caller;
I thought maybe adding a temporary respawn event handler to the player's old unit could work, but haven't tested it
anyone kickin around?
Yep
Nien
Is it in any way possible to do remoteExec on callExtension?
I'm getting a stupid generic error in expression for this line...: if ((!isNull _source) && (!isNil "_source") && {_source != ""}) then {
Yeah Its in a helipad i don't know why I said it was in the initplayerlocal. Thats just the unflip one.
There is only one in initplayerlocal and thats the vehilce flipper.
So being that I really have a 0.1% understanding of scripts, how do i make it an addAction instead?
one is in a helipad and one is to flip vehicles in your cursor view. I want the one in the helipad to execute when missions starts and i want the unflip to execute when a player is pointing at their vehicle and selects on the scroll wheel "flip vehicle".
I'm not very knowledgeable regarding scripts so any advice is appreciated.
pretty sure that's how you do lazy evaluation
wouldn't you want to check for nil before null?
thats a good one
// initPlayerLocal.sqf
player addAction
[
"Flip Vehicle",
"flip.sqf", // Take the code from your flip vehicle script and put it in a file called flip.sqf
nil,
1.5,
false,
true,
"",
"cursorTarget isKindOf 'AllVehicles'"
];
i bet source is weird
I'm pretty sure sqf's IF statement evaluates all components, it won't do early termination of evaluation, so the order (isNull or isNil) doesn't matter, both get executed
thats why you should check isNil first
Yeah, bit in a separate if
I really appreciate the help. Thanks Dart.
Technically there's some cases that the action will show up but not do anything but if that bothers you you can just copy/paste the condition from the flip code (the (!isNull cursorTarget) && {alive cursorTarget} && {cursorTarget distance player < 3} && {cursorTarget isKindOf 'Landvehicle' || cursorTarget isKindOf 'Air' || cursorTarget isKindOf 'Ship'}) and replace cursorTarget isKindOf 'AllVehicles' with it.
Just remember to keep it in quotes
if (!_isNil "_source") then {if ...
forgot " "
giving it a whirl
:P
Dont need a separate if, if you make the nulk evaluation lazy as well
It does ? I remember it didn't always do that
Would be worth checking this out, early termination would be nice
@outer plover Lazy condition evaluation uses a different syntax but yes, it's implemented in SQF
It's not the default, however, so if ( false && [] call fake_fnc_TakesForever) then {...} will take a long time to return ;)
Yeah, that's what I mean :D
It's a good habit to get used to doing if (false && { [] call fake_fnc_TakesForever}) then {...} when you've got a "trivial" check happening before a significant computation. I.e. testing a unit is present/not-null/alive before testing if there's an entereable building withing 500m ;)
Does revealing a mine with revealMine stop the AI from pathing into it?
O.o Somehat counter-intuitive, but then, it'S SQF :|
Exactly. Since #arma3_scripting has also become #sqf-ranting let's all just marvel at the amazing langauge design process that must have been going on somwhere at 3am, hours after the coffee ran out, to give us this marvel of "WTF SQF" behaviour.
not strictly, no, certain conditions makes the AI ignore them, basically as long as they are not in AWARE or SAFE behaviour modes they will "risk" pathing on the mines even if revealed
(I know language design and implementation is hard. I'm not really giving the original creator(s) sh*t about it, I'm just poking fun at the fact it's still the best (ok, only) way to write code in A3)
so I ended up just using bis_fnc_param for my source to only accept objNull type, and I'm only using !isNull for the if condition, but my the handleDamage is writing a string for the source at the very end (from an explosion)
@agile pumice remember that bis_fnc_paramis unnecessary overhead nowadays. We've got the params command that will do the same thing much faster.
How does the Deformer Eden addon work? Does it run purely on SQF scripts?
tell me more about this params command
the wiki page is confusing AF
oh
i get it now
Cool! It's a pretty neat command.
Just hope I've set this up correctly: params [["_unit",""], ["_part",""], ["_damage",0], ["_source",objNull], ["_projectile",""]];
Yes
or would: params [["_unit","",""], ["_part","",""], ["_damage",0,0], ["_source",objNull,objNull], ["_projectile","",""]]; be safer?
third param needs to be an array though I believe
I need some help with the Gendarmerie offroad, I know it has a PoliceHorn but wont activate via forceWeaponFire
Uh.. yes, maybe?
More details needed
Well I'm making a mod along with an extension where I'd like to limit the function and extension calls to local execution only
doing so with functions is easy enough with cfgRemoteExec as far as I can tell
with extension calls I'm somewhat treading unknown ground for me, I couldn't find anything about calling remoteExec on callExtension or how to prevent it
thought of looking into call_context to write a check but haven't fully looked into that yet
You could use just functions for RE and block SQF commands altogether, or set RE of callExtension to disabled in CfgRemoteExec
CfgRemoteExec can also block the callExtension command
wouldn't that interfere with other mods?
And yeah I think the second part would be the call context thing that was added recently
It potentially could. But I only know a handful of mods with extensions, and none of these remoteExec extension calls
Isn't remote executing extension calls a (very) bad practice anyway π
It always goes through at least some SQF function wrapper
Probably yeah
Thinking of it makes me shudder
it is, but the context here is that if anyone is using remoteExec on these, there's a chance that they're malicious.
end goal would be blocking remoteExec on Extension completely, while having a toggle for the functions
Well, you can do the blocking of commands themselves in CfgRemoteExec (and also should in my opinion). And use SQF wrapper function like Dedmen said, if there's actually need to trigger the callExtension from clients in the first place. May I ask what's your specific use case here?
The (server side!) wrapper function could contain additional logic whether to accept the extension call request or not. If you want extra security, you can e.g. make it a server side mod so clients don't have direct access to it
I'm writing an API wrapper so people can shock themselves if they get shot/suppressed/etc. Allowing remoteExec means people can shock each other w/o consent
This wouldn't do unfortunately, with the mod targeting client-side
Is there a reason you want to do this externally? (Like that wouldn't an ingame option be enough or am I lacking some context here)
Can't do API calls ingame afaik
most of the process is handled ingame, its just the transmit/receive that's done with the extension
Could you move the actual logic to ingame and if you need something like logging, do that only in/via the extension?
I would say just block callExtension from remoteExec, I don't think you'll have any problems.
And if you do, you'll see it in your logs and can do something about it then
Unless you can easily solve that with the call context thing
and obviously unit isn't a string, but It seems to work now so
I'd prefer to block remoteExec on callExtension completely, while having the option on in-game functions
that'd be the safest option
Extension context doesn't solve it
That seems like a missed opportunity there. I don't know if it can still be fixed without adding another function
call_context gives the steamID of the caller, that might work
also there's a difference between Extension Context and Call Context right?
Extension Context: What extension returns to extensionCallback EH
Call Context: Caller, Source etc of the extension call
guys, this script used to work for me but no longer does. I can't spot the issue:
// initPlayerLocal.sqf
VAL_fn_showAllyOnMiniGPS = {
if (isNil "gpsDisplay") then {gpsDisplay = _this#0;};
if ((visibleGPS) && diag_fps > 15) then {
{
_icon = getText (configfile >> 'CfgVehicles' >> typeof _x >> 'icon');
gpsDisplay drawIcon [
_icon,
[0,0.3,0.6,0.90],
getPosWorld _x,
18,
18,
getDirVisual _x
];
} forEach (units group player - [player]);
};
};
// description.ext
class Extended_DisplayLoad_EventHandlers {
class RscCustomInfoMiniMap {
VAL_DrawGPS = "\
params ['_display'];\
private _control = _display displayCtrl 101;\
_control ctrlAddEventHandler ['Draw', { call VAL_fn_showAllyOnMiniGPS; }];\
";
};
};
That used to display the icons of all the player's team mates on the mini GPS screen (CTRL+M).
Myb its init order have you tried declaring your fnc in cfgFunctions ?
Just tried using cfgFunctions and the icons still don't show
I can only see my own icon
Well for one thing you shouldn't serialize the display
Just use params ["_disp"] and use the local var
also verify if the EH is getting called at all
It could be a problem on CBA's side
Maybe that is the issue, I am no longer using CBA
Then you can't do it like that
But what I said about the serialization is also an issue
Thank you for helping finding out the culprit, I was going insane π
I will look for a "CBA less" alternative
@agile pumice so .. first of all, use the damned tripple ` to make code blocks or single to make code lines ...
then ... what you want to do?
is it really required to do all the type checking?
How do I find the mini GPS display?
You can do something like this:
private _displays = uiNameSpace getVariable ["igui_displays", []];
{
private _ctrl = _x displayCtrl 101;
if (!isNull _ctrl && ctrlType _ctrl == 101) then {
//do stuff
};
} forEach _displays;
Thanks! Will try now
ok, my approach did not work but at least I found a new way to destroy my Arma 3 stability:
VAL_fn_showAllyOnMiniGPS = {
addMissionEventHandler ["EachFrame", {
if (diag_fps > 15 && !(visibleMap)) then {
private _displays = uiNameSpace getVariable ["igui_displays", []];
{
private _ctrl = _x displayCtrl 101;
if (!isNull _ctrl && ctrlType _ctrl == 101) then {
if (visibleGPS) then {
{
_icon = getText (configfile >> 'CfgVehicles' >> typeof _x >> 'icon');
_ctrl drawIcon [
_icon,
[0,0.3,0.6,0.90],
getPosWorld _x,
18,
18,
getDirVisual _x
];
} forEach (units group player - [player]);
};
};
} forEach _displays;
};
}];
};
At least it doesn't show an error
No it won't, that is just the local players steamID.
Doesn't say if it came through a remoteExec
No callback is not context
Uh actually we can easily extend the context.
It's just an array of strings. So we could add remoteExec ID into there
fairs, pretty much settled on disabling remoteExec on extension outright anyway.
Focusing on to see if I can have a toggleable system on the ingame functions
isRemoteExec seems to cover that
and remoteExecutedOwner to see who remoteExec'ed a thing
On the server yes
but it only works on the server
I looked at the extension context.
I have some ideas on how we can expand this further in 2.16
Include the remoteExec information, include a full stacktrace (if you want it) and maybe more
@queen cargo, yes it does slow down the location commands nearestLocation(s) but I've actually never really seen anyone use locations for anything and the engine doesn't even really use them
Well I'm glad that I unintentionally gave you a feature idea
but yes, remoteExec info could be useful to people (even if using remoteExec on callExtension may not be a good idea as discussed earlier)
I might ask BI to give us something like just a generic data object
more a generic namespace object
or some sort of "pushNamespace"
then it owuld not even be needed to move above the object generation
nah, just "createDataObject" would be fine, its all in the code, a namespace is just a global GameVarSpace in the engine
every object has a GameVarSpace, locations have one, teammembers, and a few other things
they could literally just copy the locations class and get rid of the commands for drawing them finding them on the map, and any other stuff that'd be pointless
BI though does seem really reluctant to add new datatypes though
cause they'd have to handle a few serialization issues
for the plebs that still play singleplayer ;)
Hey now, singleplayer is quite fun ;)
@grizzled cliff i asked, and asked
i'll poke Joris tonight or next week about it, i have a few tickets from the ACE people that I need to have him look over too.
Hi, I am trying to understand the following function: https://github.com/official-antistasi-community/A3-Antistasi/blob/unstable/A3A/addons/gui/functions/GUI/fn_configColorToArray.sqf
private _configColor = _this select 0;
private _configColorAsString = str _configColor;
private _colorArrayString = "[" + (_configColorAsString select [1, (count _configColorAsString) -2]) + "]";
call compile _colorArrayString;
and its example of use
private _color = [A3A_COLOR_SELECT_MARKER] call A3A_fnc_configColorToArray;
where
#define A3A_COLOR_SELECT_MARKER {1,1,1,0.75}
I do not understand how this works - I could not find it in the wiki and the debugger window throws errors when this is used.
is {1,1,1,0.75} valid SQF?
It is sadly valid SQF yes
It creates a piece of code, that pushes these values onto the stack (You can check its disassembly)
Then it pulls the text string out of it, and puts it into an array
What it really is doing there is basically parseSimpleArray in... bad
is it the preprocessor that is doing that?
But then why does it throws an error when used in the debug window? (this is why I assumed was the preprocessor)
what are you executing in debug window, and what error
I did it this morning to confirm, but I am not with it rn. Will write it here in 1h or so when I get hold of it!
private _configColor = {1,1,1,0.75};
private _configColorAsString = str _configColor; // "{1,1,1,0.75}"
private _colorArrayString = "[" + (_configColorAsString select [1, (count _configColorAsString) -2]) + "]"; // "[1,1,1,0.75]"
call compile _colorArrayString; // compiles to {[1,1,1,0.75]}, gets called and returns [1,1,1,0.75]
That is the same (just alot more complex and slower) as if you did
parseSimpleArray ("[" + toString {1,1,1,0.75} + "]")
So that whole function can be replaced by one line, or even put into a macro.
parseSimpleArray ("[" + toString (_this select 0) + "]")
I just ran it in debug console and had no problem
As for if its valid SQF
diag_dumpScriptAssembly {1,1,1,0.75}
push 1
push 1
push 1
push 0.75
Is there any way to prevent drawing of a friendly UAV "icon" in UAV Terminal display?
What did joris job title switch?
The error was probably caused by the use of #define. The preprocessor isn't doing any of the functional parts, but #define is a preprocessor command, and debug console inputs don't go through the preprocessor (in the default debug console). This is also why you can't use // comments in the debug console.
eh?
Added: execVM and spawn command now define a _thisScript variable containg a handle to the SQF script
awwwwesome
needed that
:O
does A3 itself have some spawn plane into air scripted action or best to do some custom coding?
Yes, createVehicle with "Fly" special state
Also afaik that's the only way to spawn vehicles that have long startup time (e.g. helicopters or I guess planes with propellers)
Hey everyone. Looking to get a bit of help from someone who is a bit familiar with the Arma 3 custom modules system. I'm working on a canine handler script, and I have it working in mission scripting, now I'm trying to practice porting it over to a module. The issue I appear to be having, is passing variables/data from the config to the function itself attached to the module class. I was wondering if someone might be able to take a look and assist? I want to get comfortable with the module system in general because I feel like it will help with a lot of the systems I'd like to reuse between missions that I am developing.
class AHS_DogType
{
displayName = "Dog Type";
tooltip = "Select the type of dog";
property = "dogType";
control = "Combo";
typeName = "String";
expression = "_this setVariable ['%s',_value];"
defaultValue = "MFR_B_GermanShepherd";
class Values
{
class MFR_B_GermanShepherd {name = "German Shepherd"; value = "MFR_B_GermanShepherd";};
class MFR_B_GermanShepherd_Black {name = "German Shepherd Black"; value = "MFR_B_GermanShepherd_Black";};
class MFR_B_Shepinois {name = "Shepinois"; value = "MFR_B_Shepinois";};
};
};```
For instance: - I want to pass the property of dogType to the function attached to the module.
the value of that property specifically.
To move things between missions you don't need modules btw
Unless those modules have some necessary "editor functionality"
I'm specifically putting the module down to sync with a unit, to assign that unit as a handler, to spawn a dog for said unit, and to select the breed of the dog.
So it has editor defined parameters.
to clarify - a player needs to get in manually in the plane first on the ground (hence the "action")
this is my 10+ year old code for it
//beam into the air
_speed = 150;
_position = position _plane;
_plane setPos [_position select 0,_position select 1,500];
_plane setVelocity [_speed * (sin (direction _plane)),_speed * (cos (direction _plane)),10];
// _plane setVelocityModelSpace [x, y, z];```
hmm- Should I move back all my parameters or add a new one to the end? (The angle brackets)
light point settings, intensity, <dayLight???> flareSize, start, constant, linear, quadratic, hardStart, hardEnd <dayLight???>
setVehiclePosition
it might make more sense to put it near the start, but then I'd need to either make backwards compatability (no) or change all the things I go that are calling the function xD
Also you might want to avoid the setPos and getPos/position 
oh didnt know that, who is project lead now?
Unable to get this code working for both h1 and h2.works for h1 but not h2.Any help appreciated.
while {true} do {
sleep 0.1;
if ((h1 distance pzsmokepos1 < 2000) || (h2 distance pzsmokepos1 < 2000)) exitWith {};
};
You can take a look at vanilla modules for examples
The way to read module parameters is doing _module getVariable ["paramClass", defaultValue]
Okay, awesome, will look into this and give it a shot... stupid probably noobish question but how do I look at the vanilla module code?
Open the function in function viewer
You mean you want the code to exit if either h1 or h2 is closer than 2000m to pzsmokepos1?
It already does that tho
so that should work?
Yes
hmmm
Is h2 defined?
I don't understand the question
You're using global vars in the code you showed earlier so in the mission
So if you type "typeof h2" in debug console it returns the heli type?
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
wait 1
jay crowe ;)
"Added: execVM and spawn command now define a _thisScript variable containg a handle to the SQF script"
For what tough? im missing smt obv am i?
_carrier = ussliberty;
_p1 = p1;
_gun1 = gun1;
_gun2 = gun2;
_gun3 = gun3;
_gun4 = gun4;
_pos1 = getMarkerPos "target_1";
_pos2 = getMarkerPos "target_2";
_pos3 = getMarkerPos "target_3";
_pos4 = getMarkerPos "target_4";
_grp = grp1;
_grp_b = grp1_b;
_h1 = h1;
_h2 = h2;
while {true} do {
sleep 0.1;
if (_h1 distance pzsmokepos1 < 2000) || (_h2 distance pzsmokepos1 < 2000) exitWith {};
};
{ _x enableSimulationGlobal true } forEach units _grp;
{ _x enableSimulationGlobal true } forEach units _grp_b;
[_p1,"RadioMsg_Alpha_1_1_approaching"] remoteExec ["sideRadio",0];
uisleep 6;
[_carrier,"RadioMsg_Alpha_1_1_cleared_for_landing_1"] remoteExec ["commandradio",0];
_gun1 doArtilleryFire [_pos1, "magazine_ShipCannon_120mm_HE_shells_x32", 6];
uisleep 1.5;
_gun2 doArtilleryFire [_pos2, "magazine_ShipCannon_120mm_HE_shells_x32", 6];
uisleep 2.5;
_gun3 doArtilleryFire [_pos3, "magazine_ShipCannon_120mm_HE_shells_x32", 6];
uisleep 2;
_gun4 doArtilleryFire [_pos4, "magazine_ShipCannon_120mm_HE_shells_x32", 6];
}; ```
thtas what i have so far
h2 doesnt fire the rest of code
?
wait 1
@grizzled cliff Pettka
Just to double check put this in the while loop:
systemChat str [_h1 distance pzsmokepos1, _h2 distance pzsmokepos1];
k
Then try to see what it returns for distances
i get an error in h1 but nothing in h2
must not be firing script in h2
gonna check
wasnt firing script in h2 when entering.
Thanx
i have an error from messing with it no i think
*now
gotta check my code
ππ»
@little raptor I got it figured out now, thank you so much for pointing me in the right direction!
@little raptor I got it figured out now, thank you so much for pointing me in the right direction! Me TOO !! lol
ππ»
Ah.
"Added: execVM and spawn command now define a _thisScript variable containg a handle to the SQF script"
For garbage collecting. Need to track script handles.
i guess with combination with diag_activeSQFscripts
but noting really amazing
But wait, how would you track it that way?, you can allready do
handle = [] spawn {};
or
handel2 = [] execVM "";
Is there an event handler for when a player has spawned in
Or any good way of executing a script once they have
I've tried to use player addEventHandler ["Init", and player addMPEventHandler ["MPRespawn", but they both seem to run the script before the player has been initialised. I've got it printing the player name to system chat for debugging and when it's called it prints out Error: No vehicle
And is there any reason getPlayerUID would return an empty string?
Being passed a null object, probably.
Did you try just "Respawn"?
I remember editing some code from a liberation mission and pretty sure that's what it used
I'm testing with a friend, doing getPlayerUID returns mine but not his
I'll try it
Ahh thanks, I completely forgot about those
It's really confusing reading this on mobile, the simple code format doesnt show at all.
i think _thisScript is inside the thread
you could use it maybe for some inter thread communication
yea you can allready do that
breakOut
breakTo
^^ dont break betwen threads it goes wrong horiblly
i simply cant see how handle of a thread within that thread does anything,
as you can either terminate a thread or check if its null or done, and none of that makes sense from thread itself
wait i got something to read about for that interesting case. http://www.informatik.uni-bremen.de/agbs/lehre/ss09/trs/script/trs_script.pdf example 1.3
this is used to find out if something could go wrong with inter thread communications
Grim, it is because when i create objects i need to track where they were created so i can collect them later when they are no longer in use
since you usually create objects inside threads, you need to know the thread id in which it was created
again, i need to associate objects to threads
there was no way to do that before
so when i walk the object list i can check oh, this was created in a spawn thread, is that spawn thread still running? no? collect this object for deletion
oh i get it
so lets say you spawn an event in 1 thread
insted of using an array to gather object check all objects to be deleated after not needed
smt like that?
kinda, ill explain more when i get back from class, gotta go do me some art history bitchessss, get that futurism on yeaaaaa
just out of curiosity why does 'setObjectScale' reset objects scale when object is moved?
engine ways and matrix transformation iirc
Can't it be optional? Because there are some examples with eachframe eh, why forcing it when it could be optional.
I know it would be nice but I believe it was intricate way too deep in the engine to allow for that
Dedmen is the one behind the feature's access
has to do with magnitude of vectors or something along the lines of that
probably
either way even changing scale of objects is stretching rv4
rv4 mesh deformation when
aw come ooon, now Dedmen ran away again
watch your mouth will you! π
given i turned his majestic object scaling into a cursed height changing mod for the memes i cant blame him
though i dont understand why it doesnt work if not local to server π€
I've gotten players to enter very small vehicles, making them very small. But allowing movement of objects while small I haven't been able to accomplish. Does your method allow players to move?
don't spread the forbidden knowledge!
oneachframe set it to that size
Ello, sorry for interjecting, I want to know something.
So how can I combine everything into a single group rather than multiple groups?
allTrucksWithCrew = createVehicleCrew _emptyTrucks;```
Create the crew for each vehicle individually and then joinSilent them into a single group.
how...
i mean
lemme show u something
{
_x params ["_id", "_classname"];
for [{_i = 0}, {!isNil ([_id, _i] joinString "")}, {_i = _i + 1}] do {
_placeholderC1 = missionNamespace getVariable ([_id, _i] joinString "");
_spawnPosC1 = getPosATL _placeholderC1;
_vehC1 = _classname createVehicle [_spawnPosC1 select 0, _spawnPosC1 select 1, (_spawnPosC1 select 2) + 0.2];
_vehC1 enableSimulationGlobal false;
_vehC1 allowDamage false;
_vehC1 setDir (getDir _placeholderC1);
_vehC1 setPosATL _spawnPosC1;
[_vehC1] call KPLIB_fnc_clearCargo;
sleep 0.5;
_vehC1 enableSimulationGlobal true;
_vehC1 setDamage 0;
_vehC1 allowDamage true;
_vehC1 setVariable ["KP_liberation_preplaced", true, true];
[_vehC1] call KPLIB_fnc_addObjectInit;
convoyVehiclesC1 = createVehicleCrew _vehC1;
};
} forEach [
["c1LV0_", KP_liberation_c1LV0_classname],
["c1LSV0_", KP_liberation_c1LSV0_classname],
["c1FBV0_", KP_liberation_c1FBV0_classname],
["c1TTV0_", KP_liberation_c1TTV0_classname],
["c1RSV0_", KP_liberation_c1RSV0_classname],
["c1RV0_", KP_liberation_c1RV0_classname]```
yeah I'm not reading that for-loop logic.
;-;
This isn't your code is it?
nope, KP_Liberation, you know me I cant code that well
Im just editing one of the file that would let me create a convoy and then I want to add crew and then combine them all into one single vehicle and use that 8)
you realise that this is just the first of a thousand problems
Don't make convoys in Arma unless you have very strong tolerance.
Hi guys quick question why is this not detecting when i fire from vehicle am i doing something wrong ?
if(isNull objectParent _unit) then {
//on Foot
_unit addEventHandler ["Fired",{
systemChat "Fire foot";
}];
} else {
//in Vehicle
(vehicle _unit) addEventHandler ["Fired",{
systemChat "Fire vehicle";
}];
};
Are you talking gunner seats or FFV or what?
Basicly in a plane as a pilot and trying to shoot it dosent fire at all.
If you're working with units then maybe just try FiredMan.
I am working with a player not untis.
The player is a unit.
Unless they're a headless client, in which case they don't fire :P
As for why that code doesn't work, maybe describe where/when you're calling it.
It should work if the unit is already the pilot when it's called.
I was spawning it in initPlayerLocal.sqf as a fnc. and a _unit was just passed as player.
But is the player in the plane already at that point?
No. its outside the plane
Then it's not going to work, is it?
oh.. yea π€¦ββοΈ.Firedman basicly fixed it.
raises eyebrow
Actually another question i have
:0
I have this code to give me magazine names of all missiles in game:
getAllMissiles = ("toLowerANSI getText (_x /'nameSound') in ['missiles','rockets']" configClasses (configfile >> "CfgMagazines")) apply {configName _x};
but this dosent include the ["Vorona_HEAT","Titan_AA","Titan_AT","NLAW_F"] is there any way to make above to include everymissile in game from turrets, vehicles, aircrafts, and on foot ?
well XD new ideas new problems
garbage collection would not be needed with arrays :P
You know i made a convoy script? :)
@fleet sand You'd probably need to drill down to the ammo.
I think nameSound is only used for vehicle weapons?
In CfgAmmo you can just use the simulation type.
I think i manage to make it to work:
getAllMissiles = ("getText (_x >> 'simulation') in ['shotMissile']"configClasses (configfile >> "CfgAmmo")) apply {configName _x};
probably want to keep the toLower in there. Config is all busted.
Although if you're not checking shotRocket as well then you can just use ==
like this ?
getAllMissiles = ("toLowerANSI getText (_x >> 'simulation') isEqualTo 'shotMissile'"configClasses (configfile >> "CfgAmmo")) apply {configName _x};
just use ==
(it's case-insensitive, unlike isEqualTo)
otherwise you'd need to be comparing to 'shotmissile'
any help?
In front of the loop:
_groups = [];
Replace this line:
convoyVehiclesC1 = createVehicleCrew _vehC1;
with
_groups pushBack (createVehicleCrew _vehC1);
After the loop:
MyStupidConvoyGroup = createGroup convoySideGoesHere;
{
units _x joinSilent MyStupidConvoyGroup;
} forEach _groups;
i made an infinite helicopter mission generator just recently that spawned a generated convoy going from random location to another random location, let me find it
Oh wow
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
here's the relevant part, you should be able to extract what you need from it
num_veh = [1, 3] call BIS_fnc_randomInt;
vehtypes = ["UK3CB_TKC_C_Lada", "UK3CB_TCK_C_Hatchback", "UK3CB_TCK_C_Hilux_Civ_Closed", "UK3CB_TCK_C__Hilux_Civ_Open", "UK3CB_TCK_C_S1203", "UK3CB_TCK_C_Skoda", "UK3CB_TCK_C_V3S_Closed", "UK3CB_TCK_C_V3S_Open", "UK3CB_TCK_C_UAZ_Open", "UK3CB_TCK_C_UAZ_Closed", "UK3CB_TCK_C_Ural", "UK3CB_TCK_C_Ural_Open", "UK3CB_TCK_C_Pickup"];
veh = createVehicle [selectRandom vehtypes, position block_1_spawn];
vc = createVehicleCrew veh;
wp = vc addWaypoint [position block_1_stop, 0, 1];
wp setWaypointType "HOLD";
wp_2 = vc addWaypoint [position block_1_despawn, 0, 2];
wp_2 setWaypointType "MOVE";
}];```
Hi... I've been trying to get this code to spawn a vehicle, but for some reason I can't get it to work...
If I do veh = createVehicle ["some_vehicle", position block_1_spawn];
It does work, but it won't if I try to get a random vehicle
Could someone help me? I will be eternally grateful
Doesn't work how?
When selecting the addAction, the vehicle fails to spawn
hint what selectRandom returns before spawning it
I did that previously, it returned what you'd expect "UK3CB_TCK_C_Ural_Open" for example
I tried to format it in case it wasn't returning a string just in case, neither case works
Any errors?
Negative
it's like if the vehicle class was non-existent
Are you sure all of classNames there are all valid?
I'll try with just 2 classNames that for sure work on their own
Okay I found the problem
I think, brb
I misspelled most vehicle classes with TCK instead of TKC
I would like to apologize for the wasted brain cells
No need to. Whenever it happens it happens
Thanks to both for your help. Valuable lesson learned in debugging
Need armaism testimony. I've added an addaction onto some traders in my exile server so they switch to a standing idle position from a captive position simulating they were saved. the problem is, some of the traders default back to the captured animation and some of them don't
{
_allTraders = (getMarkerPos "MafiaTraderCity") nearEntities [["Exile_Trader_Hardware","Exile_Trader_Food","Exile_Trader_Armory","Exile_Trader_Equipment","Exile_Trader_SpecialOperations","Exile_Trader_Office","Exile_Trader_WasteDump","Exile_Trader_Aircraft","Exile_Trader_AircraftCustoms","Exile_Trader_Vehicle","Exile_Trader_VehicleCustoms","Exile_Trader_RussianRoulette","Exile_Guard_01","Exile_Guard_02","Exile_Guard_03"], 500];
for "_i" from 0 to (count _allTraders)-1 do
{
_trader = _allTraders select _i;
removeAllWeapons _trader;
_trader setVariable ["ExileAnimations", ["Acts_ExecutionVictim_Loop"]];
_animation = "Acts_ExecutionVictim_Loop";
_trader switchMove _animation;
_trader setCaptive true;
_trader addAction ["Release Hostage",
{
(_this select 0) switchMove "HubStanding_idle1";
(_this select 0) removeAction (_this select 2);
}];
};
};
i want them to change to the standing idle animation permanently after the add action has been used
could be related to locality. another possible reason is exile still trying to do its "exileAnimations"
so you should also remove those anims
yea but i already wrote one for fast hash maps in ACRE
there is no getting around the slowness of arrays being used as hash maps
so if i have a GC for that, then dynamic objects are not that big of a deal
besides easier to write a GC than write all that typing stuff into a compiler :P
@fallen locust I want to roll this into CBA in the future, so at least then everyone will have it (well anyone that runs serious modifications).
Though to be fair I'd probably never use carma in my own projects simply because I already have existing codebases that are massive and arma doesn't really require an OOP language to do everything.
In fact I'd say its a benefit that it doesn't have OOP because most people have no idea what to do with OOP
most sqf coders are the equivelent of a virgin walking into a tantric sex seminar when it comes to programming concepts.
Both animations are applied by this script. It isn't defaulting to it's exile animation. It's defaulting to the Execution Victim animation
that is the exile animation
_trader setVariable ["ExileAnimations", ["Acts_ExecutionVictim_Loop"]];
you should reset that too
params ["_trader", "", "_id"];
_trader setVariable ["ExileAnimations", []];
_trader switchMove "HubStanding_idle1";
_trader removeAction _id;
I'll give it a go, thanks!
Would it be better to set it to nil vs empty you think?
I can try both I guess
Still never figured out a good solution to this. I did try adding a temporary respawn handler to make the player remote control the new respawned unit, but that didn't seem to work.
Where do you execute that ?
Need to remoteExec that for every client, since the traders are local for each client.
Same for the animation changes on "Release Hostage".
Can anyone explain to me why this returns "This value should be impossible to return" and only prints "In getdatapad string", "after unit", "at very end RET:" and "This value should be impossible to return": http://pastebin.com/srJxgiZM
I just don't understand how neither if nor else can be executed...
any way to disable nvgs without removing them? a event handler for when they are on would work
Client override in my mission pbo
for players or AI?
players
Hey can someone help me out?
I'm making a campaign for a MilSim group i Zeus for and i need a Script that acts in the doors of the non-enterable CUP buildings so they can climb them, my first thought was making a trigger in each door where it creates a addAction to teleport to each trigger (one being the door on the bottom and the other the door on the top), i have one issue with the script i was using
trigArse attachTo [arse, [0,0,1]];}```
That is the trigger (Variable name = Entrance1) in the door at the bottom of the building, and there's a trigger Building1 at the top of the building
I found this script online a while back that adds a Arsenal Action to players within the area, when left the addAction disappears
The problem is when i make the teleport script using this same format the addAction stays in the player like he didn't left the trigger and it will keep stacking, i need help figuring this out
Other methods are welcome, they are a Realism heavy MilSim unit so they wouldn't accept just a random flagpole there, and removing the flagpole model makes so the addAction does show up
is there a decent explanation of arma's implementation of try/throw/catch anywhere? the ones on the wiki are bare bones
a key interception could do
damn hoped there would be a command or an action for it but i guess not many people rebind the key thanks lou!
you can "key" intercept by "actionkey" intercept, don't listen to "N" only
ah thank you i will look into this
displayAddEventHandler β https://community.bistudio.com/wiki/displayAddEventHandler
onKeyDown EH β https://community.bistudio.com/wiki/User_Interface_Event_Handlers
im just looking at thest two right now
https://community.bistudio.com/wiki/inputAction/actions
https://community.bistudio.com/wiki/actionKeys
nvm i see you linked it
so it doesnt get lost
"nightVision" is the key
wait reforger has nightvision? ooh might have to explore that at some point between pulling my hair out dealing with enforce script
Not sure if it's helpful. But there is also a "Pier Ladder" object that would allow folks to climb the building.
huh - we are in the arma 3 scripting channel
Reforger only has NVGs support through mods, not officially
it should fire at each and every vision mode change and i know at least one place where it's used to show a fullscreen dark overlay as a means to disable thermals
@gusty flame It isn't displaying "In First Else"?
And is it displaying any errors in there?
You can also detect https://community.bistudio.com/wiki/addUserActionEventHandler nightVision / transportNightVision and use https://community.bistudio.com/wiki/action to immediately revert it
Was looking at input actions and saw it under the reformer tab
No on both, I have show script errors on but it isn't giving me any errors
The "Arma Reforger" column is for the Reforger-like control scheme preset in Arma 3. That page is a reference for Arma 3 only.
So it must be skipping over the entire if statement. I know everyone is different in their style of coding, but maybe the else { being on a seperate line than } is causing a problem?
I have plenty of other cases in my code where I have my elses like that and they work, but I'll try it anyway lol considering how weird this is
I always place the } else { on the same line, never tried it any other way haha
Will the if command return false or an error?
_var = nil;
if (_var-1 > 5) then {};
try doing _var = _unit getVariable 'datapad_bioweapon_data'; and then if(_var)...
Hello, I have the following properties defines for a UI button control, which play the appropriate sounds as expected.
soundEnter[] = {"\A3\ui_f\data\sound\RscButton\soundEnter", 0.09, 1};
soundPush[] = {"\A3\ui_f\data\sound\RscButton\soundPush", 0.09, 1};
soundClick[] = {"\A3\ui_f\data\sound\RscButton\soundClick", 0.09, 1};
soundEscape[] = {"\A3\ui_f\data\sound\RscButton\soundEscape", 0.09, 1};
However, when I try to getArray soundClick[], for instance, and playSoundUI, A3 is telling me the file is not found in the logs. So, is there perhaps an unnamed extension for these embedded resources that the default 'just knows'?
// i.e.
private _args = getArray (_config >> "soundClick");
playSoundUI _args;
Probably an error since it tries to reference an undefined variable
try printing _var after that ^^^
https://community.bistudio.com/wiki/playSoundUI
When using a file path, the file extension (likely to be .wss for native files) must be specified
.wss? I am not familiar with that... I thought it was .ogg?
it is correct, .wss, thanks...
.ogg is one of the formats commonly used by the community, but a lot of the default game sounds are .wss.
good to know, thanks man
actually, what is 'data_bioweapon_data'? is it a boolean?
if not you need to compare that to something in order for the if statement to work
hmm, okay, it 'works' but the actual button click sounds rather muted, not sure why...
but when I play the resource itself from the config, it is MUCH louder... is there a volume squelch I may apply before I play it?
perhaps applying the getAudioOptionVolumes UI factor?
For now it's just nothing, haven't implemented it yet, so expecting to hit all the elses for now and return "no data on it"
I'll try the _var thing now
well if it doesnt exist then the getVariable returns nothing and the if statement breaks right?
I'm pretty new to Arma scripting, but in no other language I've used can an if-statement break :P It's either true or not, and if not the else is executed
I'm expecting getVariable to return nil here I guess, and I'm expecting an if(nil) to return false and execute else
Ive never been able to break an if statement before, but not saying it isn't possible.
I would try filling your unit with test data to begin with.
tried that, or soundVolume, both of which claiming 1 for volume settings... other bits are diminished in getAudioOptionVolumes in particular, but I do not think those are appropriate for UI volume? could be wrong...
getAudioOptionVolumes;
// [0.085194,0,0,0.80622,1,0.693248]
I cannot imagine FX volume factor should be used here, but given the difference, it 'sounds' more plausible than UI.
ideas?
Hello, Sorry for interjecting. May I ask how I can convert a string (leader convoyGroup) to an object that can be used? :D
Or just make it a variable that I can call in another script (different sqf script)?
use getVariable array i had similar issues before
Hi, does anyone know, why groups with such event handlers added still attack each other? https://pastebin.com/T1E1ZNPg
leader convoyGroup is an object
Lol actually it was me being dumb xD the thing was already an object (like u said) ... shouldnt code for 18 hours xD
Thanks for help Lou <3
don't code while tired! ^^
experimentally have some confirmation, seems very likely that _fx * _ui * _x is perhaps the way to go, but would like for clarification, if possible.
what do you mean by getVariable array? I'm pretty new to Arma scripting :)
https://community.bistudio.com/wiki/getVariable
alternative syntax
Can I exit from a .sqf script like this? Will it return false? Or should I put _returnMe; once on the last line of the exitWith {_returnMe;}? ```sqf
if (_nearTargetsDistIndex == -1) exitWith
{
_returnMe = false;
_returnMe; //Needed here or redundant?
}
if (_nearTargetsDistIndex == -1) exitWith
{
false;
}
it should return "Data undefined"
Would this _returnMe = false; work as well?
in that instance you would need this
The assign operation returns true if successful, am I right? So basically the opposite of what I need.
That was what I was thinking ^^
no
it doesn't return anything
this won't exit the "script". it exits the scope
My scope is the function as a .sqf file.
I meant generally
it is a common misconception, I think, SQF is not like 'C' in this regard... assignment does not also convey data flow value.
In another words: Do not code! π
that too :p
I cannot recount all the times I have made stupid mistakes, whereas investing in rest saved so much time and debug
Haha wow :O that worked. Never have I ever worked with a language quite like this one before hehe.....
Thanks for the help guys!
Just reporting back
(_this select 0) setVariable ["ExileAnimations", nil];
Fixed this, thank you
Depends on where you execute.
In scheduled error and the if/then/else block will be ignored.
In unscheduled no error but still ignored
Hello - If one was to create an AFK script for a server to check player location, would it also be possible to check if a key is being held for x_ amout of time?
For example, a player is trying to avoid the AFK (position check) and place an item on their keyboard making them continue to move to avoid being kicked
You can have an onKeyDown EH, store the last key pressed and time in an array, if the button pressed is the same as the first element in the array then substract current time from last time and then you have seconds inbetween
Thank you
Would a standalone string work as a return value? Thanks
getSomeString =
{
_nonsesHere = 1 + 2 - 1 - 2;
... ... ...
"Hey there!"; //Return value
};
hint call getSomeString; //Will it display hint with "Hey there!"?
exactly accurate. that's how SQF is 'data flow' IMO.
hint call getSomeString
Are there general "player is in zeus" or "player is in camera" checks?
Kinda like how there's is3DEN
Figured that was how I'd have to do it
By chance do you happen to know what display the camera ui is in?
The splendid camera, where you can change the weather, time, angle, etc. etc.
I'll check later after I eat
Appreciate it, if I had to guess it'd be in "GUI_displays", couldn't find a specific display for it on the allDisplays page
It is obtainable by findDisplay
configfile >> "RscDisplayCamera" >> "idd" 314
How do I create a custom 3dsound and play it using a script or addaction?
Is it the same as making a music file?
It can be similar (not exactly the same)
https://community.bistudio.com/wiki/Description.ext#CfgSounds
https://community.bistudio.com/wiki/say3D
Or it can be a bit different
https://community.bistudio.com/wiki/playSound3D
Hello I have a script to knock down trees - but they seem to recover after about an hour. Is it possible to repeat this every 30 minutes?
Just while?
If* using while do i use sleep; 1800 //30 minutes to prevent it from repeating a bunch?
Yep
while { /* condition, could just do true to always run*/ } do
{
// destroy trees
sleep 1800;
};
Yeah
THANKS
π
Sqf doesn't support if then else does it?
How can I change the atmosphere color?
Is there a way to make the sky/fog an orange color?
Same answer
You can use a colour correction effect (https://community.bistudio.com/wiki/Post_Process_Effects#ColorCorrections) - note that this will affect the entire scene and not just the sky, so it might not be able to achieve the exact look you're after.
idk where you intend to use it but given that you use this I think you wanted to use it in obj init, which won't work
when you're in doubt, you can always just test stuff in debug console. neither the game nor your computer will explode I promise π
worst case scenario is you crash/freeze the game 
(well you could also erase saved stuff if you mess with profileNamespace...)
what's a better idea for getting players' inventories in MP and saving to a db?
a) using BIS_fnc_saveInventory (which i just discovered)
b) continuing using my own functions
Why are some gestures not working?
player playAction "gesturePoint";
the above for example does nothing
hmm doesn't seem to work
Then it doesn't
haha xD
what about switchAction?
Again
It probably is not configured well for your current animation
ah okay just noticed if i hold a weapon it works
Hi, I'm bumping my question: does anyone know, why groups with such event handlers added still attack each other, when they shouldn't? https://pastebin.com/T1E1ZNPg
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
What makes you think the event handler is causing it?
lol i just noticed an Ali G reference in bis_fnc_respect
default {hintc "NO RESTECP!\nError in respect evaluation script."};
Sorry, causing what? Those EHs when ran are not causing anything that's the problem, expected behaviour would be a 2 hostile groups aren't attacking each other if they have those EH attached, but they still do
Why not use setCaptive instead?
A
dont even consider bothering with own functions if BIS already did the work for you ...
also ... why the hell you want to save inventories?!
really? Unless his function is written poorly it would be better since bis_fnc_saveInventory returns an array and saves to the profilenamespace, which is relatively taxing. It also still uses bis_fnc_param
ye youre right @native hemlock
better write your own function by copy the BIS function and changing those lil things
thats the good way
because reinventing the wheel always worked
and redundant coding is good
π
I am getting an error with this code-
sleep 1.5;
if ((_h1 distance pzsmokepos1 < 2300) && (activate1)) || ((_h2 distance pzsmokepos1 < 2300) && (activate1)) exitWith {};
};```
Any help appreciated.
Thanks
what is the error
think i'll stick with my functions, will be easier to debug in future
and i'm saving inventories, etc, so everything's persistent after mission restart, what's weird about that?
saving the engine and light status of every vehicle on the map...now that's weird
as long as you do not plan to do some weirdo altis life or wasteland thing you simply do not need any database
only player stuff or vehicles as well @candid sun
both
Me again. i have this in a script
sleep 1.5;
if ((_h1 distance _pzsmokepos < 2300) && (activate1) || (_h2 distance _pzsmokepos < 2300) && (activate1)) exitWith {};
};```
and i have
activate1
in a waypoint but i dont think the script is getting the condition activated
any thing i am missing?
Thanks
ah, backpacks inside vehicles?
i think i needed this to be defined correctly in the script _activate1 = activate1;
well
i have
activate1in a waypoint
Wut?
fuck those backpacks then
its just a nightmare to load
What effect are you trying to achieve? I'm talking gameplay experience wise.
yeah i think i'll work on saving bullet count in each magazine first
that'll be much more enjoyable
think i got it friend.i forgot to add it in the defines.just testing now.:)
Now, I am coding without Arma installed. π So I wanted to make sure, that once I do, it won't fall into pieces. π I am doing a "huge" refactoring of my code, so I am pretty curious how the debug stage will go after days of no testing.
Hmm, is there even any debuggin tool for SQF? π€
0 = [] spawn {
private["_p1","_p2","_base","_h1","_h2","_activate"];
_p1 = p1;
_p2 = p2;
_base = carrier;
_h1 = h1;
_h2 = h2;
_activate = activate0;
while {true} do {
sleep 1.5;
if ((_p1 in _h1) && (_activate) || (_p2 in _h2) && (_activate)) exitWith {};
};
uisleep 1;
[_p1,"RadioMsg_Request_takeoff"] remoteExec ["sideRadio",0];
uisleep 5;
[_base,"RadioMsg_Request_takeoff_TowerReply"] remoteExec ["commandRadio",0];
uisleep 5;
[_p1,"RadioMsg_Request_takeoff_confirm"] remoteExec ["sideRadio",0];
uisleep 10;
"Reminder: Adjust View Distance Before Take Off" remoteExec ["hint", 0];
[[this]] call ANZ_heli_mission_fnc_pzchat1;
};```
error is undefined variable in expression.
activate0 = true;
in a waypoint
any help appreciated
Not a pro SQF coder, but this looks suspicous to me 0 = [] spawn {
What is the purpose of the 0 there?
If you declare a function with a variable then you probably might want to put the code after the equal sign into curly brackets.
0 = { [] spawn { ........... }; }; One closing bracket is for spawn and one for the whole fucntion.
And I would probably choose more self-explanatory name for a function instead of just "0". π
as long as you dont go into contents of containers in vehicles its pritty easy
that fixed it m8.ππ»
it ran ok b4.is the activate bit a variable?
i am working from examples from internet
sqf-vm
Usually it might skip some wrong lines of the code, and then stop after the compiler/parser realizes that the context of what it originally thought it is in is now completely different. For example when you forget ; or combime two not corresponding brackets like { and ).
rgr that.Thnx
Usually u use {} for a code block, () for regular expressions (if statements) and for setting calculation priorities, and [] for arrays or arrays of arguments that go into function as an input.
Np.Thank you!
iam using this code and it works but shouldnt it be && instead or?waitUntil {uisleep 1;{!(alive _x) || _x in _heli} count units _grp == count units _grp}; _copilot vehicleRadio "RadioMsg_troops_on_board";
cant be that hard @fallen locust ...
hell -.-' if i would not be compeeting against @grizzled cliff ... i would spend the this WE with writing some fancy function for that
Probably correct? If some guy is dead you're not expecting him to board to continue.
it works correct though.of what i have seen..
should this part _x in _heli
be in bractes?
()
*brackets
Doesn't need to be.
does the first part need them?
and/or have lower precedence than other binary commands.
No, !alive _x is fine but it looks odd to some people.
however !(_x in _heli) would need brackets.
unary commands are higher precedence than binary commands.
what?
!(alive _x)
It is a negation. Not alive. !alive means return true, if the unit is not alive.
alive _x --> is _x alive?
!alive _x --> is _x not alive?
means is alive?
It gets retarded pritty quick
try it ;)
Also I think that uisleep 1 could be replaced with sleep 1. But I don't want to confuse u even more. π
np.i was unsure of that.i thought i read that uisleep was better
yeah uiSleep is a common cargo cult.
sleep 1; // waits for 1 second in-game, 4 IRL seconds (1 / 0.25)
uiSleep 1; // waits for 1 IRL second
uiSleep is for stuff that should delay in real time rather than simulation time. Primarily UI, hence the name. If you're wondering whether you should use it for something, think what you want to happen when the game's paused in SP.
np.again thanks
so pretty much all the scripts i have posted should be sleep and not uisleep?
That would be the general rule.
waits for 1 second in-game, 4 IRL seconds
This is not true, because setTimeMultiplier doesn't affect simulation time.
If u used the uisleep 1 then the condition would be checked once a second even if you paused the game with escape button. But when the game is paused, you don't need to check it, because no unit would enter or leave a vehicled during that time. Basically, the uisleep timer never stops, and the sleep timer stops when the game is paused.
im used to retarded shit ... hell i wrote XMedSys after like one and a half month practice in SQF