#arma3_scripting
1 messages ยท Page 629 of 1
so if a marker is not in a vehicle it gets deleted? ๐
yes! ๐
if you pass a group, it deletes the units then the group, and it works with arrays of elements too
[units player] call LM_fnc_delete
```poof, no more sidekicks
_myWaypoint call LM_fnc_delete too
โฆwhat am I doing with my life
๐
โฆwhat am I doing with my life
@winter rose Yeah, today I told myself I am just going to fix that one thing, then discovered that I could do something entirely new with addonFiles
Now I am sitting here 4 hours later
masโฆ debugging
https://community.bistudio.com/wiki/Category:Example_Code <-------
unsure if it is pertinent to have @cosmic lichen
You are saying you wrote an efficient function which can just delete anything? Maybe even my mother in law? Yes it's pertinent
well it's just a "clean way of doing", so you don't bother finding and checking deleteVehicle/crew/deleteLocation stuff
well, I'll post it and you tell me
Hello. It's me again! Yet again another issue
I'm using the "Create Diary Record"-modules linked to a trigger that activates when we complete an action on an object. The trigger activates since we get the "log downloaded"-message that I put in there. But the diary entry does not show up for any of us. I'm guessing the module doesn't work on dedicated servers? if so, is there any other way that works on dedicated?
@delicate lagoon It probably has local effect, at least the command variant does:
https://community.bistudio.com/wiki/createDiaryRecord
BTW, are you sure what you want is not "Tasks"?
ok
it's weird tbf
I recommend that you add the diary by remoteExecing that command in the trigger activation code.
I think the trigger code might execute for all of you, so you should make sure it only runs on one machine (preferably the server)
module's function is indeed using the command only (local effect)
so uh
anyone know if there is a good command for pulling the default inventory of a crate from it's config?
assuming the config has the items in the Transport(Type) defined in the format:
class #ITEM{
name = #ITEM;
count = COUNT;
}
Am trying to convert the full list across all types into one usable 2D array with classname and quantity. Not sure if there is a nice way of doing it.
https://community.bistudio.com/wiki/Example_Code:_General_Deletion
the function is currently buggy (fixing), but do you confirm it is wiki-worthy? @cosmic lichen
Is there a way to check if a file exists before using loadFile or preprocessFileXXX?
Arma2OA: I cannot find the information I need to successfully add a new fire mode (for use by the ai) to an existing weapon.
that is something in the configs: https://community.bistudio.com/wiki/CfgWeapons_Config_Reference#modes.5B.5D.3D_.7B.22this.22.7D
PS. could be slightly different in A2OA (eg. be in magazine config or something)
Can you make a new fire mode inherit from a another fire mode in the same weapon class? Or does it always inherit from the class that the weapon inherits from?
afaik are all weapons based on the same core class which have the different modes defined. Or it's even separated completely... no idea, never worked with weapon configs...
PS. this is more a #arma3_config question, since there's nothing you can do with scripts
For the Chemical Detector MFD animations
"YourLayerName" cutRsc ["RscWeaponChemicalDetector", "PLAIN", 1, false]; //IGUI display on``` What exactly is "YourLayerName" for? Like Is that to sort out multiple variants if I was to change different detectors or?
it's the name of your layer, which you'll need for other commands later on (like removing the layer, or adding a fadeIn/Out
alternatively you can use the layer number (since Arma 3 v1.57)
Does removeAction completely remove an action, or just hide it? I'm currently looking for a way to temporarily disable an action when it is activated, but the game does not like me trying to use addAction to bring back the action which I had added at the start of the sqf file.
completely removes it
Currently it would appear that I have to create the same action from scratch within the same loop, which I'd prefer avoiding
you can use a variable in the condition field and set it true/false when you want to show/hide the action
I got it to work in a way that it does the script I put into the variable embedded within the action, and it succesfully hides the action after using it, so that is at least working.
Oh well, I'm guessing I'll just have to do a new action at the end of the If-statement
Alright, it's working now.
Also, how do I go about making a hint that is only shown for the person that uses this addAction? Like this way: _thisPlayer hint "You used the action"
I know it doesn't work that way, or so I believe, but you get the point.
hint "You used the action"
hint is unary - only takes a right argument, and it has a local effect, meaning it only shows the hint on the player who executed it.
Oh, alright.
Hey folks, so I am a bit confused due to "onPlayerRespawn.sqf" not firing at mission start while I have respawnOnStart = 0; in the description.ext
does this only fire on multiplayer sessions or also on sessions executed from eden?
I might be working in another scenario, Im currently loading in so im not sure but it often is something as plain as that when I really cant figure it out
hehe yeah it was a different scenario
from https://community.bistudio.com/wiki/Description.ext#respawnOnStart:
0 - Dont respawn on start. Run respawn script on start.
so it won't fire the sqf, but it will start the template scripts
@sonic thicket โ
Noticed a small problem in my script, it would appear that everyone has the addAction available and they can activate the script for the ones that have it in their init as long as they're looking at them. I'd assume this is due to the lack of a condition.
What would be the simplest way to set the addAction condition to be just you.
if (local this) then { /* addaction */ } @hollow plaza ๐
I meant as in condition that is within the addAction itself, this is currently my script up to the condition.
_speedBoost_action = _runner addAction["Stim Boost", "boost_activated = true", "", 1.5, true, true, "", "CONDITION"];
where does the code execute?
because if you add the action to everyone but escape it with a condition, that's losing CPU for nothing
It is set within the init of certain units that are allowed to use the boost
use local around the addaction then, it's better
speedBoost = [this] execVM "speedBoost.sqf"; That is the init thingy
Ah alright, so I'll stick the whole script within if (local this)
By script I mean the forementioned sqf file
no, just the execVM thing
if (local this) then { [this] execVM "speedBoost.sqf" };```
Oh, right
I'll check it real quick
Still appears that I'm able to activate the script for others as well
The object to whom I give the action is _runner, which is _this select 0
Does that have anything to do with this problem?
Actually no, it shouldn't, considering that only gives the action to the people it is assigned for within their init.
Yeah, it's meant for MP. I'm guessing this is only because I'm doing it with AI on SP, so it should work perfectly fine with players in a way that they cannot activate it for each other?
Yep
player == would work both sp & mp
I guess I'll go with that, considering I can't test MP scripts by myself
Yep, it works now. @winter rose Thanks fella
Hi,
My goal is to end up with an array over the players current mag count:
["magType", amountOfMagazines]
Following:
_magArry = magazinesAmmo player;
_magArry = _magArry call BIS_fnc_consolidateArray;
Will create something like:
[["magType", magsize]amountOfMagazines]
Is there a better way to fetch the data? If not, could someone help me with the statment to transform the data? Iยดm not an expert on nested arrays ๐ฉ
what are you having issue with specifically?
@cedar sundial
also, do you care about ammo amount in each mag or just the overall count of each type?
I'm not able to achieve my goal. I have gotten so far that I have this nested array, but not able to transform it how according to my need. I do not care about size/counting rounds, just the amount of each type.
Storing that data in a way so it's easy to compare with an equal set of data, to spot the differences
then you may do better wiht this: https://community.bistudio.com/wiki/magazineCargo
then you can count for each type as you go through
Oh, that looks neat indeed. Not sure how I missed that one
nice little page for inventory commands: https://community.bistudio.com/wiki/Category:Command_Group:_Vehicle_Inventory
now working with a 2D array. You should be able to you two selects like so: array select 0 select 1 with the first select selecting the pair and the second selecting the value from that pair.
and appending you can append the entire pair [classname, count]
that said, if you are counting from that array format, you can do 2 parallel arrays for simplicity
Thanks Lou, sorry for the late reaction by the way ๐
Oh, thanks! I was trying to find that syntax. Tried array select (select 0 ) without success
Is there any way to prevent damage done by checking if there is damage done?
Reason why i am asking is because I am trying to work around a mod
You can prevent damage by event handler
_unit addEventHandler ["HandleDamage", {0}];
@sonic thicket what are the requirements for this check? In what cases? What mod?
Ravage zombies hits persons through cars and I want to stop this from happening as I've implemented my own system that first breaks all the windows and then starts hitting the players that are inside
Nice, HandleDamage ill look that up ๐
does setDamage even trigger the Eventhandler?
it should fire for HandleDamage
Oh heck well it works off the bat
so i guess it doesnt trigger setDamage
Thanks Knopen, that worked out perfectly ๐
Is there a way to check if a file exists before using
loadFileorpreprocessFileXXX?
@little raptor in script currently no. But I wanted to make one, I wonder where that went
hello guys, i was wondering if the napierian log was existing alongside the base 10 one ๐ค
thanks !
thanks
Hey folks, is there a reliable method to check, if unit is inside a building?
This is what I currently use, but it does not always work:
NIC_CheckInside = {
private _unit = _this select 0;
private _unitPos1 = getPosWorld _unit vectorAdd [0, 0, 1];
private _unitPos50 = getPosWorld _unit vectorAdd [0, 0, 50];
private _objectsUP = lineIntersectsObjs [_unitPos1, _unitPos50];
private _unitPosDown2 = _unitPos1 vectorAdd [0, 0, -2];
private _objectsDown = lineIntersectsObjs [_unitPos1, _unitPosDown2];
if (_objectsUP select 0 == _objectsDown select 0) exitWith {true};
false
};```
In certain buildings, e.g. the industry shed ("Land_i_Shed_Ind_F"), the roof windows will not collide with lineIntersect.
So, if a unit is inside that building, but under a roof window, it will return false, though the unit is inside.
A few other buildings have this problem as well. Any ideas?
@languid oyster The most reliable LineIntersectsXXX command is lineIntersectsSurfaces. Ditch the rest
But some buildings do not have proper LODs, so it may not work for some buildings anyway.
but under a roof window, it will return false
BecauselineIntersectsObjsuses the "VIEW" lod. You should use the "GEOM" (or "FIRE") and "VIEW" lods inlineIntersectsSurfaces`
Aha, many thanks for the answer. Will test, if I get anything more reliable.
@languid oyster, i have an existing function for checking
wait 1
while i dig it out
ok, so there's 2 ways to do this
lineintersects is one way
do you know which building you are checking for or is it any building?
It's better to check if the AGL height of the unit is positive first
Can save you some performance
Altho not true in some buildings
(e.g. sheds)
how do I post code here?
Ctrl+C, Ctrl+V ๐คฃ
sqfbin if it is big, ```sqf if not
you want me to copy it straight in?
(see pinned message)
k
is my rework of a kzk function
returns true if the supplied position is in any house (must be ASL)
does a reasonably good job of returning false with balconies that have an overhanging roof section too
and another function if you know the building you want to check..
this originally from pedeathtrian, modified by me
Hey sorry to bother but I'm having some issues with the sleep function. I'm trying to delay ordnance on an objective. It's triggered when opfor appear in a trigger space.
@half spear I think you're using sleep in unscheduled environment. You should spawn/execVM the code
if (isNil "_argument") exitWith { false };
if (
_argument in [objNull, grpNull, controlNull, displayNull, locationNull, scriptNull, taskNull] || {
private _typeName = typeName _argument;
[0, {}, configNull, missionNamespace] findIf { typeName _x == _typeName } != -1 ||
_argument isEqualTo teamMemberNull || // isNull exception
}
) exitWith { false };
```@little raptor
should do, I guess?
I think it's worse than the original now!
if (isNil "_argument" ||
{
_argument in [objNull, grpNull, controlNull, displayNull, locationNull, scriptNull, taskNull, teamMemberNull] ||
{
typeName _argument in ["SCALAR","CODE","CONFIG","NAMESPACE"] //alternative approach: _argument isEqualTypeAny [0, {}, configNull, missionNamespace]
}
}) exitWith { false };
now it's fast
https://community.bistudio.com/wiki/isEqualTypeAny maybe instead of the string stuff?
I didn't know that existed
But anyway, my way is a bit faster (unless you prefer a more "readable" approach)
Hello I have a problem, I will explain to you,
I would like to detect a player when he disconnects and be able to retrieve the player's values with GetVariable "****",
so I proceed the way with the ```sqf
addMissionEventHandler ["HandleDisconnect", function_blabla];
the function works, I manage to execute HandleDisconnect on the server side but when I want to retrieve the player's variables
_player = _this select 0;
_variable = _player getVariable "*****";
well the variable does not exist, and I assure you that the name of the variable is correct, so I would like to know how I can do this?
If the variable was local to that player's machine, I don't think you can retrieve it anymore (because that client is no longer connected to the server)
How can I do the trick to store a variable in a player and then be able to fetch it?
Not sure what u mean by use spawn/execVM. Iโm pre new to scripting with arma 3 missions
do you execute that in the trigger activation code?
whatever it was you wanted to do with sleep
you didn't even mention what you wanted to do, or what your script was
@modest vector look up https://community.bistudio.com/wiki/setVariable alt syntax
But don't use it if the variable update rate is too fast
otherwise you'll ruin the server performance
if (isNil "_argument" ||
{
_argument in [objNull, grpNull, controlNull, displayNull, locationNull, scriptNull, taskNull, teamMemberNull] ||
{ _argument isEqualTypeAny [0, {}, configNull, missionNamespace] }
}
) exitWith { false };```will do ๐
So questions on fsm files right , how (if possible) can one import the variable name of an object synced to say a module?
what does it have to do with fsm?
List of objects synced to some other object:
synchronizedObjects _object
you can use it inside fsms too (if that's what you meant)
yeah thanks , and this creates an array of objects or list? (kinda gonna try modify a preexisting module to get rid of hard coded variables)
an array
there's no such variable type as a "list". So if you see the term list, we typically mean arrays
fair enough , thanks alot ๐
modify a preexisting module to get rid of hard coded variables
Not quite sure what you want to get rid of, cuz modules need their "variables"
BIS_FD_Competitor , i want to change firing drill module to accept any competitor linked to it , not just the one person called BIS_FD_Competitor
firing drills work in MP , but only one player can be running the drill before you need to restart the mission to allow the next
To do that you have to modify the module function
jup , hence why I asked about fsm
diag_activeScripts ?
@finite sail Hey, your routine works quite nice. Thank you ๐
you're welcome, which one did you use?
@winter rose
isn't this even better?!
if (isNil "_argument" ||
{
_argument isEqualTypeAny [0, {}, configNull, missionNamespace] || {
!(_argument isEqualType "") && {isNull _argument}
}
}
) exitWith { false };
๐ฎ PERHAPS
well, unless I'm missing something (e.g invalid isNull), it is
can _argument be an array?
misses the teamMemberNull exception
and yes, _argument can be anything
totally forgot that one...again! ๐
Hi friends. Can I contact anyone here for help? I would like to make an arena style TDM map (think Quake or UT), but I don't have the mental horsepower for it. And looking for solutions on google don't help. Main problems are - 1) giving players default gear when they spawn and 2) dead bodies don't disappear, so their gear can still be taken. Here is a video of what I have done so far. Mainly weapon pickups that respawn, so that's interesting.
It seems like what you're asking is #creators_recruiting
tky_fnc_inHouse = {
private _unit = _this select 0;
diag_log formatText ["%1%2%3%4%5", time, "_unit: ", _unit];
private _unitPos = getPosWorld _unit;
lineIntersectsSurfaces [_unitPos, _unitPos vectorAdd [0, 0, 50], objNull, objNull, false, 1, "GEOM", "FIRE"] select 0 params ["","","","_house"];
if (!(isnil "_house") && _house isKindOf "House") exitWith {true};
private _wallScore = 0;
private _directionsToCheck = [[2,0,1],[0,2,1],[-2,0,1],[0,-2,1],[2,2,1],[-2,2,1],[-2,-2,1],[-2,2,1]];
{
lineIntersectsSurfaces [_unitPos, _unitPos vectorAdd _x, objNull, objNull, false, 1, "GEOM", "FIRE"] select 0 params ["","","","_house"];
if (!(isnil "_house") && _house isKindOf "House") then {
_wallScore = _wallScore + 1;
}
} foreach _directionsToCheck;
if (_wallScore > 7) exitWith {true}; // found at least 4 walls nearby
false
};```
@languid oyster , yeah, killzonekid did most of the heavy lifting on the script, I just fiddled with it a bit
it was Tankbuster's
๐
Anyone know if there is a scripting command that would list all controls of a display/dialog?
So, I'm fairly new to scripting, and I've had idea to make a thing when one ai is shot at another comes running to help in another direction. I thought using firedNear could be useful. If anyone could point me in a direction it would be good.
this way โ
joke aside, you could wait until behaviour of unitA is "danger", then tell unitB to move to unitA's position
I kind of wish there was an eventHandler that related to unit behaviour, would avoid adding a waitUntil as you propose
there will be an EH for suppression, but as of now we have nothing alike
the firedNear is only valid up to ~69m around the unit, and it could be about someone shooting at the clouds
Specifically Lou: distance: Number - Distance in meters between the unit and firer (max. distance ~69m) so it's not even about how close the projectile is to the unit, but how close the shooter is to the unit
yep (I somehow meant that, I swear!)
I can see that the programmer who implemented that command was a ... man of culture ๐คฃ
I'm trying and failing to think of a practical use case for that EH.
scaring birds :p
"hearing" shots?!
That was my first thought Leopard20, but then, you'd have to be truly deaf not to hear a shot at 70m
Birds included ๐
What about the AI?! Like reacting to a situation or something?
Something like a behaviourChanged event handler would be way more useful as it would already leverage the AI's ability to perceive / react to danger.
I could already see how it could be implemented:
params ["_unit", "_previousBehaviourState", "_currentBehaviourState", "_unitThatCausedChange"];
}];```
... I guess you could kind of get there with an `animChanged` event handler if you knew they would go into the weapons up animation on a behaviour change.
I tried using the spawn script with sleep to create the ai unit group but it ignores the sleep function and immediately spawns them
Nvm I found a fix
Hi guys. Is anyone super familiar with DAC. its acting funny and cant find a fix
something like a behaviourChanged EH would be a nice replacement for the danger fsm hooking
of course, you could make your own CBA eventhandler in a custom dangerFSM and handle it that way
Howdy lads, could someone help me with this script?
this addAction ["Collect Food", {food = food+1; deleteVehicle _this;}];
it's supposed to delete the object it's on when it finishes but i keep getting an error saying "_this is an undefined variable"
undefined variable doesnt sound like the right error ๐ค try deleteVehicle(_this#0)
target (_this select 0): Object - the object which the action is assigned to caller (_this select 1): Object - the unit that activated the action actionId (_this select 2): Number - activated action's ID (same as addAction's return value) arguments (_this select 3): Anything - arguments given to the script if you are using the extended syntax
thank you, that worked
as for firedNear - this EH is really handy for grenade detection and I think it was primary use of that EH in past
it is used also on Contact alien entity
as for dangerFSM - it would be super cool to be able to stack it or have it attached per vehicle, instead per AI. This way you could do special procedures for more sophisticated vehicles (i.e. shtora)
Hi there I'm trying to use an addAction to change a tasks state. I'm doing this by assigning each addAction a public variable with a number. Then in a trigger im trying to add them together and use an if statement to pass the task.
this addAction ["Pick up First Aid Kit", "PublicVariable2 = 1;"] This is what the indivudal addActions look like
if (PublicVariable + PublicVariable2 = 2) then [fak setTaskState "Succeeded"];
This is what the code looks like in the trigger to try and pass the task
var = something <- "var" will be defined
var == something <- "var" will be checked against "something"
You better read this:
https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
@topaz field
Is there any way to force an AI unit to a certain spot inside a building, which is NOT a predefined building position?
setPosXXX ๐คฃ
CBA has something called "Building position" or something. I've never used it, but you can take a look at it.
The reason the AI can't move freely inside a building is that the building path LODs is just a bunch of lines, not polygons
So their movement is always fixed along those paths
CBA's "Building position"
Doesn't give them a path. They still cannot move in the "immersive" way you want
Challange for the cracks: Make a mod, where AI naturally runs into building, gets on balcony, then climbs on roof ๐
That's what I'm working on rn
๐ฎ me too
I mean a full AI replacement mod, with significantly better path finding
oh, then not ๐ I'm happy if I manage to know, if an AI is inside a building or not ๐
Trying to do a mod for a medic, who is able to get to incapacitated players on rooftops
get to incapacitated players on rooftops
using ropes and ladders?!
Oh god, no. Wanted to use Enhanced Movement Rework routines for that. No salvation on skyscraper rooftops
Guess you know this already?
https://forums.bohemia.net/forums/topic/222844-jboy-ai-cqb-movement-scripts/
Somehow, he cheats the AI to move through buildings
Ai is tied to the building paths when moving on/inside objects. I highly doubt that it can be changed.
Ah his system uses forced animations to move. Which like he says can be unreliable.
@languid oyster
he cheats the AI to move
so do I. But it requires you to generate paths inside the building. If you want to go down that road, it is definitely possible. But could be difficult if you're not familiar with that stuff
@little raptor I AM not familiar with that stuff. As far as I understand, the things he does are scripted. Meaning they work for one building at a certain place. Where as I would like to have things dynamic. Will see, if I can do it or not.
I'm not talking about what JBOY does. In general, you'd have to generate a navigation mesh for the building and then generate a path using the nav mesh.
That's the "fastest" way you can generate a dynamic path for a building
is setTaskState Obsolete?
@little raptor so you are building a navmesh and new movement system to work with that?
@little raptor Building a nav mesh? Me? Guess I'll dump the idea.
will be fixed in the next patch, use remoteExec setObjectTexture for now
(or hideObjectGlobal)
maybe ยฏ_(ใ)_/ยฏ
hideObjectGlobal backpackContainer player
any error?
if it doesn't work, use this
[backpackContainer player, [0, ""]] remoteExec ["setObjectTexture", 0, true];
oh and indeed, hideObjectGlobal is server-side only.
[backpackContainer player, true] remoteExec ["hideObjectGlobal", 2];
``` may be better JIP-wise, but don't forget to unhide it if you apply another texture
w/p
Is it possible to define custom formations in Arma 3?
I would like a squad to have a unit close to another, while the rest of the squad is more spaced out
Or am I limited to only the vanilla formations?
configFile >> "cfgFormations"
Only through a mod though =/
And I dunno if custom formations work. I've yet to see a mod which uses custom ones.
I see, thanks for the help!
@young current yup: https://www.youtube.com/watch?v=bXmke6nnXDs
This video is from a year ago. Things look much better now! ๐
Quite cool. Will it work in MP too?
https://community.bistudio.com/wiki/BIS_fnc_cinemaBorder
I'm attempting to use this in scripting but I dont like the feature that disables player movement. Is there a way I can have the borders and still let players move?
Would adding this to the script solve the issue?
disableUserInput !userInputDisabled;
Nvm I found out that indeed nope that does not help xD
@young current
Yeah
It'd be pretty disappointing if there's no way to allow players to move when the borders appear, but c'est la vie
I was replying to HorribleGoat! :)
@worn vale If you want to use cinematic borders and have user input, you can use cutRsc
Can you give me an example of how to use it or a link? ๐ฎ
Ok. I'm not very experienced with scripting in Arma 3 but I do want to figure this out. I am trying to do this for a multiplayer mission, does that complicate things?
For what you want, something like this will do:
class RscText
{
access = 0;
type = 0;
idc = -1;
style = 0;
w = 0.1; h = 0.05;
//x and y are not part of a global class since each rsctext will be positioned 'somewhere'
font = "TahomaB";
sizeEx = 0.04;
colorBackground[] = {0,0,0,0};
colorText[] = {1,1,1,1};
text = "";
fixedWidth = 0;
shadow = 0;
};
class RscTitles
{
class MY_cinematicBorders
{
idd = -1;
duration = 1e6; //1e6 seconds
fadeIn = 1; //1 second to fade in
fadeOut = 1; //1 second to fade out
onLoad = "uiNamespace setVariable ['MY_cinematicBorders', _this select 0]";
onUnLoad = "";
class Controls
{
class Top: RscText
{
idc = 1200;
colorText[]={0,0,0,0};
text="";
colorBackground[]={0,0,0,1};
x = safezoneX;
y = safezoneY;
w = safezoneW;
h = 0.15*safezoneH;
};
class Bottom: Top
{
idc = 1201;
y = safezoneY+0.85*safezoneH;
};
};
};
};
I am trying to do this for a multiplayer mission, does that complicate things?
You'll have toremoteExecthat for every player in MP
oooo boy ok. And yeah that sounds like it should be no problem then to have it work in MP
Yeah, it will work fine in MP too
If you're planning to make a mission and not a mod, note that RscText (for the part: class RscText;) is not defined. You'll have to define it manually
I have some more information on what exactly I'm trying to do in #arma3_editor
But yes, just a one-off multiplayer mission for me and some friends
For fade in and fade out time, put them into the above config (in seconds). You can also adjust the duration (again, in seconds)
@worn vale updated the above config entry.
You'll have to put it in description.ext
To show the border:
"MY_cinematicBorders" cutRsc ["MY_cinematicBorders", "PLAIN"]
It needs to be remoteExeced in multiplayer
["MY_cinematicBorders", ["MY_cinematicBorders", "PLAIN", 1]] remoteExec ["cutRsc", 0]
something like that
Depends when he wants that to appear, if it's at mission start he can also use some init scripts.
Yup, that's even better!
Ok so, I've got the description.ext file in my mission's root folder with the config you posted above
What I'm aiming for is for the borders to appear on one trigger, and then fade out on another... or am I getting too complicated?
So I would place that into my trigger volume?
volume? You put it in the trigger activation/deactivation statements
More or less what I meant haha, lol
But okay cool. Sorry if I seem like a big confused noob. It's because I am
It's alright. Anyway, for MP, don't forget you'd need to remoteExec these cutRsc and cutFadeOut commands, because they have local effect
You need RE only if using server only trigger
otherwise you have local triggers on every machine.
Yeah, if you placed the trigger using Eden editor without checking "Server only", the trigger runs on each machine separately, so no need for remoteExec
OK so... ultimately if I'm using triggers and I have all that info in the config above in description.ext would it go like
trigger 1, borders fade in
"MY_cinematicBorders" cutRsc ["MY_cinematicBorders", "PLAIN"]
trigger 2, borders fade out
"MY_cinematicBorders" cutFadeOut 1;
am i getting this right or?
yes. You can also define the fade in time using:
"MY_cinematicBorders" cutRsc ["MY_cinematicBorders", "PLAIN", 1]
excellent, I'll give it a test!
Kind of a dumb dumb question, but how would I make an Ai friendly until attacked? Been bashing my head against it.
use setBehaviour "careless", and add a hit event handler mayhaps
You mean once attacked, it becomes enemy to you?
if so, just use a handleDamage event handler, once taken fire, create a new group on the enemy side and move the unit to the new group (although everyone will attack the poor AI!)
or maybe just use: _unit addRating -1e4
The borders didn't seem to come in when I tested the triggers
where did you put the codes? also are you testing in SP or MP?
Testing on MP
Are your triggers set to "server only"?
So I have this in description.ext
{
access = 0;
type = 0;
idc = -1;
style = 0;
w = 0.1; h = 0.05;
//x and y are not part of a global class since each rsctext will be positioned 'somewhere'
font = "TahomaB";
sizeEx = 0.04;
colorBackground[] = {0,0,0,0};
colorText[] = {1,1,1,1};
text = "";
fixedWidth = 0;
shadow = 0;
};
class RscTitles
{
class MY_cinematicBorders
{
idd = -1;
duration = 1e6; //1e6 seconds
fadeIn = 1; //1 second to fade in
fadeOut = 1; //1 second to fade out
onLoad = "uiNamespace setVariable ['MY_cinematicBorders', _this select 0]";
onUnLoad = "";
class Controls
{
class Top: RscText
{
idc = 1200;
colorText[]={0,0,0,0};
text="";
colorBackground[]={0,0,0,1};
x = safezoneW;
y = safezoneY;
w = safezoneW;
h = 0.15*safezoneH;
};
class Bottom: Top
{
idc = 1201;
y = safezoneY+0.85*safezoneH;
};
};
};
};```
This in the fade in trigger
```"MY_cinematicBorders" cutRsc ["MY_cinematicBorders", "PLAIN", 1];```
And this in the fade out trigger
```"MY_cinematicBorders" cutFadeOut 1;```
None of the triggers are set to server only.
Then try remote execing the command like I mentioned
OK
Like this?
remoteExec "MY_cinematicBorders" cutRsc ["MY_cinematicBorders", "PLAIN", 1];
remoteExec "MY_cinematicBorders" cutFadeOut 1;
Ok, apologies. I'm not sure where to put it
Left hand side are the arguments, right hand side the command and targets
["MY_cinematicBorders", 1] remoteExec ["cutFadeOut", 0];
The other one
Okay, thank you so much for your help btw. I don't normally do this kind of scripting stuff but I wanted to try something cool XD But I feel so lost when I try to learn this kind of stuff lmao
check out the pinned messages. you can find some tutorials and stuff
Still no dice on that cinematic border ๐ฅบ
do you get any errors?
maybe check out the rpt?
also, I recommend that you test the thing in singleplayer before jumping to MP
No errors
I normally make all of my missions in multiplayer since that's the kinds of missions I make
But i will try it in SP now
Or that's not really possible is it? Hrmm
you're missing a }
ope
in the config
Dang where?
last line
It's ok. what needs to be fixed?
check out the updated rscTitles.
here's a test mission, in case you run into problems again:
https://www.dropbox.com/s/xq8zetw8d8zfp85/test.VR.zip?dl=0
it works for me
you probably don't need the remoteExec stuff anymore
Yep that test mission works like a charm
ok, so just replace your description.ext with mine
yooo it's working
good to know! :)
I think I broke the fade in effect. You can fix that yourself (fadeIn = 1)
Yep no worries lol I got it
Is there any way to check if an extension (.dll) exists? (in sqf)
try to call it
https://community.bistudio.com/wiki/callExtension
Return Value:
String - data sent back from extension; If the extensiion wasn't found an empty String will be returned
so it needs at least one call (and one rpt log)
use the other one with error code
It returns 0 for error code:
"noExt" callExtension ["fnc1", []];
Shouldn't it return some other error code? According to the wiki, 0 means no errors
Thanks for raising and fixing the issue Ded', much appreciated ๐
Hello everyone, I have been trying to bind the arma3 default tracks to a radio. However playmusic does not come with a _object parameter and all other methods dont recognize the classes from songs ( Class source: https://community.bistudio.com/wiki/Arma_3_CfgMusic )
The only other method I know of is mapping all the music source files and using something like say3d but that'll take longer then i'd hope for
that's ^ the solution.
Ah bummer, that's gonna take a while. Its weird that these functions do not recognize the default class names though
Hmm, putting it that way it does actually makes sense. Sometimes i forget arma is old and therefor sometimes can be references to as a house of cards ๐
Thanks for raising and fixing the issue Ded', much appreciated ๐
@winter rose wat
Shouldn't it return some other error code? According to the wiki, 0 means no errors
@little raptor I thought there were like 101 102 and such errors
Hello !
I have spinning weapons.
But since I am very very bad in maths I cannot understand how to have the weapon spin in the correct position.
Currently the weapon is spinning layed on it's side. I'd like it to be spinning up-right like when you hold it in your hands.
I understand I might need setVectorDir, setVectorUp or setVectorDirAndUp
But I do not understand the geometry/maths behind the commands so I don't know which one to use and how
while {/*condition*/} do
{
_X1 = (_X1 + 0.1) % 360;
if (/*condition*/) then
{
w1Launcher setDir _X1;
};
sleep 0.01;
};```
Because the weapon "object" was probably designed on it's flank
If you place a weapon object in the editor it's always lighing on it's side
Because it gets placed inside a weaponHolderSimulated
If you say so ๐ that doesn't help me with my issue ๐
Well, it kind of depends how the weapon looks when it's on its side.
First, you'll have to make it upright
Then rotate it
All you have to do is just rotate the [0,1,0] vector (which points towards the front of the model)
_vec = [sin 10,cos 10,0];//rotate 10 degrees
_object setVectorDirAndUp [_object vectorModelToWorld _vec, _object vectorModelToWorld [0,0,1]]
e.g. spinning an object:
obj = createSimpleObject [getText(configFile >> "cfgWeapons" >> primaryWeapon player >> "model"), eyepos player];
obj setVectorUp [0,0,1];
onEachFrame {
obj setVectorDirAndUp [obj vectorModelToWorld [sin 1,cos 1,0], obj vectorModelToWorld [0,0,1]]
}
if you posted a screenshot of how your object looks, I could help better
Oohhhh that helps a lot ! Thanks !
hey, I need to remove the brackets that appear in each string that is created
my result >
2020/11/11, 2:44:11 "Time to complete: 0 (in seconds)"
2020/11/11, 2:44:11 "Result: [[""truckDel5_1""],[""truckDel1_1""],[""truckDel2_2""]]"
need
2020/11/11, 2:44:11 "Time to complete: 0 (in seconds)"
2020/11/11, 2:44:11 "Result: [""truckDel5_1"",""truckDel1_1"",""truckDel2_2""]"
Join the arrays together before making the string
but how do I do that, I get the data from here
_query = "SELECT name FROM business WHERE owned='1' AND needitems='1'";
_queryResult = [_query, 2, true] call DB_fnc_asyncCall;
assuming queryResult is the array, _queryResult = _queryResult apply {_x#0}
Anyone know if there is a good way to get the default inventory of a crate from the class name or is it easier to spawn the crate in some dummy location and get the inventory via the normal commands?
I'd say it's easy to do that via create a dummy one, but it always possible to fetch from config
Yeah the problem is the format
Debug corner coords are 0,0,0 I think right? Never really needed to use debug corner before tbh
Debug corner? That doesn't exist... 0,0,0 is just the bottom left corner
Well, let me try to fetch from the config
_class = "B_SupplyCrate_F" ;
_class = configFile >> "CfgVehicles" >> _class ;
_return = [] ;
{
_x params ["_transportClass","_name"] ;
_returnTemp = [] ;
("true" configClasses (_class >> _transportClass)) apply {
for "_i" from 1 to getNumber (_x >> "count") do {
_returnTemp pushBack getText (_x >> _name) ;
} ;
} ;
_return pushBack _returnTemp ;
} forEach [
["TransportMagazines","magazine"],
["TransportWeapons","weapon"],
["TransportItems","name"],
["TransportBackpacks","backpack"]
] ;
copyToClipboard str _return ;```Quick mockup
["30Rnd_65x39_caseless_mag",(...),"30Rnd_65x39_caseless_mag","30Rnd_65x39_caseless_mag","30Rnd_65x39_caseless_mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","16Rnd_9x21_Mag","30Rnd_45ACP_Mag_SMG_01","30Rnd_45ACP_Mag_SMG_01","30Rnd_45ACP_Mag_SMG_01","30Rnd_45ACP_Mag_SMG_01","30Rnd_45ACP_Mag_SMG_01","30Rnd_45ACP_Mag_SMG_01","20Rnd_762x51_Mag","20Rnd_762x51_Mag","20Rnd_762x51_Mag","20Rnd_762x51_Mag","20Rnd_762x51_Mag","20Rnd_762x51_Mag","100Rnd_65x39_caseless_mag","100Rnd_65x39_caseless_mag","100Rnd_65x39_caseless_mag","100Rnd_65x39_caseless_mag","100Rnd_65x39_caseless_mag","100Rnd_65x39_caseless_mag","1Rnd_HE_Grenade_shell","1Rnd_HE_Grenade_shell","1Rnd_HE_Grenade_shell","3Rnd_HE_Grenade_shell","1Rnd_Smoke_Grenade_shell","1Rnd_Smoke_Grenade_shell","1Rnd_SmokeGreen_Grenade_shell","1Rnd_SmokeGreen_Grenade_shell","chemlight_green","chemlight_green","chemlight_green","chemlight_green","chemlight_green","chemlight_green","NLAW_F","NLAW_F","NLAW_F","Laserbatteries","Laserbatteries","HandGrenade","HandGrenade","HandGrenade","HandGrenade","HandGrenade","HandGrenade","MiniGrenade","MiniGrenade","MiniGrenade","MiniGrenade","MiniGrenade","MiniGrenade","SmokeShell","SmokeShell","SmokeShellGreen","SmokeShellGreen","UGL_FlareWhite_F","UGL_FlareWhite_F","UGL_FlareGreen_F","UGL_FlareGreen_F"],
["launch_NLAW_F","arifle_MX_F","arifle_MX_F","arifle_MX_SW_F"],
["FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","FirstAidKit","Laserdesignator","acc_flashlight","acc_flashlight","bipod_01_F_blk"],
["B_Kitbag_mcamo","B_Kitbag_mcamo"]
]```Returns this
Ok, interesting. Iโll see if I can adapt that to the ACE crates and such as the transport classes arenโt written as string arrays for them.
Hello, is there any command to select a grenade in the inventory?
Suppose I want to use a script to change the current grenade (as when pressing CTRL + G).
Not sure, try https://community.bistudio.com/wiki/selectWeapon.
Is there a way to change the projectile despawning distance of 7000m?
maybe setFeatureType, can't guarantee it
when does it occur?
sounds like a timing issue; trying to get the player object before it exists
a JIP thingy yup
waitUntil not isNull player, it should do
player isEqualTo player โฆ wat
(also, your code brackets {} are incorrectly placed)
It can be placed like that. But it's not efficient
and it's not doing what he wants
The { } are redundant (except for the first one)
waitUntil {!isNull player && {!isNull (findDisplay 46) && time > 0}};
nope, the code is "valid" and won't throw an error.
do you have -showScriptErrors enabled?
Got different code in mind that could error? You mentioned teleporting and accessing the name.
Where?
when executed in the same frame the unit was created
the problem is isPlayer returns false.
We could work around that using "player in allPlayers" but.. Im not sure about the performance of that.
but yeah, looks like an Arma bug
replace isPlayer by unit in allPlayers and it should be fine
For teleportation?
no, for setPos* it should work whatever the isPlayer status
What's the best way to get all players in a given radius assuming that most of the time there will be no players but there will be plenty of AI? But when players are near it's safe to assume that >75% of the players on server will be near
allPlayers select {_x distance _pos < _radius}
a trigger isn't better?
hardly is
i'll be doing it every 5 seconds though
altho it depends on what you want.
5 seconds is like infinity in programming. plus it's scheduled so...
CBRN mission, if they don't have certain facewear and certain backpacks they'll get damaged
if i teleport him its his bot that come not the actual player.
it doesn't make any senseโฆ? the player's camera remains on spot? what is the issue
https://community.bistudio.com/wiki/inArea
With the mission area marker perhaps?
distance is faster than area
On all machines?
how about you just don't do anything to the unit until the conditions in https://github.com/michail-nikolaev/task-force-arma-3-radio/issues/1096#issuecomment-246206280 are satisfied?
in other words add more conditions to the waitUntil
It most likely is a network issue, yes.
maybe adding one more condition can fix it?
waitUntil {!isNull player && {!isNull (findDisplay 46) && time > 0 && !isNull group player && isPlayer player}};
or some delay?
Bugs hide everywhere.
Are you using AI stand-ins until a player takes the slot?
some epic jip code like
if (player != player) then
{
waitUntil {!(player != player)};
};```
heard of isNull? ^^"
The condition can never be met.
it can, but it's rediculous
!(player != player) โ == too ๐
probably changed in a3 then the code i posted is default a2 jip framework
this problem just reminded me of that
As far as I understand it the issue is Arma 3 MP being A3 MP: Sometimes things break.
Player slots filled with AI until a player takes the slot and joins.
I don't know, maybe?!
https://community.bistudio.com/wiki/Description.ext#disabledAI
This is the setting for it.
You could try turning that off (if your mission permits it), but other than that I think it sounds like an A3 MP issue indeed.
distance is faster than area
inAreaArray
that's not scheduled. Could end up being worse (depends on the number of players)
It will be always faster, it can be more noticeable on frames tho.
Yeah. That's what I meant by worse
https://github.com/michail-nikolaev/task-force-arma-3-radio/issues/1096 this issue looks very close than mine.
@echo yew That issue is fixed in next game update
where what comes from
what causes the issue
some error in code caused the issue
it checked one of two things, and errored if first failed. Even though you can still get name even if first fails
Dedmen I don't know if you have any pull with the powers that be but it would sure be nice to have some control over what gets spat out into the .rpt file...
The great majority of things in the .rpt file are potentially significant to Bohemia but have no relevance to the average scripter
its with the s iirc @astral dawn
you can install some extension for writing data into log files and make your own log files with blackjack and ...
I can recommend a few
All I'm asking for is a toggle that lets me log script errors but suppress system notes. For example I'll get thousands of lines related to server: object not found which is of no use to me, and probably no use to Bohemia, either
oh that's cool
"object not found" you can disable these in server config
and probably no use to Bohemia, either
well it outlines some desynchronization error generally
Fantastic!
Wait are you saying I can already disable these in server config, or that this will be the impending change?
#perf_prof_branch has the answer
So I'm not sure if you're asking me to scroll back through that entire channel, but can I surmise that you're talking about a change that's current in dev branch that will eventually come to the regular branch?
That's awesome. Thanks for reading my mind in terms of what I was wishing for!
it will be long road of moving some logs to debug mode, adding more log info and stuff
No doubt but I truly appreciate the intention
@little raptor
For my spinning weapons, the solution to have it up-right correctly was this (based on what you provided).
But now that I've changed the vector, the sin 1, cos 1 is rotating the object by 90ยฐ instead of 1ยฐ...
w1Launcher setVectorUp [0,1,0];
onEachFrame {
w1Launcher setVectorDirAndUp [w1Launcher vectorModelToWorld [sin 1,cos 1,0], w1Launcher vectorModelToWorld [0,1,0]];
};```
do you mean change sin 1,cos 1 for it to affect another vector (the one I changed it to) ?
w1Launcher setVectorUp [0,1,0];
onEachFrame {
_dir = [vectorDirVisual w1Launcher, 1] call BIS_fnc_rotateVector2D;
w1Launcher setVectorDirAndUp [_dir, [0,1,0]];
};
maybe try this?
like I said it depends on the orientation of the object. your object is not "standard"
It may not work correctly if your object is being influenced by the game (e.g. gravity)
it's not, I disabled simulation
if so, you can make that even simpler:
w1Launcher setVectorUp [0,1,0];
onEachFrame {
_dir = [vectorDirVisual w1Launcher, 1] call BIS_fnc_rotateVector2D;
w1Launcher setVectorDir _dir;
};
lol yeah I just realized that the dir is now [0,0,1]! ๐
so you cant rotate it with the bis fnc
Is it possible to change the vehicle class/vehicle without creating a new vehicle.
So basically replace it.
no
didnt think so
@quartz coyote
since we now know that your up vec should be [0,1,0], this should be safe to use:
onEachFrame {
w1Launcher setVectorDirAndUp [w1Launcher vectorModelToWorld [sin 1,0,cos 1], w1Launcher vectorModelToWorld [0,1,0]];
};
(not tested)
but underneath, it's still the same vehicle
@little raptor figured it would be something like that so I already tried it but it ends up glitching like hell. So that doesn't work
Also tried [sin 1,0,tan 1] in my great ignorence ๐
why?????
Why what ?
the tan
told you, in great ignorance lol
I don't understand the maths so I'm just "testing & breaking"
Anybody have a good example of a 'world generator' script that basically sets the settings but then saves those for persistence?
I have all my markers set up, but would like them to only randomly move once then just stay that way, even after restart.
you need to leverage profileNameSpace
ie create a variable, then you can do:
saveProfileNamespace;```
Then later on mission restart you can do:
missionNamespace setVariable ["myVariable", profileNamespace getVariable "myVariable"];
Is there such a thing as PlayerConnected.sqf or similar in the mission folder?
I THINK I remember having an onPlayerConnected.sqf file in a previous mission, but I'm not seeing that online at the moment.
My initPlayerLocal isn't working for join in progress.
Should I just respawn on mission start and fire my script onPlayerRespawn?
I think you need to examine more about why your initPlayerLocal isn't working for join in progress, because there's no reason it shouldn't.
@shadow sapphire only mission files are listed in https://community.bistudio.com/wiki/Event_Scripts
Of course is it possible to add any file which is called through some other file/script with event handlers
Heya everyone.
I have a static, empty, object. A pile of dirt (Dirthump_3_F).
For my mission I am pretending it's a pile of explosives that needs to be set off with a bullet.
My ideas was to use the "Hit" EventHandler to trigger an explosive script.
However, I find that the target needs to take damage for EH to fire. So I'm considering covering the dirt pile with some kind of invisible object. Does anyone have any ideas?
Or should I be scripting this another way? I mean, is there a bullet object detection of any kind?
, you need another object to sense the bullet hit, with a handledamage EH @tough abyss
i usually use traffic cone, which you can hideobject
so that it's not seen
alternatve
is nearestObject [(position of dirtpile), "#crateronvehicle"];
but you'll need to run that in a loop
another alternaive I've just thought of.. might not work as its untested
create a satchcharge at the position of the dirpile and hideobjectglobal it
not sure if it will exploded if shot, i suspect it will, but have never done it
wait 1 while i test <<< cant make that work
Hello, what is the code for the left mouse click???.
The one with the mouse I know is this (MouseButtonDown), but that one takes all the mouse buttons. Please do not send me the typical KeyCodes link
@worn forge, interesting. Yeah, it works in singleplayer just fine. No idea why it's not working for multiplayer.
@shadow sapphire post your code or pastebin it, sounds like there's a locality issue but it's impossible to know without seeing it.
how to disable engine auto start i added this evh and it doesn't work
private ["_veh"];
_veh = _this;
_veh addEventHandler ["Engine", {
private ["_var"];
_var = (_this select 0) getVariable "engineState";
if ((isNil "_var") && (local(_this select 0))) then {
(vehicle player) engineOn false;
};
}];
hello. i once had this working: execVM "C:\Program Files (x86)\Steam\SteamApps\common\Arma 3_folder\file.sqf";
but it was execVM _folder\file.sqf; after 2.0 patch it's not working anymore
i also tried it with leading backslash
but it was execVM _folder\file.sqf
what?
after 2.0 patch it's not working anymore
did you try filepatching and running arma as admin?
I wouldn't be surprised if it didn't work. It poses security issues and it's actually a good thing that it doesn't work anymore (if that's really the case here)
@dark ocean Does your event handler work at all? Did you try putting a hint or systemchat in it to see if it works?
@finite sail Hidden objects wont take damge
Hello, what is the code for the left mouse click???.
The one with the mouse I know is this (MouseButtonDown), but that one takes all the mouse buttons. Please do not send me the typical KeyCodes link
takes all the mouse buttons
what? the second argument is always the mouse button keycode
And it's 0
_button == 0 is left click
FAO RHS...
because _value is a number
and you can't compare a number to a string
expression="if(_value != 'NoChange')then{ _this setVariable ['rhs_decalNumber_type2', _value];[_this,[['Number', cBTR2NumberPlaces, _value]]] call rhs_fnc_decalsInit}";
class Value
{
class data
{
class type
{
type[]=
{
"STRING"
};
};
value="NoChange";
};
};
};```
what?
it throws an error when trying to spawn in compositions from a script. because the vehicles have rhs specific attributes in the editor
but tries to compare a value to a string of text
So if (0 != 'NoChange' could be changed to like if ('PoopyPants ' != 'NoChange' then it works lol
well, you'll have a bigger chance if you report this in the RHS feedback tracker, because this is for scripting help, not bug reports for random mods ๐คทโโ๏ธ
although looking at that config, the value should be a string, with the default of NoChange, so technically still correct.
oh crap wrong place im so sorry! wrong channellll
howdy fellas I need some help with the "UnitCapture/Play" command
I was testing on UnitCapture/Play commands in the editor today, I followed the instructions exactly as this video said for a helicopter (https://youtu.be/bjNuMUHdZL8) and when I activated the Radio Bravo trigger to playback my flight path the aircraft does nothing! No error messages, nothing at all. I tried looking up possible reasons but they all lead to stuff I think don't pertain to my predicament. I'm simply just testing out the the feature (I literally found out about this yesterday, had no idea it was in Arma 2 either.)
did you follow the YT steps exactly the same?
because I tried it and worked as in the video
Lemme try it one more time, I tried it in Arma 2 and it worked perfectly :/
one thing I wanna know is how can I capture input for interacting with a vehicle as well, for example, I wanna capture a cargo helicopter opening its doors so I can load a vehicle into it
Ok I think I named the pilot "heli1" not the air craft itself, maybe that has something to do with it?
yep that did it lol I just named the wrong thing the variable name
With allowDamage set to false the HandleDamage EH don't trigger?
Does anyone know a way to refresh the inventory? When using setUnitLoadout and the inventory is open your vest and bag vanish and reappear when the inventory is modified (add/remove item or close/open inventory again) - does anyone know of a way to do this via script? player action ["Gear",""]; does not seem to work
right now I add and remove a dummy item which does the trick.. but wondering if anyone else knew offhand a better method
I think you can just close the dialog and reopen it immediatly ?
@past tiger correct
@finite sail Hidden objects wont take damge
@little raptor I just damaged a hidden traffic cone with an explosive charge
You can damage hidden objects. If you destory them they even get replaced by their ruin model if they have one.
default
{
{_x hideObjectGlobal true;_x allowDamage false;};
That's why the edit terrain module also disables dmg for example.
oo, didnt know that, @cosmic lichen . I have a big hideobjectglobal of the trees in the middle of Feres AB (who has air airbase with a forest in the middle of it?). I will allowdamage false those tree objects too to stop them doing their fallover animation
https://www.youtube.com/watch?v=n9XdLpmGIEU
video of handledamage firing on a hidden traffic cone
I use this a lot for sensing explosions on objects that don't take damage
It's true to say that hiddenobjects don't take bullet hit damage, though
Hmm interesting, I never damaged them with explosives!
explosive or missile fire can damage them to be more accurate
They're both explosives! ๐คท
in other words, any ammo with an "indirectHit" larger than 0
yes that ^^^
here a roadbridge is destroyed because hidden object roadcones take damage from the titan round
Ooh that was sexy! ๐
I would play that mission! ๐
its a secondary mission, part of
i always meant to add objects falling into the water as the bridge section is hidden , a sort of falling rubble visual
but it never got done ๐
https://community.bistudio.com/wiki/Particles_Tutorial#Rock_Shower could help you @finite sail ๐
oh wow
Is it compatible with AI? I wanted to play alone!
its a coop mission really, best experienced on a dedi server,but its possible to play alone. this mission scales itself back a little for solo players
ill be playing it on friday evening with my mate if you want to tag along
bring beer
friday evening UK time, btw,
@winter rose thank you! I didnt know about that
will have a look
can't wait to see the result!
@finite sail Thank you for these ideas! Yes, a traffic cone would be a good hidden object. But the dirtpile is really very large (I am making a target that players can easily shoot from 2 km away).. What's the biggest (flattest?) object that detects hits?
Oh...damn you shadowplay and nvidia
When you go back into the game and press a few heys and shadowplay says "Video has been saved" and you check the shadowplay dir... there's a 4GB file there.. dont remember starting the recording
Whoops I'm interrupting another conversation ๐ . I'll wait
no its fine mate
just me waffling on
ok, so the sensor object idea won't work
using hiddenobjects in that way only works for explosions, not for bullet hits
default { {_x hideObjectGlobal true;_x allowDamage false;};That's why the edit terrain module also disables dmg for example.
^I just read this above... but it doesn't apply to bullet hits?
thats correct
only works with explosions
but I mentioned using https://community.bistudio.com/wiki/nearestObject
look at example 5 and use "#crateronvehicle"
you might be able to get the bullet hit that way
@tough abyss If you're familiar with object builder, it's very easy to create an invisible block that can be damaged
will require an addon though
true
or maybe it doesn't
because you can create a simple object
Not sure if they can take damage
Simple Objects are simple enough not to take any damages
Am trying the crater idea. Brb.
Do all bullet impacts use the "#crater" type?
So I just tested nearestObject [player, "#crater"]; in the debug console with a few weapons. Only got it to work with craters created by launchers, not bullets. The nearestObjects command doesn't seem to work with #crater in the search array.
Does the engine really have no handle or ID for bullets? I mean, I could just define a trigger area to cover my object, no problem.
Note: shooting at the dirt pile seems to create a dirt particle effect: can that be detected? (When the player is 2 km away ๐ฌ )
I don't think so
were you running the nearestobject in a loop?
No, I just ran it once after firing each shot.
I don't follow. Just to be clear; after every shot, I clicked back to the debug console, then ran the code again. Effectively I ran the check every 3 seconds. What condition would I loop it on, that would catch it better?
Does the engine really have no handle or ID for bullets? I mean, I could just define a trigger area to cover my object, no problem.
@tough abyss bullets are objects
the nearestobject command only runs once when you ran it each time
@finite sail that makes sense. And it reliably detected the crater decal my RPG launcher made when it ran. Just not bullets. Unfortunately :(
@still forum I couldn't find the classname or object name that easily in the BIKI. Could you tell me where such a list is?
classname is the CfgAmmo classname
@tough abyss
Let's do it in a different way:
bullets = [];
player addEventHandler ["FiredMan", {
_bullet = _this select 6;
_dir = vectorDir _bullet;
_pos = getPosWorld _bullet;
if (_dir vectorCos (_pos vectorFromTo getPosWorld DirtPile) > 0) then {
bullets pushBack [_bullet, _pos];
onEachFrame {
{
_x params ["_bullet", "_pos"];
if !(alive _bullet) then {
bullets set [_forEachIndex, -1];
if (_pos inArea DirtPileArea) then {
//explode
};
} else {
_x set [1, getPosWorld _bullet];
};
} forEach bullets;
bullets = bullets - [-1];
}
}
}]
Oh, also the physical object when it is fired? Pardon, I am new to this aspect of missionmaking. Thank you.
I would say, add Deleted Eventhandler on the bullet, and check where it was when it was deleted/hit an object
onEachFrame is a bad idea, you break other onEachFrame or they break you
Does the deleted eh work?
it should
I know that killed EH doesnt work on them
@finite sail that makes sense. And it reliably detected the crater decal my RPG launcher made when it ran. Just not bullets. Unfortunately :(
@tough abyss Oh ok, it reliably found explosion decal but not bullet ones.. gotcha
Not sure about deleted
onEachFrame is a bad idea, you break other onEachFrame or they break you
For testing it is fine
well bullets don't get killed, they do kill
killed == destroyed
ok so that means Hit event probably doesn't work on the target object
but I didn't see anyone talking about that anyway
we wouldnt be doing this crazy stuff otherwise! ๐
Yes; my idea was to make a very large target that regular players could shoot at from more than a kilometer away. Justification being that it's a pile of explosive material.
there is a hit EH on the ammo itself but only config
@still forum Could you elaborate?
Also Leopard your code, can probably use inAreaArray.
Also your _pos looks wrong, you never update it
really, the lnly way to make that work is if the target is a man
"Could you elaborate?"
There is are per bullet eventhandlers, but you can't access them via scripting so they are no option for you
good point, fixed.
not sure about inAreaArray...
or, have them shoot explosives (rocket/missle) at the target
and use the craterdecal
or a hidden sensor object like the traffic cone that can take the damage instead
@tough abyss Did you try my method?
Yeah, it would be sensible to make the player use a launcher, or scale down the distances and target size. The kick in this mission was making players assassinate some target at over 1 km with a very big rifle.
I'm going to play a little with Leopard20 's script. Just a question: how heavy would this be?
Depends on how many bullets you intend to fire!
Not much
You can remove the event handler when the pile is dead
maybe you should filter bullets that go in the direction of the pile
otherwise you capture all bullets that go anywhere else even if you don't care
AHA! Me can't read
Well; it's a 4 player coop mission running on dedicated. I could assign 1 person is assigned as the main sniper (with the .408 sniper; forget the name), for instance.
OK OK I'm going to play with this a little. Thanks gents.
remember to define the pile area in ASL format
And the area must have a height
In other words:
https://community.bistudio.com/wiki/inArea
c must be positive (syntax 3)
@little raptor Yes; it works! You had added an unnecessary curly brace at the end that created errors, and I had to figure out cfgAmmo, but it absolutely works.
FYI the dirtpile object is 12x7x6 meters in size. So I can probably make the "filter" angle quite small, even if players decide to get closer to it.
The thing is, you can also shoot things "indirectly" at the object and it may still hit
For example, a grenade launcher
or just grenade
So I think 90 degrees is safer
You had added an unnecessary curly brace at the end that created errors
typing in discord will only get you so far!
That is true. But to give usage context: I am making players standing on the cliffs in Malden shoot at an object on the coast (wanted them to shoot the target character directly, but no rifle reticle will go that far with the ACE ballistics mod loaded). The players have a 20 minute window, and depending on how far they choose to walk, range will be 2.4 km - 800 meters.
I point out the curly brace thing to give myself a tiny bit of troubleshooting credit, not to look a gift horse in the mouth! Impressive you just coded it without testing.
Also, remember to use a stackable event handler instead of onEachFrame. That was for testing.
Also, if you make sure that the event handler is added locally, you can run that code per client, saving the server performance.
Could you clarify (or send BIKI link) on what you mean with "stackable"?
Well, you can either use EachFrame mission EH, or:
https://community.bistudio.com/wiki/BIS_fnc_addStackedEventHandler
If you intend to use the mission EH (which is recommended), make sure you don't add duplicate ones.
You can use a condition, e.g:
if (missionNamespace getVariable ["BulletEHAdded", false]) exitWith {};
BulletEHAdded = true;
addMissionEventHandler ["EachFrame", ...
addMissionEventHandler* is better, stacked is scripted & slower
what did I say?!
(mb for tagging you, gimme the time to read your message ๐)
@little raptor thanks for changing that =true . Was confusing me!
I apologise for ignorance, am not a programmer by training. How is stacking important here? Is this related to memory stacking?
No. if you used onEachFrame, and another mod did the same, it would override yours
It's about "coexisting"
Clear enough. And I am pretty sure the CBA and ACE mods make use of it. So this will be important.
I don't think they do! They're smart enough not to use that. But other less skilled programmers might
Oh. Well, there are no other mods in the mission. But I will apply your fix, regardless. This is getting quite educational.
@tough abyss One thing I forgot to say: make sure you remove both the "FiredMan" EH and the "EachFrame" EH once this pile is destroyed. You can save the event handler IDs in a variable (either in missionNamespace or object variable space)
In fact, if the mission spans across a large AO, you can add the "FiredMan" EH when your units are close enough to the dirtpile (using a trigger or something)
Good point in removing the EH. The AO is bloody huge, on purpose, so perhaps I should activate the EH when the previous task completes.
Yeah.
On second thought, there's no need to save the "EachFrame" ID, because you can simply use:
if (_pos inArea DirtPileArea) then {
removeMissionEventHandler ["EachFrame", _thisEventHandler];
//explode
};
The variable _thisEventHandler is defined by the engine for each event handler
Didn't know you could delete the whole EH from an inner scope.
Thanks for all the help and tips. Will write back if I have further questions.
no problem!
By the way, Dedmen, the "deleted" EH doesn't work on bullets. I just tested.
I couldn't find any EH that works on them ๐คท
Can we ask for an EH that triggers before the bullet is destroyed?
@worn forge, this is my initPlayerLocal.sqf file: https://pastebin.com/NHM3EZCW
waitUntil { not isNull player };```would be nice to have at the top @shadow sapphire
https://community.bistudio.com/wiki/Event_Scripts#initPlayerLocal.sqf
runs for normal and JIP players, so wait until they join the game ๐
I'll try that immediately!
My results are the same, but I'll keep the line, thanks @winter rose!
I'm thinking of just moving this script to onplayerrespawn.
This shit makes me SICK. I know it's something simple or stupid that I'm missing, but for every single little tweak you make, you have to shut down the server, open the editor, load the mission, export the mission, exit the editor, launch the server, rejoin, fail, repeat mission endlessly. Absolutely nauseating.
you can run with a local server
It seems to let things slip, it seems to allow things through that won't work on the dedicated sometimes.
Most recently, it seems to be treating the player and server as the same entity when I run the local server.
yes sort of, the player and server are sort of the same thing on a local server
but it does almost all the locality stuff correctly
You can launch your local multiplayer game just from Eden Editor
... That's what we are talking about.
yes
Directly, I mean. You don't need to export or something
my mission is designed to run on dedi boxes, but I rarely have to actually put the mission on the dedi for testing, 99% of testing is done with local server
Not a problem for me! Thanks for trying to be helpful, @warm hedge!
Not a great time to try to help someone, 2 AM ๐
@finite sail, I'll try to see if I can get it to do the same thing.
@shadow sapphire do you want me to run through how i do it here? im sure they same process will apply to you
Sure! If you have the time.
Take your time!
ok, so game main meni, editor, double click vr world
then load the mission into the editor
for me, its ion the mpmission folder
then I'll tab out into my code editor. 99.9999% mission dev is done in visual code, not in Eden
make changes etc
find that missing semicolon ๐ save the file in visual studio, tab back to the game
Well, my issue is that the initplayerlocal.sqf is not firing at all anymore, for reason I can find. It fires just fine in singleplayer, doesn't fire on the dedicated.
initplayerlocal shouldnt fire on the dedi... i assume you mean it doesnt fire on the player when you use a dedi
Yes.
oooh, would that be the issue from the beginning
yeah it only fires where there is a player behind the screen
you do need to bear in mind, the init scripts do fire in a slightly different order when on dedi / local server, but it shouldnt make any real difference
do you do stuff in preinit?
because I dont
if you want code to run whatever the server, use initServer.sqf
I have this at the top of my initplayerlocal, to keep the init order fairly safe
waitUntil {getClientState isEqualTo "BRIEFING READ"};
The things I need to fire need to be fired on the players when they join, at least the beginning part, the other bits might need to be shuffled around, but I know for a fact that the beginning stuff isn't firing.
ok, just a shot in the dark... playerrespawn.sqf doesnt fire on player join... that caught me out a few times
First thing that should fire is a gear script, Call ASG_FNC_SOFGear;
If the other things didn't fire, I'd think they need to be shuffled to the server, but that one I know should be firing.
its a function? are you sure the function is compiled by the time initplayerlocal runs?
i bet it isnt
ok, you might find initplayerlocal is running too early
the waituntili posted earlier will mitigate that problem
in my experience, when it doesnt work in MP SQF without syntax errors... if it aint locality that broked it, it almost always is timing
a script running before its time, in other words
The function is compiled on server initialization.
wait, how?
I mispoke. IDK what I was trying to say.
the function needs to compile on the client
do you mean that it's compiled everywhere when the server initialises?
because it might be that that isnt happening
No. Ignore what I said, I meant it was defined in the description, thought that was in the serverinit, it's not.
Yes. I think. That's where it's defined, and it works as called in singleplayer, does not work in multiplayer.
I tried your waituntil, and I've tried putting it behind increasingly larger sleep thresholds, neither appears to work in multiplayer.
Anyway, I've got to go as well.
waitUntil { not isNull player };```would be nice to have at the top @shadow sapphire
@winter rose tbh I've never seen that as an actual issue. I know why it's there. It's never made a difference in anything I've seen. But I'm guessing you swear by it?
well, there are checks with the player value in there, and apparently in some cases (which ones?) a JIP player can be not fully initialised at this stage.
Opinion:
== operator should compare bools too
I know the "you should use if (_var) then {} instead" point, but it really just adds to the annoyance and confusion when == works in such non-uniform way: it work with strings and numbers, but not with bools. In the end it just leaves bugs somewhere in the control logic of the code for no good reason at all. If SQF checked this at compile time then it would be more manageable.
@astral dawn that's already the case
huh?
How about
waitUntil { !(isNil "ASG_FNC_SOFGear") };
Call ASG_FNC_SOFGear;
...
and I have no idea what the practical value of having all those Sleep statements is
@astral dawn since Arma 3 v1.99.146526
https://community.bistudio.com/wiki/a_%3D%3D_b
wait, what ๐ฎ
i just got an rpt from guy who had my code crash for him
ok let me check his version
yes that's right, 1.98
my bad, sorry for the rant
Nooo lou don't tell people about the heresy
hue hue hue, take that, ebol coder
I will get rid of bool == true probably... maybe?
I guess replacing _var == true by _var everywhere universally should be fine huh?
probably isn't.. meh
I want to tho
it's cool, ded. If SQF raised the error at compile time then it would be ok
compile time warnings, can do
but since it's dynamic... meh
or rather optimizer time warning
@worn forge, thanks! Will try that waituntil.
The sleeps are because the subordinate elements being assigned donโt exist yet, and then when they exist, the remaining sleep ensures the subordinate are assigned in a specific order.
Iโm positive there is a more elegant solution, but Iโm not a coder. At all.
Hi folks, I am trying to create sentries for wall block and towers, but they are not registering when testing with 'nearestBuilding'. Is it possible to spawn them into wall defences and in hesco towers? Example classname: "Land_HBarrierWall_corner_F". Cheers
sandbag bunkers work fine... is there a trick to walls?
@winter rose i believe after 2.0 it started to trigger, but with a damage value of 0. This is good for me.
correct, tested just now
@rough dagger I believe nearestBuilding looks for structures that have building positions, and if that command isn't picking up what you want, that's probably why. You'll need to use nearestObjects or similar.
Iโll play around with that ... thanks Ryko...
Do you know if walls have positions you can send units to?
I mean they look like legit options for unit placement but I get the feeling they are for human players only lol
That's what buildingPositions are, and if they don't show up in nearestBuilding, they're not buildings, thus your answer is no ๐
Thanks Lou. I was not believing, this will helpme a lot.
Thanks man .. I even tried spawning them above the wall but machine said no ๐
The problem with putting AI there is that unless you give them forceSpeed 0 or otherwise disable their ability to move, they'll walk off the wall anyway.
Are you adding a second InventoryClosed EH inside the first?!!
Im looking to change "If (PrimartWeapon Player == "")
secondaryWeapon player == ""
Also, your code is not written properly. You should revise the whole thing
That hurts to look at
gone
Not sure if there's a direct way to disable it, but you can fetch the user keybind for pinging zeus and then use the "KeyDown" EH to override it
@tough abyss something like:
findDisplay 46 displayAddEventHandler ["KeyDown", {
inputAction "curatorInterface" > 0
}]
(not sure if it works with inputAction, you'd have to use actionKeys otherwise)
how do i go about doing a mod check?
like, say... see if ACE is loaded?
so I can make a single mission but make it compatible if ACE was loaded (medical items etc)
could check if the related addon patch exists
checking for the workshop id with getLoadedModsInfo is also an option, but that wouldnt work for non-workshop versions
if (isClass(configFile >> "CfgPatches" >> "ace_hearing")) then {
// do something when ACE Hearing exists
};
Although you also might be able to use activatedAddons (never used/tested it)
I am doing some little rearm script. Made an observation. The Sholef for example. Right at start, it has 20 155mm HE rounds. But in the config, the magazine reads "32Rnd_155mm_Mo_shells", and it can, of course, be filled up to 32 rounds. Is there any reason for the unit to start with only 20 rounds? Same goes for the "6Rnd_155mm_Mo_mine" magazine. From the start, there are only 4 rounds available, though up to 6 could be fitted.
post the paste bin
also, make sure the units ammo slider didn't accidentally get moved when you were in the editor
@fair drum
"also, make sure the units ammo slider didn't accidentally get moved when you were in the editor"
please shoot me
gladly ๐คฃ ah well, happens! ๐
Ok, here comes the next dumb question
Currently, I have this in my config:
class Extended_Fired_Eventhandlers {
class B_SAM_System_03_F { // MIM-145 Defender SAM rocket launcher
fired = "_this execVM '\NIC_FSU_rearm\scripts\rearm.sqf';";
};
class B_MBT_01_mlrs_F { // Seara multiple rocket launcher
fired = "_this execVM '\NIC_FSU_rearm\scripts\rearm.sqf';";
};
class B_MBT_01_arty_F { // Sholef artillery
fired = "_this execVM '\NIC_FSU_rearm\scripts\rearm.sqf';";
};
};
class Extended_Reloaded_Eventhandlers {
class B_SAM_System_03_F { // MIM-145 Defender SAM rocket launcher
Reloaded = "_this execVM '\NIC_FSU_rearm\scripts\rearm.sqf';";
};
class B_MBT_01_mlrs_F { // Seara multiple rocket launcher
Reloaded = "_this execVM '\NIC_FSU_rearm\scripts\rearm.sqf';";
};
class B_MBT_01_arty_F { // Sholef artillery
Reloaded = "_this execVM '\NIC_FSU_rearm\scripts\rearm.sqf';";
};
};
I am sure this can be optimized to a more elegant solution. How?
Could use them as a child classes if you really wanted to trim it a bit. sqf class Extended_Reloaded_Eventhandlers { class B_SAM_System_03_F { // MIM-145 Defender SAM rocket launcher Reloaded = "_this execVM '\NIC_FSU_rearm\scripts\rearm.sqf';"; }; class B_MBT_01_mlrs_F : B_SAM_System_03_F {}; class B_MBT_01_arty_F : B_SAM_System_03_F {}; };
@languid oyster
also, make a function instead of execVM'ing
@dusk gust thanks for optimisation
@winter rose function sounds good. Would be easier for adding or removing units too. Could you give or point me to a little example on how to define or call from config?
there are more methods available, although I don't think you want to go into that rabbit hole yet
What he said!
Ok guys, thanks for the help. Will look into that functions thing.
In case of units spawned later, the function would have to have a loop to check for those new spawned units to add event handlers, right?
Hello all wondering if anyone can assist.
How do I write the !alive name expression outside of a trigger?
Long story short I've got ai to spawn in on a script but one with a variable name i want to check that if he's dead or not to pop up a hint
And I'm assuming I will need to use a sleep command to slow down the check prior to the ai spawning in
well, it's good practice to check if the unit exists before trying to access it.
// create new unit
waitUntil {!isNil unitVar};
// rest of code
// create new unit
waitUntil {!isNil pilot};
Hint "bla";
Like that?
for example
although if you have everything in one script than it shouldn't be needed, since it the variable exists when you use createVehicle/createUnit, so you can access it directly
Thanks mate
isNil takes a string (or code)
isNull takes an object
only in Arma...
although nil is also used to check if a variable exists (independent of string/code/object)
?
isNil {_variable}
_variable can be anything
I've got ai to spawn in on a script but one with a variable name i want to check that if he's dead or not to pop up a hint
And I'm assuming I will need to use a sleep command to slow down the check prior to the ai spawning in
why use "variable name"? Just store the unit in a variable (unit = _group createUnit ....), then:
waitUntil {!isNil "unit" && {alive unit}}
waitUntil {!isNil pilot};
doesn't mean he's "alive"
@idle jungle ๐ that's what you want
Ohh thank you!
Hi! My script results in a "2 elements provided, 3 expected" error - the group spawn, but the task to Defend is not issued. Any clues?
AZ = [21100, 7400];
private _side = West;
private _grouptype = configFile >> "CfgGroups" >> "West" >> "rhs_faction_usarmy_wd" >> "rhs_group_nato_usarmy_wd_M113" >> "rhs_group_nato_usarmy_wd_M113_squad_mg_sniper";
private _vfgrm = [AZ, 0, 100] call BIS_fnc_findSafePos;
gruppe = [_vfgrm, _side, _grouptype] call BIS_fnc_spawnGroup;
gruppe deleteGroupWhenEmpty true;
systemChat format ["%1 spawned at %2.", gruppe, _vfgrm];
[gruppe, AZ, 100] call CBA_fnc_taskDefend;
probably the findsafepos failing
diag_log all of the variables bfore you send them to the findsafepos
Maybe for that, but what about the CBA function?
@signal kite Probably because AZ must have 3 elements
@little raptor this! - thank you
probably the findsafepos failing
wouldn't it return [] tho? (aka 0 elements provided error)
iirc, it returns worldcentre if it fails to find
I've never tried the function variant, so I don't know!
theres another varient?
command
isn't it the same as:
https://community.bistudio.com/wiki/findEmptyPosition
?
looks a bit like: https://community.bistudio.com/wiki/isFlatEmpty
findsafepos uses isflatempty
internally
findemptyposition doesnt look at terrainslope, it doesn't have a blacklist function and doesnt have a shoreline finder
yeah I didn't really read the biki page for : BIS_fnc_findSafePos
I just assumed based on provided params
[AZ, 0, 100] call BIS_fnc_findSafePos;
there's only 3
finsemptyposition is ok for placing small vecs, markers or manbase, for big vecs or on huilly terrain, findsafepos is best
also, ive cooked my own findsafepos, based on Joris' original, that incorporates a lineintersects function
Any way to just disable zeus pinging?
@tough abyss
You've got two options:
- add a keybind to the
curatorInterfaceactionKey, but I have a feeling this isn't foolproof:
(findDisplay 46) displayAddEventHandler ["KeyDown", {
params ["_display", "_key", "_shift", "_ctrl", "_alt"];
if ( _key in (actionKeys "curatorInterface") ) exitWith {true};
}];```
2) use the `CuratorPinged` eventHandler on the zeus module itself (I'm assuming an Eden-placed module, putting this code in the init field):
```sqf
this addEventHandler ["CuratorPinged", {
params ["_curator", "_unit"];
if ( count allCurators == 0 ) exitWith { "No zeus to ping. Don't ping!" remoteExecCall ["hint", _unit]; };
_allCuratorUnits = [];
{ _allCuratorUnits pushBack (getAssignedCuratorUnit _x); } forEach allCurators;
if ( count _allCuratorUnits > 0 && {!(_unit in _allCuratorUnits)} ) then {
"Zeus alerted, stop your pingin!" remoteExecCall ["hint", _unit];
format ['%1 wants attention', name _unit] remoteExecCall ["systemChat", _allCuratorUnits];
};
true
}];```
Untested, but it's a variant of what my community is using currently.
Doesn't it just warn the user not to ping Zeus?
if ( _key in (actionKeys "curatorInterface") ) exitWith {true};
first of all:
_key in (actionKeys "curatorInterface")
is enough
Second of all, what about key combos with shift,alt,ctrl?
Third of all:
#arma3_scripting message
?
Didn't I already say that?
you use inputAction, I used actionKeys
My preference is not to override user keybinds, which is why I added the second method.
I use inputAction to also detect ctrl,shift and alt
Fair, I may adapt to use that
nope, ends with true
If you push true at the end it aborts, that's why I've got the exitWith {true} in my first example
push false and it continues with regular operation
hmm I gotta ask Lou or someone else to add this to the wiki
no
why not?
j/k ๐
IDK where to ask this question but im trying to make an ambient EOD type of mission.
I have it setup with me and 3 other AI. 2 AI are just standing there with ambient standing animations while the other AI is clearing out mines.
What i want is for the EOD AI to clear out 15 mines and then go for the 16th mine and just....D I E
and then have a mission thing pop up saying "Go pick up EOD and finish the mission". What also would be nice is to have the "standing" ai go into an animation of crouching behind cover and looking, there is actually an animation for that.
How would i get this all to work??
for the first case, you can use a loop that does this for each mine:
- Tells the Ai to move to where the mine is
- When the AI is close, it should go prone.
- When it's close enough, play the "Pickup" animation and just delete the mine (or disarm it)
When it reaches the last mine, just use:
mine setDamage 1; AI setDamage 1
There is actually a demining waypoint in the dev version. So what i could do is have the ai do that, then place a "Move" waypoint on a mine. Would this be easier?
but the thing is the demining waypoint has the AI demine ALL mines
in the dev version
If it's in the dev version, you gotta do with what you have now (especially if you intend to later publish your mission).
There's no way to tell when the next stable will come out
Yeee i guess ill do what i can. The animation scripting idk how to do tho. Cuz of course i want the animations to happen after the EOD AI dies
You can do all of this in one script
is this just a mission you want to play in single player, or something you want to do in multiplayer?
If you're going to go multiplayer with it I suggest you code with that in mind
code? oof. Ye ill focus on singleplayer first XD
step1: name all your mines: mine_x (or whatever you prefer, just make sure you change that in the script too)
step2: sample of the script you should use
//_cntMines: number of mines to defuse
for "_i" from 1 to _cntMines do {
_AI setUnitPos "UP";
_mine = call compile format ["mine_%1", _i];
_AI doMove ASLtoAGL getPosASL _mine;
waitUntil {_AI distance _mine < 12};
_AI setUnitPos "DOWN";
waitUntil {_AI distance _mine < 5};
deleteVehicle _mine;
_AI playMoveNow _pickupAnim; //find this in animation viewer;
};
// now go for last mine and die
_AI setUnitPos "UP";
_mine = LAST_MINE;
_AI doMove ASLtoAGL getPosASL _mine;
waitUntil {_AI distance _mine < 12};
_AI setUnitPos "DOWN";
waitUntil {_AI distance _mine < 5};
_mine setDamage 1; //mine explodes
_AI setDamage 1;// AI dies
_AI2 setUnitPos "MIDDLE"; //second AI crouches
wow
methinks maybe you want to start with a simpler mission idea
Ok maybe i wanna start smaller XD. Question. How do i have an AI go into a permanent animation, unless told otherwise, on a waypoint?
Is it possible for a trigger to have an explosion but only affect the one inside the trigger?
go for explosion effect
I want the EOD to go into the trigger, get blown up by a "mine" but all the other mines must stay.
I'm pretty sure mines are susceptible to explosion damage, so I would fake it - create an explosion "effect" and then delete the mine
How does one create an explosion effect?
I would help you but something tells me you know nothing about sqf, so it's gonna be a waste of time
How about you come back after learning some sqf?
I wonder if you could allowDamage false the other mines
Does someone have an extension thats whitelisted by BE in a3?
Leopard's right Ryan, if you don't know how this stuff hangs together, you're spinning your wheels
its all been triggers
Check the pinned messages in this channel to get started
@proper sail TFAR, ACRE, ACE.. just to name a few
alright cool
why u ask
@torpid niche This is a good place to start:
https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
Thanks ๐
!(_guy inArea markerOrTrigger)```@cunning oriole
how do you find item ID's to add to an array?
which "id" ?
things like..... "G_AirPurifyingRespirator_02_olive_F" for instance
im trying to add modded assets into a CBRN script array to be allowed as a gas mask
typeOf is to get the object's classname
allowed as a gas mask
masks are not "vehicles" Lou
indeed
So typeOf doesn't work on them
im used to id's in other games, sorry for the confusion. gas masks are in a facewear slot. i just looked in equipment, and i noticed that uniforms are marked with a U at the start, vests with a V, and helmets with an H. but i see no section for Facewear ( glasses, etc). im.. trying to explain my thought process.
im still brand new to scripts for arma, sorry for the confusion. im trying to find the name of a modded gas mask on the coding side so i could add it to an array. i just... dont know how to do that.
@tropic willow you could wear it in the editor, then use in the debug console
goggles player
```https://community.bistudio.com/wiki/goggles
thanks for the information Lou
Hmm, i learned mainly from looking into altis script's how things function, that might be a nice way to get things rolling after getting the basics of scripting down
altis scripts?
err Alias*
ah
that was a weird mistake ๐ค
made a horde module script, would it be all right to post a video on it's execution here? It still got some issues which I am fixing currently but I am planning on sharing the script
afaik you can't post videos here not even if you wanted to
Mmm
hint parseText format["<t size='1.6' color='#0067c7'>Loadout</t><br/>The loadout could not be saved because the following items are not allowed:<br/><br/><t color='#ff0000'>%1</t>",_names];
```
How would I get _names which is an array of various items to be pushed as a new line on the hint? So it lists the item on a different line?
So I get like:
Weapon 1
Weapon 2
Weapon 3
...
Instead of Weapon 1, Weapon 2, Weapon 3
@frank ruin
convert it:
_names joinString "<br/>"
Assuming names is an array of strings
what are you trying to do again? Explain in more details
yes
when they leave the area.
who's they?
Why not use triggers?
If it's a mission
Is this a multiplayer scenario?
maybe if you created local triggers for each client it would be better
But if you want to do it using scripts, it is still fine
What is the problem right now?
You said you're stuck?
@cunning oriole
one thing I'm not sure of is whether local triggers consider only local players or all players
Yeah maybe
with an empty trigger of course
I'm breaking my head over this next issue where everything seems to work and all the checks seem to indicate it should work but it still doesnt work and throws an error.
So, lets break it down to something simple as the script itself isnt since it has 3 kind of paths different exexVM's can take by using [] parameters as ID's.
The part of the script that does not work involves setVariable and getVariable.
When one trigger is activated it uses the varnamespace of the trigger to set a variable:
_trigger_horde setVariable ["zombie", _zombie, true];
So in the above trigger the entity ( _zombie) is saved under the _trigger_horde which is the trigger varnamespace.
When another trigger is activated it tries to get this variable using:
_allhordezombies = (_hordetype getVariable "zombie");
_hordetype and _trigger_horde both reference to the exact same trigger varnamespace, I double checked this.
However when the string _allhordezombies = (_hordetype getVariable "zombie"); is run it throws the following error:
Error Getvariable type string expected namespace object group display... etc
So what am i doing wrong here?
[Context]: Trigger spawns in horde, anoter trigger stops and purges the horde by using a foreach on the output of "_allhordezombies = (_hordetype getVariable "zombie");"