#arma3_scripting
1 messages Β· Page 634 of 1
thisList depends on what was set in the "Triggered by" parameter.
If you set it to "Activated by players" or something like that, there are only players in thisList.
ohhhh okay makes sense
if activation is set to "ANYPLAYER", it will only trigger on players
blufor being any blufor unit and players?
BLUFOR includes all members of BLUFOR groups, players and AI alike. Not sure about vehicles with that one.
no thats great to know thank you
You can modify Grezvany13's code with if (isPlayer _x) then {..., then you can have it kill players only regardless of activation.
it will trigger for everyone it is set to trigger for. so it its activated by any opfor, itll kill any opfor etc
nope:
thisList - list of all objects in trigger area, based on 'Activation'
the trigger will activate for everyone, true, but when using thisList it will only go through the objects in the trigger area
Howdy there....
I have problems with waitUntil and isTouchingGround...
situation: I have a group, which has been given scuba gear to infil AO...with a SDV. inventory was saved with
{[_x, [missionNamespace, "inventory_var1"]] call BIS_fnc_saveInventory;}forEach Units player;
what I'm looking for is that the team get the inventory back with
{[_x, [missionNamespace, "inventory_var1"]] call BIS_fnc_loadInventory;}forEach Units player; but I want it to happen once they reach the shore.
I tried with:
waitUntil {isTouchingGround player}; if (isTouchingGround player) then { {[_x, [missionNamespace, "inventory_var1"]] call BIS_fnc_loadInventory;}forEach Units player; };
and with
player addEventHandler ["GetOutMan", { waitUntil {isTouchingGround player}; if (isPlayer player) then { {[_x, [missionNamespace, "inventory_var1"]] call BIS_fnc_loadInventory;}forEach Units player; }; player removeEventHandler ["GetOutMan", _thisEventHandler]; }];
No joy..and I'm getting lost here...any ideas?
Unless water is considered ground by isTouchingGroundπ
```sqf
code
```
Sorry..???
see the pinned messages
To Format your code proper
Single ` is pretty much for "snippets"
Triple for blocks
gotcha..sorry
No hard feeling, just noting it as your code gets much more readable then ππ
Not working... the best result I had was with ``` waitUntil {isTouchingGround player};
if (isTouchingGround player) then {
[player, [missionNamespace, "inventory_var1"]] call BIS_fnc_LoadInventory;
}; ``` but as soon as I get out of the SDV inventory is given back..
you can try it it a more advanced way:
waitUntil {isTouchingGround player && {
terrainIntersectASL [getPosASL player, getPosASL player vectorDiff [0,0,0.1]]
}};
also this is what X39 meant
as you can see my code has "colors"
I see..
also your second condition is redundant
I try with ``` my script
no wonder..lol
try editing your old code
sqf ```waitUntil {isTouchingGround player};
if (isTouchingGround player) then {
[player, [missionNamespace, "inventory_var1"]] call BIS_fnc_LoadInventory;
};```
no put it IMMEDIATELY after the three `
no space, no nothing
not even a next line
```sqf
code
```
waitUntil {isTouchingGround player};
if (isTouchingGround player) then {
[player, [missionNamespace, "inventory_var1"]] call BIS_fnc_LoadInventory;
};```
???
waitUntil {isTouchingGround player && {
terrainIntersectASL [getPosASL player, getPosASL player vectorDiff [0,0,0.1]]
}};
[player, [missionNamespace, "inventory_var1"]] call BIS_fnc_LoadInventory;
that's it
no need for if ... then {}
and if you want to check it for a group of units:
waitUntil {
units player findIf {
!(isTouchingGround _x && {
terrainIntersectASL [getPosASL _x, getPosASL _x vectorDiff [0,0,0.1]]
})
} == -1
};
checks it for the player's group
I do...thanks
fixed
OK..so it should go like this:
waitUntil {
units player findIf {
!(isTouchingGround _x && {
terrainIntersectASL [getPosASL _x, getPosASL _x vectorDiff [0,0,0.1]]
})
} == -1
}; {[_x, [missionNamespace, "inventory_var1"]] call BIS_fnc_loadInventory;}forEach Units player;```
let me test it..sitrep asap..
altho I should mention that a problem with that code is that no one gets their inventory back unless they all make it to the shore!
so you can try running the code separately for each unit
I'll try that..because with the above part of the code
{[_x, [missionNamespace, "inventory_var1"]] call BIS_fnc_loadInventory;}forEach Units player;``` is not working. trow an error.
example:
{
_x spawn {
waitUntil {isTouchingGround _this && {
terrainIntersectASL [getPosASL _this , getPosASL _this vectorDiff [0,0,0.1]]
}
};
//give inventory back
}
} forEach units player;
@serene quiver you don't need to use a function for something so trivial
//save inventory
{
_x setVariable ["SavedInventory", getUnitLoadout _x];
} forEach _units;
//get inv
{
_x setUnitLoadout (_x getVariable ["SavedInventory", []]);
} forEach _units;
so "forEach _units" is intended the units in player group,right?
let see if I got this right......
//save inventory
{
_x setVariable ["SavedInventory", getUnitLoadout _x];
} forEach unit player;
{
_x spawn {
waitUntil {isTouchingGround _this && {
terrainIntersectASL [getPosASL _this , getPosASL _this vectorDiff [0,0,0.1]]
}
};
//get inv
{
_x setUnitLoadout (_x getVariable ["SavedInventory", []]);
} forEach unit player;```
No
π©
You should've put the get inventory part inside the spawn
Also you should remember that it runs for 1 unit
So you should use:
_this setUnitLoadout (_this getVariable ["SavedInventory", []]);
confused..how is their "land" inventory saved inside the spawn, is they're given scuba gear before they board the SDV?
That's because each spawn runs for one unit now
Not the save part
The get part
Look at the code I posted
It's the get part
scripting is hard lmfao
And if you don't understand any part of it, feel free to ask
I just wanna jump out of the window right now..hahaha
Hold on....
Here is the whole script I'm using to get those units in the SDV...
https://sqfbin.com/ozihiviruwokapizelun
{
_x spawn {
waitUntil {isTouchingGround _this && {
terrainIntersectASL [getPosASL _this , getPosASL _this vectorDiff [0,0,0.1]]
}
};
_this setUnitLoadout (_this getVariable ["SavedInventory", []]);
};
} forEach units player
I hope I got it right
Cuz I'm typing on my phone now
so that part goes where in the above script?
I meant in MY script..hahah
like this? (look at the bottom..
https://sqfbin.com/qazetuxepomisayoneku)
I think I got it..
https://sqfbin.com/xucoyiwitujijegoveba
not unit player
Units player
The rest seems good
Also too many forEach
Put all those codes in one forEach
LOL how?
awesome..didn't know that..
Your whole code is just one forEach essentially
There are some parts that may need adjusting
Told ya...it's working..but it make scripters drop deads..hahah
It's more of a performance issue
You run the loop like 20 30 times
sqf loops are SLOW
Try to get the job done in as few loops as possible
or make small loops, and call external scripts only when needed
ok..so for example..something like this?
{removeAllWeapons _x;
removeAllItems _x;
removeAllAssignedItems _x;
removeUniform _x;
removeVest _x;
removeBackpack _x;
removeHeadgear _x;
removeGoggles _x} forEach Units player; ```
It's faster if you empty the player's inventory by hand
Then use getUnitLoadout in debug console
Then copy the result and use it with setUnitLoadout
// remove everything
player setUnitLoadout (configFile >> "EmptyLoadout");
That's a thing?
yup
it will just give you a "naked" guy
I use it in my framework which needs to set a loadout from a database, so to be 100% sure that the player does not have anything he shouldn't (in case DB data is corrupt or something) I first run that line to remove everything, before using setUnitLoadout with his personal loadout
So for a group, this?
// remove everything
{_x setUnitLoadout (configFile >> "EmptyLoadout")} forEach Units player;```
yup
π₯³ lol..finally getting something right at the first try...thank you..
so I guess reversing to give units a new loadout, right?
but you can improve your script a lot by only using set/getUnitLoadout, especially if you have a fixed loadout you want to set
Actually, the group has the inventory saved, then will get a fix inventory set, and then they'll get theyr stuff back..
So I use
{_x setUnitLoadout (configFile >> "EmptyLoadout")} forEach Units player;```
for taking away everything and then
```sqf
{_x getUnitLoadout (missionConfigFile >> "MyLoadout");} forEach Units player;``` right?
looking at the script in sqfbin there is so much going wrong...
The cinema border is something that has to run locally for each player, and than the script is running the same scripts for all players.
Meaning that it will execute amount players x amount players...
like; when is this called? in a trigger, in an init script?
It's SP mission..called by an addAction
Player walk to an object, get the action and is teleported in the SDV with scubagear..
_divingKit = []; // UnitLoadout Array
[0, 0] spawn BIS_fnc_cinemaBorder;
sleep 1;
titleText ["", "BLACK FADED"];
{
// store loadout locally to unit
_x setVariable ["SavedInventory", getUnitLoadout _x, true];
// remove everything
_x setUnitLoadout (configFile >> "EmptyLoadout");
// add diving kit
_x setUnitLoadout _divingKit;
// if group leader
if (leader group _x == leader _x) then {
_x addWeapon "Laserdesignator_03";
_x moveInCommander SDVinfil;
} else {
_x moveInAny SDVinfil;
};
cutText ["", "BLACK IN", 3, true];
[1, 1] spawn BIS_fnc_cinemaBorder;
[_x] spawn {
params ["_unit"];
waitUntil {
isTouchingGround _unit
&& {
terrainIntersectASL [getPosASL _unit, getPosASL _unit vectorDiff [0,0,0.1]]
}
};
_unit setUnitLoadout (_unit getVariable ["SavedInventory", []]);
};
} forEach units player;
All you need is to create the diving kit in the Arsenal, export it, and put it in the first line π
π WOW...awesome man..I'm gonna test it right now....thank you.
not tested of course π but should do the trick
I'll sit-rep ASAP...hol on...
I feel so dumb right now..I try to export the inventory like usual and paste it where you told me to...but I get an error and is not working....???
https://sqfbin.com/ahuhapezocorogejiqen
true... I'm used to the ACE arsenal
if you're in the editor, make a unit with the prefered loadout, load that mission (as that unit) and put in the debug console copyToClipboard getUnitLoadout player
You will now have the correct data which you can simply paste with CTRL+V in the script
"copyToClipboard getUnitLoadout player" trow an error in the debug console:generic erron in expression...
getUnitLoadout does not return a string.
Should be:
copyToClipboard str (getUnitLoadout Player);
Should be this, right?
["CUP_smg_MP5SD6","","","optic_Holosight_smg_blk_F",["CUP_30Rnd_9x19_MP5",30],[],""],[],["CUP_hgun_Mk23","CUP_muzzle_snds_mk23","CUP_acc_mk23_lam_f","",["CUP_12Rnd_45ACP_mk23",12],[],""],["U_B_Wetsuit",[["FirstAidKit",1],["SmokeShellBlue",2,1],["CUP_30Rnd_9x19_MP5",4,30],["CUP_12Rnd_45ACP_mk23",1,12]]],["V_RebreatherB",[]],["B_Assault_Diver",[["CUP_30Rnd_9x19_MP5",5,30],["SatchelCharge_Remote_Mag",1,1],[["Rangefinder","","","",[],[],""],1]]],"","G_B_Diving",[],["ItemMap","","ItemRadio","ItemCompass","ItemWatch",""]
π
Ok man...the loadout part is done now...still doesn't work. It start the cinemaborder but then it stops, and nothing happen...
an no script errors, or anything in your log files?
no error report...
and define "nothing"
you select the addAction, you get the cinema border and then nothing happens... what are you expecting at that point?
btw... you could move these 2 lines to the end of the file (so below the forEach)
cutText ["", "BLACK IN", 3, true];
[1, 1] spawn BIS_fnc_cinemaBorder;
OK...after you select the addaction, the screen goes black as it should..stay black for few seconds and then it comes back to normal, but the teleporting action is not happening..
and the vehicle has the correct variable name? SDVinfil
yap
it's a bit hard to build complex scripts without testing them
and the script I provided should give you enough to keep changing stuff till it works
dumping some stuff in chat or the log files (diag_log str <some_data>;) could help
Yes thank you a lot...got it finally working with:
_divingKit = [ MyLoadOutHere];
[0, 0] spawn BIS_fnc_cinemaBorder;
sleep 1;
titleText ["", "BLACK FADED"];
{ _x setVariable ["SavedInventory", getUnitLoadout _x, true];
_x setUnitLoadout (configFile >> "EmptyLoadout");
_x setUnitLoadout _divingKit;
_x moveInAny SDVinfil;
[_x] spawn {
params ["_unit"];
waitUntil {
isTouchingGround _unit
&& {
terrainIntersectASL [getPosASL _unit, getPosASL _unit vectorDiff [0,0,0.1]]
}
};
_unit setUnitLoadout (_unit getVariable ["SavedInventory", []]);
};
} forEach units player;
cutText ["", "BLACK IN", 3, true];
[1, 1] spawn BIS_fnc_cinemaBorder;```
π₯³
Hello, I am pretty new to the game, what is scripting and what does it do?
Here's a good introduction to scripting in Arma: https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
Thanks
10:03:32 Bad conversion: bool
10:03:32 β₯ Context: [] L1 ()
What could be causing this? I checked the script but I am not converting any variable of type bool in a (at least to me, forbidden manner)
Only thing I do is something like systemChat format ["%1",true]; which doesn't seem to cause the rpt message
Is there anyway to change how someone sits in a seat of a vehicle? I have a back seat in a jeep you can look out of the sides of the vehicle to shoot but I was wondering if there was a way to make it to where instead of sitting they stand up in the back is that possible to do?
@cosmic lichen can you post your code?
also are you sure it is from your code?
I'd seen this error before but I don't recall what it was about
10:35:01 Bad conversion: bool
10:35:01 β₯ Context: [] L1 ()
[] L1680 (3denEnhanced\functions\GUI\variableViewer\fn_variableViewer_onLoad.sqf [ENH_fnc_variableViewer_onLoad])
<- [] L1 ()
It might be possible to do with some modeling work:
- Create a new "vehicle" with FFV that uses the animation you want
- Attach the new fake vehicle to your target vehicle
The other way might be to use the animation directly, but it will probably get glitched
Im not smart enough to make a new vehicle im just barely learning how to do scripting
how does the animation part work
so add switch move to the seat I want and it should out them in that animation?
@cosmic lichen the only two places I suspect it might be happening:
"ENH_VariableViewer_AllLocationTypes pushBack configName _x" configClasses (configFile >> "CfgLocationTypes");
and
_display displayAddEventHandler ["keyDown",//Focus Search
{
params ["_display", "_key", "_shift", "_ctrl"];
if (_key isEqualTo 33 && _ctrl) then
{
ctrlSetFocus (_display displayCtrl 2000);
}
}];
most probably configClasses
The second code I used in other scripts as well and they are fine.
ohhh
The first one it is
configClasses expects bool as condition
change it to:
"-1 == ENH_VariableViewer_AllLocationTypes pushBack configName _x" configClasses (configFile >> "CfgLocationTypes");
exactly
you're providing a number
Yeah, I've never done this before and I can't seem to find a reason why I did it there. It was probably very late at night π
Thanks for the help π
no problem!
switchMove works on units
not "seats"
for example:
unit switchMove "AmovPercMstpSrasWrflDnon"
this will put them in standing up animation
Do I have to execute that everytime someone gets in then?
yes, use an eventHandler
but first test it on a unit in your vehicle to make sure it works
Like I said the chance is pretty slim
hot damn it actually works
i used switchAction but still.. the result is actually somewhat decent
Good to know!
Because playMove kicks the unit out (or maybe they just exist themselves). I wasn't sure about switchMove
i can even go prone with this https://imgur.com/c9nMrSY
@vestal radish so good news for you! it works
What's the difference between camPrepare... and camSet... commands?
Sorry got busy experementing so what line of code did you use because im having issues figuing this out
I didn't use anything I'm just saying that based on Wipeout's image
ooooooo misread
See Camera's tutorial @little raptor (I believe I wrote an explanation there, but maybe not)
Prepare* version preloads assets near the camera's future POV
@vestal radish
and it's really simple to do:
put this in your vehicle's init box:
this addEventHandler ["GetIn", {
params ["_vehicle", "_role", "_unit", "_turret"];
if (_role != "driver") then {
_unit switchMove "AmovPercMstpSrasWrflDnon"
}
}];
you may have to do more work here, but it should give you some hint as to how this works
thank you
Hey, Iβm trying to creat a trigger that counts the amount of players in side it (dosenβt matter if you this team or that team). Then I would like to put the number into a gui. Canβt get my mind how to do it though? Any idΓ©s?
@carmine tartan You'd need a loop that counts list _trigger
if trigger is set to activate by players
otherwise you'd need to filter it as well:
{isPlayer _x} count list _trigger
Okey, will play around with it for a bit cheers
One more thing; would something simple like
"[123,321]"```
Suffice as bypassing the array networking stuff?
"Bad conversion" is reading a config entry.
I think its conversion TO bool
What is in L1680?
Sorry I read the backlog first
line?!
not really worth it
Understood
it did?! I don't see what it means: [] L1 ()
what's that?!
That's
[dunno what was here] L Line number (script file path)
so the empty one just.. doesn't have path nor whatever is at the start there that i forgot what it is
like compile "hint bla" doesn't have a file path, and thus cannot show it
in this case, that's the code that configClasses compiled, the condition has no path
What do you mean?
The context told you the problem is in L1680
so I meant to look at that line and see what it does
which will be that configClasses that you posted
Well, this line isn't really useful in this case since I have a macro file included which counts to the lines unfortunately
But the problem was solved anyway π
oh really ? π
somehow block comment after include breaks it
We fixed it in ACE/CBA by just moving the #include everywhere
I can now fix the preprocessor I guess, but didn't get to it yet
Let me test that.
including before comment block didn't work for me
#include "\3denEnhanced\defineCommon.hpp"
/*
Author: R3vo
Date: 2019-08-30
Description:
Draws the mod icon next to the Eden entity.
Parameter(s):
-
Returns:
BOOLEAN: true / false
*/
Like this you ment right?
ye
Still says line 16XX
any left includes after the block comment?
nope
that fix works in ACE/CBA definitely
I am working on creating a weapons free zone for my players to gather in. I set up a trigger that can loop through the players in the trigger and remove their weapons. I also created another trigger that stores and returns their loadout when leaving.
The problem I am having though is that triggers don't activate each time a player enters the area. I thought the simple solution was to just loop while the trigger was active to remove all weapons from all players ever second or so. removeAllWeapons seems to play a small noise when it executes. I don't want that noise playing once a second during briefing. Does anyone have a suggestions on a good way to have something execute just once when entering an area?
for reference this is what I was using in the onActivation on the trigger.
_safezone = {
params ["_thisTrigger", "_thisList"];
while {triggerActivated _thisTrigger} do {
{
_x setVariable ["Oasis_activated", true];
removeAllWeapons _x;
} foreach _thisList;
sleep 1;
}
}
[thisTrigger, thisList] spawn _safezone;
@severe vapor
_safezone = {
params ["_thisTrigger", "_thisList"];
_oldList = [];
while {triggerActivated _thisTrigger} do {
_newList = _thisList - _oldList;
{
_x setVariable ["Oasis_activated", true];
removeAllWeapons _x;
} foreach _newList;
_oldList append _newList;
sleep 1;
}
}
that will only work once tho. so if a player leaves oasis, rearms and comes back, he wont be disarmed afai can tell
i assume that the removeAllWeapons _x plays the sound (why ever that might be, kinda senseless) so you could just check if the player has a weapon, only then remove it.
will allow constant check for weapons, with only noise at detected weapon
That should work every time someone enters the trigger area, since the script will be called again.
Problem might be that the weapons will also be removed from all players who were in the trigger and moved out, because the trigger is still active π€
is thisList passed as a reference or value?
if its a reference, a leaving player isnt in thisList anymore, therefor safe.
if its passed as a value, then he ll always be in _thisList
Hello...question: is "lasertarget player" from a handheld designator "viewed" differently by the game than the ones from any vehicle? What I meant is a script "recognize" the had-held one, but not the other (from a vehicle)...
I don't think so
They both create the same laser target object
both are of "LaserTargetW" type (the "W" part depends on side)
It's passed as a reference
if you try:
thisList pushBack player;
you'll get an error
it's a reserved variable
good to know π one day ill learn how to do one or the other without guessing
So should I use lasertargetW player instead?
LaserTargetW is likely the class name and not a global variable you can call
It's the classname of the laser target object
have you tried using
hint str laserTarget player;
in singleplayer to see if it works at all?
ah you want to create one, alright
see documentation:
private _target = laserTarget gunner heli;
so for vehicle targets, its not the laserTarget of the player but the gunner
Your question is very vague. I have no idea what you want to do with it even if you knew where the laser comes from
There is a way to make one player rate -2000 to a second player and 10000 to a third player?
what do you mean?
May be a local effect setRate command.
that makes no sense
rating is global
plus why would you even want a "local" rating?
Basically, on a SP mission, a little script https://sqfbin.com/uqenofovigakotiwoyed connect an AI manned VLS, thus allowing the player to call an airstrike on a lasertarget object. It works very well with a handheld laser, but in a vehicle it's not reading the laser and throw an error:
`18:54:40 Error in expression <;
if (isNull _laser) then
{
_nearObj = nearestObjects ["Car","Tank","Man","Buil>
18:54:40 Error position: <nearestObjects ["Car","Tank","Man","Buil>
18:54:40 Error Type String, expected Bool`
@serene quiver
your code is wrong
it has nothing to do with vehicle vs handheld laser target
the error is clearly telling you that
look at nearestObjects syntax again. you'll see it yourself
You meant this part,right?
_target = objNull;
if (isNull _laser) then
{
_nearObj = nearestObjects ["Car","Tank","Man","Building"];
if(count _nearObj == 0) then
{
strikeAllowed = false;
hint "Strike not allowed...USE LASER DESIGNATOR";
}
else
{
strikeAllowed = true;
//Selecting random target
_target = selectRandom _nearObj;
playSound3D ["A3\dubbing_f\modules\supports\artillery_acknowledged.ogg", player];
};
}
yes
I'm sorry, I'm so bad at this that I don't know what's wrong. What I know is that with a handheld laser it work, with a vehicle it does not.Seriuously...I'm clueless..hehehehe
Still no clue....
the only thing missing that I see,compared with the wiki example is the radius..and maybe the 2D/3D optional boolean..
are you sure that's all that's missing?!
Obviously there's something else..but I cannot see it
yours
_nearObj = nearestObjects ["Car","Tank","Man","Building"];
wiki
nearestObjects [player, ["Car", "Tank"], 200];
nearestObjects [position, types, radius]

nearest objects needs an array of params:
1st elemnt: pos
2nd element: array of types
3rd element: radius
_nearObj = nearestObjects [player["Car","Tank","Man","Building"];200];```
hahahahahahahahahahahahahaha
ok.....
did that part of code like that?["Car","Tank","Man","Building"];
"nested"?....
nearestObjects [player, ["Car", "Tank"], 200];
array within an array
damn it...forgot the comma!!
β6β6`sqf
you didn't just forget a comma
_nearObj = nearestObjects [player,["Car","Tank","Man","Building"];200];```
you also put ;
_nearObj = nearestObjects [player,["Car","Tank","Man","Building"],200];```
LOL..I'm draining you lately...in that case , what it would be more correct?
lasertarget player (or vehicle π )
so put that
_nearObj = nearestObjects [lasertarget player,["Car","Tank","Man","Building"],200];```
laserTarget can be objNull
???
so..tell me already...hahahaha
π€·
it's up to you. I don't know what you're trying to do
get the VSL to lock on the laser of the player and launch the missile.
so why do you use nearestObjects at all?!
Don't know...Is an old script I "frankenstein-ed" ...
don't even remeber where it come from...
I tried to make it work with laser to hook the VLS ..
what's VSL again?!
VERTICAL LAUNCH SYSTEM; it needs a connection with a laser sensor to fire.It cannot be fire by AI on its own. It needs this part to fire:
TARGET = laserTarget player;
west reportRemoteTarget [TARGET, 3600];
TARGET confirmSensorTarget [west, true];
0 = VLS fireAtTarget [TARGET, "weapon_vls_01"];```
I'm trying to have him locking on my laser when I call the stryke with a radio trigger...
So use laserTarget
You don't need nearestObjects
When laserTarget is null, the user is not using the laser designator
So you have nothing to fire at
There was no need for a global variable "strikeAllowed"
Just exit there
If (isNull _laser) exitWith {hint "use laser designator"}
https://sqfbin.com/wodeyitabujezuqapeva wait...I saw that mistake..think I've corrected..hahha..look
exitWith has no else
didn't know that..
Put that code in else after exitWith
Not in it
After it
Plus there's one more strikeAllowed left
You removed your playsound
And you must end your line with ;
And there's an unmatched } at the end
I tested the last version..it fire but if the laser is from a vehicle (try with a drone) it say "need laser designator"..
How do i place activated demolition blocks and satchel charges in the editor?
i know a script to make vbieds and stuff like that, but in this mission i need a disarmable bomb that won't go off
Does anyone have an Idea of how to make ["Vladimir", "Dimitri answer the fucking phone"] spawn BIS_fnc_showSubtitle; sleep 2; Global?
ARMA2OA... is there a problem using "set" with global arrays inside of an sqf function?
Nevermind, problem was elsewhere
laserTarget vehicle player;
it also works for on foot soldier
Hello guys!
I found the getAllPylonsInfo command
Are you planning to add it in the next Arma 3 update? Because It's awesome command and I really need it in my project. x))
https://community.bistudio.com/wiki/getAllPylonsInfo
if marked as 2.01, it will be in 2.02 @peak thunder
Awesome! Thank you!
if you want to try it now, switch to the dev build
The only command that can play sound from its file path is playSound3D right?
no alternatives?
I believe so, at least off the top of my head
how can I convert ?
code = { hint "test"; false };
to
code = 'hint "test"; false';
needed for inGameUISetEventHandler ["Action", code];
Did you try str code?
yes
doing it manually or calling a function is not an option?
code = { hint "test"; false };
inGameUISetEventHandler ["Action", str code];
11:40:47 Error in expression <{ hint "test"; false }>
11:40:47 Error position: <{ hint "test"; false }>
11:40:47 Error Type code, expected Bool
expected behaviour:
code = ' hint "test"; false ';
inGameUISetEventHandler ["Action", code];
inGameUISetEventHandler ["Action", format["_this call %1", code]];
You can get rid of the declaration of _wPos. Its never used
You should clean up that code, half of it is obsolete and the other half uses double variables :D
yeah, lines 5 to 15 are not used, so delete all of them
and TARGET is the same as _laser, so replace it with _laser
Thank you, a lot!
Vehicle player is either the car/heli etc he is in, or himself if he is on foot
playSound3D ["A3\dubbing_f\modules\supports\artillery_request.ogg", player];
sleep 5;
//Detecting if player has laser
_laser = laserTarget vehicle player;
If (isNull _laser) exitWith {hint "use laser designator"};
playSound3D ["A3\dubbing_f\modules\supports\artillery_acknowledged.ogg", player];
sleep 5;
playSound3D ["A3\dubbing_f\modules\supports\artillery_accomplished.ogg", player];
hint "CRUISE MISSILE INBOUND...KEEP LASER ON TARGET!!!";
_laser = laserTarget vehicle player;
west reportRemoteTarget [_laser, 3600];
_laser confirmSensorTarget [west, true];
0 = VLS fireAtTarget [_laser, "weapon_vls_01"]; ```
_laser = laserTarget vehicle player;
duplicate
but anyway it should work fine
Just for the sake of it...what would be the correct one,please?
Give me a minute, ill refine your code
//Info: this code only works in singleplayer as it uses local variables as "player".
playSound3D ["A3\dubbing_f\modules\supports\artillery_request.ogg", player];
sleep 5;
//Detecting if player has laser
_laser = laserTarget vehicle player;
If (isNull _laser) exitWith {systemChat "use laser designator"};
playSound3D ["A3\dubbing_f\modules\supports\artillery_acknowledged.ogg", player];
sleep 5;
playSound3D ["A3\dubbing_f\modules\supports\artillery_accomplished.ogg", player];
systemChat "CRUISE MISSILE INBOUND...KEEP LASER ON TARGET!!!";
west reportRemoteTarget [_laser, 3600];
_laser confirmSensorTarget [west, true];
if (isNil "VLS") exitWith {systemChat "no vertical launch system found."};
if (isNull VLS) exitWith {systemChat "no vertical launch system found."};
0 = VLS fireAtTarget [_laser, "weapon_vls_01"];
btw, iirc you can have a condition in your scrollwheel action, so that it only shows up when the condition is met. condition is checked continuously. you could put
(!isNull (laserTarget vehicle player))
in there. action will only show up when a laser is detected
In the trigger condition, right?
wait trigger? where is the laserfire code called from?
from a radio trigger
condition: radio alpha on act: []execVM "missile_support.sqf";
so you placed a blue trigger object with the above code?
never worked with radio triggers tbh
ah i see its a variation of the normal trigger
Yap..blue trigger with the above code, and the "missile_support.sqf" is the block of code you nicely provided me
how do you call it? is there a scroll wheel action the player clicks?
0>->0 to access the radio trigger list (you can have multiple radio triggers) and then the number of the action you want
@spark turret
if (isNil "VLS") exitWith {systemChat "no vertical launch system found."};
if (isNull VLS) exitWith {systemChat "no vertical launch system found."};
if (isNil "VLS" || {isNull VLS}) exitWith {systemChat "no vertical launch system found."};
Would be nice to have the action under the 0 >9 custom tab of the action menu..or even better in the 0> 8>support tab..
It is possible
How?
will throw an error if isNil bc isNull cant handle undefined i believe
thats why i separated it. not sure if theres a better solution
ah right bc its positive eval, true
the condition in {} will not be evaluated if isNil is true
in other words, this is what the game sees: (altho in a faster way)
if (if (isNil "VLS") then {true} else {isNull VLS})
yeah i know. i just didnt see that its a positive eval and it will exit on the first true condition.
i was stuck on the usual, negative eval where it will check each condition connected with ||
I tested this...but is not working..no action of any kind at all...even with the correction Leopard20 suggested..
//Info: this code only works in singleplayer as it uses local variables as "player".
playSound3D ["A3\dubbing_f\modules\supports\artillery_request.ogg", player];
sleep 5;
//Detecting if player has laser
_laser = laserTarget vehicle player;
If (isNull _laser) exitWith {systemChat "use laser designator"};
playSound3D ["A3\dubbing_f\modules\supports\artillery_acknowledged.ogg", player];
sleep 5;
playSound3D ["A3\dubbing_f\modules\supports\artillery_accomplished.ogg", player];
systemChat "CRUISE MISSILE INBOUND...KEEP LASER ON TARGET!!!";
west reportRemoteTarget [_laser, 3600];
_laser confirmSensorTarget [west, true];
if (isNil "VLS" || {isNull VLS}) exitWith {systemChat "no vertical launch system found."};
0 = VLS fireAtTarget [_laser, "weapon_vls_01"]; ```
you mean the code doesn't run at all?
yap
previous code was "working" ..in the sense that it fires the VLS, but only if player lase on foot...
playSound3D ["A3\dubbing_f\modules\supports\artillery_request.ogg", player];
sleep 5;
//Detecting if player has laser
_laser = laserTarget vehicle player;
If (isNull laserTarget vehicle player) exitWith {hint "use laser designator"};
playSound3D ["A3\dubbing_f\modules\supports\artillery_acknowledged.ogg", player];
sleep 5;
playSound3D ["A3\dubbing_f\modules\supports\artillery_accomplished.ogg", player];
hint "CRUISE MISSILE INBOUND...KEEP LASER ON TARGET!!!";
_laser = laserTarget vehicle player;
west reportRemoteTarget [laserTarget vehicle player, 3600];
laserTarget vehicle player confirmSensorTarget [west, true];
0 = VLS fireAtTarget [laserTarget vehicle player, "weapon_vls_01"];```
you say it's not running,
so not even the playSound3D plays
nope
well then it's not executing
in other words, whatever that executes this code is broken
let me test it from the console..
plus the change you just made is incorrect
use the _laser variable again
you're using sleep, so laser target can change
it must be constant
Hey, I would like to know how I could count players in a area (using triggers or whatever), and then be able to put it in to the gui. https://gyazo.com/5575265ad5f01b643cb5c4b7e899c425
you mean the sleep 5; in line 6? the one between the soundPlay?
yes, your code is scheduled, so the laser target can change. use the old code. it was correct
if that's all of your code, it has no problem at all
also, no need for 0 = ...
never
@carmine tartan count (allPlayers inAreaArray _trigger) https://community.bistudio.com/wiki/inAreaArray
It's all ther..and is not running at all..not even with the debug console...
how do you execute it?
How do I then put it into a gui?
console>localexec
check your rpt file then
you cant
your code is scheduled
it doesn't run in debug console
true, also its got comments
make a text control or something like that, and set it. https://community.bistudio.com/wiki/ctrlSetText https://community.bistudio.com/wiki/ctrlSetStructuredText https://community.bistudio.com/wiki/DialogControls-Text
even with the radiotrigger doesn't run..
you have to spawn the code
[] spawn {
//Info: this code only works in singleplayer as it uses local variables as "player".
playSound3D ["A3\dubbing_f\modules\supports\artillery_request.ogg", player];
sleep 5;
//Detecting if player has laser
_laser = laserTarget vehicle player;
If (isNull _laser) exitWith {systemChat "use laser designator"};
playSound3D ["A3\dubbing_f\modules\supports\artillery_acknowledged.ogg", player];
sleep 5;
playSound3D ["A3\dubbing_f\modules\supports\artillery_accomplished.ogg", player];
systemChat "CRUISE MISSILE INBOUND...KEEP LASER ON TARGET!!!";
west reportRemoteTarget [_laser, 3600];
_laser confirmSensorTarget [west, true];
if (isNil "VLS" || {isNull VLS}) exitWith {systemChat "no vertical launch system found."};
VLS fireAtTarget [_laser, "weapon_vls_01"];
}
try this in the debug console
poop i was to slow
nope..sorry..dead..no vital signs
even when I test it I get results
restart your mission
you're probably killing the scheduler
are you using a while without sleep?!
ok restarting the mission..hold on
or its in MP and hes executing on another client π
he said local exec
yeah i know, just a fun thought
killing some rando on a public server with artielly sounds
we have a troll on this server...
No man..ok..after restarting the mission now it fire
I suggest you check your mission
it means you were killing the scheduler
as I mentioned
"your spamming your machine with code"
yeah that
still no joy from the vehicle tho..it say "use laser designator"
do you lase it from a drone?
absolutely right..lol
yes from a drone
well then that's obvious it won't work
why?
you have the get the laser target from the drone
not the player
maybe try cameraOn
I'm not sure if the game has a native command for UAVs
hold on..isn't lasertarget vehicle player supposed to take care of that?
the player commadns the drone?
yes
no
player is not in the drone
hm the thing is, drones are commanded by invisible AI which the player takes control offf iirc
It's a drone (unmanned)
I was talking to zagor
I know it has AI
I mean the player is not in it
so vehicle player is not drone
no wonder is not working then
To conclude:
The player only "remote controls" the drone, he is not in it. Therefore its not his vehicle, so lasertarget verhicle player doesnt work
Just to be clear..I want the player to be free to call it while on foot or in a vehicle.Is possible?
Yeah but a bit more difficult
gotcha! finally I can see a bit of light...
Maybe
'''
If (isNull(laserTarget vehicle player)) then {
//use lasertarget of drone
}
use cameraOn instead of player
Good idea
Is there a way to get default dynamic loadout of vehicle from its config?
@serene quiver
//Info: this code only works in singleplayer as it uses local variables as "player".
playSound3D ["A3\dubbing_f\modules\supports\artillery_request.ogg", cameraOn];
sleep 5;
//Detecting if player has laser
_laser = laserTarget vehicle cameraOn;
If (isNull _laser) exitWith {systemChat "use laser designator"};
playSound3D ["A3\dubbing_f\modules\supports\artillery_acknowledged.ogg", cameraOn];
sleep 5;
playSound3D ["A3\dubbing_f\modules\supports\artillery_accomplished.ogg", cameraOn];
systemChat "CRUISE MISSILE INBOUND...KEEP LASER ON TARGET!!!";
west reportRemoteTarget [_laser, 3600];
_laser confirmSensorTarget [west, true];
if (isNil "VLS" || {isNull VLS}) exitWith {systemChat "no vertical launch system found."};
VLS fireAtTarget [_laser, "weapon_vls_01"];
default probably, but dynamic?
if its a dynamic loadout, its probably modified by a mod-owned script like british armed forces
@little raptor I swear man, I'm not trolling at all..I'm just so shitty on this scripting thing that my brain melts..
its fine, i didnt know about cameraOn as well
I know
we were talking about something else!
or its in MP and hes executing on another client π
I'm trying to get the loadout which vehicle has like by default when placed in the editor
ah pretty sure thats in the config. try finding the vehicle in the config viewer
In config it only has those weapons which cannot be changed
I already checked it in config viewer
I think you mean the components
the pylons info are there afaik
Yep
configFile >> "CfgVehicles" >> typeOf _veh >> "Components" >> "TransportPylonsComponent"
But how do i find default loadout?
dunno
@little raptor and @spark turret ..... THERE WE GO!!!!π₯³ π₯³ π₯³ Thank a lot guys...work like a charm..
who's iron?!
LOL
I wouldnt know
he was pinging "iron" in case you missed that!
lol..who's the troller now?..hahahaha..again...thank you.
Might just steal the code. Never fiddled with uavs and cruisemissiles but would like to
cruise missiles are hilariously OP
@little raptor it's related to make "r" lock work on players in the same side and allowing then to enter in the same vehicle.
If anyone needs: Loop each x seconds (default 1, _cycle = 1) with error correction!```sqf
_cycle = 1;
_init = time-_cycle;
_tError = 0;
waitUntil {
_t = time;
_delta = _t-_init;
if (_delta >= _cycle-_tError) then {
_init = _t;
_tError = _tError+(_delta-_cycle);
//YOUR CODE HERE
};
false
};
that's a horrible loop
if you need delay, just use sleep
waitUntil is scheduled, so you're not doing anything except wasting performance by doing that
thats the most complicated module loop ive seen so far lol
private _i = 0;
while {true} do {
sleep 1;
_i = _i + 1;
if (_i mod 10 == 0) then {
//every ten seconds do:
}
}
not sure if thats what you want as i dont quite understand whats going on
wait is that just a super complicated sleep?
I do a error correction because sleep x will take more than x time to complete
again not doing anything helpful. but this is even faster:
private _i = time + 10;
while {true} do {
sleep 1;
if (_i > time) then {
_i = time + 10;
//every ten seconds do:
}
}
anyway, all of these are horrible ideas. just use plain sleep
yes, because it's scheduled. and the second factor is delay due to framerate.
and if you make it happen faster, you're not doing it "every N seconds" anymore. plus there's no guarantee that it will happen when you want it to
that selfcorrecting sleep looks like it will clog up your scheduler
maybe not if used once, but if you have a couple scripts running with that, it will
it does. it runs in every scheduler cycle (if it can)
i was thinking in a loop in a server running with low fps, where there is a need of a loop but the error in time could be big.
when the FPS is low, the error can be both positive (running late) or negative (running early, because of your self correction). So you're not really helping the situation. When the server FPS is low, all scripts run slower. And you're making it worse by running that in the scheduler in every cycle.
and like I said, it's scheduled, so it also depends on the number of scripts that are currently running (and how long they have before they can finish).
@little raptor @spark turret here it is in action...with a little twist I added for immersion...hehehehe...again..thank you, guys.
https://youtu.be/KGSg3QcO7qI
if i want to just change the radius of add action how do i do that
can i just do radius=5
could be "_target distance player < 3" ???
it already comes with a radius parameter
this sample should help you figure it out
object addAction [
"title", // title
{
params ["_target", "_caller", "_actionId", "_arguments"]; // script
},
nil, // arguments
1.5, // priority
true, // showWindow
true, // hideOnUse
"", // shortcut
"true", // condition
50, // radius
false, // unconscious
"", // selection
"" // memoryPoint
];
yeah but for example
if i just put 10 after the scripot
script*
how will it know.. that i want that to be the radius
ok let me just
boy addAction ["Rescue undercover agent", {[boy] joinSilent group player, boy setUnitPos "AUTO", boy sideChat "We have to get out of here before they blow this whole place up!"}];
so if i do
You have to place all the parameters up to radius
if you want to avoid timeoffset cumulating there surely is a better way. like use sleep 1, and every 60 seconds you check for time offset and correct
@ember path
also, what I showed you already uses the defaults
also uiSleep shouldnt have time offset through low FPS i think
so do i just copy paste that then... ig
yes
oh and how do you prevent from the action staying on the screen
then replace the parts you need
i see
what do you mean?
when you scroll wheel, the action is still there after you use it once
ig remove all actions?
do you want to hide it or delete it?
i want it to not be there, like a one time thing
like you rescue the agent and thats it
delete it is then
params ["_target", "", "_actionId"]; // script
_target removeAction _actionId;
put it in the action script
player i assume, ok
whoever you added the action to
ok
read the wiki if you want to know about the parameters
scripting this in editor is a mess
Don't write scripts in editor.
yeah im starting to realize that xd
i thought if they were a couple of lines it would be fine
either use Notepad++ with SQF syntax highlighting or VSCode with SQF plugin
Notepad++ is more beginner friendly
im somewhat familiar with visual studio code, i use community usually for unity
but that doesnt have sqf stuff
download the sqf plugins
I don't recall their names, but a quick search will give you some results
sqfLint
sqf_VM Language Server
sqf_VM
SQF wiki
theres a forked version of lint by a chap called senfo
thats the one to get
i got all of those, theyre great
π
but i was like.. i dont need to do this in vs code
cuz at this point i have so many scripts
huh?
senfo is the later version, iirc
yeah but it doesn't have much rating so it looks "suspicious"
im using it without known issues, a coupe of other guys too
that's only 3 people! π
(not tagging them ) 7erra and Haz and ezzcoo
you can check his repo if you want
i havent tbh
I am rn
other than the pr0n pop ups and huge debits from Mrs Tanks credit card and the emails about bitcoins, I've noticed nothing unusual
also the scripts thing i mentioned: if i turned things i use rn into scripts, id have a script for the ai to hide, a script for when they get rescued, a script for interacting with a radio box etc etc
idk how many scripts is too many scripts
lol
the bad thing about VSCode plugins is that they're from like centuries ago
my mission folder is 17 MB, the majority is scripts
so...i shouldnt feel bad for making scripts xd
no
nope, all the advanced stuff is done in script
just checked... ive got 568KB of images in my mission folder, probably some of them are deprecated, the sqm is 48 KB, the rest is scripts
if i could be bothered to maintain a stringtable, it'd be even bigger
rn im having an issue where im shooting at other units, but then my hide script doesnt execute cuz that one unit isnt in combat mode red
even tho they are hiding
Warning Message: '/' is not a value
16:32:24 Warning Message: No entry 'bin\config.bin/CfgFactionClasses.'.
16:32:24 Warning Message: No entry '.displayName'.```
how do i find the line the error is on. this message is really not helpful
run performance branch, and start game with -debug
That might tell you the script, I hope it does.. dunno
thank you
how do i use the rtp visual studio extension
or whatever its called forgot xd, the debugy one
i think so yeah, the log one
in this example
_b = behaviour _soldier; //returns "CARELESS"
what is the _b
because im trying to write a trigger that triggers when theyre aware
and im getting
the behaviour command, in taht example, creates a variable called _b
error behaviour: type group, expected object
(behaviour boys == "AWARE")
like that looks right
as the error says, behaviour command expects a group, not a unit
but ig it isnt
it is a group
oh
i have to
switch them around
fuck
mh..no wait
where do i put the -debug into the start options in steam or is there a specific box in the launcher parameters?
ahhh crap sorry for the tag
Ctrl+Alt+R
thanks!
wheres the command line startup parameters gone from the launcher
oh is it now parameter file
I think you cannot enable it in Arma launcher yet
there is no field for custom parameters, and the -debug option is only added on dev branch
Just a quick question. Is there a built in function to get a basic strength of units or Vehicles (like solider = 1, APC = 5)? Or do I have to write it?
you could get the cost from config I suppose (if it is still a thing)
Hm, ok, thank you. I hoped more for something, that returns a combat strength. Probably seperatet against Infrantry and vehicles
there are functions that tell you if infantry or vehicle, also isMan config entry
but how else do you want the game to guess what you want?
I hoped, that there is a function, that get's a strength of any unit based on there equipment.
yeah but "what is strength" Β―_(γ)_/Β―
cost is indeed the closest the game has
FYI cost is not "money cost" or "Zeus cost", it is indeed "weight" the AI gives to the target
oh, ok, that's nice, I thought that is Zeus cost. Thank you
The "curatorUnitAssigned" EH, from https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/ScriptedEventHandlers, I assume I'll replace _curator with the variable name of the module I want to attach it to, correct?
{[_x, "curatorUnitAssigned", {
params ["_curator", "_player"];
//code goes here
}] call BIS_fnc_addScriptedEventHandler;} forEach allCurators;
``` so this *should* be enough to attach it to all the modules in my mission file
no
your "module" is already being passed to the code
learn what params is:
https://community.bistudio.com/wiki/params
I'm referring to _curator as in
[_curator, "curatorUnitAssigned", { //< This line
params ["_curator", "_player"];
//code goes here
}] call BIS_fnc_addScriptedEventHandler;
```, which is how wiki says to call it.
and this is what I meant
So, calling it like this would be enough to add the EH to all curator modules?
yes
@wild prairie and I'm referring to: #arma3_scripting message
unless you have defined _curator
but again this will only add the EH to that curator module
Kay, you just confused me even more. I want to add the EH to all curator modules in my mission. Do I use option 1 or 2?
1
how would i set off a trigger after the action has been removed
(in my case i have an add action script, that lets me hack the terminal, and then plays the terminals animation, afterwards i want a helicopter to land, i assume the best way to do this is to have a hold waypoint and then activate the trigger, i just dont know how)
i tried settings the triggers condition with like script done
but that doesnt work, cuz the add action script gets executed as soon as the player gets near the terminal
i need something that checks when remove action script happened
I think i might be doing this in a very silly way..
what do you think a trigger is?
you don't need a trigger
yeah i gave up from using a trigger
helo now lands at the spot, now to just figure out how to make it take off once everyone is in
something I wrote a while back for someone else:
_landPad = createVehicle ["Land_HelipadEmpty_F", ASLtoAGL getPosASL task4d];
MY_HELI land "GET OUT";
waitUntil {
sleep 1;
units group player findIf {alive _x && !(_x in MY_HELI )} == -1
};
deleteVehicle _landPad;
MY_HELI land "NONE"; //take off
_WP = (group MY_HELI) addWaypoint [getPosASL helperObject1, -1];
It makes a helicopter land, wait for everyone from the player's group to get it, then move to a new waypoint
their case needed some objs, but you probably don't
i butchered together a thing out of some scripts i found online
this trys to mimic the escape extract, where you get extracted once you hack the terminal
(by the way how do you format the code so it looks pretty like that with colors in dsicord)
see the pinned messages
i see
_target = radio;
_actionId = 2;
_extractpos = [extract1];
radio addAction
[
"Hack", // title
{
params ["_target", "_caller", "_actionId", "_arguments"]; // script
[radio, 3] call BIS_fnc_DataTerminalAnimate;
_target removeAction _actionId;
helo move (getMarkerPos "extract1");
sleep 3;
while { ( (alive helo) && !(unitReady helo) ) } do
{
sleep 1;
};
if (alive helo) then
{
helo land "LAND";
};
waitUntil {sleep 1; allPlayers findIf {alive _x && !(_x in helo)} == -1};
helo move (getMarkerPos "extractfinal");
},
nil, // arguments
1.5, // priority
true, // showWindow
true, // hideOnUse
"", // shortcut
"true", // condition
10, // radius
false, // unconscious
"", // selection
"" // memoryPoint
];
its messy af but it works xd
ill add stuff like them telling theyre coming for extract and that they landed, but i just wanted to push through and get the ending to work
now all its left to do is the start, briefing stuff, and some polish/balancing
arma2OA, is it possible to initialize an empty array with n length, to avoid it needing to expand later?
Actually, can I make custom structures with named variables?
you can't "freeze" an array size though - if you add, it will expand
Thanks. What bout the custom data structures?
not sure what you mean
I'm using arrays, but it would be ideal to have named variables
like, i could create an instance of my custom structure, and refer to its variables like new_thingamajig.some_variable_name = some_value
no
you cannot create custom objects no
we don't have structs in sqf
but you can use setVariable on an object
there is one thing you can do
I'm using #define to name array indexes
yeah that's one way
but the problem with define is Very long names
since they have to be unique for all "structures"
the problem is your OOP approach of SQF π
anyway, I'm not sure what you want to do, but another awkward way is:
_names = ["var1", "var2"];
_values = [1,2];
_array = [_names, _values];
_values select (_names find "var2");
it's terrible. but I can't think of anything else besides these two
eh, that looks like it would have a pretty big impact on performance
having to look up the name of each variable every time it is accessed
make one script that runs the info with all its inner variables, and send an array that will be the DTO (Data Transfer Object)
How would I go about preventing the ai from firing a weapon unless prone in a relatively performant manner? This would be for a light mortar launcher
take their guns away! \o/
for return values from scripts, do I have to do something like this:
array = [a,b]
array;
or
can i do something like this
[a,b]
last two are ok
[1,2,3] // will return [1,2,3]
// or
_myArray // will return _myArray's content
semicolons presence doesn't matter, maybe in Arma 1 and I am not even sure of that
(it was thought that having a ; would make the script return nil, which is (f)actually false)
Yeah. As long as your command/expression returns something, and you don't store it, it returns a value
k thanks
I mean this doesn't
_a = 1;
But these do
_a
_a;
1
Nil
etc
WRONG
etc returns unknown variable!
and for waituntil, is it similarly, that the last returned value or expression is the condition?
Yeah
Okay, one more question. can you use exitwith in conjuction with other commands? example:
if(condition) then { do_thing; exitWith{} };
Not like that.
Either use it as intended:
if (condition) exitWith {
//Do the stuff here
};
```Or, if for some reason you don't want that, you could do it like your example shows (but using correct syntax!):
```sqf
if (condition) then {
//Do the stuff here
if (true) exitWith {};
};
```But I don't see any reason to use option two. It's bad code and it does the same as option one.
ah... I misunderstood it's purpose. Thanks for clearing that up.
Actually option two only exits the if-scope it's in, so it doesn't do the same as option one after all.
In fact it does nothing. Definitely don't use that.
k
Hey guys
Is there a way to disable the chat channels for everyone except specific user ids?
I.e. 0 enablechannel false
@idle jungle If that's the one thing you want to do, and you know the user ids in advance, you could make Switch cases
https://community.bistudio.com/wiki/enableChannel is local, and can override settings in description.ext or server.cfg (sounds like a security issue)
Oh okay
Q: How do you make dead (ahem) bodies in missions in a performance friendly way? Is there another way besides setDamage 1; and having the characters ragdoll for several seconds?
What if you hide model for couple of seconds and then show model
2bh don't listen to me haha
@idle jungle Don't give me IRL ideas π€
I guess you could kill some dudes at start and disable their simulation after they come to a halt?
Yeah, but my guess is that the CPU expensive part is at the start (and also the greatest moment of lag in my mission). Any way of skipping/shortening the ragdolling?
Guess I could execVM a script on each character setting simulation to false after 1 second. Will try that.
if i have an array, a. And I do b=a. Is there a way I can replace a with a new array through b?
private _arrayA = [1,2,3];
private _arrayB = +_arrayA; // copy, not ref
(see https://community.bistudio.com/wiki/+#Alternative_Syntax_4 @drifting sky)
I don't believe that answers the question. Maybe I should elaborate.
B is a reference to A
But, I want to replace A with a new array through B
a new array through B
I don't get that part
no can do
but you can update that reference
_arrayB resize 0;
{ _arrayB pushBack _x } forEach _arrayX;
this way, both A and B keep reference to the same array, its content being changed
thanks for the suggestion
somehow it is not what you are after⦠but you unfortunately cannot do what you meant above
private _arrayA = [[1, 2, 3]];
private _arrayB = _arrayA;
_arrayB set [0, [4, 5, 6]]; // _arrayA = [[4, 5, 6]]
i guess that's the closest you can get, but it's useless
you have to select everytime then...
Anyone had luck setting up original respawn module to work with playable slot controlled by AI? In my case if I play for the playable slot I can select respawn place as intended. But when playable is controlled by AI, it keeps respawning at the initial mission position.
there's no pushBack in A2
B = A + [];
if you want deep copy (if your array contains nested arrays):
B = +A;
that way both arrays are independent
further reading:
https://community.bistudio.com/wiki/%2B
Set the same value to a variable twice, or even many times, can cause any harm related to this var storage in memory? I mean, this can increase memory fragmentation, or anything else? I know it's a strange question, sorry for any inconvenience.
there are death animations in the game
_unit switchMove "DeadState"
I don't recall its name, but I think it was that
You can find it in anim viewer
also, if you create very simple soldiers (those without any loadout), you can save some performance
Thanks.
I thought most of the CPU was spent on the AI and calculating the ragdoll physics of the dead unit. But loadout also plays a role, you have a point.
So, in order to save server CPU, I could disable AI on the character, then use switchMove on the character, for example?
CPU was spent on the AI
A unit that is just created doesn't have AI yet
it's the looking up the model and initialization parts that take time
you'd be wasting more performance by doing that (disableAI)
the best thing you can do is create the soldiers as vehicles (use createVehicle(local), not createUnit)
then switchMove and kill
then disable simulation
Oh, you can spawn Men with createVehicle?
What's the functional difference? No FSM?
no AI
units have no physx sim
well not PhysX but they obviously have some sort of collisions and physics. Didn't mean to mix up
yeah they do
OK cool. Will look up the other commands you mentioned as well (eg Kill is also new to me). Thank you.
π΅
another important thing: no need for groups
True, since there's no AI.
Could one of you please take a look. I had a look at the remoteExec page and fiddled around with this line. It produces no syntax errors to my knowledge but does not execute the dialogue. ["Vladimir", "Dimitri answer the phone"] remoteExecCall ["spawn BIS_fnc_showSubtitle",[0, -2]select isDedicated];
"spawn BIS_fnc_showSubtitle" does not make sense π€
it's not a function/command, and it's already being called by remoteExecCall
it comes from this line ["Dimitri", "Hello?"] spawn BIS_fnc_showSubtitle;
It works
Look it up
π€¦ββοΈ
remoteExecCall only accepts a function/command name
try this
["Vladimir", "Dimitri answer the phone"] remoteExecCall ["BIS_fnc_showSubtitle", [0, -2] select isDedicated];
or probably better, since that will be scheduled (just like spawn):
["Vladimir", "Dimitri answer the phone"] remoteExec ["BIS_fnc_showSubtitle", [0, -2] select isDedicated];
im not seeing it in pinned, but is there a good guide or way to do tasks, and spawning ai when needed stuff like that. For example i dont need the helo that extracts people until the end of the mission, i looked up createUnit but that would mean id have to redo the whole unit, and i changed some of their loadouts
is there a way to spawn the group as is, as in, you make them in eden how you want them, define them, and then just like..make them spawn like that, not having to define evereything
you can use setUnitLoadout and a description.ext class
createVehicle + createVehicleCrew or BIS_fnc_spawnVehicle too
could i maybe even just keep them spawned but disable ai so they just hover, or another question: if they have dynamic simulation applied, and a script asks them to move or do something but theyre out of that range.. do they do it or
or use BIS_fnc_spawnGroup if you have defined the groups/units already
Just create them in Eden Editor, put them into their own layer and use https://community.bistudio.com/wiki/getMissionLayerEntities to enable the layer when you need them, no need for spawnGroup and such
never have I used them TBH, besides Eden organising π
this is gonna help me a lot i assume, cuz i was planning on writing another script for dynamic patrols or what not, that search for players, but i assume i could just put them in another layer with waypoints, and activate the layer when needed
i still love that windowed arma for some reason uses the win7 border
Anyone knows, if arma has somewhere cartridge models for large rounds such as 30mm, 40mm etc?
I mean the model type, that can be found e.g. here
configfile >> "CfgAmmo" >> "ACE_556x45_Ball_Mk262" >> "cartridge"
For configfile >> "CfgAmmo" >> "B_30mm_AP_Tracer_Green" >> "cartridge" the entry is
cartridge = "FxCartridge_556";
Leading to a tiny .556 cartridge, in comparison to the real world 30 mm cartridge.
Or can the model be somehow scaled in the game?
Advice me plz, if I should ask in another forum
try checking the grenade launcher ammo? e.g on hunters or ifrits
ok.. dummy question but i saw a script that goes:
{
_x enableSimulation true;
_x hideObject false;
} forEach (getMissionLayerEntities "MyCustomLayer" select 0);
does that mean that the object is still like... active.. being simulated even if the layer is hidden?
this ^ code enables the vehicle, not disables it
1/ use enableSimulationGlobal/hideObjectGlobal, server-side
2/ use false/true to disable the layer, true/false to enable it
hiding the layer in Eden is not doing anything in-mission, it is in-editor only
ohhhhhhh
oh this works great, im using that script in objects init field to disable it on mission start, and then enable it when i need to
why nottt
because init fields are ebol
ebol??
snake voice hrng.. ebol
poopy
okay...okay
exactly π
code in init fields is run client-side on every clients connection as well
so even if *Global commands only work server-side, it's still a good thing to steer away from these forsaken fields
oh so there could be a bad: where like the init gets executed for every player
that's a good (?!)
oh but could you also use it for good things, for example, in init lets say you spawn another guy next to the first guy, so for each player the init field gets executed and changes the difficulty of the mission
yes
my favourite example, if you want to start injured:
this setDamage 0.5;
```then you play, and heal yourself, cool. then another player connects: boom! you're injured again
xd
its fine, in lore you got a flashback where your friend got hurt and now youre hurt again
in some cases, an init field is OK (e.g local commands)
most of the time though, it's bad
I've personally never used the init fields in my entire Arma scripting experience. They should be removed!
yeah fair enough
let's not forget that this 20yo engine was not meant for multiplayer, and that it was added at a late development stage!
Yeah, dedmen pls fix :D
Tbh armas engine is the best 20-yo one i know about. It does its job, its moddable and its not even bad at its job
I mod a 10-yo game one-man-passion-creation from time to time and its far far far worse than arma
on the other hand: i dont have access to armas source code so idk how much spaghetti it is π
I believe they hid things well π tbh, it might be a mess in some areas, but it's still somewhat solid on the "front" side. the lack of resource usage is something showing, of course, but take an Apex screenshot and say "it's a 20yo engine running @ 60FPS" (in single player ^^), it's still something
yeah very true.
theres a discussion going on in my clan about grass. players see it, AI dont. can someone confirm that AI completly ignores grass?
i tested myself for foliage and they didnt ignore it. they were just very good at guessing where you are behind it
I think Greenforst did some tests on that
already debunked in an AI forum thread I believe?
ah yes thats what google gave me. ill look into it very thanks much help
LOL didnt know that
Note: AI can only see your "central nervous system" so to speak. They can't spot your limbs or sides of torso, only the head and spine. This is why you can hide behind traffic sign posts for example.
not true
they can see your eyePos too
up to ~200m
well eyes are part of he CNS
oh right it mentions that:
only the head and spine
has anyone noticed any issues with using createVehicleCrew? I've been having a lot of issues with the crew that gets created getting out of the vehicle, running around in a circle before getting back in once they are created
I'm not sure if it's an issue with the command or something on my end
but still, it wasn't accurate.
head is only up to 200 m
see the wiki page π
beyond that it's only aimPos
there's nothing on the wiki about that
This command does not addVehicle to the created crew in the same way this normally happens when crewed vehicle created in the editor. See BIS_fnc_spawnVehicle for a full vehicle and crew creation and group addition.
really?
I don't think it's that, I've tried manually doing addVehicle
A general question regarding performance:
I have been building an ambient battle script that creates local soundsources for each player and plays shot sounds. the soundsources all point in the direction of a "center master" object so it always seems that the sound is coming from there. reason is to have the battle be hearable from kilometers away.
now the problem is, it works fine in my local MP with 2 clients from same machine, and obliterated the mission it was intended for on the dedicated server :D
i suspect the reason is that i spawn a TON of coroutines. every shot has a spawn {sleep _delay; remoteExec playSound} foreach sound and foreach player.
other than that theres only one main loop which is ~2 seconds timeout.
Any other ideas what might clog up the scheduler?
@sage dawn
make sure your interpolateTo and connectTo for the anims are empty. the animation must not connect to anything elese
or any input is welcome
what? animation?
the unit animations when they're seated
I'm not doing anything with animations, createVehicleCrew has nothing to do with animation
did you create that vehicle yourself?
no
I mean in object builder
it happens on pretty much every vehicle I've used it on
at least from what I've seen
not all the time but often
your problem is that ai leaves the car and runs around?
yeah they get out, run around a bit and then get back in
it's most annoying when it's a static weapon on a roof or something
i have had a kinda similar issues with helicopters. i noticed that i have to leave 2 passengers seats free, otherwise they will try to escape
so it i only fill in 8/10 passengers, they dont leave
they spawn in the static weapon, get out, fall of the roof and get injured
you can disable their ability to leave the weapon iirc
though the moving back in almost seems to happen automatically
like they get put back in almost like using a moveIn command
though I dunno, it might be some mod issue
how do you do this whole process?
I just createVehicleCrew and then addVehicle ```sqf
_crew = createVehicleCrew _x;
uisleep 0.01;
_crew addVehicle _x;
don't add sleep
I think I've tried it without a sleep
_crew = createVehicleCrew _x;
_crew addVehicle _x;
units _crew orderGetIn true;
maybe that?
Can you set the rotation of a object you attachTo'ed ?
yes
how? i tried setVectorDir on the object that i attached, but it resets
