#arma3_scripting
1 messages · Page 511 of 1
@novel trellis you can have mod with sounds and reference them in mission config, not sure why you have a problem
okay thankyou for confirming, i will double check everything
you can avoid all of that by playing alone @tough abyss
hi everone
i have a problem
Error in expression <dAction['Rob Shop',life_fnc_robShops];
>
Error position: <
>
Error Invalid number in expression
File core\harita\fn_robShops.sqf [life_fnc_robShops], line 35
this robshop.sqf: https://hastebin.com/piwakulawa.cs
Looks like an error
can anybody tell me if spawn-ed code shares local variable scope in the same way that call-ed code does? i.e. is there any need/point to declaring vars as private within a spawned routine?
no it does not share from unscheduled into scheduled scopes, but does share from scheduled to child unscheduled scopes (obviously).
[] call {
private _a = 0;
[] spawn {
systemchat format["%1",_a]; // "any"
};
};
[] spawn {
private _a = 0;
[] call {
systemchat format["%1",_a]; // "0"
};
};```
Not really sure if its worth doing in a fresh spawn scope but I still do as good practice.
Thanks, appreciate it.
spawn creates a new script instances
Which is completely seperate. Local variable lookup looks in parent scopes. The new script instance doesn't have any parent scopes because it's seperated. Thus local vars don't carry over
systemchat format["%1",_a]; // "any" That is script error. Scheduled errors on undefined variable
still prints any though. was just showing that it was nil.
@peak plover @keen tusk i don't know solution i don't understand problem
the line in that error doesnt even exist in the file you linked after it, are you sure its the right file?
@robust hollow yes i am sure
well good luck then 👍
@rancid pecan Right now it's impossible to find the solution
The code is in an obscure language. SQF is written in English
once you find the file, you have bad line endings
https://i.imgur.com/kBdE8du.png
Guys, I have a problem. I call the code and when the character moves I have the output of the code, but it should not be.
for "_i" from 0 to _time step 1 do {
hint format ["Passed %1 of %2",_i,_time];
_pos = getPosATL player;
if (speed player > 24 OR {player distance _pos > 20} OR {!alive player} OR {vehicle player != player}) exitWith {hint "Capture aborted"; _exit = true;};
sleep 1;
};
not sure what ur saying there but just going to point a couple of things out:
... from 0 to _time step 1 ...
no need to write step 1, it is the default.
_pos = getPosATL player;
if (speed player > 24 OR {player distance _pos > 20} ...
player distance _pos will most likely never be greater than 20 because you're setting _pos then checking it immediately.
i assume you mean to have something like this so it exits when the player gets too far away from where he started the action
private _pos = getPosATL player;
for "_i" from 0 to _time do {
hint format ["Passed %1 of %2",_i,_time];
if (speed player > 24 OR {player distance _pos > 20} OR {!alive player} OR {vehicle player != player}) exitWith {hint "Capture aborted"; _exit = true;};
sleep 1;
};
@robust hollow hmm, now check
I doubt player on foot can move faster than 24 km/h, what is this check supposed to achieve?
description.sqf > description.ext
@fleet hazel check your speed when running sideways, I remember it being only forward and backward
ex. Hold W and D
@peak plover Ok
I'm attempting to script a dynamic point for a mission, using bis_fnc_findSafePos, however when I use this
_gate = "sga_gate_orbital" createVehicle getPos _posGate;```
I get the following error:
``` 8:59:43 Error position: <getPos _posGate;>
8:59:43 Error getpos: Type Array, expected Object,Location
8:59:43 File C:\Users\Lynn\Documents\Arma 3 - Other Profiles\Kinch\mpmissions\co_x_tauri_adventures.Altis\test.sqf, line 25```
I'm unsure of why `getPos` isn't accepting the array input, any suggestions?
I'm unsure of why getPos isn't accepting the array input
Because it says so on the wiki
https://community.bistudio.com/wiki/getPos
also findSafePos already returns a position. Trying to get the position of a position doesn't make much sense
Oh... okay that makes sense, thank you
in CBA_Settings_fnc_init how would one add extra information, much like how ACE does it? https://cdn.discordapp.com/attachments/497428101702352897/537285503649579018/unknown.png
Yeah i just thought to do that also, saw there is an array 😛
<STRING, ARRAY>
Cheers 😃
np bud
so it would be something like: ["Main Title", "Tool TIP Text"]?
yes
Awesome
[
setting var name,
"CHECKBOX",
[setting name, settingdescription],
[setting menu name, sub category name],
true, // Default value
true, // _isGlobal
{
params ["_value"];
_script;
}
] call CBA_Settings_fnc_init;
example for a checkbox
i usually like to use ace for examples when using cba function as sometimes i find cba wiki doesn;t do the best job at explaining things
_this globalChat "I haven't seen anything, dont bother me"
_this globalChat "sorry, i don't think i can help you"
_this globalChat "sorry, i don't think i can help you"
i want the script to pick one of these (or other lines i will add) randomly every time it's run
how do i do that?
systemChat (selectRandom ["1","2","3"]);
how do i set which is 1,2 ect..
?
systemChat (selectRandom ["I haven't seen anything, dont bother me","sorry, i don't think i can help you","sorry, i don't think i can help you"]);
if you want to reference it after somewhere, then yes. But don't see any need for that.
just convert it to globalChat with the unit you want
this addAction ["<t color='#FFFFFF'>(selectRandom ["Have you seen anything?","Have you spotted any russians?","Any trouble around?"])</t>",{player execVM "talk_unknown.sqf";}];
could i use it like this aswell?
no
selectRandom is a script command. Script commands work in scripts
what you have there is a string. Not a script.
ah
Is there a subtype name that called house(building) only, not powerline, wire, fence, gate, lamp street...etc ?
doesnt "House" already do that?
House include wire, lampstreet, powerline etc...
"BUILDING"?
https://community.bistudio.com/wiki/nearestTerrainObjects there is a list of them
this addAction [format["<t color='#FFFFFF'>%1</t>",selectRandom ["Have you seen anything?","Have you spotted any russians?","Any trouble around?"]],{player execVM "talk_unknown.sqf";}];
@modest temple
Building also includes powerline, lamp street, gate etc..
House_Small does not include garage, slum house, house big and house small class.
What about Structure
Sorry, Structure does not include any house.
Does create3DENComposition not create an array for anyone else? Tested in debug console with:
_myComposition = create3DENComposition [
configFile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfSquad",
screenToWorld [0.5,0.5]
];
_myComposition
Return:
[]
Is config valid?
Well it's an example from the wiki
It creates the units fine, just doesn't return an array of the entity IDs
So I can't edit them at all afterwards
Strange
Yeah, I wanted to ask here first before I submitted a bug report, unless this isn't a bug?
Are you sure it's BIS, not BUS?
returns an empty array for them too
Just open the config viewer, find it, observe the path.
But even that was the case midnight, it wouldn't create the units. However it does create units, just doesn't return a array
see
What if you create them on land?
Who knows
Same thing
Who can point me, how to make fire\napalm for populate only on walkable areas and ignore walls\objects?
Yeah seems like a bug
Hey guys, thought I'd come here to ask for directions, since I've browsed forums, tutorials and scripts and didn't help much, which was proven by my non-funcitonal scripts xD
I'm a programmer and I do it for living, but never done anything with this scripting language, started playing with it recently
and I find it suprisingly hard to comprehend 😄
Any idea where can I learn proper distinction and best practices of server/client side scripting? How to write scripts that run properly on both? I've seen people taking different approaches in the same direction, but I can't find a constructive guide on that
most of guides I've seen consist of basic mission scripting, but I'm building a Arma 2 Epoch server which requires more than that
personally i learnt for looking at ace and cba code and reading their guildlines
i can send their githubs as well if you want
most of the new important things won't work in arma 2 tho
plus killzonekid is really good
look at his post on his website
yes true but arma 3 has a lot of backwards compatibility, its mainly new commands, functions and some syntax changes between them
Arma 2 is for masochists
( ͡° ͜ʖ ͡°)
Thanks for the links @calm pond
yeah I assume major differences will be documented in arma docs
Arma 2 is for Massachusetts? Cool, cause I live here

