#arma3_scripting
1 messages · Page 615 of 1
@fair drum yes
I want to write code, but I don't want to write code
We can only help you if you are willing to learn something, because we won't write stuff for you...
Well
#creators_recruiting an SQF dev
i have some code that Lou Montana wrote for me, and it works great. I just want to modify it a little bit. I am working on a project that i want to get done in the next couple days, and i dont have time to learn a coding language
I literally gave you exactly what you needed to understand
i am getting a lot of mixed messages because there are like 5 people giving me code
im having to talk to 5 people at the same time
it would be much easier with just one person helping me
doing it for you*
let's be honest, you don't want to learn, you would like the end result provided here
ok thats kinda true
but i am learning some stuff along the way
and i dont have time to learn the entire language right now, so im just learning the stuff that you guys show me
I suggest making ample use of the BIKI it's fairly well documented
okaaay, stop, we're running in circles here.
but what i am able to take from the wiki is very very limited, because i dont know most of what it is telling me
now: whoever is available to write this script for him, dm him, thank you.
yes that would be great
i dont have paypal but if anyone can write me a script i will pay in asylum money lol
if anyone plays asylum...
😉
sec, forgot you want it in a trigger which is unscheduled
@past wagon place in your trigger
if (hasInterface) then {
[] spawn {
private _endTime = diag_tickTime + 300;
while { sleep 1; diag_tickTime < _endTime } do {
if ((vehicle player == player) and !(player inArea "Zone1")) then {
player setDamage 1;
};
};
};
};
if (hasInterface) then {
[] spawn {
sleep 300;
if ((vehicle player == player) and !(player inArea "Zone1")) then {
player setDamage 1;
};
};
};```
no need for the while loop here
//Loop 300 times
[] spawn {
for "_i" from 1 to 300 do {
if ((vehicle player isEqualTo player) && !(player inArea "Zone1") && (hasInterface)) then {
player setDamage 1;
};
};
};
//Loop Forever
[] spawn {
for "_i" from 0 to 1 step 0 do {
if ((vehicle player isEqualTo player) && !(player inArea "Zone2") && (hasInterface)) then {
player setDamage 1;
};
};
};
Is remoteExec breaking for anyone else
none of the params im passing will actually get passed
@silent latch code?
[_unit, _name , _value, player] remoteExec ["life_fnc_acceptBet", _unit];
oh
ah
not touching that! g'night ^^
listen man i get it everyone here hates life servers im just asking why this remoteExec wont work
Hello there, in tracers module, for custom bullets, I just need to enter a weapon and ammo ? Does't seems to work. https://imgur.com/a/IWuoPZh
//Put this below your params in life_fnc_acceptBet
hint format ["Script: %1 \n _unit = %2 | _sender = %3 \n _value = %4 | _senderUnit = %5", _fnc_scriptName, _unit, _sender, _value, _senderUnit];
//Run this in debug console as local
private _targetPlayerForBet = cursorObject;
[player, name player, 1000, _targetPlayerForBet] remoteExec ["life_fnc_acceptBet", _targetPlayerForBet]; //Change the variables you want to send through as you wish
//Tips - make sure its defined in cfgRemoteExec.cfg and also check names and function names are correct and in the right folder etc.
@silent latch
@solemn steppe do you get any errors?
Because the module checks if the weapon and magazine(!) are compatible
did you try the example I provided in the debug console?
check both servers .rpt files, yours, and the player you are testing it on.
yeah i have and i get undefined var erros
@exotic flax They should be, as they came from NATO Cheetah, autocannon and his ammo. weird.
@open star no because it was a nice intent; however #rules state not to entertain a foreign language discussion (with the exception of moderators to explain them, the rules)
@solemn steppe tried quotes perhaps?
then where ever you are doing the remoteExec, you are pushing out variables that aren't being defined in that script. @silent latch
they are
@winter rose Yeah even with quotes, module broken maybe
ive put a system chat before the remoteExec and all the vars are fine
but they all get passed as nil
tried ```sqf
[[player, name player, 1000, _targetPlayerForBet]] remoteExec ["life_fnc_acceptBet", _targetPlayerForBet];
//Before we push out our variables, lets check that they work - put above the line of ur remoteExec
hint format ["Script: %1 \n _unit = %2 | _sender = %3 \n _value = %4 | _senderUnit = %5", _fnc_scriptName, _unit, _name, _value, player];
[_unit, _name , _value, player] remoteExec ["life_fnc_acceptBet", _unit];
@silent latch
yeah i had it pretty much just like taht
@solemn steppe if the module's function is BIS_fnc_moduleTracers, these last three parameters are actually not used at all 😂
whaaaaat...
value and everything comes through to the hint it just will not pass through the remoteExec
@silent latch have you tried what I suggested?
Also, isn't it blocked by some kind of security or whatnot?
yeah ive cfg whitelisted the functions
and restarted?
yep
¯_(ツ)_/¯
and its not like my function is broken because i put it in a test server and it worked just fine no errors or any issues
magic it is then
yeah im really stumped
wait guys
i need a substitute for this
while { true } do
{
that instead of looping infinitely, loops 300 times
thats all i need now
for "_i" from 1 to 300 do {
🤦♂️
simple question: I want to add an image in some Structured Text (which I do with <img image="path\to\file.jpg"/>), but how can I make it larger than 24 pixels? Do I just have to use the size attribute?
//first part
if (hasInterface) then
{
[] spawn {
for "_i" from 1 to 300 do
{
waitUntil { sleep 1; alive player };
if (vehicle player == player && !(player inArea "Zone1")) then
{
player setDamage 1;
};
};
};
};
//second part
while { true } do {
waitUntil { sleep 1; alive player };
if (vehicle player == player && !(player inArea "Zone2")) then
{
player setDamage 1;
};
};
for some reason this skips to the second part without going through the first loop 300 times. anyone know why?
because the spawn part MAY run later than the rest of the script
how do i fix it?
put the second part also inside the spawn block
oh
so i move one of the }; from the bottom of the first part, to the bottom of the second part?
or is it the other way around?
if (hasInterface) then
{
[] spawn {
//first part
for "_i" from 1 to 300 do
{
waitUntil { sleep 1; alive player };
if (vehicle player == player && !(player inArea "Zone1")) then
{
player setDamage 1;
};
};
//second part
while { true } do {
waitUntil { sleep 1; alive player };
if (vehicle player == player && !(player inArea "Zone2")) then
{
player setDamage 1;
};
};
};
};
Try to document your code as much as possible, so you know what is happening (even when you wrote it yourself, or copied it from someone else). This will make it a lot easier to understand what is going on.
And the wiki can explain every single command/function in case you don't know.
yea
also
IT ACTUALLY WORKS
IM DONE ASKING FOR HELP NOW
THANK YOU TO EVERYONE WHO TRIED TO HELP ME
@past wagon yeah don't stop there. Keep learning
is there a relatively easy way to return the action ID of a given addAction applied to an object? im searching - doesnt look simple...
you'd have to go through every actionIDs and find the one you want by checking actionParams i think
given you know the params of the action you're looking for it shouldn't be too risky, since once addAction is called all but the action's title will be unchangable
Why not just save the id when you're adding the action?
im assuming his script doesn't have knowledge of the id, if that's not the case def save the id when the action is created instead
question, do ghillies naturally increase camo vs AI via unitTrait?
i will keep learning
actually, i thought i did that...
will share in a sec
I have this on a laptop object: 3 = this addAction ["Assault Course 1: Remove Targets", "Scripts\AC1DT.sqf", nil,0,true,true,"","",2,false];
This is part of a script that executes as part of the action above: ControlLaptop removeAction 3;
The intent is to have the script execute and remove the addActions from all associated laptop objects.
Now this works for a different addAction and removeAction combination numbered "0", but not for others labeled with different numbers at times, and I have reason to believe that it's because the Action IDs are being applied in the order of which the actions were initially input onto the objects...
so I believe my goal is to determine which actions are assigned to what action ID numbers
Anyone have a creative way to detect if a position is near water other than sampling relative locations around it with surfaceIsWater?
kinda thinking a function like this....
_location = nearestObject _location;
private _iswater = false;
[0,45,90,135,180,225,270,315,360] apply {
if(!_iswater) then {
_iswater = surfaceIsWater(_location getRelPos [500, _x]);
}
};
_iswater ```
will using BIS_fnc_EXP_camp_setSkill override a server's value for skill and accuracy set in the difficulty?
or alternatively
does setSkill also work independently of the difficulty settings skill bar?
...
What should I do if I have a command where I have two sets of arrays that I want to go through...
_subskills = ["aimingAccuracy","aimingShake","aimingSpeed","spotDistance","spotTime","courage","reloadSpeed","commanding","general"];
_allUnits = allUnits;
_x setSkill [_x,0.3]; //Example of where I want the arrays to go
how would I go about going through both arrays for this one command? is it possible?
what are you using _allUnits for @fair drum
//Run global in debug console
{
private _subSkillsArray = ["aimingAccuracy", "aimingShake", "aimingSpeed", "spotDistance", "spotTime", "courage", "reloadSpeed", "commanding", "general"];
private _subSkillsArrayofNumbers = [0, 0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8, 0.9, 1];
private _allPlayersArray = allPlayers; //Not sure if you are even using this
private _randomSkill = (selectRandom _subSkillsArray);
private _randomSkillNumber = (selectRandom _subSkillsArrayofNumbers);
//Set a random skill on each player
_x setSkill [_randomSkill, _randomSkillNumber];
//Hint the skill we placed
hint format ["Skill (%1) was set to a value of (%2)", _randomSkill, _randomSkillNumber];
} forEach allPlayers;
``` @fair drum
Well yes I understand how to do that. Was just asking how to parse through all two of my arrays in single command. It's not quite stacking forEach I've found.
Everyunit setskill [everySkillInArray,value]
Instead of having to write every skill out in a different line then doing a allunit forEach
cause I could write it like this...
{
_x setSkill ["aimingAccuracy",0.3];
_x setSkill ["aimingShake",0.3];
_x setSkill ["aimingSpeed",0.3];
_x setSkill ["spotDistance",0.3];
_x setSkill ["spotTime",0.3];
_x setSkill ["courage",0.3];
_x setSkill ["reloadSpeed",0.3];
_x setSkill ["commanding",0.3];
_x setSkill ["general",0.3];
} forEach allUnits;
but wondering if I can condense it further
You want all those skills to be set right? @fair drum
yeah, this is more of a theory question rather than what I want. just wanting to know if you can parse through two different arrays in a single command
just using this as an example
@robust brook
[] spawn {
private _subSkillsArray = ["aimingAccuracy", "aimingShake", "aimingSpeed", "spotDistance", "spotTime", "courage", "reloadSpeed", "commanding", "general"];
private _setSkillNumber = 0.3; //Change as you wish
{
//Loop for each player
{
hint format ["Skill (%1) has been set to a value of (%2)", _x, _setSkillNumber];
player setSkill [_x, _setSkillNumber];
uiSleep 0.5; //Change this as you wish, just so all the hints dont get spammed instantly
} forEach _subSkillsArray;
} forEach allPlayers;
};
``` @fair drum Try in debug and global
//Anyone have a creative way to detect if a position is near water other than sampling relative locations around it with surfaceIsWater? - Zacho40Yesterday at 10:42 PM
_setRandomPosFnc = {
params ["_location"];
_randomPos = [[[_location, 300]], ["water"]] call BIS_fnc_randomPos; //Returns a random position, function has water blacklisted!
player setPos _randomPos;
hint format ["You have been teleported to a random position at (%1)", _randomPos];
};
[(getPos player)] call _setRandomPosFnc;
``` @orchid stone
ooo, hmmm... and if position == [0,0], i can mark it false
i'll do some performance testing to see which method is faster
thanks for giving me some ideas
@orchid stone you can increase the radius in the params of BIS_fnc_randomPos, I just limited it to 300 meters
whitelist (Optional): Array - whitelisted areas. If not given, whole map is used. Areas could be:
yep gotcha. i didn't think about using that function. will mess with it tomorrow. thanks man 🤙
performance wise it should be good, only calls being used 🙂 GL!
why are you using player? they are AI units. can't really change the skill of a player lol but it would be cool if you could haha.
just for an example, you can change it to however you want
but you can't because you can't create a second array parse for allUnits.
[] spawn {
private _subSkillsArray = ["aimingAccuracy", "aimingShake", "aimingSpeed", "spotDistance", "spotTime", "courage", "reloadSpeed", "commanding", "general"];
private _setSkillNumber = 0.3;
{
{
hint format ["Skill (%1) has been set to a value of (%2)", _x, _setSkillNumber];
_x setSkill [_x, _setSkillNumber]; //Failure Point, this is what I was getting at, two arrays need to be parsed in a single command
uiSleep 0.5;
} forEach _subSkillsArray;
} forEach allUnits;
};
I put a script for spawn units at the position MARK1, but I want put more marks for spawn ramdom units in diferent marks... The game give me an error when I write
...[getMarkerPos "MARK1,MARK2", WEST, ["B_G_Sold...
Any solution?
The complete script is it: AlphaCharlie = [getMarkerPos "MARK1", WEST, ["B_G_Soldier_A_F", "B_G_Soldier_F", "B_G_Soldier_AR_F", "B_G_Soldier_LAT_F"]] call BIS_fnc_spawnGroup;
getMarkerPos selectRandom ["mark1", "mark2"]```
I know 😎
🤣
tanks spawn with crew
argg
Can I pass variables as references to a call? I've discovered that assignment to arguments won't be available outside the call, but using something like set does change the actual reference.
private _arr = [0, 0, 0];
[_arr] call {
params ["_arr"];
_arr = [1, 2, 3];
};
// _arr: [0, 0, 0]
private _arr = [0, 0, 0];
[_arr] call {
params ["_arr"];
_arr set [0, 1];
_arr set [1, 2];
_arr set [2, 3];
};
// _arr: [1, 2, 3]
What I want to do is to edit some of the arguments from inside the call.
private _var1 = 0;
private _var2 = 0;
[_var1, _var2] call {
params ["_var1", "_var2"];
_var1 = 1;
_var2 = 2;
};
if (_var1 == 1 && _var2 == 2) then {
// nice
}
then just use _var1 = 1, no params
call is like "copy paste this code and run it"
private _code = { _val = 2; hint str _val };
private _val = 1;
call _code; // hints "2"
Ah, so params is what's making them private within the scope? I was mostly using it to get rid of the "possibly undefined variable" warnings from my IDE, haha. Still seems like weird behaviour to me that my set example works, even with params.
arrays are passed as references, so you are editing the actual array
numbers and other values are passed as values
Alright, so I have to specify when I want an array to be passed by value, by duplicating?
private _a = 5;
private _b = _a; // value copy
_b = 10; // a = 5, b = 10
private _a = [5];
private _b = _a; // value reference
_b set [0, 10]; // a = [10], b = [10] (same object)
private _c = +_a; // copies the array
_c set [0, 255]; // a = [10], b = [10], c = [255]
yep
Okay, thanks.
once you get the array exception in your mind, it's OK ^^
it took me some time, back in OFP :p
Hey! I'm trying to setup "simplex Support Services" So that only certain people ingame can use the module and only if they have the required items. I'm completely ignorant to arma coding and the documentation for the mod didn't really make any sense to me, Is anyone available to call and explain how I would set this up?
@haughty stump from its Steam Workshop page https://steamcommunity.com/sharedfiles/filedetails/?id=1850026051,
For usage instructions, please see the wiki https://github.com/SceptreOfficial/Simplex-Support-Services/wiki
should give you enough intel, ping us back about the issue you have? (people are usually not available for support call.)
Note that it requires ACE
Hey! i've read through that and figured out one half of what i wanted to do. I specifically want to allow only people with certain names IE "John D." to be able to use the module and only if they have a specific radio. The second part i have figured out but i'm unsure of even where to begin with the first
it is the "Access Condition" paragraph yes
https://github.com/SceptreOfficial/Simplex-Support-Services/wiki/Instructions#access-condition
correct!
private _canUse = name player in ["SovietWiggler", "JohnBob"];
player setVariable ["canUseSSS", _canUse, true];
let me test!
do or do not, no try there is
does not appear to be working, I'm assuming i would replace my name with my Ingame name correct?
negative, i'm sure im missing something basic let me remove the radio req and see if there is a change
no change
where do you put this code?
Beside "Access Condition"
…what? where?
I can make an Imgur gallery if that's allowed may be easier to understand
mind if i DM it to you
an imgur might be better if someone else wants to help
The item ingame has a configuration module that you bind with the equipment
https://imgur.com/a/pTRojfp
oh that's in game then
my code if for the editor
try maybe```sqf
name player in ["SovietWiggler", "JohnBob"];
oh man that worked!
First try!
w/ pleasure!
Oooooonly Loooooou… can make the darkness bright 🎵
i need help with a script for a mod, i already have some thoughts but i am pretty sure it doesnt work is missing something..., is anyone willing to help?
Can't help you without details
so i am trying to intruduce pain inducing bullets with the ACE mod. My first idea was doing it with an eventhandler, when ever a unit is hit by _ammo X
like this:
this addEventHandler ["HitPart", {
params ["_ammo","_target"];
if (_ammo isEqualto ""AmmoSplinterRM","AmmoSplinterRS"") then (
if (isClass(configfile >> "CfgPatches" >> "ace_main")) then (
private _painLevel = GET_PAIN_PERCEIVED(_target);
_painLevel = _painLevel + 0.2 _target;
else (
_currentdamage = getDammage _target;
_newdamage = _currentdamage + 0.1;
)
)
}];```
i also got another suggestion for someone else, but i am quite unsure how it works, and if it is even complete
["ace_medical_woundReceived", {
params ["_unit", "_woundedHitPoint", "_receivedDamage", "_shooter", "_ammo"];
if (_ammo isEqualTo "<your_ammo_class>") then {
private _painToInflict = (getNumber (configFile >> "CfgAmmo" >> _ammo >> "<your_pain_config_attribute>"));
if (_painToInflict > 0) exitWith {
["ace_medical_injured", [_unit, _painToInflict]] call CBA_fnc_localEvent;
};
};
}] call CBA_fnc_addEventHandler;```
yeh thats me
if the snippet here:
["ace_medical_woundReceived", {
params ["_unit", "_woundedHitPoint", "_receivedDamage", "_shooter", "_ammo"];
if (_ammo isEqualTo "<your_ammo_class>") then {
private _painToInflict = (getNumber (configFile >> "CfgAmmo" >> _ammo >> "<your_pain_config_attribute>"));
if (_painToInflict > 0) exitWith { // Inb4: useless here as you exit the scopes anyway @<267396223357550603> otherwise the whole message is not directed towards you :wink:
["ace_medical_injured", [_unit, _painToInflict]] call CBA_fnc_localEvent;
};
};
}] call CBA_fnc_addEventHandler;```just could rather be written like this:
```ts
CBA_fnc_addEventHandler("ace_medical_woundedReceived", function(unit, woundedHitPoint, receivedDamage, shooter, ammo) {
if (ammo === "<your_ammo_class") {
let painToInflict = getNumber(configFile / "CfgAmmo" / ammo / "<your_pain_config_attribute>");
if (painToInflict > 0) {
CBA_fnc_localEvent("ace_medical_injured", [unit, painToInflict]);
}
}
});
```would be nice, right?
so last question, i'm in the editor now and i want to place down the MK41 VLS missle launchers for use with the independent side. The object is normally NATO, so what would i need to put in to change the side of the MK41 from nato to independent?
surely it's not as simple as
"Setside Independent" in the Init box?
what about
private test = player.getVariable("test");```
advertisiiing! :D
dict or nothing.
just trying to create hype about a guaranteed flop 👯👯👯
You are not developing the next Duke Nukem, you will be alright 😄
Half Life 3 Confirmed!!!!
shhhhhs 🤫 i know
but would be cool if SQC (SQF-Cstyled) could actually gain some traction ... 😄
Bam, integrated in A3 in patch 2.02 👀
funny enough, it does not requires any magic
sooo ... imo should even be doable 🤪
dreams of a bright future full of beer filled rivers
we can jump in the water, stay drunk all the tiiime 🎵
dict or nothing.
😉 Thanks for reminding me
hint-hint: the moment some actual dictionary functionality arrives in the lang, we should be able to implement javascript ontop of SQF
{
"jsonobj": "Smells like JSON"
}```
this is the only thing not possible right now with SQF
having something like createHashMap could solve that
nope
javascript objects
does anyone have any input on how i can change the default side of an artillery piece (MK41) from blufor to independent? 👀
and yes, did a XML parser for SQF
@haughty stump change the crew units
in the editor it's not showing units
i'm an idiot. i can just drag and drop the unit i need in there
when zoomed enough yes, otherwise use the left-hand menu 🙂
time to test!
and i thought this was going to be a simple mod install 3 hours later
having something like createHashMap could solve that
👀 stop spying
it ain't spying if you just expect that to happen 🤔
literally just talked with KK about specifically createHashMap
gib gib gib gib
Yeah I'll start planning later today
once landed (official), SQC will receive JSON object-init syntax and SQF-VM the hasmap support
does this work:
_ammo isEqualTo ""AmmoSplinterRM","AmmoSplinterRS""
or does it have to be:
_ammo isEqualTo ["AmmoSplinterRM","AmmoSplinterRS"]
or
_ammo isEqualTo ""AmmoSplinterRM" || "AmmoSplinterRS""
or
_ammo isEqualTo ""AmmoSplinterRM" || _ammo isEqualTo ""AmmoSplinterRS"
i am sorry i don't understand arma languange yet, can't find it right now
Not sure what is the goal? If _ammo is either AmmoSplinterRM or AmmoSplinterRS returns true?
aye
(_ammo == "AmmoSplinterRM" or _ammo == "AmmoSplinterRS")```
really?, that complicated, damn
Is it complicated? 🤔
Nope, you can't
(_ammo in ["AmmoSplinterRM","AmmoSplinterRS"])```Beware case sensitive way
no for many reasons
= assigns, == checks equality
isNull respawn
isNull doesn't check if the variable is defined
PIE_respawn = [];
if (PIE_respawn isEqualTo []) then
{
PIE_respawn = [missionNamespace, blufor, "Rally Point"] call BIS_fnc_addRespawnPosition;
};
SQF-VM?
(way ahead of you @queen cargo 😋)
I keep trying to apply C# to this language
didnt know assignment operator could be used to check quality in C#
//Check https://community.bistudio.com/wiki/BIS_fnc_addRespawnPosition for different parameters
if (isNull yourGlobalVariable) then {
yourGlobalVariable = [missionNamespace, "yourMarkerName", "respawnNameHere"] call BIS_fnc_addRespawnPosition;
};
``` @open star
😉 Thanks for reminding me
@still forum i can remind you every week, if you want 😂
I think what you are looking for is isNil.
if (isNil "myGlobalVariable") then {
// create respawn
} else {
// move respawn
};
Alternatively, if you are looking for a global variable that may or may not exist: missionNamespace getVariable ["myGlobalVariable",[]] where the [] is just the default value of the variable if it does not exist. Could be anything though.
https://community.bistudio.com/wiki/getVariable
https://community.bistudio.com/wiki/isNil
@open star
[] spawn {
private _subSkillsArray = ["aimingAccuracy", "aimingShake", "aimingSpeed", "spotDistance", "spotTime", "courage", "reloadSpeed", "commanding", "general"];
private _setSkillNumber = 0.3; //Change as you wish (0-1)
{
private _unitObject = _x;
{
_unitObject setSkill [_x, _setSkillNumber];
hint format ["Unit: (%1) \n Skill (%2) has been set to a value of (%3) \n Current element (%4) of _subSkillsArray", _unitObject, _x, _setSkillNumber, _forEachIndex];
uiSleep 0.5; //Wait 0.5 seconds per each setSkill/hint
} forEach _subSkillsArray;
} forEach allUnits;
};
``` @fair drum Forgot to give you this, should work as you requested.
did you define rallyRespawn somewhere?
and btw, do you want it to be enableable, disableable (if these are words) or only created once and that's it?
you shouldn't need the if then?
then make it a one-time action? I don't get the issue?
ah, perhaps 😁
making things simple is complicated, that's a fact
step back, cool down, rethink it, then write code 🙂
so:
- you know there will be only one action of creating a respawn
- you know how to create a respawn
- how will you make the player create the respawn? make this creation way removed as soon as the player selected a spot, and no more need to worry about it
how so?
Check params for https://community.bistudio.com/wiki/BIS_fnc_addRespawnPosition @open star
position: (Array - format Position) OR (Object - specific object. When some crew positions are available and unlocked, players will be respawned on them, otherwise they will appear around the object.) OR (String - marker name)
with global variables, I suggest using more complex names instead of "RALLY", also you can try ```sqf
yourGlobalVariable = [missionNamespace, (getPos RALLY), "Rally Point"] call BIS_fnc_addRespawnPosition;
Try that instead
in the init of the object put ```sqf
RALLY = this;
double click on the object
Does anyone know a way to get a public string array from .cfg? It looks like misson params only accept integer (https://community.bistudio.com/wiki/Arma_3_Mission_Parameters). Is there a method to achieve this?
For example, server hoster would be able to enter an item name like {"ItemGPS","ItemRadio"} to the config and then .sqf could use those values.
@opal ibex in Description.ext?
getText (missionConfigFile >> "myClass" >> "myEntry");
Entries are integer no?
@opal ibex What exactly are you trying to do?
I don't know how else i can describe it better than the example i gave
// Description.ext
class MyClass
{
items = { "ItemGPS", "ItemRadio" };
};
// sqf
private _items = getArray (missionConfigFile >> "MyClass" >> "items");
I see, so we can do custom classes, they would override it inside .cfg mission right?
class Missions {
class Mission1 {
class MyClass {items= { "ItemGPS", "ItemRadio" }}
}
}
So I see the issue I've run into now then.
I guess at least, I was assigning this:
rallyRespawn = [missionNamespace,RALLY,"Rally Point"] call BIS_fnc_addRespawnPosition;```
to an Object that had Simulation, Show Model, and Damage disabled and it wouldn't appear. So I oddly tested a theory and placed another object and tried this isntead:
```sqf
rallyRespawn = [missionNamespace,rallyRespawnObject,"Rally Point"] call BIS_fnc_addRespawnPosition;```
and it works just fine.
You just changed the global variable name right?
No, I turned on Simulation, Show Model, and Enabled Damage.
And after a few more tests, turns out if Simulation is disabled on the object you're attaching it too it breaks?
You are misusing server.cfg @opal ibex ```sqf
//https://community.bistudio.com/wiki/server.cfg
class Missions
{
class TestMission01
{
template = MP_Marksmen_01.Altis;
difficulty = "veteran";
class Params {};
};
};
@open star are you wanting to hide the object and/or disable damage also?
Nah as long as it's hidden and doesn't "exist" in the world it's fine.
I can't believe that was the source of most of my frustration.
@open star Put this in the init box, if you are wanting to hide it by sqf means```sqf
this hideObjectGlobal true;
I'm still struggling on this, christ.
Could some one help me with my acre2 ?
@robust brook no global command in the init box like this 👀 ```sqf
if isServer then { this hideObjectGlobal true };
Okay so I made this work the way I want too by placing the Respawn Position Module down giving it the variable name "RALLY" and then when I set the position it moved the respawn position to the players position, since I'm moving RALLY variable which is the respawn module.
This whole issue is because I didn't want to have Rally Point respawn position on map start, I wanted it created later.
@winter rose I've had a couple objects place with that line of code in their inits, in a mp enviroment the objects remain hidden globaly. Does it really matter to check?
@robust brook it will simply run the command one time on server + x times the players' number/joining so not ideal (not a performance killer, but still unwelcome)
setObjectTextureGlobal, e.g, has a weird behaviour with init fields
Does anyone know if variables stored in the missionNamespace are retained if the player goes to the lobby and switches his slot? Does it make a difference if the mission simulation is suspended when there are no players on the server while the player is in the lobby?
Unrelated to the question that was asked
afaik missionNamespace is cleared on server connect/disconnect. So from lobby back to ingame should not be cleared, but not 100% sure about that
is it possible to take kill zone kids script and make it so that all c4 placed through ace adds his objects to it?
If so would one of you awesome people be able to edit the script below to make that happen?
I don't want the scroll wheel options, just transform the c4 we use into the his script below.
We are trying to create a way to clear trees that works with JIP.
"BOOM" addPublicVariableEventHandler {
_c4 = _this select 1 select 0;
_c4pos = _this select 1 select 1;
for "_dir" from 0 to 359 step 45 do {
0 = [_dir, _c4pos] spawn {
_dir = _this select 0;
_f = "Land_CargoBox_V1_F" createVehicleLocal [0,0,0];
_f setMass 999999;
_f allowDamage false;
_f setDir _dir;
_f setPosASL (_this select 1);
_f setVelocity [cos _dir * 5, sin _dir * 5, 5];
sleep 0.5;
deleteVehicle _f;
};
};
_c4 setDamage 1;
};
} else {
KK_fnc_makeC4 = {
player addAction ["Put C4", {
_c4pos = screenToWorld [0.5,0.5];
player playActionNow "PutDown";
sleep 0.5;
_c4 = createVehicle [
"DemoCharge_Remote_Ammo_Scripted",
_c4pos,
[],
0,
"CAN_COLLIDE"
];
player removeAction (_this select 2);
player addAction ["GO BOOM!", {
BOOM = _this select 3;
publicVariableServer "BOOM";
player removeAction (_this select 2);
call KK_fnc_makeC4;
}, [_c4, getPosASL _c4]];
}];
};
call KK_fnc_makeC4;
};```
Can I declare variables while constructing arrays? E.g.
myArray = [
_varAlfa = 117,
_varBravo = 034,
_varCharlie = 087
];
Alright, thanks then
You can do it like this:
_a=[1,2,3];
_a params ["_v1","_v2","_v3"]
It's not the same though (it has a hidden "private" there too)
im trying to make it so that if a player has an item in their virtual inventory and gets inside an air vehicle it will move them out, but it keeps giving me a missing ) no matter how many ways i do it
_blueprints = ["bppack","mk200diss","ifritdiss","qilindiss","4wddiss","car95diss","spar16sdiss","lim85diss"];
_inv = ((findDisplay 100800) displayCtrl 100802);
if ((_blueprints in _inv player && count _inv > 0) && (vehicle player isKindOf "Air")) then {
moveOut player;
};
@still forum just double-checking that missionNamespace clearing, since I've run into issues with that - the vars aren't cleared if you disconnected and went back to the server browser - they stay there until you back out to the main menu or join a new server
I only know that because I have a loading screen Display that uses a RscMapControl & "Draw" event - the display doesn't close and the event still runs while in the server browser, so you can check the state of the variables that way
private _varAlfa = 117;
private _varBravo = 34;
private _varCharlie = 87;
private _myArray = [_varAlfa, _varBravo, _varCharlie];
//OR
private _myArray = [117, 34, 87];
private _varAlfa = _myArray select 0;
private _varBravo = _myArray select 1;
private _varCharlie = _myArray select 2;
@potent dirge
where would i ask questions about things such as best units for defending a base?
@robust brook Thanks, but I had already implemented something similar to your second option
@ionic anchor what does your _inv exactly return?
its a listbox of items, mayeb i should use lbdata instead
@ionic anchor are you using a specific framework or mod? for the inventory system
altis life
V5?
no 4.4 i think
the array is to check for any of those virtual items are present in players vinventory
figure out what you had set the virtual items names as, ex: life_inv_bbpack or whatever
they are what are in the array I.E. "variable = "ifritdiss";
{
_x params ["_vItem"];
private _amountOfEachVirtualItem = missionNamespace getVariable (format["life_inv_%1", _vItem]);
if ((_amountOfEachVirtualItem > 0) && (vehicle player isKindOf "Air")) then {
hint format ["You had a virtual item (%1) \n with an amount of (%2) \n so you were removed from the vehicle!", _vItem, _amountOfEachItem];
moveOut player;
};
} forEach ["bppack", "mk200diss", "ifritdiss", "qilindiss", "4wddiss", "car95diss", "spar16sdiss", "lim85diss"];
``` @ionic anchor
legend, thank you very much @robust brook
where would i ask questions about things such as best units for defending a base?
@knotty flame #arma3_scenario
how can I remove the targeting pod's ability to lase? remove an aircrafts self lasing ability for players?
plane1 removeWeaponTurret ["Laserdesignator_pilotCamera",[-1]];
for others to reference
Hi guys how would I make something like this. And does anyone know if there’s something similar? https://youtu.be/-hrSkqGOXUc
by doing some UX magix and "a few" lines of code
it is essentially a "toast" message system
but i recommend you to rather use https://community.bistudio.com/wiki/Arma_3_Notification
as that already exists
Ok thx. I’m sorry but what is UX magix?
GUI coding 😄
Alright thank you
but unless you are rather experienced with SQF and at least already displayed some custom dialog, i would not recommend you to try with it
Is there a way to reference a groups waypoint array? I know you can reference individual waypoints using [_grp, index] but I’m trying to count how many waypoints there are
@strange seal https://community.bistudio.com/wiki/waypoints ?
@winter rose oh my god I feel stupid now, been looking all over that thing and for some reason just skated over that, thank you very much!
one other question, I’m trying to use createMarker I create it, set the shape (icon) and set the type (using the classname I see in the editor) but it never shows up on the map I’ve also tried setting color as well along with everything, what am I missing?
setMarkerType from cfgMarkers (see the wiki)
setMarkerSize perhaps
Thanks again
Guys whats the best way to make infantry (players and AI) dismount from a chopper thats moving on a unitcapture recording?
Its also for an MP mission
how fast?
cause I know that if you do your waypoints just as you would without the unit capture, they still fire when you get close to them
@ripe sapphire
//Example #1
player action ["Eject",vehicle player];
//Example #2
{ _x action ["Eject",vehicle1] } forEach crew vehicle1;
//Example #3
_group = [];
_group = _group + [player] + units group player;
{ _x action ["Eject",vehicle player] } forEach _group;
@ripe sapphire
Normal fast
Im trying to do like a big air assault landing with recorded helicopter paths
I will try the waypoint and scripts thanks
@fair drum should i have that script start after a trigger of heli altitude = 0?
well you want them to jump out while flying in the air right? and they parachute down?
@ripe sapphire
do you want them flying away with their pilots after dropping off? @ripe sapphire
well, you don't have to. depends, are the players gonna notice that the helis are flying away? or do you think they are going to go right off to the objective and not care. if they don't care, then you can keep them on the ground then delete them after x amount of time as the players leave
also, I need to know if its 1 pilot, 2 pilots, 2 pilots and 2 gunners etc etc. how many non cargo crew are there going to be?
@ripe sapphire
//Condition
(heli1 in thisList) and ((getposATL heli1 select 2) <= 2)
//On Activation
private _ejectCrew = crew heli1;
_ejectCrew deleteRange [0,1];
{ _x action ["Eject",heli1] } forEach _ejectCrew;
this is if you have 2 pilots. it will kick all other members out
fires when the heli is in the trigger as well as if its height above terrain is lessThanOrEqualTo 2 meters
you want to have the units in the helicopter have a waypoint where you want them to go, if not, they will get back into the chopper since the SL didn't tell them to get out
separate squads from the pilots
how do I set off a placed in editor APERS mine dispenser? setDamage 1 doesn't work with that one.
//Place this in the "APERSMineDispenser_F" object init box
mineProneForExplosion = this;
//Run these on debug or a .sqf file
_spawnedExplosion = "ModuleMine_APERSBoundingMine_F" createVehicle (getPos mineProneForExplosion);
_spawnedExplosion setDamage 1;
//OR
[] spawn {
for "_i" from 1 to 5 do { //loops detonations from APES mine (5 shots)
_spawnedExplosion = "ModuleMine_APERSBoundingMine_F" createVehicle (getPos mineProneForExplosion);
_spawnedExplosion setDamage 1;
uiSleep 0.5;
};
};
``` @fair drum
so I need to use the "_F" version. does this apply to all mines and deployables?
@fair drum https://community.bistudio.com/wiki/Arma_3_CfgPatches_CfgVehicles - check the class of "CuratorOnly_Modules_F_Curator_Mines"
I'm creating a scripted explosion, still doesn't effect the actual object as it's just static.
oh well the apers dispenser doesn't create an explosion. I just want to activate it to spit its mines.
i think we aren't on the same wavelength. nvm this is what I'll do. I'll create said mine, assign it to a npc, then do action touchoff to do it, its crude but it might work
_mine1 = createMine ["APERSMineDispenser_F",getposATL position1,[],0];
unit1 addOwnedMine _mine1;
unit1 action ["TouchOff",unit1];
private _apesMine = createMine ["APERSMineDispenser_F", (getPos unitTesting), [], 0];
unitTesting addOwnedMine _apesMine;
unitTesting action ["TouchOff", unitTesting];
``` @fair drum just tested this and works like a charm
setDamage should work on a script-created mine dispenser
is there an equivalent of initplayerlocal.sqf inside a mod?
a preinit CfgFunctions I would say @waxen tide
is there a tutorial or an example around?
i prodded the wiki but i only ever did mission scripts, never really touched mods
Is it possible to allow the driver of a vehicle to hold a weapon out to use?
thx !
im looking to make a script for a heli crash, iv got the crash on lockdown (heli shakes players blackout etc) but i want to original heli to despawn and as the players recover a pre made crash site appears im at a loss
I suggest a combination of moveOut, deleteVehicle and setPos. Alternatively, selectPlayer might also be of interest.
I'm currently encoutering a strange issue where setVectorDir seems to not have a global effect when used on a CfgAmmo object. Is this documented behavoir?
Running a dedicated server. Command fails to progate effect to clients.
When running the command from a client connected to the server, the command appears to be working fine locally, but no changes are seen on other clients or the server.
use setPos to sync the directions globaly, should do the trick. @steel fox
after you setVectorDir
Aight, checking now.
Sadly, it doesn't sync the direction.
normal CfgVehicles work fine, even with out a setPos. CfgAmmo objects just seem broken.
I just noticed your using ammo as an object lol
my bad
What exactly are you trying to do? @steel fox
Creating a tripwire. Several one meter segments get chained to create a dynamically sized tripwire.
I can provide my code, but the issue can be replicated without it.
provide if you want to, or dm me @steel fox
//Create a tripwirePart: an 1m segment of tripwire and an empty helper:
private _fnc_createPart = {
params["_position", "_vector", "_tripwirePartsIndex"];
//Create the helper:
private _helper = createVehicle ["rid_tripWire_helper", (ASLToATL _position), [], 0, "CAN_COLLIDE"];
_helper setVariable [QGVAR(tripWireNodes), [_object0, _object1], true];
//Give the helper the Index to the position where the tripwire it is part of is stored in _object0's rid_tripwire_parts ARRAY, to allow rid_core_fnc_tripWireActivation to clean up the tripwire:
_helper setVariable [QGVAR(tripwire_parts_index), _tripwirePartsIndex, true];
//Spawn the tripwire segment:
private _segment = createVehicle ["rid_tripWire_segment_ammo", (ASLToATL _position), [], 0, "CAN_COLLIDE"];
//_segment setPosASL _position;
_segment setVectorDir _vector;
[_segment, _helper];
};
This is the part that is relevant to the tripwire creation.
well, a single segment
class CfgAmmo {
class APERSTripMine_Wire_Ammo;
class rid_tripWire_base_Ammo: APERSTripMine_Wire_Ammo
{
author = "Walthzer/Shark";
isCW=1;
SoundSetExplosion[] = {};
defaultMagazine="APERSTripMine_Wire_Mag";
hiddenSelections[]={"camo", "start", "end"};
hit=0;
indirectHit=0;
indirectHitRange=0;
soundHit[]={"",1,1};
explosionEffects="rid_tripWireEffect";
CraterEffects="";
soundTrigger[]={"",1,1};
class CamShakeExplode {
power=0;
duration=0;
frequency=0;
distance=0;
};
};
class rid_tripWire_segment_Ammo: rid_tripWire_base_Ammo
{
model=QPATHTOF(rid_tripwire);
mineTrigger="rid_tripWire_base_trigger";
mineModelDisabled="";
};
};
and the tripwire segment object
@robust brook after learning more, i get what you meant yesterday by me misusing the server.cfg file but i still haven't found a solution to my problem.
Let me try to explain it again, i need a way for a server owner to easily change a variable that is used in a mission.pbo and afaik server.cfg is the only place to do this. I don't want unpacking .pbo changing Description.ext and packing again. If it is an integer, no problem easy to do, you use the params. But with what i'm trying to do i need a string array to be changed and params only use integers. Is there a way to achieve what i'm trying to do?
Thanks @fair drum for the scripts, will try them soon
DayZ uses Enscript, not C#
@still forum Do you know of any published examples of Enscript code? Did some googling and could only find something from 1980
well isn't it similar to C#? which means that I should learn that in preparation?
Its as similar to C# as it is to C or C++ or Java
so like how SQF is a mismatch of languages sort of thing?
Like every language ever basically 😄
see https://community.bistudio.com/wiki/DayZ:Enforce_Script_Syntax for Enscript
tyvm
im assuming there will be commands just like in sqf that we can use that simplify stuff?
🐮 perhaps
You can try DayZ scripting if you are so eager to start ahead of time on unannounced game
thats true, Hypoxic you got about 4-5 years to learn probably 😄
Enscript is using SQF anyway
juuust kidding, I swear I heard 3 cardiac arrests from here 😄
Anyone know how to set task so player can wear helmets/other gear?
What are you trying to do?
You know the set task?
yes
Like player picks up the gun and the task is completed.
I’m trying like that but I’m not sure if it works at all.
how do you do it?
That’s why I am asking, not sure myself too.
…so you did not do anything so far ^^
Not much, aside from making dialogues in sideChat.
do you simply want "any gun = task completed"?
Like that one but with helmets/vest
you could do something like this (very raw thing)
waitUntil { primaryWeapon player != "" };
// or
waitUntil { vest player != "" };
// etc
Umm..
the "better" (more convoluted) way would be to use the "Take" Event Handler
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Take , but that might be too advanced for now
Thank you
Hey could someone provide me some insight. Im deleting a bunch of vehicles, and to avoid ghost objects im deleting their crews beforehand. My loop for deleting the crew works fine but the game keeps throwing me an undefined variable error in expression crew #_vehicle and here's my code
for "_i" from 0 to (count _objects) do
{
_vehicle = _objects select _i;
{_vehicle deleteVehicleCrew _x } forEach (crew _vehicle);
};```
for "_i" from 0 to (count _objects) do
{
_vehicle = _objects select _i;
wat
forEach?
yes
_i would be a number?
just use forEach I mean
its a for each in a for each
for "_i" from 0 to (count _objects) do
that's not a forEach
why would you want to avoid forEach and replace it by a much worse performing for loop
{
private _vehicle = _x;
{_vehicle deleteVehicleCrew _x } forEach (crew _vehicle);
} forEach _objects;
where does _objects come from?
if _objects contains nil's, that'll cause the error you posted
{
if (!isNil "_x") then {
private _vehicle = _x;
{_vehicle deleteVehicleCrew _x } forEach (crew _vehicle);
};
} forEach _objects;
forEach just repeats a piece of code, what you do with that is left entirely to you
I was getting confused because I couldn't figure out how the magic variable gets handled when having multiple forEach
its not magic
just stop thinking things are "magic" and take them as they are, just some variable 😄
'magic variable' is just a nickname for _x is it not?
people often think a "magic" variable has some magic properties that make it special so that you can't handle it just like a normal variable
Lol i was simply calling it that because of this piece from the biwiki Description: Executes the given command(s) on every item of an array. The array items are represented by the magic variable _x. The array indices are represented by _forEachIndex. In Arma 2 and later, the variable _x is always local to the forEach block so it is safe to nest them.
and I obviously never noticed the last part where it says "the variable is always local to the block"
which is why I spaghettied and tried to avoid multiple forEach blocks
What is the lightest EH or system that I could use to do timed events. Like if I wanted a patrol to spawn and deploy every 12:00 in-game time. What would be the best tool to accomplish this?
how exact does it need to be?
does it need to respect code changing ingame time ala setDate?
Doesn't have to be perfect, just not be super heavy on the system that I could have multiple events happening depending on time of day.
Does changing time by other means throw it off a lot?
@quaint ivy your for-loop goes 1 number too high, if you're interested
it would have to be
for "_i" from 0 to ((count _objects) - 1) do
but stick with forEach, it's better for what you're doing
@ionic orchid yeah i realized that too, but the issue was that some values within _objects was nil
try this:
forEach (_objects - [nil]);
that should trim all the nils out beforehand, so you don't have to check inside the loop
thanks, although im just skipping the case if the current object is nil which works perfectly for what i need
👍 whatever works for you!
By the way, anyone know what the best way for spawning object compositions is trough scripts?
By the way, anyone know what the best way for spawning object compositions is trough scripts?
https://forums.bohemia.net/forums/topic/191902-eden-composition-spawning/ used this a few years ago and it was lit
I've read the additem wiki
What do I have to put in the damn init field of an object for it to simply spawn with an array of items that I want it to
In the editor
this addItem
this addItemCargo
this addItemCargoGlobal
they don't work. I know additem wants a str so fine, but the others?
wiki should have examples, no?
I've tried
this additemcargo [["ACE_fieldDressing","ACE_morphine","ACE_epinephrine","ACE_EarPlugs","ToolKit","ACE_elasticBandage","ACE_bloodIV_500","ACE_microDAGR","kka3_ace_extension_Land_BagFence_Long_F","kka3_ace_extension_Land_BagFence_Round_F"],[50,20,20,5,2,50,15,3,10,10]];
Doesn't want to put it into the container
It has plenty of space
I've named the object _crateammo, added a trigger which triggers when any player is present in a 100m zone, added the script
_crateammo additemcargo [["ACE_fieldDressing","ACE_morphine","ACE_epinephrine","ACE_EarPlugs","ToolKit","ACE_elasticBandage","ACE_bloodIV_500","ACE_microDAGR","kka3_ace_extension_Land_BagFence_Long_F","kka3_ace_extension_Land_BagFence_Round_F"],[50,20,20,5,2,50,15,3,10,10]];
No errors, no items in my crate
Nothing
with any of those changes
itemcargoglobal, and the value I had, setting everything to 1, or using itemcargo and having the amounts be 1
this command only works for 1 item and 1 number value
zzzzzzzzzzzzzzzzzzzzzzzz
Thank you
You want it so you can place it in the object init box? @stable wedge
That would be ideal yea
@stable wedge
[this] spawn {
if isServer then {
params ["_crate"];
private _item = [
"ACE_fieldDressing",
"ACE_morphine",
"ACE_epinephrine",
"ACE_Earplugs",
"ToolKit",
"ACE_elasticBandage",
"ACE_bloodIV_500",
"ACE_microDAGR",
"kka3_ace_extension_Land_BagFence_Long_F",
"kka3_ace_extension_on_Land_BagFence_Round_F"
];
_crate addItemCargoGlobal [_item select 0,50];
_crate addItemCargoGlobal [_item select 1,20];
_crate addItemCargoGlobal [_item select 2,20];
_crate addItemCargoGlobal [_item select 3,5];
_crate addItemCargoGlobal [_item select 4,2];
_crate addItemCargoGlobal [_item select 5,50];
_crate addItemCargoGlobal [_item select 6,15];
_crate addItemCargoGlobal [_item select 7,3];
_crate addItemCargoGlobal [_item select 8,10];
_crate addItemCargoGlobal [_item select 9,10];
};
};
I wrote it so you can take out the spawn loop (starting with if isServer) and make it a separate file if you wished, then you can call it with [boxGoesHere] execVM "filepath.sqf"
Could you explain why this method works instead of how I had it?
1.) If you just used addItemCargo, that is a local command. You would have needed to execute that on every machine in multiplayer. addItemCargoGlobal is global so you only need to run it on the server and all players will see the changes.
2.) addItemCargo and addItemCargoGlobal follows the syntax of box addItemCargoGlobal [item, count] where box is a SINGLE object (object), item is a SINGLE item (string), and count is a SINGLE value (number)... the way you had it, you were feeding a whole bunch of values to item and count which just does nothing
Ah
Say you wanted all of them to be the same number of things... you could do
_arrayOfItems = ["item1","item2","item3"];
{box addItemCargoGlobal [_x,10]} forEach _arrayOfItems;
now you only have 1 line for the command that will run with every iteration of _arrayOfItems
Okay that's fairly straightforward
and I completely forgot what my question was going to be when I opened this...
private _crate = yourCrateObject //Change this in here for whatever (private or global) variable you had for the crate
private _itemsArray = [
["ACE_fieldDressing", 50],
["ACE_morphine", 20],
["ACE_epinephrine", 20],
["ACE_Earplugs", 20],
["ToolKit", 20],
["ACE_elasticBandage", 20],
["ACE_bloodIV_500", 20],
["ACE_microDAGR", 20],
["kka3_ace_extension_Land_BagFence_Long_F", 20],
["kka3_ace_extension_on_Land_BagFence_Round_F", 20]
];
{
_x params ["_stringItem", "_itemCount"];
_crate addItemCargoGlobal [_stringItem, _itemCount];
} forEach _itemsArray;
``` @stable wedge
and I completely forgot what my question was going to be when I opened this...
@fair drum Sorry friend
Thank you, let me test that
hoooold up, never considered this... _x params ["_stringItem", "_itemCount"];
the more you learn...
I love me some params 😄
I was using debug...
did you name your box and then place the box in the top line?
make sure to remove comments if you are trying with debug
take out comment
yes
So my crate I will call _crateobj
as the variable name for its init
private _crate = _crateobj;
Needs a global variable name not a private, if its placed in the editor
for the script
use _crate = crateobj
I see
do you understand the difference between global, local, and private variables?
like 5/10
global and private yes
local not so much
ok I named my crate _crateobj in the objects variable name
then run the scenario
in debug I run
`
_crate = _crateobj;
private _itemsArray = [
["ACE_fieldDressing", 50],
["ACE_morphine", 20],
["ACE_epinephrine", 20],
["ACE_Earplugs", 20],
["ToolKit", 20],
["ACE_elasticBandage", 20],
["ACE_bloodIV_500", 20],
["ACE_microDAGR", 20],
["kka3_ace_extension_Land_BagFence_Long_F", 20],
["kka3_ace_extension_on_Land_BagFence_Round_F", 20]
];
{
_x params ["_stringItem", "_itemCount"];
_crate addItemCargoGlobal [_stringItem, _itemCount];
} forEach _itemsArray;
`
Nothing in crate
first line still wrong
private _crate = crateobj;
or _crate = crateobj;
but using private is more proper
my variable name for my object is _crateobj
change it to crateobj
in both the script and the variable name
when naming things in the editor for variable name, use global. so without the "_"
testingCrateObject = this; //Put this in the init box, or place "testingCrateObject" in the variable name box
//This in debug
private _itemsArray = [
["ACE_fieldDressing", 50],
["ACE_morphine", 20],
["ACE_epinephrine", 20],
["ACE_Earplugs", 20],
["ToolKit", 20],
["ACE_elasticBandage", 20],
["ACE_bloodIV_500", 20],
["ACE_microDAGR", 20],
["kka3_ace_extension_Land_BagFence_Long_F", 20],
["kka3_ace_extension_on_Land_BagFence_Round_F", 20]
];
{
_x params ["_stringItem", "_itemCount"];
testingCrateObject addItemCargoGlobal [_stringItem, _itemCount];
} forEach _itemsArray;
``` @stable wedge
now do you understand why
_ makes things not global
yes, because local things can only be seen in the script that it was defined
global seen by all scripts, local seen by its script, private seen by its scope
question now, with the method CSS has, is there a way to run that in an object's init without me having to use the debug?
yes, look at the last thing he posted
Ideally, I can create item lists and then just chuck them into an objects init
That still requires debug exec
im saying without it
Like your method
I could attach that to a trigger maybe?
You can put it an .sqf? lol
True
private _privateVariable1 = ""; //This is a private variable
_privateVariable2 = ""; //This is also another way of defining a private variable
testingGlobalVariable = ""; //This is a global variable (accessible to either server or client which ever its defined on)
testingPublicVariable = ""; //To broadcast a publicVariable it must be global variable first - https://community.bistudio.com/wiki/publicVariable
publicVariable "testingPublicVariable"; //Variables broadcast with publicVariable during a mission will be available to JIP clients with the value they held at the time.
``` @stable wedge
then just have the object run the sqf?
private _testingCrateObject = this;
if isServer then {
private _itemsArray = [
["ACE_fieldDressing", 50],
["ACE_morphine", 20],
["ACE_epinephrine", 20],
["ACE_Earplugs", 20],
["ToolKit", 20],
["ACE_elasticBandage", 20],
["ACE_bloodIV_500", 20],
["ACE_microDAGR", 20],
["kka3_ace_extension_Land_BagFence_Long_F", 20],
["kka3_ace_extension_on_Land_BagFence_Round_F", 20]
];
{
_x params ["_stringItem", "_itemCount"];
_testingCrateObject addItemCargoGlobal [_stringItem, _itemCount];
} forEach _itemsArray;
};
^ you can place in the init
without naming the object
okay so the isServer runs on a dedi or server host
it runs on the server, and if you are single player, you are the server
right
"IsServer", It will return true for both dedicated and player-hosted server.
if you don't put that, say you have 20 players, this code will run 20 times and you'll have a crate with billions of stuff
whew
Thank you both so much
This will help a lot
And I have a couple of things to learn !
especially the multiplayer one. it changes the coding game so you might as well learn it at the start
Yea
nvm I see my error
is public variable ordering guaranteed?
@pliant stream wdym "ordering"?
observed in the exact order in which they are sent
send two pv. does the other machine see them in that order? this isn't complicated
can I see the public variables?
the variable or the value doesn't matter
I don't understand what you mean by order of the variables lol
client A sets an event handler on PV X
client B sends value 0 in X
client B sends value 1 in X
does the EH on A always fire in order 0, 1?
it should, I think, but … don't use PVEH?
it's the only message channel available to me in A2
oh, A2.
Wait, isn't there a Function module with [params] call RE; for remote execution of some things?
i think there is something like that but i won't be using it. i already have my own high level RPC abstraction
even if i was doing A3 i would probably have to build the same on top of whatever new message channel is available
the A3 RE doesn't have any return values right?
is there a way to check if it is daylight or not without using time of day?
_privateVariable2 = ""; //This is also another way of defining a private variable
no thats a local variable, not a private one
@stable wedge
I've named the object _crateammo,
you can't give objects names with a local variable, object names can only be global variables.
is public variable ordering guaranteed?
afaik yes
to be pedantic what he's doing can't easily be modeled using foreach
it could, as was already shown above, which is why I deleted my message as I posted it before I saw that
is there such a thing as an unlimited fuel script for cars?
yes, setFuel
There's no fuel consumption command multiplier command, though. I want it badly
just damage your fuel tank and see the result 😛
There's no fuel consumption command multiplier command, though. I want it badly
@warm hedge what do you mean
vehicle setFuelConsumptionRatio 3 // three time fuel consumption
vehicle setFuelConsumptionRatio 0 // UNLIMITED POWEEER
```I suppose?
ratio?
Yes, that's something I want
trying to use Bis_fnc_liveFeed... for the target parameter, how can I get the location to where a gunner is looking?
does that work if its an AI using the gunner like on a UAV?
or does it have to be a hasInterface
eyePos of a UAV is most likely not to work 😄
but maybe something to do with turret pointing, dunno
why not use the UAV camera?
i want something squad leaders can view without having a UAV terminal while one player controls the UAV.
kind of like info from the air to the units on the ground type thing
my plan was to addAction for the squad leaders to have this feed created on the side of their screen
Yes. I always feel vehicles (especially fixed/rotary wings) have big fuel tank than it should compared to the map size
vehicle setFuelConsumptionRatio 3 // three time fuel consumption
vehicle setFuelConsumptionRatio 0 // UNLIMITED POWEEER
```I suppose?
@winter rose That would be nice.
Kinda becoming offtopic though, I want to make it so CAS planes have to land and refuel more frequently and it feels more authentic-y than current almost infinitely flight
It has many use cases. Make a feedback tracker ticket
You could store the fire on the unit using _unit setVariable ["SmallDino_fire", _fire]; inside fnCreateFire.
You would then be able to later retrieve the fire (to delete it) using _unit getVariable ["SmallDino_fire", objNull];.
it will break with JIP. it's (probably, not actually sure about A3) very complicated to do correctly
make a function to be called and that will delete said objects after a condition is reached
with this way, all would stop after the same condition (if the condition is a global variable)
what do you want to do?
oh, I get it. you could make asqf unit setVariable ["SMOLDIN_onFire", true, true];
and locally, when the fire is put outsqf unit setVariable ["SMOLDIN_onFire", false, true];
the fire condition would besqf unit getVariable ["SMOLDIN_onFire", false];
well, you could make it JIP friendly
a script that check all units and create a fire if their onFire variable is on or off
and set damage only if unit is local
looping over all units is so pedestrian
I am not sure with "#classname" classes
(anyway, particle commands are local)
(written by a guy who knows stuff)
With this script, how can I spawn a vehicle with a "varible name"?
AlphaCharlie = [getMarkerPos selectRandom ["MARK100", "MARK101", "MARK102", "MARK103", "MARK104", "MARK105", "MARK106", "MARK107", "MARK108", "MARK109", "MARK110", "MARK111", "MARK112"],
WEST, ["O_MBT_04_cannon_F"]] call BIS_fnc_spawnGroup;
@thick chasm what do you mean ?
[position, side, toSpawn, relPositions, ranks, skillRange, ammoRange, randomControls, azimuth, precisePos, maxVehicles] call BIS_fnc_spawnGroup
that wiki page doesn't go into the MP synchronisation aspects
I want spawn a "O_MBT_04_cannon_F" with the variable name "tank1", for example
that wiki page doesn't go into the MP synchronisation aspects
that page says it is local @pliant stream
the rest is up to the scripter, I suppose
right
In this propieties it is not especificate:
[position, side, toSpawn, relPositions, ranks, skillRange, ammoRange, randomControls, azimuth, precisePos, maxVehicles] call BIS_fnc_spawnGroup
makes sense that they wouldn't want to go into it. synchronisation is complicated and the game does nothing to help you
@thick chasm https://community.bistudio.com/wiki/BIS_fnc_spawnGroup
Return Value: Group
so```sqf
ALEX_mySuperTank = vehicle (_units group select 0);
or do leader
makes sense that they wouldn't want to go into it. synchronisation is complicated and the game does nothing to help you
"they" don't think it is the page's topic (and see page edition logs please ^^)
arma isnt really complicated MP wise. you just remote exec the local stuff
Or execute on initialization.
arma isnt really complicated MP wise
now* ^^
as in, it will be worse in the future?
No it was
no, but it was worse in the past 🙃
it's still worse for me in A2
Absolutely not.
🤷♂️
before remoteExec we had BIS_fnc_MP, before that it was A2 and RE (RemoteExecution)
I only like CUP for its Core, buildings and what not. MAYBE some of the maps.
i wouldn't trust that BI RE thing even if it provided an adequate RPC API
well, you can always do you r own stuff but then you have to write your own doc ^^
that's exactly what i've done
(https://community.bistudio.com/wiki/Multiplayer_framework for those who don't know A2 RE)
is there a command that stops aircraft from showing up on radar systems?
setCaptive perhaps
seems pointless if you can't return
remoteExec cannot return either, we deal well with it 🤷♂️
remoteExec can return very easily.
at target just remoteExec the result back to remoteExecutedOwner
right, but then you're just using it as a low level building block for a higher level api
correctly implementing the rpc return is non-trivial. just calling remoteExec on the sender breaks as soon as you have two calls in flight at the same time
There is a bis fnc that does that iirc
my rpc functions just return futures
mmh
i made my futures generic, not tied to any remote execution api
i use them for some local async operations as well
that's noice
https://gist.github.com/vasama/e5d30021661ec05176404fe7f827a011
Delegate<R(T)> is just a (R(T,C), C) pair
You can use remoteExec locally too 😄
can't you create a localRemoteExec then 🤔 😄
wat
hello
pc1 setVariable ["NotUse", false, true];
"The download will start in 3 seconds. Pick the drive after download finished" remoteExec ["hint",west];
sleep 3;
for "_i" from 1 to 100 do
{
sleep 2;
hintSilent format ["Download in progress : %1",_i];
};
"Download completed! Pick the thumbdrive from PC." remoteExec ["hint",west];
pc1 setVariable ["NotPicked", true, true];
pc1 addaction ["Pick Drive", { [] execVM "PickDrive.sqf"}, nil, 2, true, true, "", "_target getVariable ['NotPicked',true]"];
how i want everyone to see hint for countdown?
i tried something like this [["Download in progress : %1",_i],"hintSilent Format",true,false,false] call BIS_fnc_MP; but not working
@scenic mantle ```sqf please 🙃
sorry
remoteExec is what you are looking for, not BIS_fnc_MP
you have an example with hint in your own code 🙃
["Download in progress : %1",_i] remoteExec ["hintSilent format",west]; so like this?
"hintSilent format" is not a command name
its a string that contains two command names, that's invalid for remoteExec, you wanna use a single command, so remove the format from there
[format["Download in progress : %1",_i]] remoteExec ["hintSilent",west]; like this?
[format ["Download in progress : %1",_i]] remoteExec ["hintSilent", west];
// split
private _text = format ["Download in progress : %1",_i];
[_text] remoteExec ["hintSilent", west];
```@scenic mantle
ouh. ok2. tq @winter rose !
Is it possible to transmit audio from one in-game chat to another?
I want to increase the realism of in-game player radio communication a bit by autometically transmitting everything the players say in any channel into the local channel as well or at least make it hearable locally. Basically like the communication with NPCs: Yes, they do talk to you in the group chat (or for support requests what every channel you set as the support channel) but what they are saying over the radio can also be heard by everyone that is close enough to the speaking NPCs.
Is such a thing possible in any way?
what is _veh, _text or _offroad? what is -
@vague geode no, there is basically no control at all over voice chats from scripting
Ok, thanks anyways.
thx
Is there an evh that checks when a player puts an object in a container/inv?
Put
ty
see https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Put for documentation (and other EHs)
is there a script for unlimited rocket launcher ammo and no reload?
not ready made but sure that could be done if one invests the time and effort
Fired EH and addWeaponItem I suppose? I think I've done it before
setVehicleAmmoDef 😛
is there a script for unlimited rocket launcher ammo and no reload?
@stuck rivet use eventhandler for fire?
yeah ive been trying scripts i find with google, but none of them work with the disposable RHS rockets
like this one:
player addeventhandler ["fired", { params ["_unit", "_wep"]; _testIsRocket = getText (configFile >> "CfgWeapons" >> _wep >> "cursor"); if (_testIsRocket isEqualTo "missile") then { _rocketArry = getArray (configFile >> "CfgWeapons" >> _wep >> "magazines"); _rocket = (_rocketArry select 0); _unit addMagazine _rocket; reload _unit;//remove if unwanted }; }];
@stuck rivetWhat/who fires the RHS rockets?
Hi, everyone!
I need help, I use this code for choosing all available players:
private _players = allUnits select {isPlayer _x && side group _x == east}; private _unit = selectRandom _players;
How exclude from selectRandom player with variable name: Player1 and Player2?
player addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
private _testIsRocket = getText (configFile >> "CfgWeapons" >> _weapon >> "cursor");
hint format ["%1", _testIsRocket];
}];
``` @stuck rivet
tell me what the hint returns after you fire the rocket
@thorn cape allPlayers - [Player1, Player2]
@thorn cape
allPlayers - [Player1, Player2]
@digital hollow and code will not select Player1, Player2, yes?
Its removing player1 and player2 from _players
By removing them from the array before selectRandom, it becomes impossible to select them.
it returns rocket
Its removing player1 and player2 from _players
@robust brook @digital hollow thank you!
@stuck rivet What exactly do you want to happen once you launch the rocket?
have another rocket ready to fire without having to swap out launcher
if I do [player,["grenadier",2,-1]] call BIS_fnc_addRespawnInventory;, does this limit of 2 stack for every iteration of the code in initplayerlocal.sqf? cause last game, I had a limit of 1 sniper, yet every squad could have 1 sniper.
Reference:
Array - format [class, number, limit]
class: String - CfgRespawnInventory class
number: Number - Number of players who can use this inventory (-1 = no limit, default)
limit: Number - Limit for role assigned to given loadout (-1 = no limit, default)
Only role or only loadout can be limited at one moment, if there is limit for both, then only role uses limit.
If the limit definition for role is called multiple times with different numbers, then the highest number is used.
player addEventHandler ["Fired", {
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
private _rocketWeaponString = getText (configFile >> "CfgWeapons" >> _weapon >> "cursor");
if (_rocketWeaponString isEqualTo "rocket") then {
private _rocketAmmoTypesArray = getArray (configFile >> "CfgWeapons" >> _weapon >> "magazines");
private _rocketAmmoString = (_rocketAmmoTypesArray select 0);
hint format ["_rocketWeaponString: %1 \n _rocketAmmoTypesArray: %2 \n _rocketAmmoString: %3", _rocketWeaponString, _rocketAmmoTypesArray, _rocketAmmoString];
};
}];
Try that and let me know if it works, if not let me know what the hint returns
it returns the ammo type
tbh i don't think unlimited disposable rockets are possible because i think RHS turns the launcher into a (used) launcher and i don't think you can stop that with scripts, but thanks anyway i really appreciate the help freely given
freely? 👀
It might have been useful to know the RHS one shot launchers were in question
🙈
and yes they have special behaviour
best to use some other laucher
Is it possible force this code on server/local multiplayer game?
_mission = floor random 2 ; switch (_mission) do { case 0: { Player1 synchronizeObjectsAdd [task_module]; }; case 1: { Player2 synchronizeObjectsAdd [task_module]; }; };
is there a way to get string from init field of object by SQF ? getter of setVehicleInit
what is the cameraVieworcameraOn for UAV Terminal? How do I detect if a player entered a UAV terminal?
cameraOn is the UAV
i mean just in the terminal menus
oh
you are still the player, it's "only" an overlay
is there a way to detect if this overlay was opened?
maybe by checking displays, because there seems to be no command for that
i guess all I'm trying to do is remove UAVs that are placed in editor from the terminal of my players. I've tried so many ways so far and nothing has been fruitful
what do you want to do, again?
players are independent. i have a nato radar and nato sam that I have changed their group to independent side upon init. I want so that if my players spawn in as the UAV operator, they cannot see those UAVs in the terminal menu to select. so far I've tried using disableUAVConnectability and action "UAVTerminalReleaseConnection" to no success.
about disableUAVConnectability,
This command has effect on a UAV terminal, not on whether a unit is able to connect to a UAV or not.
unit disableUAVConnectability [[uav1, uav2], true];
(local effect, so remoteExec it if needed)
can't seem to get it working with remoteExec currently. I figured out a crude workaround though...
private _uavs = [uav1,uav2];
private _bob = (creategroup independent) createUnit ["ffp_m05w_rifleman_uav_op",getPosATL uav1,[],0,"NONE"];
_uavs joinSilent group _bob;
cause they are removed from the menu if they are in a group apparently
hue hue hue weird workaround, but ok !
is there a way to trigger something when the map closes? I have onMapSingleClick being used to set waypoints for units but I want to set it back to "" when the map closes, I haven't had any luck searching the wiki
You could try an onUnload UI event handler (https://community.bistudio.com/wiki/User_Interface_Event_Handlers#onUnload) in relation to the map display (display 12)
I'll give it a shot, I'm new to scripting so it looks pretty daunting, thanks 🙂
@strange seal I've used something like this in the past
[] spawn {
waitUntil {!visibleMap};
//code...
};
how would i go about implementing an article of clothing into my game as a mod? i wanted to import a model of a space suit for a mission im doing but idk what to do
Have you ever experienced or heard that pilot player is invincible after fighter jet ejection?
So the player is not dead by any enemy attack unless respawn by itself.
our players reported it and no idea how to solve it.
you running ace?
no vanilla mode.
so occasionally, a players plane will explode, go all the way to the ground, and they get out?
yes, right
eject the seat and land without time to parachute, but he stil survive and invincible.
vanilla mode but just some server side Mode like Sling, Rappelling.
try taking off those mods and see if you can replicate it? or, make sure they also have the mod, not just the server
private _groups = [];
{
if ((side _x == opfor) and (count units _x > 2)) then {
_groups = _groups + [_x];
};
} forEach allGroups; //Returns array of groups _groups = [group1,group2,group3,etc]
{
private _group = _x;
//if a {_x setDamage 1} forEach units _group is placed here, it goes through all groups
waitUntil { ({alive _x} count units _group) < 2 }; //pass
{
_x setCaptive true; //pass
_x action ["Surrender",_x]; //pass
[_x] joinSilent grpNull; //pass
} forEach units _group; //pass
} forEach _groups; //error: only applies to group index [0] in _groups
I'm hitting an issue where its only applying to 1 group (happens to be index[0] of the _groups array). Anyone see the problem?
Is it possible force this code on server/local multiplayer game?
_mission = floor random 2 ; switch (_mission) do { case 0: { Player1 synchronizeObjectsAdd [task_module]; }; case 1: { Player2 synchronizeObjectsAdd [task_module]; }; };
@thorn cape
this isn't working for you? synchronizeObjectsAdd is a global command so you shouldn't have to remoteExec it. are you sure you are calling it right? and are your units named player1,player2,etc?
https://community.bistudio.com/wiki/removeMagazine
Note: You may create invalid combinations with this function. When doing so, application behaviour is undefined.
i hope they're just abusing the concept of undefined behaviour here right? i.e. it's not actually going to format the hard drive?
it is going to ban you from this Discord
I suppose it is command application behaviour result that is undefined.
well reading this comment it just sounds like someone made the game crash with this command
hopefully not, but perhaps, actually
also note that this remark may have been for a previous title and may or may not apply to A3
Could setParticleParams be used to overwrite only certain particle effect parameters (i need to increase particle lifetime only), not everything?
nope, but you can store the settings array somewhere then only update one part with set
yeah, didn't even think about that, it is an array so i can increase parameter by index, thx
Alright so I am trying to make an elevator to go to the roof of a building using two flagpolls and this script line
this addAction ["Teleport", {player setPos (getPos blue1)}]
blue1 being the other poll. while I do teleport i do so at 0 height at the base of the building instead of up high, anyway to fix this?
@ionic orchid just did a test and it looks like that worked perfectly! thank you very much!
can we get some binary operators in SQF?
like:
// bit-or
float larg, rarg;
return (float)((int)larg) | ((int)rarg);```
wonky ... but usable enough for people to find usecases
there are BIS fnc bitflags, but… :-\
you only have 24 bits of mantissa in a 32 bit float... it's not great
could in theory be solved by adding a multi-type scalar 🤪
std::variant<int, float>
is that intercept library still a thing? there's your bit ops
Hi guys, is there a way to spawn a group in CUP units in a script like this ?
_group1 = [getMarkerPos "spawn1", EAST, (configFile >> "CfgGroups" >> "EAST" >> "OPF_F" >> "Infantry" >> "OIA_InfTeam")] call BIS_fnc_spawnGroup;
Just use CUP config, yes
Like configFile >> "CUP config" ?
I don't know the right syntax
you can check the config path in the Config Viewer
forgot about that. Thank you ❤️
Erm, am I mentally challanged or does this not work:
Setting up the displayEH "MouseMoving", rotating the current VectorDir/VectorUp of a camera by the angles given by the event (horz & vert) and yielding it back to the camera by "setVectorDirAndUp" should result in smooth camera movement. But why doesn't it, though?
(one does not exclude the other)
(my math is "correct" [well, obviously isn't], I've compared it to "BIS_fnc_transformVectorDirAndUp" in which Killzone_Kid makes very nicely use of the A3-matrixmult cmd and a mathematical trick)
What do you mean?
You just apply the Rotation Matrix given by the Horz (= yaw) Angle and the Matrix given by the Vertical (pitch) to both the current directional/Up vectors of the camera, don't you?
am I mentally challenged or does this not work
both are possible at the same time 😬
but I don't know about mousemoving
the camera moves as expected, but does so in stutters?
Yes, that's true
Nonono, "as expected" would be very far fetched here.
It actually begins to roll, I've no idea how to describe that
It certainly does not do what it's supposed to do
It's kinda strange, because it is comparable to Example #2 of https://community.bistudio.com/wiki/BIS_fnc_transformVectorDirAndUp
Instead I am using the second argument of the EH in place of the "GetDir"-Thing for that UAV (no "Roll"-ing applied)
"BIS_fnc_setObjectRotation" works even less. That, however, is kinda trivial, the functions doesn't rotate the vectorUp by the yaw, as it should (?)
I can't be the first person wanting a free view camera, can I
Trying to play animations with switchmove and playmove, for some reason on the one that I need the gun keeps going back into the unit's hand even if i switch it off before
@wheat geyser you can check how the Arsenal does it in the BIS fnc?
quick question , how would one check is unit x got into helicopter y?
slightly longer question , translate that to code quick😅
private _unit = x;
private _heli = y;
if (_unit in _heli) then
{
hint "I iz in da choppah";
} else {
hint "get to da choppah!!1!";
};
slightly longer answer ^^
^^
quick question number 2
!(hos getVariable "Enh_isHostage");
I have this in the condition of a trigger , but the trigger never fires regardless if the hostage is a hostage or not
any idea how to fix this?
Currently checking out "BIS_fnc_camera". They do it very weirdly. It's not really """correct"""
Instead of manipulating the actual pitch of the camera, they allow only free camera movement while depressing the Right Mouse Button. As this event continuously returns the On-Screen Mouse Y Position, this is actually used instead of the actual Pitch Angle (meaning one of the Euler Angles)
They themselves were not using their own functions "bis_fnc_getPitchBank" and "bis_fnc_setpitchbank" (they use only the latter w/ the above trick)
@gilded rover make sure it is the proper variable name 🙃
I'm currently trying to change the default Gau-8 ammo for the USAF A-10, Addmagazine doesn't seem to be working anyone got any ideas?
/this addmagazine ["UAS_Base_30x173_XM1170_1150Rnd",[1]]/
I'm currently trying to change the default Gau-8 ammo for the USAF A-10, Addmagazine doesn't seem to be working anyone got any ideas?
this addmagazine ["UAS_Base_30x173_XM1170_1150Rnd",[1]]
@haughty stump```
during the mission or a mod?
in the editor, it's going to be a respawning A-10 for liberation so i'd like it to respawn everytime with the selected ammo
@haughty stump check the wiki page for addMagazine please
... I had an extra bracket
@gilded rover make sure it is the proper variable name 🙃
@winter rose got it working , i feel like noob
How do Laser designators work? I am asking because whenever I spawn a laser target it disappears again after a second. Are there any way that I can prevent it from despawning until I want it to?
have you tried searching forums? https://forums.bohemia.net/forums/topic/170910-spawned-laser-targets-disappear/#comment-2669147
Hey there, Im having troubles getting scripted / spawned laser targets to work. They seem to be non persistent and disappear a few seconds after spawning. Its for an SP mission where the player lases some targets, then calls in CAS and gets switched to the pilot position of th...
@unique sundial Hey, you wrote the script "BIS_fnc_transformVectorDirAndUp". Do you know any reason that this Transformation doesn't work in conjunction with the arguments in the Display EH "MouseMoving"?
no idea there is example on biki or are you saying it doesn’t work anymore?
No, the Transformation is code itself is fine, I'm asking about a free camera movement via "MouseMoving"
Even the official seem to the safe the pitch angle, using it for the later transformation. This, however, is IMO bad design, because if s/o was to constantly spin in one direction, the number could overflow, can't it?
I'm still having trouble getting this to apply to all groups in the array. Any help?
https://discordapp.com/channels/105462288051380224/105462984087728128/750918540739215471
camera setVectorDirAndUp ([[vectorDirVisual camera, vectorUpVisual camera], _alpha, _theta, 0] call BIS_fnc_transformVectorDirAndUp); should do the trick, doesn't it? (If "MouseMoving" returns [display, _alpha, _theta])
@fair drum because it will wait for group 1 to surrender, then apply it to group 2, etc
spawn
okay, so spawn the whole internal block? I'll try it
@Killzone_Kid Thanks alot.
YES! Finally! After scratching my head all night, it finally works!
https://sqfbin.com/efamekaciyiyowelohav
thx lou
camera
no idea doesnt say anything this is just variable could be anything
If "MouseMoving" returns [display, _alpha, _theta]
Huh? MouseMoving doesnt return angles
Hm? What does it return?
i kinda feel like i should start actual arma modding again
Don't just upvote @young current 😱 you need to tell me "no, sqf-vm and other tooling is your future." or "forget about that medic mod you are too lazy to write UI Code for"
😝
"forget about that medic mod you are too lazy to write UI Code for"
and all the other projects you started and never finished 😄
That ain't true
Arma.Studio is not dead, sqf-vm still alive, xmedsys was done, the few other mods too
Just that most of those are not really known 😅😅
EG, XInsurgency
But really... Ui is just horrible to do, especially for what I plan to do... Maybe only some xmedsys relaunch... That at least was extremly simple 😅😂
UI got a lot of love recently
mhh? what kind of love?
i mean ... technically, i already have some UI cobbled together:
https://imgur.com/Gy1q5pU
but implementing the whole interaction stuff with it is ... meh
how does one "rotate" a vector?
e.g [-1,-1,0] rot90 = [-1,1,0]?
it is for some kind of relative position.
What do you mean.
https://community.bistudio.com/wiki/setVectorDirAndUp (see examples)
This is a special case for Planes (in 2D)
Switching the items and negating one of them
Cannot be applied for the general case, though
For general directions and angles you'd need to apply the known Rotation Matrix
I will (hopefully) only need 2D rotation
Only 90°?
https://steamcommunity.com/app/107410/discussions/17/2942494909163039726/ If anyone could answer this question(s) that would be great
@tough abyss re-add the action to the put laptop, that's about it
thank you, how would I go around doing that?
use the "Put" Event Handler to grab the newly placed laptop 🙂
"Take" EH to get the picked up one
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Put so just put this in the object's init?
no, ideally don't put anything in the object's init - bad for MP, rarely good for anything
use the EH on your unit that should put the laptop, and if the _item corresponds to the laptop's class, add the action to the _container
How would I make it available for say every single unit in an MP game?
bear with me im new to scripting
add it to player in init.sqf, surrounded by ```sqf
if (hasInterface) then
{
waitUntil { not isNull player };
player addEventHandler ["stuff", { /stuff/ }];
};
that means no one will be able to interact with it besides the person who put it down?
this way, yes
unless you use addAction with remoteExec
execVM and remoteExec, are they the same or?
nope, not at all.
execVM will simply "run a file script", where
remoteExec will broadcast a scripting command
e.g```sqf
[1, 2] execVM "myFunction.sqf";
// vs
["Hello there!"] remoteExec ["hint"];
(btw, have you heard of our lord and saviour the Wiki? 🙂)
I have yes, but I get headaches looking at documentation
PTSD from making discord bots 😛
np, the channel remains open for questions and assistance
I'll come back if i need help, I'll try not to bother too much though 😄
I mean, the channel is here for that and we are not alone, plenty of peeps here :3
@winter rose sadly looks like the put event handler and take one are for taking/putting stuff into containers
doesn't it trigger when you drop something 🤔
It does
Triggers when a unit puts an item in a container.
Although technically, when you drop something on the ground it will also be in a "container"
hah 😛
ah yep - String
How would I get a classname of an object?
Just Ctrl+C in the editor or?
@winter rose
Is createVehicleLocal limited? or can be limited? Im starting make a script that you have a 3D preview of a selected vehicle, is there a problem?
nevermind I think it just shows up under the actual item
@astral tendon should be no limitation so far - you can also use createSimpleObject with a "local" parameter
Does pylon configuration works with vehicles created with createSimpleObject ?
I don't believe so!
is this a valid way to compare?
if (_item=="Item_Laptop_Unfolded") then {
yes
is this a valid way to compare?
if (_item=="Item_Laptop_Unfolded") then {
@tough abyss
if ( (typeOf _item)=="Item_Laptop_Unfolded") then {
oh, it is.
(but looks up config)
true, it's slower
if (_item=="arifle_MX_SW_F") then {
hint "test";
};
tried this
doesn't work with it either
show the full EH test plz?
if (hasInterface) then
{
waitUntil { not isNull player };
player addEventHandler ["Put", {
if (_item=="arifle_MX_SW_F") then {
hint "test";
};
}];
};
i tried it outside the if statement
it works like that
maybe remove the _?
you didn't use params
do I have to keep the params part in?
of course, it is what defines the variables, from _this
oof, monkey mistake
if (hasInterface) then
{
waitUntil { not isNull player };
player addEventHandler ["Put", {
params ["_unit", "_container", "_item"];
if (item=="arifle_MX_SW_F") then {
hint "test";
};
}];
};
ah well, the sooner you make the mistakes the less there are you can make! 😄
this better?
```sqf
/* your code */
``` and it's perfect 😉
ah yeah use sqf with the formatting
and indent that second-to-last line, come on! D:
vsc doesn't like indenting sqf for some reason
i didn't tell it its sqf
probably why 😛
if (hasInterface) then
{
waitUntil { not isNull player };
player addEventHandler ["Put", {
params ["_unit", "_container", "_item"];
hint "test1";
if (_item=="arifle_MX_SW_F") then {
hint "test2";
};
}];
};
test1 gets triggered but not test2 for some reason hmm
@winter rose any ideas?
did you drop an MX SW ?
yup, do attachments make a difference?
should not
instead of "test1", try hinting _item - you will get the class you dropped
ah, with or without the quotes?
I think is a premade weapon with attachments
arifle_MX_SW_pointer_F
vs
arifle_MX_SW_F
yep
yeah alright, i'll try it with the laptop now 😛
anyway, the laptop doesn't have attachments yeah!
if (_item=="Laptop_Unfolded") then {
hint _item;
[hackLaptop1,
"Upload Virus",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_hack_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"_this distance _target < 5",
"_caller distance _target < 5",
{_caller playmove "Acts_Accessing_Computer_in";sleep 2},
{_caller playmove "Acts_Accessing_Computer_Loop";parseText format["<br/><img size='2' image='\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa'/><br/><br/><t size='1.5'>\\\VIRUS UPLOAD///</t><br/><br/><t size='1.5' color='#FFFF00'>UPLOAD IN PROGRESS...</t><br/><t color='#FFFF00'></t><br/><br/><t size='1.25' color='#CCCCCC'>%1% Complete</t><br/><br/>",round ((_this select 4) * 4.16),name (_this select 1)] remoteExec ["hintSilent"];playSound3D ["A3\Sounds_F\sfx\click.wav", hackLaptop1]},
{_caller switchmove "Acts_Accessing_Computer_Out_Short";parseText format["<br/><img size='2' image='\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa'/><br/><br/><t size='1.5'>\\\VIRUS UPLOAD///</t><br/><br/><t size='1.5' color='#00FF00'>UPLOAD SUCCESSFUL</t><br/><t color='#00FF00'></t><br/><br/><br/><br/>",name (_this select 1)] remoteExec ["hintSilent"]; sleep 2; "" remoteExec ["hintSilent"];
_nearStreetLights=nearestObjects[hackLaptop1,["Lamps_base_F","PowerLines_base_F","PowerLines_Small_base_F"],500];
{
_x setHit["light_1_hitpoint",0.97];_x setHit["light_2_hitpoint",0.97];_x setHit["light_3_hitpoint",0.97];_x setHit["light_4_hitpoint",0.97];
}forEach _nearStreetLights;
},
{_caller switchmove "Acts_Accessing_Computer_Out_short";parseText format["<br/><img size='2' image='\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa'/><br/><br/><t size='1.5'>\\\VIRUS UPLOAD///</t><br/><br/><t size='1.5' color='#FF0000'>UPLOAD ABORTED</t><br/><t color='#FF0000'></t><br/><br/><br/><br/>",name (_this select 1)] remoteExec ["hintSilent"]},
[],
15,
10] call bis_fnc_holdActionAdd;
};
anyways, i get through the if statement this time
the holdaction doesn't trigger though for some reason
the variable name is hackLaptop1
assigned in the editor
not sure if it stays after being picked up and dropped
it works if I do it by debug console, but not by the script for some reason
it's not to hackLaptop1 you want to add the action, it's _container
hackLaptop1 doesn't exist the moment you pick it up
ahhh okay
let me try that
Ay, it works!
now one more thing, is it possible to make the event handler a one time thing? Once it detects the laptop being dropped once, it just stops checking for puts?
just to save some performance
yes, add```sqf
_unit removeEventHandler ["Put", _thisEventHandler];
love you, no homo intended 😄
(he can then only place it once)
be sure that not at all!
@winter rose last thing i promise, is there a way to get a certain object that's part of the map from the editor?
i have 3den enhanced if that helps somehow
get it as in get its classname
oh, then yes
go in the editor, play, aim at it, in the debug console:sqf typeOf cursorObject;