http://killzonekid.com/category/games/arma-3/
https://github.com/CBATeam/CBA_A3/wiki - just because use these function it will save you a lot of time
https://github.com/acemod/ACE3/tree/a18f4180ac0309c1ad48889abe8676bc2b6e700c - ace code base, imo the best format for a mod despite being a bit finicky to set up
both have A* documentation, which is better than i can say for a lot and things, including my own
i hope it does, still would recommend doing it a3 tho. but thats just me.
Enjoy
Ask @queen cargo for the book
yeah I was thinking about it, but I'll save it for the next project, DayZ community in A2 is still massive
ooh, "the book"?
Yeah 😩
you don't seem too enthusiastic about it 😄 Thanks, I'll ask him 😄
He just needs a bit of motivation to finish it
oh I just sent him a message xD
XD
thanks, made me look like an asshole, I definitely made a great first impression xD
Did you insult him or something?
i have a shit ton of bookmarks if you want them
split into there categories
its from a old post i cant find
oh dude would be perfect
@tough abyss noo, it's just about pestering someone I didn't know about some piece of work he didn't finish 😄 only joking man
He is a good guy hopefully will not get mad and kill you
yeah he's a top bloke, thanks for recommending him mate
Anyway you probably find more help just asking here rather than going through ancient posts elsewhere. Wha lingo are you programmer of?
@tough abyss Problem is... I have limited time and nobody is really helping 😅
Time is of the essence!
@tough abyss well I'm a webdev and I specialise in JS, but I've worked with some other, lower-level languages in the past as well 😄 Gamedev-wise PAWN took a massive amount of time of my life, for scripting server-side mods for good old Counter Strike
to be fair though, SQF syntax makes a lot of sense to me and it's not the biggest problem, although I know that I have to get to know it better
I mostly struggle with functions, how and why they are called, and generally how to write code that works in perfect harmony with all clients and the server 😄
Functions are just variables containing type CODE. You can execute code directly with call or spawn command
There are many other ways to call functions but you probably don't wanna know them.
Though if you understood how SQF works underneath. You'll already know that
CODE is just compiled string containing the statements
So you write your script as text, compile it and boom now you can execute it
So you can pass code literal like call {hint str 123}; or store it in a variable first func = {hint str 123}; call func;
When you look up wiki pay attention what type of argument a command takes
There are not many types
But there are many many commands
That is what makes sqf difficult to learn
thats why google exists
But most commands are just APIs for engine functionality
Engine methods exposed for scripts
Some more recent commands were added to improve and speed up common operations in sqf
@jagged mica Based on your desire to achieve 'perfect harmony with all clients and the server' the biggest thing to get your head around is locality; https://community.bistudio.com/wiki/Locality_in_Multiplayer
Oh
this is quite a good blog; http://killzonekid.com/arma-scripting-tutorials-locality/
guys, I can't thank you enough
perfect, that might answer a lot of questions, thanks a lot, all of you
just beware when using kk's blog as reference. Most of the stuff on there is years old. And some this can be done way easier today. And his scripts don't use things that are standard today, like private keyword and params.
But if you only care about Arma 2 then that doesn't matter to you
yeah good point
Hey is it possible to set a specific weapon to infinite ammo?
I've done it for AI, but I want a specific weapon (a handheld minigun) to have unlimited ammo only
you would probably need to create some sort of repeating event/script that refills the ammo periodically.
@jagged field
https://community.bistudio.com/wiki/setAmmo
with fired eventHandler for example
ty
ah crap, its only for local
so I can't do it on a server
oh wait the unit is local to the server
so if the server runs the mission it should be alright
RemoteExec
@jagged field no, every pc runs the mission
A handheld mini gun is not vanilla item ergo you can configure your mod so that it contains tonnes of ammo, more than you can fire
are you running cba?
just remotexec it with the vehicle as target, not that hard
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
}];``` I'm confused how this event handler works, are these `"_ammo"` things just String names?
this addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
_unit setAmmo [_weapon, some random int for the amount of ammo happy? IE 1];
}];
this is just a guess, dont @ me
Google params arma 3
it wont work, give me a sec
ammo is a string
you could just set it to 30 or what ever you want
I'm confused, I thought it was just a variable type String
what would setting it to 30 do
as in the name of the variable is 30, or can I send it the number 30 and it sets the current mag to 30
@calm pond I doubt you can add number to string and get away with it
no that why i said it wouldnt work
its an int you just set to what number he wants
plus i said dont@ me bro
oh its: setAmmo [weapon, count] count just being an int and weapon the String name of the weapon
is what he meant I think
You seem to know how to edit yet you decided to leave that intact
better?
best thing is i have no idea if that works, was just a guess, not even sure how EH work with ai. I assume the same but you never know
Sure it works
params ["InfGun"];
_unit setAmmo [InfGun, 50];
}];``` Set Navid Variable name to `InfGun` is that correct or am I misunderstanding everything
Yes you’re misunderstanding things, until you read about params
It's not params per se, but the general idea of function parameters. This might be a better starting point: https://community.bistudio.com/wiki/Function#Parameters
and order is critical
Hi guys. Anybody know how to allow to edit sqf script on server side while it running?
First think was to use compile preprocess File. But ARMA lock this file immediately after first call of preprocess and dont release it...
this addEventHandler ["Fired", {
(_this # 0) setAmmo [currentWeapon (_this # 0), 10];
}];
@wanton swallow file patching, should work for prepped functions on reload and on next virtual exec run of the file
https://community.bistudio.com/wiki/Arma_3_Startup_Parameters#Developer_Options
@slim oyster file patching works for client side but dont work on dedicated server in the same game.
After first exec ru of the file on the server it's stand to lock.
Forgot to said: this script called from servermod.
From what I'm reading, if you are running server file patching, execVM should be able to load scripts from the arma install folder
which should release the file between executions
it might not release the lock if you reload the file every frame or VERY frequently.
LOL @lilac escarp # was added specifically so that you don’t need to surround it with parentheses. Also current weapon used is passed as param already
private _foo = 5;
private _bar = 10;
_foo += _bar
something like this possible? instead of _foo = _foo + _bar
No
I mean, you could make a macro
@tough abyss no matter. the main thing is that it works))
p.s. Sorry for my English)
If you knew how SQF works. You'd see that it can't work.
_foo += _bar
Variables are resolved before command call ->
5 += 10
Uh.. What now.. Can increment the 5, but no idea where to store the result into.. Can't do anything with this.
Jeez I really have to know better how SQF works to avoid such questions 🤔
Thx for clarification
just saw a commit of sb.
private _return =+ _prepend;
therefore was curious what is happening here.
But sb. already commented on that to have it this way
= +_prepend;
=+ works. Or SQF-VM atleast
+= is a little different from =+
Simply because it's actually = +
Isn't it?
yeah
can i overwrite an existing custom info panel with my bullet cam script then revert the panel back to default afterwards?
https://community.bistudio.com/wiki/Arma_3_Custom_Info
here is my basic bullet cam:
FORGET ABOUT THE SCRIPT, FOCUS ON THE CUSTOM INFO PANELS TY
will it be possible to take for example the mine detector panel, switch it out with the camera then switch?
_null = nonsense
_missile = _this select 6; if you only want one parameter. Then only pass that parameter to the spawn. Don't pass the whole array first, and then get a single element out later
so how about the custom info panel stuff? (thats what i wanted feedback about)
Can you hide the panel and draw your own in place and then show old one when done?
@lusty canyon ifs in waitUntil? You could simplify it
Usually when people ask things in #arma3_scripting people look at the script instead of at the wiki page that explains config stuff with 0 scripting inside. ^^
thats the thing tho, i could of taken my question to config but i wanted something that i can just run on the fly in debug console. i hoped for a sqf only solution to accessing info panels
I don't know if there are sqf commands for switching info panels
so much for bohemia saying the info panels were mod friendly
i guess this is why the rhs raven still uses that ugly old looking pip window
thanks anyway, sorry if i got a bit pissy
It looks like you'll need to define a custom resource based on RscTransportCameraComponentMissile
@still forum there are
Is there a way to print those values using hint?
https://community.bistudio.com/wiki/Arma_3_Particle_Effects:_Config_Parameters
I guess you need to retrieve the needed values from config with functions like getNumber, etc, and then do whatever you like with them
I am not sure how could I get for example value accelY, arent those sources?
I am not totally sure about the specific attributes you need to get, but if you can see it in the arma's config viewer than there should be no problem with getting them
Oh I know what you mean. No it isnt that, there is a line in config for example like this:
enabled="accelY interpolate [39.9999999,40,-1,1]";
and I would like to read in realtime what accelY parameter is equal to
Oh I see... so this variable is only relevant inside whatever string processor arma uses for configs 😫 what a mess
If you really need this, you could monitor vehicle's velocity every frame, take their difference, divide by time passed, and thus calculate velocity first derivative or acceleration, then convert this acceleration vector into vehicle's model space, and I guess it would be equivalent 🤷
Wait 🤔 I think ACE has G-force effects? They should be based on vertical acceleration, check how they do it
Ok will check those, big thanks 😃
I think I've found a bug. Can anybody confirm it for me before I make a ticket?
It's in BIS_fnc_initVehicle, where it checks whether to skip reset of animation sources (line 244). Expected behaviour is that if you pass false as the first element in the animations array (see example 10 in the function header), it'll not reset the animations. Actual behaviour is that it ignores the false and continues anyway. Example 10 itself doesn't actually work as expected.
I suspect it's because "false isEqualType true" will return true. Perhaps it was meant to be isEqualTo?
It appears that it should work since [false, ...] call bis_fnc_arrayShift would return false and assign it to _resetAnimationSources, but I'm gonna do some more testing to make sure
unit test appears to work, an _animations value of [1,2,3] returns true while [false,1,2,3] returns false
Hey everyone, it's me again
after yesterday I felt inspired to get back to one of the projects I've abandoned for arma 2
any clue if there's any chance I can play an animation of user sitting (on a chair/in a vehicle) with his weapon drawn? I played around with some switchMove and some animations but can't find anything constructive
How to make Custom in Game Left Top Logo ?
create a picture control, position it in the top left and set text to the image filepath
like this @digital plover
#include "\a3\3den\ui\macros.inc"
private _ctrl = (findDisplay 46) ctrlCreate ["RscPicture",-1];
_ctrl ctrlSetPosition [safezoneX + (3*GRID_W),safezoneY + (3*GRID_H),16*GRID_W,16*GRID_H];
_ctrl ctrlSetText "\a3\ui_f\data\logos\a_64_ca.paa";
_ctrl ctrlCommit 0;
Hello guys. Could someone can confirm this ?
When giving order to a unit, using doTarget and fireAtTarget at another unit, the "lock" is only possible if the bullet/missile/bomb has the capability to lock the target ?
exemple : a VLS firing a missile at a car, the missile will reach his target because the missile is configured to lock on ground vehicles ?
Can the same VLS could lock and destroyed a helo flying if his missiles can't lock AA targets ?
I'm trying to figure what doTarget and fireAtTarget can really do.
@robust hollow where should I write this code exactly?
into an sqf file so you can execute it when you need to.
yes
not from my phone no
mylogo.sqf: ```#include "\a3\3den\ui\macros.inc"
private _ctrl = (findDisplay 46) ctrlCreate ["RscPicture",-1];
_ctrl ctrlSetPosition [safezoneX + (3GRID_W),safezoneY + (3GRID_H),16GRID_W,16GRID_H];
_ctrl ctrlSetText "\a3\ui_f\data\logos\a_64_ca.paa";
_ctrl ctrlCommit 0;```
Correct ?
anda MyMod config.cpp: ```class CfgPatches
{
class MyMod
{
units[] = {};
weapons[] = {};
requiredVersion = 0.1;
requiredAddons[] = {"A3_Data_F","A3_Map_Altis","A3_Map_Stratis"};
};
class exile_client{};
};
class CfgMods
{
class MyMod
{
name = "MyMod";
author = "Spook";
version = "0.1";
};
author = "Spook";
timepacked = "";
};
class CfgFunctions
{
class SPK
{
tag = "SPK";
class SPK
{
file = "MyMod\functions";
class init
{
postinit = 1;
};
};
};
};```
mylogo.sqf in the MyMod\functions path
@robust hollow
Does this work?
you tell me, does it? im going to guess no cause you havent defined it in cfg functions.
I have no idea about this. trying to do something by trying
So I been digging around for a anti-looting script. Basically something that just removes enemy weapons on killed. I found this in a old forum that looks like what I need, but I feel this is directed to the player rather then the AI?
player addMPEventHandler ["MPKilled",{_unit = _this select 0; removeAllWeapons _unit; removeAllAssignedItems _unit; clearMagazineCargo _unit}];
If it does effect AI, how could I make it universal to a dedicated server with HC?
add it to "EntityKilled" EH
with condition checking if it is a soldier that has been killed and not a vehicle
with locality in mind of course
I'm lacking scripting knowledge. But isn't the even handler the condition itself?
So like addMissionEventHandler ["EntityKilled", { params["_killed"]; if (_killed isKindOf "Man") then {?
or something like that.
Would that be a major issue?
isnt there a class that men inherit but animals dont? CAManBase or something like that.
I would also start the code with
if (!local _killed) exitWith {};
Do what Connor says
Would that be a major issue? no
Hey is it possible to prevent damage conditionally, i.e. Allow damage from only a specific user? allowDamage isn't an option because it disables all damage. Any chance to achieve this with handlers or something?
HandleDamage EVH with ur condition inside would do the trick
HandleDamage is not an easy EH to comprehend though
how so?
Fires multiple times for each body selection including the "whole body" """section""""
because it fires for every selection and the damage is applied after depending on return values from each selection damage @robust hollow
if you just return 0 it will restore full health
Doubt this is what Vestarr wants
oh, yea i knew that much, thought there must have been something else going on i was unaware of. fair enough though 👍
So i have been working on a map for my server and i types up this script to lock it to our server name only so other people cant use our map while our community is still running a server. This is the first 2 line of the script:
if (!isMultiplayer) exitWith {};
if (_servername != "Oure Server Name Here") exitWith {
The problem im getting is when I launch the server it gives me and error and says File mapProtect.sqf, line 0: '.if': "(" encountered instead of "=".
are you loading it as a config or something?
im using the config.cpp to call it like this #include "mapProtect.sqf";
🤔
I don't think your map is going to be worth protecting...
Also you can't write a script like that
At all
Without a custom .dll
** lock it to our server name only** so other people cant use our map while our community is still running a server
This is harder to do than you think
What's preventing someone from repacking without that line? Nothing. Obfuscation will
im using the config.cpp to call it like this #include "mapProtect.sqf"; thats not how it works, and yea, even if you do get this working, nothing is stopping anyone from removing it.
We have already use the Obfuscation
so why are you doing this?
What you are asking for:
A script which checks if your community is running a server, if it's still running a server, then player can not load that map on other servers
This is difficult to do
i think he just means he will remove the check when they stop using the map
All it is ment to do is to check what the server name is and if it is not our server name then stop the server form loading
You guys are giving me the chills, we're talking about a terrain right?
¯_(ツ)_/¯
@robust hollow he can't guarantee that he is still alive or remembers at the time his community dies
This is not the first server that has or have tried to do this
Map = "Terrain" ? "Scenario" ??
You can't script that
What about leaving the key absent from a mod?
does the client still need the key with the signed files?
@peak plover i know what your saying, i just dont think he means for it to be so complicated. simply checking the server name and ending if it doesnt match is all he is trying to do.
Yes that ^^^^^^^
I have seen it done before thats the only reason why im trying to do it
if(serverName != "BLAH") then
{
"EveryoneLost" call BIS_fnc_endMissionServer
};
or, if you want without gui style.
if(serverName != "BLAH") then
{
"CONTINUE" remoteExec["endMission",0];
};
Yikes
Smart lad
life servers usually have remoteExec configs and stuff 'tho
so I doubt that'll work
remoteexec from server doesnt pay attention to the config.
add it to whitelist. Bam.
Are you sure connor? Doesn't CfgRemoteExec have specific "You can't target clients" option?
please don't use remoteExecute there
yea but i understand it to be sending from one client to another. i dont define whitelist for functions if its just the server sending to clients and it works fine
Someone will join his friends server with the wrong mod and cause everyone's mission to end
Hmm
only let the server execute the check then?
Yeah ,that could work
Or just endmission for the client
So he'll go back in the lobbyu
also include an error message somewhere
Otherwise they will not know why
This kind of stuff should be obvious 'tho
No, just leave them in complete confusion please. It'll be funny.
It would be lol
crash the server when it loads. then u dont need to worry about players joining 👌
It will be funny, but if someone did that to me I'd deobsfucate and upload the files somewhere
in spite
true
Is it possible to have a variable created in the definition of a variable?
Ex:
_table =
[
blue = "Blah!",
red = "Blaaahhhh!"
];
I wanted to use the color names as index references. But it would seem this is not possible.
no, no it isnt.
Darn. I thought this was going to be really simple:
_blockColor = _table select (_table find _color);
You can create a new namespace and use setvar/getvar
Hmm, how do you mean new namespace?
any object or anything which has a namespace, usually location
Aha. That's what I thought you meant, will see about it.
_blockColor = _namespace getVariable _color;
imagine if . worked as getvariable
_namespace._color
loc setVariable["colorLibrary",
[
["Blue",[255,255,0]],
["Red", [255,255[0]]
],true];
Like so?
nah
I'm retarded. Hold on.
Red def = color, namespace holds color are reference
loc setVariable["Red",[255,255,0],true];
//so on for each color
#define . getVariable 😂 if only...
{
_namespace setVariable [_x#0,_x#1];
} forEach [
["Blue",[255,255,0]],
["Red", [255,255[0]]
];
// locations are local ONLY, so you can't use public variables
I see, excellent wizardry.
private _color = _namespace getVariable 'Blue'
Neat. That's cool.
If this is a ui, you can even use a display or a control as your namespace
Won't even have to create a location
Correct, this is actually for those VR blocks. Was looking for a good way for a quick lookup / quick setter function for each of them. But good to know for the future, pain in the ass ui color.
https://discordapp.com/channels/105462288051380224/105462984087728128/537927892445822977
Is it possible to have a variable created in the definition of a variable? Sure. But the = will return nothing, and will error out when the array tries to retrieve the value while it only get's nothing. The variables will be defined, your array won't work tho
Gotcha. That makes sense.
Also no SQF command ever can see the name of the variable you pass to it. The variable is always resolved before the command is called. The command has no clue where that value comes from
["Red", [255,255[0]] syntax error 😉
if (_servername != there is a command for that serverName https://community.bistudio.com/wiki/serverName
LOL
Diwako does the same with his unitHud. Storing colors in a namespace by the name they will be looked up on. Mainly for performance
Though I think that indirectly comes from commy
syntax error not quite red either 😩
Hey, it was for ex.
Anyways, this is technically the most performant way of doing so?
Well if you already know what color you want, hardcoding the array might be faster than getVariable call
Nope, it's supposed to be random. I didn't want to have to pass the exact color values to fnc everytime, so I wanted to build a lookup of sorts.
Has anyone had experience with multiplayer performance impact of running setObjectMaterial possibly every frame to reflect an animation scalar value (i.e. throttle)?
@still forum correct commy suggested it. I completely forgot about namespaces as I normally do not use them
setObjectMaterial is local why would it have any multiplayer impact?
true, I guess just for lower end machines
as an example for using (cba) namespaces for caching:
https://github.com/diwako/diwako_dui/blob/master/mod/functions/fn_getColorStyles.sqf#L24-L40
Hi guys, with
_position = _this select 0; //starting search pos
_threshold = _this select 1;
{
if(_x distance _position < _threshold) exitWith
{
hint format ["%1 is closest",_x];
};
} forEach allMapMarkers;
if I was using a Square marker, would it count the markers edge or from the markers centre for the distance?
https://forums.bohemia.net/forums/topic/188016-search-for-the-nearest-marker/
center, though allMapMarkers returns strings so you need to change _x to markerPos _x
i think you do anyway
yep that's right Return Value: Array of Strings
Yea sweet. I've got a setup as below
https://i.imgur.com/UiqLiGs.png
and essentially i've got dudes that spawn in based on the quantity of building positions in a grid to occupy + random dudes patrolling. I want to further bolster those numbers based on nearby markers.
So like
If theres 2 nearby, its likely an area thats larger and would justify more dudes in that area
Just trying to discover an effective and not performance rapey
cause I got to run it for every marker
@daring pawn you can check if position is inside the maker with inArea if this is what you are trying to do https://community.bistudio.com/wiki/inArea
Hi there - if I remember correctly, it was possible before to give a doStop/moveTo combination to an AI that had another AI as a group Leader, they would wait at their position as intended. These days it seems that after a little while, they will go back into formation after a certain interval, no matter what - does anyone know anything about this? Even if I use a doMove/sleep/doStop combination it will take about 5 seconds before the unit returns to formation
Have I told you that I love you all
not enough. give it up
My question is a long way up but HandleDamage is exactly what I needed
Could you give a better explanation please @fleet hazel
@drowsy axle How do I set the radius of a given circle?
I'm trying to return a Cfg... entry from an Object. ```sqf
params ["_object"];
private _class = (configFile) call BIS_fnc_GetCfgData;
switch (_class) do {
case CfgWeapons : { _classname = (configFile >> _class >> _object >> "displayName") call BIS_fnc_GetCfgData; };
case CfgMagazines : { _classname = (configFile >> _class >> _object >> "displayName") call BIS_fnc_GetCfgData; };
default { hint "Something Went Wrong!" };
};``` Here's what I've got so far. I hope someone can help me.
@fleet hazel How are you creating the circle?
@drowsy axle I need to make a transparent barrier around the player with a radius of 15 meters. If he goes beyond the radius then his script is interrupted. How to make a transparent barrier?
you are trying to get a classname from the display name after you throw it through getCfgData?
No. the Cfg
@fleet hazel you can use a trigger.
private params makes no sense
@drowsy axle The player does not visually see the trigger...
Refined version above @still forum
@fleet hazel Why don't you locally create objects, around the player at a radius of 15 metres
answer my questions.
That code is so nonsense that I don't understand what you are trying to do
@drowsy axle What are the objects?
_ object is either a Weapon or Magazine. @still forum
All I want to do, is have an AddAction on an object, which runs above script, that SHOULD, switch depending on it's Cfg class. Now, that I know which Cfg class is it, get the classname of the object.
The FiredNear event handler has a note in it that the distance has a maximum of 69m, so does that mean a pair of units more than that, say 100m apart would not have the event triggered at all?
where do you get that weapon or magazine thing from?
If you have the class then you already have the classname
I assume that is what it means rather than it would just report it as a maximum of ~69m
I don't want to do it manually for every object.
that's what that should mean yeah @tough abyss
@fleet hazel you can't, it is what it is
I want to place a ``[this] call CAP_fnc_getClassname` script. inside each objects, init field, in the editor
@drowsy axle WHAT IS INSIDE _object. Why is that so hard to answer?
A object is in there?
So Not a weapon or magazine at all
https://community.bistudio.com/wiki/typeOf here. That returns the classname of a object
I was sooo close. I looked at TypeName..... ffs man. Why is it so hard for me to find the command that I need.
Thanks for that long winded bullshit. I apologise.
Why is it so hard for me to find the command that I nee typeOf is in see also on typeName page and second result on google under typeName
pointless
how?
"I dont know commands, I want information about an object"
Object Information -> smaller list of commands useful for the user
ok.
how can i manually access the stored arsenal presets?
i.e where does arsenal write the presets
also exporting does not help me in this case
Profilenamespce
Im not sure what the variable names are but you can find them from function viewer, and then see the arsenal script
thnaks!
profilenamespace getvariable ["bis_fnc_saveInventory_data",[]]
hey there (again ^^ ) ive got a script where i collect nearEntities to apply damage to them but its not working for the case the entity is inside a vehicle its ```sqf
_near_units = (position _object) nearEntities [["Man"],8];
if (count _near_units >0) then
{{
if !(vehicle _x == _x) then {
_bomb = "Bo_GBU12_LGB" createVehicle (getpos _x);
_bomb setdamage 1;
diag_log "player in vehicle has been killed by an anomaly (burp)";
} else {/*do something else because on foot*/};
}foreach _near_units;
};
this is inside a foreach near_units btw,i think that does matter
added this
huh, nearEntities isn't returning units in vehicles for me
don't see that anywhere in the docs
Because it doesn't return units in vehicles
_near_units = entities [["man"],[],true,false];
?
The entity it would return would be the vehicle itself
Not if you have it return only kind of Man
Is that not something that should be mentioned on the wiki? The only qualification mentioned is the unit must be alive, which units in vehicles are.
Good point calling @winter rose over
(entities [["man"],[],true,true]) select {player distance _x < 8}; would be the equivalent, however it takes 4x longer than nearEntities, and that's just on a test map with 4 units
Is there an alternative?
@tough abyss good evening?
If you want to count units in vehicles with nearentities the workaround would probably be slower @foggy moon
How’s going?
@tough abyss Fine thanks, how may I help (:
@foggy moon brought up interesting point, wiki for nearEntities doesn’t mention that it doesn’t detect units in vehicles, do you think you could amend that?
true, will do!
Sweet
is this sentence correct?
If any types are given, only entities of given types or subtypes are listed
regarding the plural form for any types and further plurals
If the alternate syntax is used, would be more accurate as it only applies to that
but technically yes
How would I call for an NPC's classname from EDEN and use it in a script?
@mortal nacelle Do you mean Right click unit(s) > Log > Log Classes to Clipboard?
No no @foggy moon I believe Lou has given me what I wanted.
@lilac escarp Going back to your issue, adding vehicles to the nearEntities check and iterating their crew might still be the fastest way
@foggy moon this is not my problem)) but I also find it interesting
sorry went afk for a few minutes.so this is not me but difficult at all,no?
so counting the crew ?
@foggy moon @tough abyss I was on a roll and added (one) performance comparison @ https://community.bistudio.com/wiki/Code_Optimisation#nearEntities_and_nearestObjects
beautiful
nice! can anyone give me an example how to approach this ( in terms of a dummy code snippet so i can understand)?like if i should do a pushback or append or whatever?
@sturdy cape I would say use nearEntities, then do a second pass where you add crew _x to the array, and remove the vehicle from the array?
thats something i can start with
sorry if i need coffee but could i just do something simple like sqf if ((_x isKindOf "Car") && (player in crew _x)) then {?
That would only work if the code is called on the clients. If you want to run the code on server then I wouldn't use 'player'
If you are just trying to see if the vehicle is occupied you could use (count fullCrew _x) > 0
player in crew _x could just player in _x @sturdy cape
Yeah this code is running client side via broadcasted function
You never stop learning. Fullcrew is interesting.
if ((_x isKindOf "Car") && (count fullCrew _x)>0) then {``` need to test this in the morning.thank you
Is there any way to get the classname of a road? IE:
_roadList = [worldSize / 2, worldsize / 2, 0] nearRoads worldSize;
_road = selectRandom _roadList;
systemChat format ["%1", str _road];
to return
systemChat: "CUP_A2_Road_OA_dirt1_02000"
for instance.
EDIT:
It returns the ID number (I think?) but I can't get the classname from that.
Does typeOf not work? (I've never tried to return the classname of a road object, so I have no clue)
TypeOf doesn't work, no.
EDIT:
Figuring out the width of the road might help determine which classname it is on certain maps. IE: Wide roads == paved, slim roads == dirt.
I feel like I've missed something. I'm having troubles adding eventHandler "killed" to vehicles such as cars and explosives (ieds). Has anyone had similar issues and know what I'm doing wrong?
@tough abyss how are you getting the vehicles? Also,killed or MPkilled?
I know this is a long shot but try redefining the object via select again inside of the EH.had this once and this worked
anybody got a clever pattern that allows an array as a macro param?
This what you mean?
#define myMacro(a) systemchat str a
private _myArray = [1,2,3,4,5,6,7,8,9];
myMacro(_myArray);
yea, cause it "translates" it to systemchat str _myArray so cant get confused by the commas
thanks but as i don't yet require CBA it's probably overkill for this purpose (just tidier code)
roger, thanks both
d'oh, wasn't the fact that i was passing an array, rather that I'd used '#' (for select) within the macro
im wondering if this will work in multiplayer
civilian AI's init
this addAction ["Have you seen anything?", "talk_unknown.sqf"]
contents of the talk_unknown.sqf
player globalChat (selectRandom ["I haven't seen anything, dont bother me","sorry, i don't think i can help you","sorry, i don't think i can help you","go away","i wish i could help","i don't think i have notice anything...","everything seems normal around here"]);
no it won't
what should i do then?
Well actually.. Do you want people around you to hear what the AI said to you?
Then it doesn't make a difference if multiplayer or not
Btw.. The player is saying the answer, shouldn't the AI be saying it? ^^
you get the ai as parameter in _this
so _this globalChat?
check out the addAction wiki page. Just grab the AI and pass that to globalChat, instead of player
no. IN _this. It is not _this, _this is an array. check the wiki page
aight
@sturdy cape
It's all spawned using createVehicle in mp (not dedi yet). Still not working.
_ied = createVehicle [classname, pos, whatever, bla bla]; //works
_ied addEventHandler ["killed", "systemChat "IED destroyed"];
doesn't work. Spawns in IED but if I blow it up it just goes away.
Try deleted eh then
_ied addEventHandler ["MPkilled",
_ied = _this select 0;
"systemChat "IED destroyed";
];```
I know there's an error in the eh btw heh wrote it hastily. Don't have the exact code rn
just try this,i solved an object killed EH doing this
alright, I'll try it out. Thanks! 😃
does anyone know a way to recompile fsm during mission?
Are you sure your issue wasn't just the fact that you tried using an undefined local variable inside the EH @sturdy cape?
IE:
_object addEventHandler ["MPkilled", {systemChat format ["%1", str _object]}];
because it doesn't really make any sense otherwise, then again this is arma.
_ied addEventHandler ["killed", "systemChat "IED destroyed"]; pretty obvious why that doesn't work
even discord shows you that it doesn't work
{}; ermahgerd didnt even see this.making coffee now. @tough abyss the guys here are awesome and we suck 😉
Yeah, that's not the issue @still forum
_ied addEventHandler ["Deleted", {
systemChat "IED DESTROYED!";
}];
Could it be because it's the ace pressure plate ieds? They have some weird behaviour at times but could be it's like that for all mines.
Deleted EH might be unrealiable
I already know it fires even if the vehicle doesn't get deleted.. When you create a vehicle in zeus then Deleted EH fires on it, it's nuts
What do you mean?
I've tried deleted and killed so far. Neither has worked. Not even hit works it seems :/
You need vehicle reference to add eh to
_ied = createVehicle [_iedType, _iedPos, [], 0, ""];
_ied addEventHandler ["Killed", {
systemChat "IED DESTROYED!";
}];
Vehicle reference?
or are you talking about zeus?
Yes asking Dedmen
CBA XEH. Config Deleted eventhandler
You don't need a reference to add a config handler in the class
Could be the cba
Oh, is this ace explosives? you might as well give up xD ace explosives swaps in like 3 different objects depending on what stage of placing it is in. When I did my breaching charge I had to spawn another object and put an "explosion" eh on that.
Does ace explosives not have a EH that you can just hook into?
I didn't look very hard in that direction. That does sound optimal.
Yeah that's what I just kinda realised 5 min ago @digital hollow
I remember running into issues with ACE explosives before.
@still forum
I hope so!! 😄 Otherwise some ghetto triggers or smth might work.
explosion eh on wire_loop_F , that's the way to go =p
https://ace3mod.com/wiki/framework/events-framework.html#28-explosives-ace_explosives there is one for tripflare 😄
ace just does setDamage one to explode
yeah I was hoping ace_firedNonPlayerVehicle would work but seems like it doesn't 😦
Running vanilla ArmA3 using the debug console in editor
_ied = "IEDUrbanBig_Remote_Ammo" createVehicle position player;
systemChat format ["%1", _ied];
_ied addEventHandler ["Killed", {
systemChat "IED DESTROYED!";
}];
doesn't work neither :/
If anyone knows any good ways to detect mine explosions hit me up! I need something to execute the ied position and object name when the ied is either defused or destroyed.
got another one here: i need to check for a condition and count an array to check if a vehicle is already claimed (for my locking system plugin).code is as follows sqf _claim_count = {_vehicle = _x select 0; !isnull _vehicle && {alive _vehicle && {_vehicle getVariable["type", -1] == 3 && {_vehicle getVariable["oOWNER", ""] == _player_uuid}}}} count DB_var_Objects; if _claim_count is <5 the result is true and the player can claim another vehicle,.somehow this line always returns false.ds_var_objects is an array of all db objects.so it should check for all vehicles if alive,type 3 (saved to db which the former claims would have done),owner id etc. but it doesnt.did i go wrong in this code line ?
diag log db_var_objects results in an array containing what it should obviosusly,checked what i am capable of already
sorry i am always asking kind of naive questions,i just see no error in syntax and sometimes its just that second pair of eyes looking at it what makes the difference^^
how would you get the player object by netid or uid without having to loop around allUnits? Any ideas?
Have you tried objectFromNetId? https://community.bistudio.com/wiki/objectFromNetId
was there ever a plan to make ACRE2 and TFAR compatible to each other? Like people using ACRE2 could talk to peeps using TFAR
You mean like people on XBox playing with people on PlayStation?
is it that far from possible?
yep
@frigid raven yes it is far
🌹 too much negativity for me 🌹
Is there a base class for a rifle projectile? If i want to filter projectiles into projectiles who come from a rifle/gun/marksman, etc. but no tank or something like this
Nvm i think i found one. "BulletBase"
Hey, so i'm struggerling to understand the param. If I have another variable, let's say _test in one function, and I want to pass that variable over to this function, how do I do it? Would I just do _test = param[0]
?
You can pass _test by including it in the input array.
private _test = "test value";
[_test] call _func;
Then in _func you can get it using param
private _var = param [0];
_var //"test value"
Thanks. Can you use an array of classnames with typeOf
?
_distance = player distance2D (typeOf person player == _npcArray);
_npcArray = ["npc_supermarket","npc_supermarket_1"];
person what's that?
distance2D to a boolean? that doesn't make sense
what are you trying to do
Okay let me explain, this will be a long one.
I am trying to get all the classnames of the NPC's from EDEN. I am then executing a function that robs that specific npc. But I am trying to get the distance from the NPC to the player, and if the player moves away from the npc e.g. 3m then it will exit the script
if that makes sense
"the npc's" (many)
"robs that specific npc" (one)
which one?
What does robs mean
yeah sorry my english is whack 😂 I am trying to find the distance from the player to the NPC.
But I want to use NPC classnames, that I set in the mission.sqm
why not just give the npc a variable name in it's attributes in the editor?
I have done that.
That is what I mean
But i'm just too stupid to describe that
😂
hey guys, I'm toying with MenuInventory respawn template, and ive run into problem, i cannot make any locations to respawn with [missionNamespace, 'respawn'] call BIS_fnc_addRespawnPosition; I do have an empty marker named respawn, tho even after i enter it into debug console, Resapwn button is avalible but no locations
huh, I can't sleep in a CfgFunctions defined function… weird? canSuspend returns false
What are you trying to do?
hmm wait, maybe it's the wrong problem… I had sleeps in it before. I have to dig
yep, seems I should spawn it
lol
I am not really familiar with CfgFunctions-declared functions indeed
OK. So on runway lights I was told by a forum to do the following
{
dataType="Object";
class PositionInfo
{
position[]={23125.061,3.2350702,18981.07};
angles[]={0,3.1400568,0};
};
side="Empty";
flags=4;
class Attributes
{
init="call{_light setLightIntensity 9000;}";
};
id=3857;
type="Land_MBG_EdgeLight_Green";```
The effect is supposed to be to make the object shine brighter though after the "init" the light is more dim. Can anyone with a bit more insight please advise? **Note I am a idiot to coding**
init="call{_light setLightIntensity 9000;}"; i dont think _light is predefined, have you tried changing to init="this setLightIntensity 9000;";?
Yoh that kinda went over my head. will try init="this setLightIntensity 9000;";
thinking on it more, i dont think setLight... commands work on objects, only lightpoints?
Yeah, I doubt this will work. You're referencing the lamp instead of the light object.
Yeah still the oposite effect
I have no idea how you would get the light object.
However, you could spawn an additional light effect and adjust that one to your needs.
I tried light effect but the wash is weird and clips through some of the terrain so it looks jagged. Trying to find a fix without running a .sqf
Well, the init statement is SQF...
Only lights I could find was land_MBG_MiddleLight_"color" and land_MBG_EdgeLight_"color". Can not seem to find any other runway markers
There are several script commands to manipulate light sources. With the right settings and positioning, I'm sure you could get rid of the clipping and jagging.
Is there a way to change the radius? So light spreading from 1 meter to say 5cm but still visible from range or "approach"
Check out setLightAttenuation
will do
If you have Achilles by chance, you could play around with the light source module to get an idea.
@winter rose CfgFunctions are no different than anything else. Just goes through compileFinal command
CfgFunctions are also just compiled via script
I never really got this distinction in my mind I think.
call compile preprocessFileLineNumbers "script.sqf";``` works, even in the script has `waitUntil` ; functions don't?
call doesn't change environment
depends on where you call it from
there is 0 information stored inside the script about how and where it was compiled
if you call from unscheduled then you can't sleep
@winter rose Maybe your script has lupus
@high marsh it's never lupus (except in that one episode)
😃
https://feedback.bistudio.com/T129113
Is there a cleaner way to do what Wulf did here?
[_mine] spawn {
params ["_mine"];
waituntil {
sleep 1;
not alive _mine
};
systemchat "DEAD";
};
Wat.
_mine spawn
{
waitUntil
{
!alive _this;
sleep 1;
};
systemChat "HE'S DEAD JIM!";
};
if you only pass one parameter, then that'll work. Otherwise, it's obviously an array.
no wait
!alive _this would need to be under the sleep wouldnt it?
Damn...what did I screw up this time :/
everything! like you always do!
Wow, that really hurts.
Here take a 🍪 you done good
Thanks, is it at least oatmeal raisin?
yes. special for you
Yummy
but if you don't edit out your error then it turns into jelly
I added two more parms to it for my usage. That's just copypasted from his alternative eventHandler on the tracker 😄
_mine spawn
{
waitUntil
{
sleep 1;
!alive _this;
};
systemChat "HE'S DEAD JIM!";
};
Now lets see what type of performance hit this will give me in my EOD campaign of hundreds of stat saved mines!! (Y)
that's scheduled.. so none
that's actually amazing if ~100 waitUntil doesn't do anything at all
are mines considered ammo or "vehicle"? an EH would fit here
I think they're considered ammo. 99% sure.
From what I've done with them, they seem to essentially be a vehicle holding the given ammo
They can be manipulated with createVehicle and deleteVehicle after all
@foggy moon bullets too, but EH cannot be attached to them
sure, definitely not normal vehicles
yep, no event handler
@tough abyss you could also manage a list of mines and waitUntil one is dead, then remove it from the array – same checks, less threads
Pretty much what I'm doing. Got it working without any performance hit for now so I'm going to leave it until it's a priority heh
Thanks for the help!
hey guys so guys im making an admin menu and i have this script player list```_index = (findDisplay 45856) displayCtrl 2500 lbAdd "---- Player List ----";
{
_index = (findDisplay 45856) displayCtrl 2500 lbAdd name _x;
(findDisplay 45856) displayCtrl 2500 lbSetData [_index, getPlayerUID _x];
}forEach allPlayers;```
i want to change it to weapone list please guys i need help
You don’t need to find display every time, you can do it once and store control in a variable
You can also use RscFrame to nicely wrap your lbBox with frame with title label instead of making title the first item on the list
Can somebody help me with my foreach loop. I set it up so that if you are 3 meters away from the list of variable names i set for my NPC's, it will exit the script. However, even when i'm like 1m away from the NPC it hates me and says you are too far away..
_nearestNPC = [npc_supermarket,npc_supermarket_1];
_foundNPC = true;
{
if ((_x distance player) > 3) exitWith {
_foundNPC = false;
["You are too far away!"]
}
} forEach _nearestNPC;
if (!_foundNPC) exitWith {};
As you have it now, you have to be within 3 meters of all of the npcs for it to return true
yes, I assume you just intend any of them right?
Yes, I intend to select the closest one out of that array
So invert your selection:
_foundNPC = false;
{
if ((_x distance player) < 3) exitWith {
_foundNPC = true;
}
} forEach _nearestNPC;
if(!_foundNPC) exitWith {systemChat "you are too far away"};
please use the proper command ..
private _index = _nearestNPCs findIf { (_x distance player) < 3 }
if (_index == -1) then
{
systemChat "You are too far away";
}
else
{
systemChat "All nice and smooth thanks to findIf dude :wink:";
};```
Was just working up a findIf version 😆
just wanted to show him why the first one didn't work
@tough abyss can you change it to weapon list please?
Your request is vague, but I will try to answer it. Change name _x to currentWeapon _x
Now instead of player names you should see weapon class players have in their hands
This is best I can do answering your question mark
Yeah no idea what it means sorry
How do I access it in public zeus?
Oh you want the list of all weapons in the game? Needs config look up
Like how can I edit the script thing
@tough abyss can i add you ?
Or do I need to be admin
@tough abyss so i make a config.cpp in my menu right?
then i put the weapon config
_weaponConfig = configFile >> "cfgWeapons";
for "_i" from 0 to (count _weaponConfig)-1 do {
_weapon = _weaponConfig select _i;
if (isClass _weapon) then {
_weaponName = configName _weapon;
_ulx = toArray _weaponName;
_ulx resize 7;
_ulx = toString _ulx;
if ((_ulx != "ItemKey") and (getNumber (_weapon >> "scope") == 2) and ((getText (configFile >> "cfgWeapons" >> _weaponName >> "picture")) != "")) then {
weaponList = weaponList + [_weaponName];
};
};
};
for "_i" from 0 to (count weaponList)-1 do
{
_weapon = weaponList select _i;
LBname lbAdd _weapon;
LBname lbSetPicture [_i, (getText (configFile >> "cfgWeapons" >> _weapon >> "picture"))];
lbSort LBname;
};```
this is it?
You need to get an array from config containing CfgWeapons classes
@tough abyss you mean this https://cdn.discordapp.com/attachments/537055780554407954/537064616182939649/New_Text_Document_2.txt
That list contains classes that are not weapons as well, don’t know why you are showing it to me
Would it be possible to take the position from _x inside a forEach and use the position as a private ['marker'] variable?
yea..
Okay. How?
depends what exactly ur trying to do
well in this case, _x stores the closest npc variable name to the player. I want to get that position of the npc and use it in a marker outside of the forloop
There's no mention of it in the wiki but am I correct in assuming that if you attachto a player to an object, setDir now uses that objects relative position instead of azimut?
IE: Chair facing 090 > player attachTo chair > player setDir 180, player facing 270.
@mortal nacelle
private _index = _nearestNPCs findIf { (_x distance player) < 3 };
private _position = if (_index == -1) then {[0,0,0]} else {position _nearestNPCs#_index};
then u can use the position whereever u need
@tough abyss yes i do believe thats correct.
Ok. I missed IceShades entry on the wiki somehow smh
np @mortal nacelle
while creating a loop with iterations based off of an array element count (count _arrayOfStuff) is there benefits to using for # from # to # step # do { instead of foreach, or is this only when you need to access the index or element itself?
imo for is better for if your step is more or less than 1, if you arent searching every index or if you start at the highest element and go backwards.
@lewis ```
_foundNPC = nil;
{
if ((_x distance player) < 3) exitWith {
_foundNPC = _x;
}
} forEach _nearestNPC;
if(isNil "_foundNPC") exitWith {systemChat "you are too far away"};
he kind of had it before, just didnt understand forEach wasnt the only command to use _x.
Right, but it's the cleanest way to exit and return the element reference in one shot iirc
Does anyone know how to make the CUP SUV tougher? Trying to make it more resilient for PMC type missions but its armor level is quite low. I know there's the armored SUV but I don't want to be rolling around with a minigun all the time. Also the armor level on the armored one is still pretty weak in my opinion
Preferably without editing the config as (I imagine, I could be wrong) I'd have to have everyone in the group download the edited version
You could use the handleDamage event handler to reduce incoming damage by a certain ratio
Okay, I'll look into that, thank you
Hi everyone! How i can detect, that unit is unconscious (ACE 3 mod)?
Hi, can i specify direction for spawning vehicles...below does not seem to work.
_vehicleObject = "Some_vehicle" createVehicle (getMarkerPos "spawn_location");_vehicleObject setDir 0;```
well... the default direction is 0 so you wouldnt notice it changing direction.
So I found this and it works (sort of): unit_or_vehicle addEventHandler ["HandleDamage", {((_this select 2)/2.9)}]; but every so often, the vehicle fixes itself in random spots
@tame stream may be that:
Though effects of this command remain local, you can do a setPos afterwards to synchronize the direction on all machines in MP.
myObj setDir 90;
myObj setPos getPos myObj;
this is from https://community.bistudio.com/wiki/setDir
like this then
_vehicleObject = "Some_vehicle" createVehicle (getMarkerPos "spawn_location");
_vehicleObject setDir 90;
_vehicleObject setPos getPos _vehicleObject;```
yes, try this
@tame stream Not at all 😀
@lost copper one last thing.....
if i want to randomize spawn point between say 6 points how would i go about it
https://community.bistudio.com/wiki/createVehicle
use Alternative Syntax
in then you can add array of markers
markers: Array - If the markers array contains any markers, the position is randomly picked from array of given markers plus desired placement position. If any of the markers were given z coordinate with setMarkerPos, the vehicle will also be created at given z coordinate.
oo shit yeah sorry im on that page just missed it
_veh = createVehicle ["2S6M_Tunguska", getMarkerPos "marker1", ["marker2","marker3"], 0, "NONE"];```
_vehicleObject = createVehicle ["Some_vehicle", getMarkerPos "marker1", ["marker2","marker3"], 0, "NONE"];```
What is marker1 for, i get that marker 2-3 are for random placement
Read again: the position is randomly picked from array of given markers plus desired placement position
_vehicleObject = "Some_vehicle" createVehicle (getMarkerPos ["marker1","marker2","marker3","marker4"]);```
would this not work
so pos being picked from array ["marker1", "marker2", "marker3"]
so spawn to this marker that can be anywhere here... marker 2-10
Add selectRandom after getMarkerPos and it will work
also you can use old syntax like that:
_markers =["marker1", "marker2", "marker3"];
_vehicleObject = "Some_vehicle" createVehicle (getMarkerPos (selectRandom _markers));
_vehicleObject setDir 90;
_vehicleObject setPos getPos _vehicleObject;
@rain mulch HandleDamage is more complicated than that and yes the behaviour you described is expected with code like that
@tough abyss lol of course it is. Alright thanks, I'll keep digging
https://pastebin.com/GpdgFu6e
^ Problem, i need to pass a dynamicly created string with objects into setTriggerStatements condition [Line 21] , tried few hours last night but could find any way to get it to work.
L8 you use _objects but it isnt defined
for L11 & 13, creating the condition, you format the object directly into the string which wont work. need to do something like this
format["!alive (objectFromNetID '%1')",netid _t];
@robust hollow its only the last part of the script, i didnt posted the whole script only the condition problem
ahh, that makes sense
@tough abyss ty it worked
https://pastebin.com/DrD8ZtPH
@lost copper ace unconcscious -> https://discordapp.com/channels/105462288051380224/105462984087728128/503958760381743104
@still forum ooo, thx!
Can I attach myLight lightAttachObject [myVehicle, [-0.5,-0.25,1]]; to any object or does it have to be vehicles?
Why don’t you try and share the result?
OK.
So far I have come semi right with this
if (isServer) then {this setPos [getPos this select 0,getPos this select 1,12]; this setVectorUp [0,0,1]};light1="#lightpoint" createVehicle [0,0,0];light1 setLightBrightness 1;light1 setLightColor [3,.5,0];light1 lightAttachObject [this,[0,0,0]]
But it creates "wash" effect. Looking for a more contained light. SO more a reflector feel than a light-bulb feel.
light points are omnidirectional. there are no directional light points you can spawn. Besides just spawning a object that has a light. Like a worklamp or streetlight
Yeah I noticed. Especially after I lit up the ENTIRE altis. I am still fighting with runway lights and still trying to find a solution without having to run a .sqf as it adds weight ( or so I have been told). ^ That works in the init line without the need of a sqf though it is more for ambient / house lighting. Works nice though. Just not for what I want XD
Light effects are local, limiting it to isServer will only work for the host
Hi guys !
After 2 hours of searching and testing things, i'd like to know if you guys know if there's a possibility to change the size of a text in a RscEdit control and in real time ? 😃
ctrlSetFontHeight or something maybe
oh
@tough abyss Yea good point and did not know. (noob life). In terms of running a .sqf and something like this http://www.armaholic.com/page.php?id=23570 how heavy does it impact on performance? I have been told that sqf files run a loop after ini and takes away processing from the server with a major impact? Is this true?
No idea not about to download that to find out. But runway lights should be objects you can place that would emit light by default
Only lights I could find does not emit great at all and after running the forums for a bit it seems I am not the only one. Hence starting to look at scripts. Looking for more of "Altis Terminal" but can not seem to have find anything that match. In terms of my question I am more asking in running sqf initializations in general than to that specific one.
Arma has big limits in nightime lighting
so you cant expect to do very special things with them
Not to mention there is a limit on how many light sources you can have defined in video settings
http://prntscr.com/mcg5g4 \ http://prntscr.com/mcg5lg - this is without any tweaks
can you explain again what were you doing?
Making a basic strip. Right now just random placement but placed down the lights I wanted IE edge lights and flush lights. But they hardly emit no light at all and only noticeable with NVG. I started scouring the forums for faults+solutions and general response was to run a script as other people have the same issue. That is how I ended here
for dynamic placement?
Explain dynamic placement?
are you placing a runway somewhere where there is no runway
or are you just decorating a runway that is already on the map?
and why not use runway light objects?
Placing down runway where there isn't. Also only found lights under MBG buildings but nothing else in the editor
Is there a way to make the Runway Lighting not Blink? I am using the Mobile Helicopter Lights because the other lights do not look right but they blink and ...
there is a one way to get them to load in mission here
Looked at that. ctrl+f search return 0 results on
Land_Flush_Light_green_F
Land_Flush_Light_red_F
Land_Flush_Light_yellow_F
read more
also there are mods on workshop that add them/more of them to the editor
OK in the meantime I tried it and seems to work even though I could not find the class-name in the document.
Land_runway_edgelight_blue_F works fine and seen without NVG
So I copied the splendid camera sqf and hpp. I replaced all the function names to the one I made in the sqf. I also removed a few functions I disliked. But when the camera loads it just wont listen to any controls no movements. The camera creates though. I have an idea that it has something to do with the original hpp header, its onLoad. I have also tried the original sqf with my new hpp and it still won't work. I really need help with this as I have been stuck on this for months.
Here is the sqf: https://hastebin.com/xapovocosi.cs
Hpp: https://hastebin.com/nenobenupa.cpp
Original hpp: https://hastebin.com/gucibobewe.cpp
Hey all just looking for a little advice/help on a script.
Now I'm building a trench map for my arma group, the people in the terrain chat have been amazing at helping me learn all that, however no trench mission is complete with a nice bombardment.
I wanted a nice random bombardment, constantly, across the whole map and luckily the script existed nicely; the good ol' DZ_fnc_Mortarfire script I've seen mentioned in a few places.
Now it work perfectly with one exception. It spawns the mortar round on the ground, so you get the barest split second of that mortar "whine" noise, which I think is essential to the experience.
So my question is, how do I take this script: https://pastebin.com/GLVvSD55 and make it so the rounds spawn at a set distance off the ground so that the "whine" occurs for longer?
I'm really not great with arma coding, I tried adding _zcoord and adding that to the _firerun part however I'm sure I did not do it right and of course it did not work.
Even just a prod in the right direction would be an amazing help
@mint kraken is there a purpose for the camera system edit? Other than remove stuff you dont like?
ah RLRP..
so quite possibly you might fare better if you started to create your own camera function based on the splendid camera and add functionality instead trying to take parts out of the original
as those parts can affect others and their removal can then break them
I firstly don't like the horizontal lines, I don't like the overlay (I know that u can remove it by clicking backspace). And also I have tried using the original sqf with the original hpp (in my mission). Still same issue?
@little ether
Can you show what you tried to do?
@mint kraken what is the purpose of the new camera?
Also the script would look much nicer with params 😄
@languid tundra I deleted it all to make sure the original code went to you guys, I'll type what I tried out again if that would help?
what Im after is that perhaps the splendid camera is too complex to begin with and you could do what you want in a simpler way
Using it for a Admin "camera" I am working on.
Yeah, it would help.
@young current If there is a simpler way to make the camera having the functionality of moving. I can add stuff like night vision and map click later. How should I start?
I tried looking into EGSpectator camera but that looked a bit more complicated to understand
smooth camera stuff like that is never simple
but I think you need to build it from ground up to properly understand it
This is probably hugely incorrect but this is what I tried https://pastebin.com/txRSh57R
I could make the current code work, but what does onLoad="[""onLoad"",_this,""RscDisplayCamera"",'GUI'] call (uinamespace getvariable 'BIS_fnc_initDisplay')"; do? Because I think that is the main cause. If there is anyway to edit it to work with the current code I have. I will be right back in 10-20min
Why did you add getmarkerpos _marker select 3?
Simply because it seemed like the trend, figured at least following what came before would get me closer than my feeble attempts
You should enable Show Script Errors in the A3 launcher settings. Then you would notice that your script is erroneous.
getmarkerpos returns an array with 3 elements, but you try to select a fourth. Like there was a fourth dimension 😄
Right so I don't need to do the getmarkerpos bit, I just need to have the _zcoord on it's own to tell the createvehicle the height desired?
Also thanks for letting me know about the script error parameter
Is there a way to spawn water in Arma 3?
Once you removed that additional coordinate, it should work fine I guess.
@tough abyss Is that from the terrain builder? Or is it something I can do with commands?
I'm trying to spawn it without any mods. I guess vanilla doesn't have an option to spawn water then?
Just trying to create a village that looks like its under water.
Guys. How do I intercept the right mouse button.
@languid tundra No luck I'm afraid, I'm probably being dense but it's still saying I'm giving it 4 values. Going to look again
@fleet hazel you cant intercept the right mouse button
ah hold on think I worked it out
or at least Im 99% sure no one has succeeded in it
@young current While in the inventory menu, if you right-click on the equip it is removed in a backpack or thrown to the ground.
yes thats the normal behaviour right?
but thats likely related to the inventory dialog
what is it you want to do exactly?
@young current I want to create my inventory.
@young current If I right-click on an item to see a list with a choice of action. You need to add an action to the right mouse button. I don't know how.
ah that is different from intercepting the right mouse button
what you want is https://community.bistudio.com/wiki/User_Interface_Event_Handlers
Well I currently have this; https://pastebin.com/5G6TZSk6 which is working again but just like before is spawning the mortar round on the ground and immediately exploding it, not dropping it from a height
getmarkerpos _marker select 2 you can replace this with static 400 for example
Holy moly, I forgot to set the timer 😄
and each round should spawn 400m up
What projectile are you using?
I meant the class name
R_60mm_HE
You still have a script error... try this line instead:
_firerun = _ammo createVehicle ((getMarkerPos _marker) vectorAdd [random _xcoord, random _ycoord, _zcoord]);
Hi, im having a annoying issues with addactions, trying to reduce the distance range it can be used/seen....
current addaction (not working)
this addAction ["<t color='#FF0000'>Reset targets</t>", {0 = [80, iCenter] execVM "scripts\reset.sqf"},_this distance _target < 1];```
any suggestions
Okay I'll try that now but funny thing @young current I tried what you said, spawns the mortars travelling left to right across my screen (at the correct height though)
You tagged the wrong guy^^
No he suggested to replace getmarkerpos _marker select 2 with static 400
My bad
No all good, do you have any idea why this would happen? Script is just this now https://pastebin.com/THLWJbta
Good news is, it's the correct height, bad news is they literally fly horizontal from right to left at 400 meters
Well, somehow modify the velocity or vectorUp of the projectile...
@twin steppe pond objects are vanilla but they are just models you need createSimpleObject them
Is that as simple as adding setVelocity [x,y,z] in the _firerun? or a little harder than that?
Yeah, I thought so too, but didn't get it working so far.
"a3\map_altis\data\Water\test_ad_quarry01.p3d"
"a3\map_altis\data\Water\test_dam01.p3d"
"a3\map_altis\data\Water\test_reservoir01.p3d"
"a3\map_altis\data\Water\test_swamp01.p3d"
"a3\map_altis\data\Water\test_wf_lower.p3d"
"a3\map_altis\data\Water\test_wf_upper.p3d"
"a3\map_altis\data\Water\water_tile.p3d" @twin steppe
@tame stream look up addAction documentation you can limit distance with param you pass to it
i have been so far no joy...hence asking question here
I doubt it, the documentation is comprehensive
I cannot say more than is already said on addAction page
You are looking at radius param
im still learning arma coding, might seem obvious to you but it does not to me
I did not say obvious I said comprehensive
finding the wiki page that info was the first thing i did, then google to try and find examples in order to help myself achieve desired result....i have not managed sofar so this is why im asking here....pasting the wiki link helps zero
if you anyone can provide a example or suggests anything beyond wiki links that would be greatly appreciated
@tame stream, @tough abyss mentioned the radius parameter.
yes but im struggling to add it to addaction along with activating the script i need
If you have issues understanding the wiki page format then yes, we can help out with that too
my question is how do you incorporate it
yeah i do, wiki was goto, google youtube after...now here
@languid tundra I thought I might be able to post the setVelocity in the trigger that calls the init, but that's doing nothing either. Is it possible to name the object spawned as a result of the _firerun? as everything I'm reading says do _objectname setVelocity [x,y,z]
It's a number that you place in the addAction params; I am on mobile right now so I can't help more but add all the params (you can set nil for optional parameters, default value will be used) and when you "reach" the radius element, set your value e.g 5 @tame stream
dude addAction ["action text", "script.sqf",(…), 5];```
ok i gathered as much, radius value needs to be set to desired value...
the example on wiki is...sqf this addAction [ "<title>", { params ["_target", "_caller", "_actionId", "_arguments"]; }, [], 1.5, true, true, "", "true", // _target, _this, _originalTarget 50, false, "", "" ];
im having trouble translating that to what you posted
dude addAction ["action text", "script.sqf",(…), 5];```
im gonna try your suggestion
thx
you're welcome
(...) is not real param @tame stream
yeah error in expression
@little ether
Looks like setVectorDirAndUp works.
isNil {
_firerun = _ammo createVehicle ((getMarkerPos _marker) vectorAdd [random _xcoord, random _ycoord, _zcoord]);
_firerun setVectorDirAndUp [[0,0,-1], [1,0,0]];
};
sleep (random _timer);
oh you beautiful beautiful man, I was going to look into it myself but you pulled through ❤
hhhmmmm that crashed my arma with a script error so let me ask a quick question or two;
isNil - this is replaced by the "while {_fire} do{" part of my code correct?
Wait.....I think I've been stupid
nope, it's what you should put in the while-loop
the isNil {} part is just to ensure that the setVectorDirAndUp get executed immediately after you created the object.
ah okay, I'll slot that in and report back
@languid tundra Perfect, absolutely perfect. Thanks a ton mate!
oi fellas. quick question.
with currentVisionMode i get the... current vision mode, as the name implies
is there any way to switch the current vision mode?
with ... switchCamera "GUNNER"; i'll get the optics mode, but i would also like to autostart in nvg or tti mode
hey, does anyone knows why battleye is blocking extDB3_x64.dll ?
It is not whitelisted by BE?
You using it on a client?
I found that build 1.028 was the most recent build whitelisted by BE
as of a couple months ago
you don't run it on clients normally, so it doesn't need to be whitelisted
Trying to investigate a profiler bug.
And I found that initFunctions calls a function that randomly either puts a "wetDistortion" effect over your screen and plays music and displays copyright notices on screen.
Or the other random effect is playing music and forcing the player into a dancing animation and setting the variable BIS_IAmDancingHardSince
What the literal F bohemia?
The code responsible for compiling CfgFunctions has code to force the player into dancing animation and playing weird music? WAT?
Actually not only the player. It forces dancing animation on all units 20m around the player.
Here if anyone wants to try it out..
_timesActivated = profileNamespace getVariable [ "BIS_IShouldSupportTheDeveloper", 1];
if ((random 5) < 1) then {
_handle = [_timesActivated] execVM "A3\functions_f\GUI\fn_enableAnotherSystem.sqf";
} else{
[_timesActivated] execVM "A3\functions_f\GUI\fn_enableSystem.sqf";
}
It fires if setPos returns true, or playMove returns true.
Hint.. Both return nil.. That makes no sense
...what
okay
it is absolutely true
im just going to ignore all that in an attempt to keep my sanity
playMusic "Electronic_Track01_H";
Entertaining DRM?
@still forum F.A.D.E?
hm! according to https://en.wikipedia.org/wiki/FADE , FADE comes from… Codemasters?? I always thought it was an in-house protection…?
FADE (or DEGRADE) is digital rights management software developed by Codemasters. It operates by detecting if a game has been pirated, and initially allows the player to use the game normally. It then gradually degrades certain game features over a time, eventually rendering...
And I thought they dropped that in A3 cuz steam
it may be a leftover from before the Steam-only decision, too
So I wanted to look through how EGSpectator camera works and I found it but there was 1 thing I didn't find which was how they handle the movements of the camera, (WASD), not sure if I was blind... The addons pbo I looked in was functions_f_exp_a.pbo Anyone have an idea where I could find the WASD movements?
@tame stream could you figure it out?
Hello, i need help, in the gif you can see that the first button that i put is one layer below the text and the rest of the buttons are working well (as i configured in the gui editor) why is that?? i get this problem only in one button and the configuration for all of the buttons is the same. please help me with that. Thanks https://gyazo.com/74acabac5e4f761487fa1b5cd12b81cd
@winter rose No not yet, dude addAction ["action text", "script.sqf",(…), 5]; this gives error...havent given up yet but had to move on to make progress with mission
@verbal knoll didn't understand your problem according to the gif
do you see when i put the cursor on the first button
@tame stream yes, it's because you have to use nil instead of other params you don't want to change
iirc radius is param #7 , so you should do dude addAction ["action text", "script.sqf", nil, nil, nil, nil, 5]; or something @tame stream
_button ctrlAddEventHandler ["MouseEnter",{((_this # 0) getVariable "linkedPicture") ctrlSetText format ["Radial_Menu\textures\hover\b%1.paa",((_this # 0) getVariable "index")]}]; _button ctrlAddEventHandler ["MouseExit",{((_this # 0) getVariable "linkedPicture") ctrlSetText format ["Radial_Menu\textures\regButtons\b%1.paa",((_this # 0) getVariable "index")]}];
@verbal knoll isn't the problem about the text being
only about one line?
this is the script to make it change the picture when you hover on the button
@winter rose no i checked it
even if its one line in the first button it doesn't work
is the problem "the button doesn't hover unless the mouse is on top of the text itself"?
yes, it seems like the text is on the button but the layer priority is ------ buttonPicture >> text >> button
and the button has no texture
so you can see the text but when you click or hover you click on the button
do you get me?
…not sure =]
what did you understand from what i said so i can explain my self better
So i have made a display with 2 panels on the side and with EGSpectator open. WASD keys dont work and I am not sure but does it have to do something with focus of the display? Any way I could solve this?
@verbal knoll I "understood" that the tile effect should be on click and on hover? that's what I don't get, really