#arma3_scripting
1 messages ยท Page 216 of 1
no, no Ai, i did it myself
i dont use Ai crap
Ai crap cant do shit in Arma 3
im just not that good thats all
like i said i always need help
btw thx for your help my brothers @hushed turtle and @fleet sand
Local trigger is going to activate only locally
roger that m8
@pallid palm this is all true, the only thing to add is player units variable name so it activates only "his" radio trigger
if (str player != "delta1") exitWith {};
and of course you have to add this radio trigger to delta1 unit ...
//in initPlayerLocal.sqf
if (str player == "delta1") then {
_tr1 = createTrigger ["EmptyDetector", getPos player, false];
_tr1 setTriggerArea [0, 0, 0, true];
_tr1 setTriggerActivation ["Juliet", "NONE", true];
_tr1 setTriggerStatements ["this", "if (str player != 'delta1') exitWith {}; //bla-bla", ""];
} else {};
In multiplay I'm trying to make a trigger activation display Title Text to all my players at once.
In my trigger I have on activation I have
titleText ["Show this text", "PLAIN"];
but it only shows up for the player who activates the triggers
{ titleText ["Show this text", "PLAIN"]; } remoteExecCall ["call",0];```
something like that
@hushed turtle something wrong ? ๐
and i put it into my initserver.sqf right?
or just into the trigger
put it in the trigger where you had the "titleText"
thanks you're the best, much appreciated
Dunno what are you trying to do. What do you need str for? And of course trigger will activate only for local player when trigger is local
hoping everything works...
@hushed turtle this needs testing ... local radio triggers could have global execution
No trigger has global execution
In the fired event handler for a vehicle weapon, what code can be used to continue running the script if only a particular weapon is fired please?
Check if weapon is the particular weapon
Yes exactly. What would be the code for that please?
@hushed turtle ecxept when they run on the server of course ...
The EH provides the classname of the fired weapon (see EH documentation for provided parameters). You could use an if and exitWith to exit if the weapon is the relevant one.
If (_weapon != "...") exitWith {}
Cheers Dart, Nikko, will give that a whirl.
ok so that seems to work for the hint. The second thing I'm trying to do is make sure the trigger changes the alpha on a bunch of map markers.
This was the original code, but I'm trying to make sure it will execute for all my players and change the markers for all their maps. Will this work (old code without remote exec).
titleText ["NEW LOCATION INFORMATION HAS BEEN ADDED TO YOUR MAP", "PLAIN"];
["marker_6", "marker_7", "marker_8"] apply {_x setMarkerAlpha 1};
Trigger's code runs locally. Global trigger will execute code everywhere, where the trigger got activated, but then all these triggers run separately. Trigger's code may run global commands, but trigger's itself code runs locally.
That didn't work, but I wonder if something extra is needed to define _weapon?
Maybe private _weapon = vehicle _weapon;\ ?
params
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Fired
You need to retrieve the information provided by the EH using params.
yeah thats the weird part is setMarkerAplha says it runs all on machines on a network
@light musk setMarkerAlpha being global i dont see why it wouldnt work
@pallid palm , @hushed turtle no matter, when something is unclear testing is the only viable option, now I made triggers to be local to every player (initPlayerLocal.sqf) and testing will show if they trigger for everyone
roger that m8
I might be wrong on this one. I almost never use triggers. If you create trigger in editor and don't check server only(so, it gets created everywhere). Does this means that trigger will execute everywhere even though only one machine acitvated it?
the other reason is porting the mission to other map is easier ๐
@hushed turtle yes I think
Thanks, now it's working.
the problem is their "on act" field execute the code for everyone (aka globally )๐
and now we try to mitigate this by creating the trigger "locally" on everyones machine ... I hope it will work
Why would it execute code globally though? Global trigger is going to execute under same conditions, so what the point of global execution, when they all execute anyway?
I really don't know why they are made like this ๐คท
and why we don't have the option "local execution" next to "server only" option ...
It doesn't.
What happens is every machine has a copy of the trigger, and that copy evaluates and executes locally. If the condition evaluates to true on every machine at the same time, then every machine will execute the activation code. If it only evaluates to true on one machine, only that machine will execute the code.
The only reason he wants local trigger is, beacause he can't tell which player activated radio trigger. So by creating local trigger for each player, then you know which player activated it
unless needed, if i do end up using a trigger, its server only. put the processing on the server, not the client. each trigger copy takes away performance from every machine its on. also keeps server authority.
* effect of the executed code still depends on the type of command; Global Effect commands will still have effect on every machine even if only one executes them
I don't use scripted triggers. no point.
you can make more performance friendly things via script
there is point, for example to add change view distance to players
Can we create radios using scripting? (like without creating radio trigger) Like radio alpha under 0 in command menu
Scripts can do everything triggers can and more
i use scripted triggers lots in my missions and delete them as well
I don't use triggers all that often but honestly I do feel like they have their situational utility. A trigger condition will only be evaluated if you're within distance where as you'd have to consistently check it in a script depending on what you're doing. Kinda just depends on what you're going for
I really use radio triggers only, that's it, and they are the weirdest ones ๐ง
many of the things I've seen you post can be done with a scheduled loop instead of an unscheduled trigger check when you are in scripting world.
A trigger condition will only be evaluated if you're within distance
Are you sure about that?
It makes sense to use it, as it helps to see where exactly trigger's area is. So, if mission is not randomized, it may be easier to use triggers, instead of scripting something like inAreaArray around positions
Triggers are useful if their dimensions can be used, but even that is not hard to replace in a script.
areas are the only thing i use triggers for (using their area in a custom script). and they are immediately activated at start so they dont tick
This is true for addAction conditions but triggers do not - and can not - work the same way
Why not? As far as I know they work the same way in addAction and that is their largest benefit
Hypothetically, it could look at the options, and check whether this is even part of the expression, and do analysis on it to optimize the checking.... But that it don't and won't.
Because the Condition expression is all that matters. Doesn't matter it is radio triggered if you write something else than this.
Triggers can have conditions that have nothing to do with whether a player is in the area or not. All that matters is whether the condition code returns true, and that is checked however often you've set the check frequency to.
Same with the addAction though no? You can run anything inside of it's condition string
i use triggers to end lose: and win: my missions
You can script mission end just fine
I've ran systemChat inside of trigger conditions and to me I've never seen it run outside of it's given distance
Triggers are really good for scripting beginners
Action are attached to an object, and the condition field is not checked unless you are in an "interactable" place relative to that object.
Exceptions like adding the action to yourself.
A trigger is an object though also right?
addAction legitimately doesn't execute the condition code unless you're in range and looking at the object.
Triggers check their conditions constantly, depending on what the check frequency is set to, and don't care if there's anyone nearby or not.
addAction and triggers are not the same system and you cannot infer things about one of them based on the other.
yes trigger is an object
Action have an inherent engine-based proximity check, triggers do not, that must be satisfies before condition evaluation.
If I set a trigger's condition code to !alive someDude, it will detect someDude's death and activate the trigger, regardless of whether anyone is in or near the trigger.
Dude. You're putting words in my mouth a bit. My entire point derives from that I've ran systemChat inside of their conditions and they would not run outside of proximity.
thats a good thing right
Trigger condition code is essentially a secret waitUntil
But anyway this is all quite academic.. The main point is that by not using a trigger you can choose a different check interval, usually one much greater than every 0.5 s
You can choose the interval for triggers too btw
agree
It sounds like I am entirely mistaken, just making the point everything I've seen indicates the opposite and have looked into this myself specifically for performance
When was that added?
Maybe if this is present in condition, then engine may not run condition code until distance is satisfied?
1.98
Ah, yeah, way past my Arma 3 prime days. That must have been after the Eden editor.
Think I only used triggers for area indication since Arma 2.
I thought trigger interval was present in OFP...
Neither Arma 2 had it, nor Arma 3 in its 2D editor days.
1.98 was April 2020. Eden was added in 1.56 in February 2016
Triggers in OFP have some min, max and avarage delay stuff
I just Saving Private Ryan, Matt Damon aged....
Maybe delayed activation?
lol i remember when OFP cam out ๐
it was awsome ๐
well the way the choppers flew was anyway
So, they dont' have intervals, it's delayed activation I guesss ๐
This still exists in A3
Given how random syntax #2 works, I no longer trust any non-linear usage of min, max average on triggers.
What a piece of history
wow nice lol
Wait do radio triggers not activate globally?
So if I have a task start or complete on a radio trigger will it not complete for everyone?
Arma 3 2D Editor.. how many hours i have spend creating scenarios, it was a cycle of editor><preview
Been a while, but I think radio triggering is only local? But best thing is just to test when in doubt.
On the other hand I found this note in my knowledge base:
Radio triggers works global - not confirmed.
its hard to test that one as a lone person though since it will work for me locally for sure
I usually just start a dedicated using .bat file and join it
but even then it will still work for me if I make the radio call, that I've already confirmed. But will it activate for anyone else in the squad with me
yeah i hate it. Missions work perfectly for me then I put my squadron in them and it all goes to hell cause of fucking locality
Task framework should handle it globally. So, you're good if you are using task framework
Ah okay, confirmed I was wrong here. I had code which spawned a script on activation. Upon the player leaving the trigger range I deleteVehicle on the trigger. Which probably lead to me misremembering that the condition doesn't run when in-fact the trigger itself just flat doesn't exist anymore. Used a base trigger and does appear that it runs outside of distance.
@errant jasper unfortunately no, players change each other view distance with
setTerrainGrid 50;
setViewDistance 6000;
setObjectViewDistance [4000, 50];
ran on radio trigger placed in eden
now I am trying with local scripted ones ...
what do you mean by Task Framework?
Task framework is set of functions to simplfly tasks. I guess if you have created tasks in editor, then they use task framework. At least I hope so
local briefing tabs are also possibility ...
Yes these are local too
oh yeah i just always called them the Task Modules, same thing I guess
Tasks are local by default. Task Framework was created to simplify it all. E.g. you create tasks for certain units and Tasks Framework handles all the networking. Later you call complete funciton from one machine and frameworks handles all the networking and completes task everywhere
tasks are waypoints on steroids ๐ช
Modules in editor call functions. So, people without coding knowledge can do a lot of stuff just in editor.
one trigger can be synced to multiple things right, I'm not losing my mind cause of lack of sleep right.
and if I synch two triggers to one thing it's treated as an "AND" condition or an "OR" condition?
tasks origin is from waypoints and they are the waypoint for players in some way ...
I know what you will say, "there are tasks without position" ๐
It sounds like it's true, but tasks are just information in your task list. It doesn't do anything functionally. It's just there to tell you what to do. Not that waypoints do anything functionally for players though. ๐
I guess you can sync task and waypoint, so when you compelete waypoint, it compeletes task along with it?
in other milsim games ("Dagger Directive") waypoints are very much used to show to player where he must go and what type of task he has to do there
I remember using waypoints in OFP, but at that time we didn't have tasks yet. Only way to display marker to show player's objective in 3D, was to create waypoint
yes, player waypoints evolved into tasks in a3 or a2 I don't remember
These days I don't have a reason to add waypoints to player lead group
I think it's Arma 2 thing
You can delete task's notifications
yes and better disable 3d markers ๐คฎ
yeah that stuff takes away my emersion
i really don't like anything poping up on schreen sep for maybe side Chat stuff
Function BIS_fnc_taskCreate allows to create task without notification, but I don't see function, which could change that on existing task...
https://community.bistudio.com/wiki/BIS_fnc_taskCreate
Hello there, hope I'm not interrupting. I'm working on a helicopter script that needs tiny variations between different different chopper types. I'm currently using
if(vehicle player isKindOf "B_Heli_transport_01_F")
to distinguish between helos, but I'd also like to use the UH-80's variants (CTRG, jungle, Reaction Forces...). How could I go about creating such a condition?
For this do I need the "{" in the front?
{ titleText ["Show this text", "PLAIN"]; } remoteExecCall ["call",0];
[["Show this text", "PLAIN"]] remoteExecCall ["titleText",-2]
aa
i wast sure about double, but from wiki ->
cutRsc ["", "BLACK OUT"];
// becomes
[["", "BLACK OUT"]] remoteExec ["cutRsc"]; // double brackets are needed as the unary command takes an array
if they have a common parent you can use that. most heli variants have a common parent (for example it can be something like B_Heli_transport_base_F, check in config viewer)
otherwise, you can use an array and check all of them:
private _heliTypes = ["B_Heli_transport_01_F", "something else"];
private _veh = vehicle player;
private _matchesType = _heliTypes findIf {_veh isKindOf _x} >= 0;
if (_matchesType) then {
}
Would something like
supportedGhosthawks = [
"B_heli_transport_01_F",
"B_heli_transport_01_tropic_F",
"B_heli_transport_01_sand_F",
"B_D_Heli_Transport_01_lxWS"
];
if (vehicle player isKindOf "supportedGhosthawks") then {}```
work?
ya
!sqf
```sqf
// your code here
hint "good!";
```
โ turns into โ
// your code here
hint "good!";
You don't need call call,
#arma3_scripting message
It's just
Description:
Unscheduled version of remoteExec. The only difference between remoteExec and remoteExecCall is that remoteExecCall will run functions in unscheduled environment.
even with shift-enter I can't send a message after using code tags, wtf
Also had another question, so far, the script I've got adds a scroll-down action for the player using addAction.
It does so only if certain conditions are met: helo speed inferior to 10kps and altitude inferior to 20m. That part works fine, but I'd like to make it so that if those conditions are no longer met, the action disappears and reappears once the conditions are met again.
Can that be achieved without cremating my FPS? I tried using while instead of if, PC did not approve because it just created a million actions, but I don't know how to make it work only once when conditions are detected.
I can post the whole script if need be.
Would waitUntil work?
you only need add that in part of addaction -> Condition
Oh wow I'm getting slow lmao
Thank you!
I've just tried it out in game, got some weird results
The relevant part of the script is
[player, ["action name", {
//do stuff
},
nil, //arguments
1.5, //priority
true, //showWindow
true, //hideOnUse
"", //shortcut
"speed vehicle player <= 25 && _altitude0 <= 50", //condition
50, //radius
false, //unconscious
"", //selection
"" //memorypoint
]] remoteExec ["addAction"];```
It would seem that there is an error in the way I'm trying to have two conditions. I've tried using them separately and it works, but idk how to make them both work together
No it's because _altitude0 isn't defined
(speed (vehicle _this)) <= 25 && {((getPosATL vehicle _this) # 2) <= 50}
not sure if works but try it
Looks fine, though you can just do the vehicle _this once
So what does this mean. Sorry scripting really confuses me.
// toString isn't required, but makes it easier to understand
toString {
private _vehicle = vehicle _this;
speed _vehicle <= 25 && (
((getPosATL _vehicle) select 2) <= 50
);
};
Haven't tested but lazy eval probably isn't worth it there
hmm I always use lazy eval, in which cases you consider using them?
Whenever it's more performant to do so
For simple stuff it takes more time to create the code type than to just run the condition
interesting
Also depends how often the first condition is true.
Yeah
That seems to have done the trick
Thank you all very much, now on to the actual hard part for me
Will probably do it ~~never ~~later tbh
I always use lazy eval. Had no idea creating code would cost performance ๐
What part you dont understand?
That you dont need remoteExecCall call --> {} code?
Because you can do get same result with
[["Show this text", "PLAIN"]] remoteExecCall ["titleText",-2]
Yeah i understand that will work that same but i'm hoping you could explain a little more about what the difference so I can't try and wrap my head around remoteExec
To get all human players in a given side, there is no more optimized implem than (allPlayers arrayIntersect units west) for example?
Probably not. Would personally use select instead. allPlayers < 150 anyway. It doesn't matter unless you intend to run it per frame.
oh no. Just to get survivors at the end of the no-respawn game
Maybe this implem is better since I need them for the 4 sides. Only one browsing of allPlayers..
hum, i want the list, not the numbers only.
There is countSide if you just want figures.
hmm
west countSide (allPlayers select {alive _x})
oh cool i see
what about payable
or as in Ai playable
like if we have Ai playable units with us
use the list that you need.... allUnits|playableUnits|allPlayers|units _side
i guess i need both
In my case it is for TvT, so no AI to be considered here.
oh i see yeah im all PvE
i can only use them 2 there allPlayers playableUnits cuz i might have a chopper pilot that i dont want to include
Who here knows about PhysX?
are player chars PhysX objects?
biki said AI infantry are not PhysX, not sure about player
someone was trying do some physics with the player yday but GetMass return 0 iirc
If they are not PhysX obj, how does gravity in the game work then?
You can also operate on the lists. If you need the AI that are playable but no human inside, you can do (playableUnits - allPlayers)
Cause you do fall from heights in ARMA 3 so something clearly acts on the units
@modern plank i need both
getMass player; returns 0.
Players are not PhysX objects unless they are ragdolled.
There is another, more basic, physics system which is directly part of the engine, unlike PhysX which is a third-party library. This system was used before PhysX was added in Arma 3, and is still used for certain things that don't really benefit from being PhysX/were too complicated to make PhysX.
To come back on this afternoon topic, do you confirm that
missionNamespace setVariable["VAR",1,true] is identical to: missionNamespace setVariable["VAR",1,false] ; publicVariable "VAR";
Implying I need to access the character unit instead of player?
just an answer to your 'not sure about player' remark.
Hmm so how do you counter gravity then, the person was doing setVelocity with the Z being mass * 9.8 * dt per frame
Now that I think about it, they were setting the velocity every frame to 0 since mass was 0. then all they had was their input movement vectors
I assume setting velocity directly like that would directly interfere with the engine physics simulation, as it did appear to be a working 0 gravity
If I put a "hint" into a triggers On Activation field will it show for all players in MP even though "hint" is local?
I thought i read earlier on here the trigger will propagate it out to all clients when it activates.
I don't know how the OP cancelled the gravity in his example, but my character kept falling downwards without explicitly applying opposite force
So just putting this in the On Activation field works?
Hint "Message Here"
all players will see it?
So triggers only run and execute locally?
Im seriously not getting this.
If a trigger is not specifically created only on one machine (e.g. server-only checkbox in the Editor), then every machine will have their own copy of the trigger. Each copy evaluates and executes its code locally.
A trigger may appear to act globally if the condition is evaluated as true on every machine at the same time.
Global trigger will run everywhere, since it exists everywhere ๐
For example, a trigger that's set to simply "OPFOR Present" with this in its condition code, will appear to act globally, because every machine's local copy of the trigger will go "oh, there's an OPFOR there" at the same time, because that's global knowledge. But if you set it to player in thisList in its condition code, then each machine's local copy can activate at different times, because they're only checking for their local player.
makes sense if you still multiply by 0 mass, did you try changing it?
Didn't try, you could find the value experimentally that way though
setVelocity is about it. There's no accessible way of modifying gravity through scripting, and units aren't PhysX objects unless they're ragdolled so setMass has no effect in this context (allegedly it affects fatigue but I dunno how true that really is).
Does that work on Multi-player i thought something about player being null in the MP environment in the multi-player play on the wiki.
player is not null in MP. player always returns the local player unit of the machine executing the command. The potential issue in multiplayer is that Dedicated Server and Headless Client machines, by nature, do not have player units. That means that if the command is executed on those machines, it will return objNull. It's perfectly safe to use on player machines, and in most cases it's "safe" to use on DS and HC as well unless you're specifically expecting it to return a real unit.
should work with 9.8 * dt added to Z velocity per frame, there is no mass needed as it is not a force, this would counter gravity doing -9.8 * dt on world Z every frame
assuming the gravity constant of arma 3 is 9.8 and that the engine physics runs at the same rate as the frame handler
I would assume no, wrt addPublicVariableEventHandler
Humm.
Ok for the addPublicVariableEventHandler, I don't know if the broadcasting flag in setVariable also throws an Event.
But... as for performances/reliability?
AFAIK setVariable broadcast doesn't trigger PVEH. It needs to be PV explicitly
Okay, but I don't care much about the EH. My concern is more about the implem behind, if there is one more reliable or not.
What do you mean by reliable? They both work.
I recall reading from somewhere that publicVariable is considered a priority and broadcasted to the relevant clients as soon as possible, but no idea how that compares to the setVariable broadcast
same here, so I wil lconsider the diff should not be that big.
We trolled you really hard last night with this so I will try to clarify now.
-
There is no mass for your unit, it uses an engine based physics system for non-PhysX objects, which the player [_unit] is
GetMass and SetMass are strictly PhysX commands. -
So you had zero gravity because you set the Z component for velocity by multiplying by zero (_unitMass is 0)
-
You were directly adding to _vX, _vY, and _vZ every frame for input, then feeding that to
_unit setVelocityModelSpace _force, so your input is using model relative vectors. Because your character rotates around in world space, these model relative vectors are rotated the same. If are moving directly left in model space, if you rotate 90 deg left, your velocity is still directly left relative to your model, but it has rotated 90 in the world now. You go from moving in world space what was direct left, to now what was originally directly backwards in world space. -
You should not be reinterpreting your velocity vector like that every frame, instead you should be adding your input vectors transformed to world space to the current velocity, (getVelocity and setVelocity are world space). As of right now, you are treating _vX, _vY, and _vZ as axially locked to your model's basis, which would be [1, 0, 0] , [0, 1, 0], [0, 0, 1]. and directly adding scalar values to these with input. If you added these individual vectors transformed to world space to what your velocity is, you would maintain model relative input movement. However this would result in what are called "tank controls", where almost all games use camera relative movement. (W goes foes forward where your camera is looking, and your character rotates and goes there)
-
From #4, transforming the input to world space would involve the following operations:
_dX = [1, 0, 0] * (inputAction "TurnRight") * dt * 5
_dX = _dX + [-1,0,0] * (inputAction "TurnLeft") * dt * 5;
_dX = _unit vectorModelToWorldSpace _dX
_dY = [0, 1, 0] * (inputAction "MoveForward") * dt * 5
_dY = _dY + [0, -1, 0] * (inputAction "MoveBackward") * dt * 5
_dY = _unit vectorModelToWorldSpace _dY
_dZ = [0, 0, 1] * (inputAction "HeliCollectiveRaise") * dt * 5
_dZ = _dZ + [0, 0, -1] * (inputAction "HeliCollectiveLower") * dt * 5
_dZ = _unit vectorModelToWorldSpace _dZ
// in one pass you could do, instead of 3x
_totalMovement = (_unit vectorModelToWorld (_dX + _dY + _dZ));
#5, would give you model relative input controls (tank controls)
- You can get camera relative input easily by doing this instead:
either
_camForward = getCameraViewDirection _unit; // yaw and pitch
_camUp = vectorUp _unit; // accounts for roll of the _unit
_camRight = _camForward vectorCrossProduct _camUp;
_accelScale = 5 // arbitrary amount of acceleration for the inputs (velocity added per second)
// You would then add your input vectors:
_totalMovement = [0, 0, 0];
_totalMovement = _totalMovement + (inputAction "TurnRight") * _camRight * _accelScale * dt;
_totalMovement = _totalMovement + -(inputAction "TurnLeft") * _camRight * _accelScale * dt;
// repeat for the 6 directional inputs
_unit setVelocity ((_unit getVelocity) + _totalMovement)
// Or, model relative input controls, as discussed before:
// from #5
_totalMovement = _dX + _dY + _dZ; // already transformed from model to world, just add
_unit setVelocity ((unit getVelocity) + _totalMovement);
you have to click outside the code tags and then press enter
See this edited example from yesterday: #arma3_scripting message
Make sure you understand why doing
_unit setVelocityModelSpace every frame with continuously saved velocity component causes your current velocity to be rotated with the model orientation
Also one last note, since I have little ARMA experience, I naively thought vectorToModelWorldVisual commands were doing some camera view matrix in world space. This is wrong and you can disregard any comments regarding it.
Visual vs non-visual commands have only to do with accessing either the linearly interpolated, smooth render frame versus the physics engine (slower updating, more jittery) positions and orientation. They run in different delta times
it's not relevant here
I'm trying to run this script and keep getting an error tha tI'm missing "[]" somewhere can anyone please help:
titleText ["NEW ENEMY LOCATIONS HAVE BEEN ADDED TO YOUR MAP, "PLAIN"]; ["marker_9", "marker_10"] apply {_x setMarkerAlpha 1}; titleText ["NEARBY ENEMY INSTALLATIONS HAVE BEEN FOUND. CONTACT COMMAND ON RADIO CODE FOXTROT IMMEDIATELY!", "PLAIN"];
the first entry is missing a quote
we've all been there
hmmmm now it says i'm missing a ";"
sigh this is rough or i'm terrible at it one of the two
if you're working in the eden editor init fields, they don't like splitting code on new lines
oh interesting
you need to fit your last titleText on one line in the editor fields
It's pretty silly, because I believe you can write file .sqf scripts that do split code across lines and call the script using execVM perfectly fine
what is execVM?
ok thanks, much appreciate all the help
going through the arma 3 wiki is kind of a nightmare to find exactly what you are looking for, I was gonna try to explain more but can't find relevant page
this right here is kind of important
https://community.bistudio.com/wiki/Initialisation_Order
anyway rather than working in the editor, it may be better to define these behaviors inside a script files and use execVM, or create your own modules. Modules can do even more things.
But you need to know the init order, or you may try to reference something that isn't defined yet
And rather than typing everything in init fields I rather use, Advanced Developer Tools and debug console to test stuff
Editor code fields don't mind code on new lines, it's just tricky to do it because Enter is also "close the attributes window" and there's no scroll bar. If you're going to do it, it's easier to write it externally and paste it in.
If you have the time to figure it out (tricky at first but once you get the hang of it it's super easy), I'd recommend using functions rather than execVM: https://community.bistudio.com/wiki/Arma_3:_Functions_Library
Functions are more flexible and more efficient.
I'm not sure the behavior but I do remember it being annoying, I never used enter key in my scripts, I just type until the end and it makes it go to a newline once the end is reached. I guess that newline is different than pressing enter (which annoyingly closes the attribute window)
yeah that sounds infuriating
Text wrapping to the next line to fit the field is just a visual thing, it's not a real new line and makes no difference to how the code is executed
Hmm that doesn't track with my experiencewhere you get stuff like
titleText ["NEARBY ENEMY INSTALLATIONS HAVE BEEN FOUND. CONTACT COMMAND ON RADIO CODE FOXTROT IMMEDIATELY!", "PLAIN"];
syntax error because it stops parsing after RADIO CODE and doesn't make sense
kept happening to me
though it's possible I was using shift + enter, or enter and don't recall
Init fields are tedious to work in for several reasons, but I promise you, the automatic text wrapping does not cause technical problems.
If you were manually inserting line breaks in odd places, that could potentially cause issues, like if you did it in the middle of a variable name or a command name or something, because it would be treated like a space.
One thing init fields (and all Editor code fields) do not support is comments. Comments require the code to be preprocessed, to remove them before the game tries to execute it, and Editor code fields don't go through the preprocessor. So if there's a comment in your code, the game will try to execute it and get confused.
And that behavior is definitely unnatural for many as there are vast amount of languages where whitespace doesn't matter at all
Yeah I also noticed that there is no preprocessing
Whitespace largely does not matter. However, the presence of any whitespace does indicate a gap between words. You can put as much space as you like, tabs or spaces or linebreaks, in any place where a whitespace is valid, but you can't add it in the middle of a word if you want the game to still recognise it as one word.
_varName setDamage 1; // Valid
_varName setDamage 1; // Valid
_varName
setDamage 1; // Valid
_varName set Damage 1; // Not valid
_varName set
Damage 1; // Not valid```
Also it does matter in strings because strings are literal text, so if the game wants "PLAIN" you can't write "P L A I N", because those whitespace characters are taken literally.
for "_thanks" from 0 to 10 do {_appreciation = _thanks spawn {hint "thanks dedmen"}}
i know but i like call rem better because its instant
well only if we have no sleeps: in the function right
cant have sleeps in unscheduled code
yes
roger
because its scheduled
roger m8
thats the way i see it if there is sleeps in the function then i use spawn and if no sleeps then i can call
call doesnt actually change if its scheduled or not. you can use https://community.bistudio.com/wiki/canSuspend to check which environment your code is running
canSuspend = scheduled
How is it instant? 
it should be unscheduled and those scripts wont sleep...
call just rips right though the function fast as hell
like in the blink of a eye
oh it will tell you if your not doing it right: ๐
believe me i know ๐
lol
i messed that up a few times befor i got it right ๐
Yes it's unscheduled, because call is a script command, and remoteExec always executes script commands in the unscheduled environment.
Because all script commands run unscheduled anyways, you might as well omit call ...
[{ systemChat "Test"; }] remoteExec ["call", 0]; //call and systemChat run unscheduled
"Test" remoteExec ["systemChat", 0]; //systemChat runs unscheduled
```... unless you need to remote execute multiple commands in one go.
Then again, if you do need to remote execute multiple commands in one go, you might as well put them into a proper function and remote execute that function. If the function needs to run unscheduled, use `remoteExecCall`, if it needs to run scheduled, use `remoteExec`.
that's the way i do it cool thx m8
it makes sense call runs in unscheduled because its a command - i forgot that
if running rem exec function though you can choose between remoteExec / remoteExecCall to determine if it can suspend/be scheduled
Hello Gentlemen,
Here is part of my initPlayerLocal.sqf. It's task is to return gear to player on Respawn and return him to his side and group to which he was attached at the start of the mission.
_Target setVariable ["TAG_StartLoadout", getUnitLoadout player];
_Target setVariable ["TAG_StartSide", side player];
_Target setVariable ["TAG_StartGroup", group player];
_Target addEventHandler ["Respawn", { private _loadout = player getVariable "TAG_StartLoadout"; if (!isNil "_loadout") then { player setUnitLoadout _loadout; }; }];
_Target addEventHandler ["Respawn", { private _side = player getVariable "TAG_StartSide"; if (!isNil "_side") then { player join createGroup _side; }; }];
_Target addEventHandler ["Respawn", { private _group = player getVariable "TAG_StartGroup"; if (!isNil "_group") then { player joinSilent _group; }; }];
Gear thing works great and without issues, but side and group thing are not. Almost all the time, players are in Civilian faction instead of BLUFOR or OPFOR, and they are attached to a group of dead Players and AI and I cant find way to fix it.
Does anyone have any idea how this can work?
i would start by checking ```
player getVariable "TAG_StartGroup"
also player maybe null at the time but probably not here because the gear works
just put that line in debug console ^^^^
Is this usage of CT_WEBBROWSER despicable
5
7
1
Yes
1306278458489569340
catnod
true
is there a 2D point rotation command? I have script implementation but could use faster engine command
And what about group itself, my player is not joning his group at all?
I will check out what it does return.
Unit's side depends on it's group side. If you join blufor unit into an opfor group, then unit will behave like opfor unit, despite side unit returning blufor
If I get you right, I can even skip joining side and just make sure I join player to the right group?
Joining side? What?
If you take a look at my code, I first have variable that stores Player side that he is on, on the beginning of the mission. Than after player respawns I first try and change his side from CIVILIAN (he is always respawning as CIVILIAN) to side he was on at the beginning of the mission.
_Target setVariable ["TAG_StartSide", side player];
_Target addEventHandler ["Respawn", { private _side = player getVariable "TAG_StartSide"; if (!isNil "_side") then { player join createGroup _side; }; }];
Ah, I see. You don't need the second EH then.
Also why do you have same 3 EHs? You could put all of that code into one EH
Yep, thats true.
Ok, I will give it a try to see what's going to happen.
player join createGroup _side;
player joinSilent _group;
This would leave empty groups in the memory I'm afraid. I don't think engine would remove them automatically
I am not sure what do you mean by this?
Also, basicly I am not sure, why my players are respawning as civilians when they whould be on their initial side..
They respawn as whatever unit they selected in lobby
Joining group just does that, it joins the group. It won't change anything else. Units will keep their voice, their gear, their head and so on.
Only side will change, if different
Not sure if scoreboard will reflect the side change though
You see, that is problem, in my case BLUFOR/OPFOR/INDFOR units respawn as Civilians for some reason, that is why I added side thing.
When you create group, join unit into it and and then join the unit into a different group. The first group won't get removed and later you could have number of unused groups. But you removed that code anyway right?
Or joining group is not actually working.
Don't know what spawn are you using there
Did you configure spawn type in editor under multiplayer settings?
respawn = 3;
Respawn on marker, set in descritpion.ext
Strange for units to change their side on respawn
Possibly, problem is createt with this:
_Target setVariable ["TAG_StartGroup", group player];
_Target addEventHandler ["Respawn", { private _group = player getVariable "TAG_StartGroup"; if (!isNil "_group") then { player joinSilent _group; }; }];
Why I think so, its because all players that respawn are joining empty civilian group, group in which are dead AI's etc.
At the same moment, from Zeus they are displayed for example with green (independent) group icon, but when I open their group settings and check side, it is civilian.
Here is a screen from mission yesterday, and you can see that some IND players are grouped with dead bodies.
You should be using params:
this addEventHandler ["Respawn", {
params ["_unit", "_corpse"];
}];
Also this EH runs only on local machine
Try this:
_Target setVariable ["TAG_StartGroup", group player];
_Target addEventHandler ["Respawn",
{
params ["_unit", "_corpse"];
private _group = _corpse getVariable "TAG_StartGroup";
if (!isNil "_group") then
{
[_unit] joinSilent _group;
_unit setVariable ["TAG_StartGroup", _group];
};
}];
Don't know what unit is player in "Respawn" EH
You could debug ->
params ["_player", "_didJip"];
_player setVariable ["FRK_startLoadout", getUnitLoadout _player];
_player setVariable ["FRK_startSide", side group _player];
_player setVariable ["FRK_startGroup", group _player];
systemChat format ["Start side: %1, Start group: %2", side group _player, group _player];
_player addEventHandler ["Respawn", {
params ["_player", "_corpse"];
private _loadout = _player getVariable "FRK_startLoadout";
systemChat format ["IsNil _loadout: %1", isNil "_loadout"];
if (!isNil "_loadout") then {
_player setUnitLoadout _loadout;
};
private _group = _player getVariable "FRK_startGroup";
private _side = _player getVariable "FRK_startSide";
systemChat format ["Respawn side: %1, Respawn group: %2", _side, _group];
systemChat format ["Player side: %1, side group player: %2", side _player, side group _player];
if (!isNil "_side") then {
systemChat format ["Side is not nil: %1", _side];
if (!isNil "_group") then {
systemChat format ["Group is not nil: %1", _group];
if (side _group == _side) then {
[_player] joinSilent _group;
} else {
_group = createGroup _side;
[_player] joinSilent _group;
};
} else {
systemChat "Group is nil";
_group = createGroup _side;
[_player] joinSilent _group;
systemChat format ["Created new group: %1", _group];
};
} else {
systemChat "Side is nil";
_group = createGroup (side group _player);
[_player] joinSilent _group;
systemChat format ["Created new group %1 to %2", _group, side group _player];
};
}];
and joinSilent need to be [] , it expect array not object
I will try to give it a shot later today, thank you guys ๐
is there a way to dump all classnames of items and weapons from my server?
which items you mean, the ones players have?
GA/LE
But I wonder why anyone would run it. Its for adding it into your action menu trigger list, nothing else?
It has no multiplayer effect, also the mine is not "owned" by the player. Multiple players can own the same mine
I don't see any point of running that command when you're gonna trigger the mine instantly anyways
private variables, are local variables in scopes. Which you cannot read with getVariable. So no, not the same
You can with hashmap objects
"Entity" is the name you're looking for
But in same vain #arma3_scripting message, " private unit variables" does not exist.
unit variables cannot be private, because they are not local/scope variables
I think this is just a big mixup of confusing "private" with "not-global"
I meant private variable as left side argument for getVariable, when that private variable references object for example
Anybody have installed the Advanced sling load mod? Into multiplayer server?
Want to have it as server mod but idk its not working
Ah, then the answer is. The script command doesn't know anything about whatever variable you pass to it (which is why isNil takes a string), it only knows the value that was inside it.
It doesn't know if its local, private, global, network-published, result from another command (like a getVariable)
I like to use code in isNil rather then string, even when just checking if someVar is nil. It there anything wrong with it?
Last update: 2016 ๐ I advice not to use it, it can cause some AI bugs.
Any recommend new ones? I like to have mod to slingload everything i want with like the deploy ropes system for setting up FOBs and that stuff
Which is technically just array or hashmap anyway. Used in createHashMapObject as template to create hashmap object. And hashmap object is just hashmap with some special functionality, which some special commands use. Really, very "workaround" way of making OOP.
Am I wrong? I don't think I'm ๐ค
It is not atypical in dynamic OOP languages. Many scripting languages, eg. Python and JS are basically fancy dictionaries with special keys.
Though Arma's version look more "prototypical" than class based.
Though, unless I am mistaken, there is no way to delegate to "super"-method in SQF's implementation ?
private _baseDecl = [
["#type", "Base"],
["foo", { "bar" }]
];
private _subDecl = [
["#base", _baseDecl],
["#type", "Sub"],
["foo", {
// How to run call _base.foo ?
}]
];
That's because these object are just hashmaps. Hashmap gets copy of all methods from parent, otherwise it would be horrendous to work with any non-overlaoded method
Well if is just copied into sub-objects, then you are right, this can't be called OOP.
Just dictionaries with some factory command.
But no, that isn't right because the example have delegated "chain-called" constructor/destructor, so there is some delegation
It's just not accessible to user-level methods.
Normally you can refer to public and protected super methods from child object, even when child object itself does not have the method (it just has it because of inheritance). But because here we work with hashmaps, then hashmap needs to have copy of all super methods, otherwise you would have to do something like child.super.method to access inherited method, even when child didn't overload the method
It is alot more expensive
Well I would hope that the special call variant did the super-look check to find the proper level for the method.
But I guess there is no such thing.
isNil with varName, looks up varName by string.
isNil with code. Creates a new code context, a new scope, a new variable namespace for the scope, executes the script instruction to get the variable, which looks up varName by string, then destructs the scope, destructs the variable namespace, destructs the new context.
Someone some time ago was saving copy of super in one of the members to be albe to access it.
isNil with code is much more complicated then
Yeah HashMapObject at the end, is basically flattened down. Because I didn't want to pay the cost of storing like.. all methods as array.
Or have a hashmap for every base-class in every instance which gets super messy

I don't know if you're talking about some internal definition of "entity", but setVariable certainly works on objects that aren't returned by "entities".
It even works on map objects until they get streamed out.
arg first, eff second please ^^
I copied from https://community.bistudio.com/wiki?title=setDamage&oldid=376278 ๐
We use addOwnedMine for reconnecting respawned players with their mines, but it's old code so I don't remember whether it's actually necessary.
I guess we still could save super as a child member and handle all of that functionality in constructor manually, if we really needed to.
Args global but effect local? So adding a mine on Machine A to unit X and then running removeAllOwned X on Machine B will still have it owned by the unit on machine A ?
The obstacle is I think that the data and code share the same table. For super to work the methods would have to exist in their own object (like JS=.prototype, or Python metaclass), which we don't have.
Assuming that removeAllOwnedMines is also GA/LE, it'd just remove the local actions for that unit.
So yes.
I meant just store entire super hashmap as member. That way you could access it's members, if for example you've overlaoded a method. But of course this would likely lead into storing same stuff multiple times.
You would to run your own dispatch call, I guess it could work, but at that place not sure it is worth it.
Assuming code type is passed as reference, then one could create child method, which would just refer to super method to create inheritance. That might not be that bad. Well the problem with it is, once you call super method like that, it will also have access super members and not child members. So, guess it won't work
It's just a hashmap after all
What I've described here
Well child members are still there in self.
No, sorry
is there a script to change the scale atribute in the eden, I am using 3den enhanced
I found it
ENH_objectScaling
hello all: can someone give a link to the key press wiki like if i want to set lets say the J key to spawn a function
does anyone of a script i can use with an AA vehicle to have it shoot into the air as if targeting random air assets
params doesn't under nil as optional value?
Entity is the game development term for what you call objects
yeah but I don't like to use it for SQF because there are commands that seem to define it differently.
Just for curiosity, I tried doing JavaScript style prototype inheritance.
Base_Proto = createHashMapFromArray [
["#proto", nil],
["#new", {
_self set ["myvar", 123];
}],
["foo", {
"bar"
}]
];
Child_Proto = createHashMapFromArray [
["#proto", +Base_Proto],
["baz", {
["foo"] call OOP_SuperCall;
}]
];
OOP_New = {
private _self = +_this;
[_self, "#new"] call OOP_Call;
_self;
};
OOP_SuperCall = {
params ["_method", ["_args", []]];
[_self get "#proto", _method, _args] call OOP__Call;
};
OOP_Call = {
params ["_self", "_method", ["_args", []]];
[_self, _method, _args] call OOP__Call;
};
OOP__Resolve = {
params ["_context", "_name"];
if (isNil "_context") exitWith {[false, nil]};
private _entry = _context get _name;
if (isNil "_entry") then {
_context = _context get "#proto";
[_context, _name] call OOP__Resolve;
} else {
[true, _entry];
}
};
OOP__Call = {
params ["_callContext", "_method", "_args"];
([_callContext, _method] call OOP__Resolve) params ["_found", "_body"];
if (not _found) then {
throw "Method not found";
};
_args call _body;
};
aChild = Child_Proto call OOP_New;
systemChat str ([aChild, "foo"] call OOP_Call == "bar");
systemChat str ([aChild, "baz"] call OOP_Call == "bar");
// Below doesn't follow prototype chain though.
systemChat str (aChild get "myvar");
Anyone here mess around with arma 3 extensions, specifically the RVExtensionFillTextureSource function?
The wiki says that BIS_fnc_taskCreate is a GA. So why then does that command not create tasks on the client or local host when I place that command within a function call: call FoxClub_fnc_create_tasks;?
I then tried to remoteExec the function (remoteExec ["FoxClub_fnc_create_tasks", 0];), which did create the tasks, but there were bizarre errors. The parent task, which normally has a title and description, was empty of text. And some of the tasks had default icons instead of the ones I chose for them.
This all works fine in SP.
I added some 1 second sleeps between the task creations and that seems to help. They are ordered correctly now with the correct icons. Why did adding sleeps help?
Are you re-using the same task ID or something?
No, and https://dontasktoask.com/
Question about JIP: Is there a way to test JIP code with a local server instance from Eden?
Host a listen LAN server in the menu, run Eden there, then when needed run second instance of the game and join your own server (127.0.0.1)
host a listen LAN server in the menu << don't get it.... which menu?!??
multiplayer menu
Not sure to understand. Do you propose to start a local server with Eden, then join with another cli instance?
It's function, not command and it needs parameters. You call something like:
[/*params here like owners, title, description*/] call BIS_fnc_taskCreate;
Maybe you forgot some owners?
I have script creating 6 tasks in row without any issues and no sleep.
Only runs on server
Maybe you're using same ID like Jordan suggested
yep via LAN
anyone knows? maybe its possible to use 3D vector math for 2D purposes
With battleye turned off, you can open multiple instances of the game @modern plank
it is also Global Effect meaning that if you remote execute it on everyone, there will be as many calls as there are machines involved
execute it once, on the server.
Bypassing steam? Cause steam allows only one instance, no?
you can do matrixMultiply but It should be slower than a correct script
thx ill keep that in mind
should just be
_point = [x, y];
_theta = 90.0; //sin cos uses degrees
_costheta = cos _theta;
_sintheta = sin _theta;
_point = [x * _costheta - y * _sintheta, x * _sintheta + y * _costheta];
I would use the matrices if you wanna rotate around an arbitrary plane, idk what ur doing
otherwise the matrices have a lot of unnecessary repeated operations, and you must account for floating point matrix creep, which is a lot more calculation
yeah thats what im using now
If there's quaternions available in the scripting, I can't find it on wiki
It would be fun to make your own quaternion API
im trying to use the matrix. and i got this from objectmapper: ```sqf
_rotMatrix =
[
[cos _azi, sin _azi],
[-(sin _azi), cos _azi]
];
_multiplyMatrixFunc =
{
private ["_array1", "_array2", "_result"];
_array1 = _this select 0;
_array2 = _this select 1;
_result =
[
(((_array1 select 0) select 0) * (_array2 select 0)) + (((_array1 select 0) select 1) * (_array2 select 1)),
(((_array1 select 1) select 0) * (_array2 select 0)) + (((_array1 select 1) select 1) * (_array2 select 1))
];
_result
};
[_rotMatrix, _pos] call _multiplyMatrixFunc
I tried ```sqf
_rotMatrix matrixMultiply [_pos]
swap -sin azi and sin _azi in _rotMatrix?
i don't know why matrixMultiply would give you something different, is there syntax error or is it a diff result?
that didnt work. the values returned are oddly small and return my objects get placed in same pile
no syntax error
it actually returns empty array
yep, _pos needs to be in this format btw, [[x],[y]]
array of arays with single elements to represent 1 x m or n x 1 matrix
ok i tried ```sqf
_rotMatrix matrixMultiply [[_pos # 0],[_pos # 1]];
what is _pos? is it just [x, y ,z]?
yes
ah yeah
i'm not sure, what's the error?
does _pos * 0 make it like this [[[x]], [[y]]]? that would be bad
actually theres no error if i dont try to do something with the result
the result is also in [ [], [], []] format
ok
Also I wanna point out your implementation is actually wrong if you haven't swapped -sin azi and sin azi
k
yay it works now ๐
the final code: ```sqf
_ret = _rotMatrix matrixMultiply [[_pos # 0],[_pos # 1]];
(_ret # 0) + (_ret # 1)
thx a lot for the help! i dont want to argue but i got that _rotMatrix from BI object mapper so it should be good?
Oh I think it's because A3 uses left hand coordinates
I use my explanations for right hand coordinates
Idk what is BI object mapper tho
BIS_fnc_ObjectsMapper you can check it out from functions viewer. it places compositions
should just be that A3 is left handed, I know Reforger is left handed but I'm just guessing for A3
Your rotation was correct if it is left handed, otherwise it's just the transpose for right handed which is what I had
Instead of transposing you could also just negate theta to the function calls to get the effect of the other handed coordinate system
It just affects the rotation direction, clockwise or counter clockwise
those things are bit over my head ๐ but im glad its working now
have to say the new function i made isnt any faster than the previous so thats a failed attemb
A3 uses right hand (in scripts), but engine is left
That is hurting my brain to understand
I mean e.g if you use ai setPos [x,y,z] in your script, engine converts it to [x,z,y] internally.
that's not relevant tho, just extra info. for all you care A3 is right handed
Yeah that's what I wondering
I usually think of swapping left to right handed as negating an axis (x-axis in my brain)
I see that swapping z and y does the same thing
there's nothing really to talk about except that I think #arma3_scripting message would be faster because you don't need to access in to arrays as much, I don't know how the scripts do stack vs heap allocation either
The array of arrays has potential to be inefficient memory redirection, but it's beating a dead horse for such a small implementation
I would be curious the real number of CPU operations
Notice in yours that you repeat the same (array select #) instead of having perhaps a local value
And I save two math operations by not calling sin and cos 2 extra times
im using the performance tester to see which function is faster but they all are around 0.005 ms
ya i tried this too
I don't know anything about the performance tester precision especially for one run. You should try like, 100,000 times if it lets you
it runs the code 10k times
here is left vs right handed btw
thx i understand the axis are different just not good with matrices
no handedness with matrices just column major and row major.
on script side it looks column major
ok
col major: matrix * column vector -> column vector
row major: row vector * matrix -> row vector
The order matters and the matrices are the same but transposed
Done beating the dead horse for now, gl to you
thx, i appreciate it ๐
Extension talk is usually in #arma3_tools , because all the "real" programmers are there ๐
Ask your question in detail please
Having a frustrating time with the dynamic simulation system.
I'm making compositions for an invasion, including a MI-6 full of troops - so we're talking like six full squads of infantry. Mostly automated, just place the invisible helipad and the helicopter spawns in way overhead then instantly TPs to where I want it to actually start, full of troops.
The problem is, the last squad or so doesn't seem to be simulated, leaving them hanging in the air over the TP spot, and the helicopter once it's in range of any landable spot immediately sets down and offloads just those troops, which can cause issues for obvious reasons.
The only way to circumvent it I've got so far is to make sure my Zeus-unit is nearby (the framework my group uses teleports the Zeus unit whenever you exit the interface) the invasion corridor spot as a player to activate all the units at moment of inception, which works but is tedious .
I'm debating just extending the script to spawn in the units once the helicopter is on it's final approach, but dont want to deny any lucky players the killfeed, yknow?
At the same time, I can't afford to just disable the dynamic simulation system, for performance reasons.
You can disable dynamic simulation only for the few units you're having issues with?
You can at least do that with Eden compositions, there is a checkbox for it
Just enable the simulation once you spawn in the helicopter
The thing I don't understand is. Why does it only happen for one group inside the helicopter. DS should work all groups inside the helicopter the same way.
That's what was throwing me as well, everyone else worked fine except for the last squad (and a few units of another, usually around 14 in total.)
I ended up just createUnit'ing everyone into place at the same time I had the helicopter drop speed for a smoother AI landing, so it works out. \
I got it figured out, I found the gif MVP you posted aaaages ago. Turns out I was just missing some params
what data point can i pull a vehicles current reserve ammo from?
magazinesAmmo, magazinesTurret etc.
Apparently these return the loaded magazine as well, so you might want to subtract those. Best command I can see for that is the alt syntax of weaponItems.
okay so, finally got around to looking at the code, and put it together myself so I fully understood it but it's throwing a miss ; error at me and I just do not see where
this addEventHandler ["HandleDamage", {
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitPartIndex", "_instigator", "_hitPoint", "_directHit", "_context"];
private _health = getVariable ["VamHealthState", 100];
_health = _health - _damage;
if (_health > 0) then {
setVariable ["VamHealthState", _health];
} else {
_unit removeEventHandler [_thisEvent, _thisEventHandler];
_unit globalChat "My unlife will not end like this! I will not suffer my final death like this!";
};
}];```
Your setVariable and getVariable are missing the _unit parameter on the left side.
I caught that on the setVariable but not the getVariable, thanks.
that being said it seems not to be working.
how does one apply that?
_damage = 0?
See the code I wrote.
No, just 0; at the end of the function.
In SQF, code returns the value of the last statement.
And setVariable returns nil so that won't block damage.
(HandleDamage needs to return a number to override)
ahhh okay so handle damage is just going to take the last number in the function as the return?
that isn't attached to some other bit of code that is
or is it that it takes the final "number" I forget the actual word that any code shows in the event handler
It takes the value of the last statement.
gotcha
You should always return a value explicitly, because otherwise you can get weird bugs where you don't notice that the last statement returned something.
For example if the last statement was an addAction, that would actually override the damage because addAction returns a number.
ahhh okay
speaking of, if I wanted to apply this through an interaction how would one do that?
_damage is resulting damage by the engine, not the amount of damage dealt
what does this mean?
it means total amount of damage
The _damage value provided by the HandleDamage EH, and which you can modify by returning a number at the end, is the total damage for the selection which results after this hit damage is applied - not the delta damage inflicted by the hit.
params ["_unit", "_selection", "_damage"];
private _currentDamage = _unit getHit _selection;
private _hitDamage = _damage - _currentDamage;```
You're setting damage to 0 though, so they're the same.
iirc selection can be empty
Also, it is per selection in every HandleDamage event, which is sometimes the overall damage for the unit (selection is ""), but often is not. It can be just the damage for one particular selection, like an arm or something.
Ignoring the selection is probably fine here though. Just means that it's counting the sum of part & general damages.
The end result is that if you shoot the guy a lot, he'll eventually start taking damage.
The more likely problem is that you'd want to use pre-armour damage, and that's pretty challenging.
If you want to do somewhat accurate maths with the _damage value, I think you have to pay attention to it. They're trying to subtract the hit damage from their custom health pool, which means they need to find out what the hit damage actually is, and in order to do that they need to get the current damage, and the only current damage value that will give a helpful result is the one for the same selection.
They're all 0 because it's returning 0.
Worrying about armor at the scale of health these guys have isn't a matter, besides most of them don't use it, and it really doesn't need to be super accurate just light weight.
Well, assuming that the unit isn't injured before it gets the shield.
Oh I see
this would be applied before the op even starts, but this is partly for pub zeus so having some way to apply it to a players unit without having to put it in an innit is useful.
it's more important they can take 15 guys shooting them for a couple seconds than it is that it's properly calculated.
that being said this isn't important for a while.
It is worth noting that if the unit has taken damage already then you'd want to setDamage 0 when you add the shield.
Otherwise the damage taken might be scaled up drastically.
I see.
(because _damage is the current, not the added damage)
ahhhhhhhhh I see.
Only on the first hit, since first hit would heal him, because it returns 0 ๐
hmm, I guess the input damage does get capped at 1 too.
...probably
(_damage certainly isn't)
I would assume not, as at 30 vamHealthState it only takes a couple shots
From a 5.56 rifle
The FIA one
Same unit without the script is one shot
hit value of 5.56 is about 9. That's divided by armour to get the part damage.
If you don't have armour then it's just the uniform of 2.
Humans are very fragile in Arma.
(1 on the body is a kill)
In Antistasi we rescale the base armour so that unarmoured targets aren't a one-shot.
(except with large stuff)
yeah the math works on it not being capped to 1 then
I think the part damage (like the result of getHit) is capped to 1. _damage in HandleDamage isn't though. It'll return 17 or whatever for a 50cal hit.
Oh, I have a little table here:
unarm lvl2 lvl3
50cal 17.5 2.5 1.94
MX 4.7 0.69 0.53
9mm 2.65 0.38 0.29
Damage unit can have ranges from 0 to 1, same for body parts
At 0.5 damage on legs you're limping
does anyone happen to know how to detect incapacitated message in HandleChatMessage ? wiki says chatMessageType 2 is the kill but what about the revive stuff?
thanks for the help yall, I'll make sure my players know to appreciate the geniuses in this discord for their ability to hunt vampires
yeah i looked into it but im breaking my code currently when trying to assign to do the below.
private _mags = magazinesTurret [_turret, false];
_turret is assigned earlier and works for the rest of my code to show current ammo etc and its being called here
private _label = format["%1 [ %2 / %3 ]", _wName, _ammo, _mags];
if i take out the first section and remove , _mags and the %3 from the label it works fine.
fixed it, it was missing the vehicle object from the declaration of _mags
only problem is that its showing amount of all mags left, not currentweapon
No, there are 5 tasks with different names under a parent task.
My mistake. I am correctly calling it on the server (2).
It's weird. The day before it was working just fine. I booted it up yesterday and test again, and it did that weird behavior. I do get an error message during the process for no picture found. I'll address that later. Could that be hindering the process?
It seems like putting the sleep there keeps the subtasks from getting processed before the parent task, which goes against my current understanding that lines are processed one by one.
Parameters all look good. Owners, etc.
Well if sleeps are in there you are doing something weird like running them scheduled or something.
Wrapping multiple task creation individually in remoteExec is a no-go of course.
Tell me more about this please. This sounds like what I am doing I think. I remoteExec a function that creates 5 tasks.
There is not even reason to. Given the fact that task framework handles networking
Functions are executed in the scheduled environment; suspension is allowed.
Suppose you do remoteExec 5 BIS_fnc_taskCreate (perhaps indirectly). That is "equivalent" to basically spawning them
... spawn { [...] call BIS_fnc_taskCreate;};
... spawn { [...] call BIS_fnc_taskCreate;};
... spawn { [...] call BIS_fnc_taskCreate;};
... spawn { [...] call BIS_fnc_taskCreate;};
... spawn { [...] call BIS_fnc_taskCreate;};
Without examining the source in detail for BIS_fnc_taskCreate, I would expect it to manipulate some machine global state that could get messed up.
hi
been trying to make a heli to land on a invisible helipad and want it land and shut off its engine but i can't make them do the last part
tried heli1 engineOn false;
as Jouklik says you don't even need to use remoteExec.. But there is a difference between remoteExec a function that does 5 calls to BIS_fnc_taskCreate versus remoteExec'ing 5 individual calls.
Quick and dirty fix would be to set his fuel to zero
https://community.bistudio.com/wiki/landAt#Syntax_3
I think "Land" shuts down its engine
in this case its a heli
Would it be okay to just call the function then? Like call FoxClub_fnc_create_tasks;
weird,
heli setFuel 0;
didn't work either
i put it in the LAND waypoints Activation
Well I don't know how that function is implemented. You implied earlier that putting the call inside your FoxClub_fnc_create_tasks breaks it, which suggest something strange is going on in there.
Yeah I just tried doing a call of the function and the tasks did not create at all.
I would put task creation into initServer.sqf
How would I go about running the code in there when the time comes? About 30 mins into the mission, when the players get to a certain spot I call the funciton, as it is now.
I see
I meant for tasks created at the start. If you need to create task later, then you need something else
But I don't see a point in remote executing some function to create tasks.
For some reason they don't create unless I remoteExec it. I must be doing something wrong.
In theory it should work even if you created them on client. Only on one client. Task framework should handle the networking
no luck with this
You need to spawn if you want a sleep there.
IT IS for helis
even having 1 of them didn't work either
did you even try it?
don't you need a Condition Expression?
sync'd it to heli as the trigger owner
Good catch, it should say this for owner only present to work.
Okay I've narrowed it down some. Here's the full picture of what happens:
- I call my function from the activation field of a server-only, trigger.
- I create the tasks in the function and if I do it this way, they do get created in order without the weird issues I explained before. Hooray! Except I don't want to do it this way.
I'm trying to do this differently because I want the parent category, of the tasks to be at the bottom of the task list. As far as I know there is no way to specifically order them. They are ordered by creation order. So what I have been doing (that apparently won't work) is:
- Use
BIS_fnc_deleteTaskto delete the tasks at the top of the function (for the ones I want reordered) - Then create them again with
BIS_fnc_taskCreate. This is the part that doesn't work from the function. They get deleted just fine, but I can't create them again. Except I can create them from the debug console. I'm not sure why it works from there but not the function.
@hushed turtle
I made a workaround. Instead of trying to re-create a task that was deleted I just created some tasks with a new name and kept the description and title the same. The player won't know the difference.
Is there any issue with calling a function from inside a function?
Does this X mean "This is a bad idea." or "No, there isn't any issue."?
magazinesTurret needs to know what vehicle you're referring to. Check the wiki again.
turret paths are just arrays of numbers like [0,1]. They don't contain any reference to the vehicle.
Are you re-using the task ID when you create the task again?
Yes, I figured no problem since I use the remove task function. The name shouldn't exist anymore right? But I guess it does.
yeah i got it now ๐ ty
Yeah don't do that.
After you delete a task, never touch the ID again :P
This was the source of most task bugs in original Antistasi.
Obey that one rule and the task framework is pretty stable IME.
Why doesn't deleting tasks modules work? I use:
deleteVehicle testTask;
But I can still see the task in my journal.
Given that I have never created a task module, I would guess that it's just pushing commands to the task framework, and deleting it doesn't do anything.
Guess I need to convert that one to the task framework now that I know how to use it.
Eden and zeus need modules to do things and that's often the only reason that the module exists. It's not fundamental to how the logic works.
So far I'm starting to get the feeling that scripting tasks and triggers is better than using the editor placed versions.
Triggers just sound like a pain in the arse to me. Especially if your events don't fit well within the system.
I appreciate with scripting triggers that I don't have to hunt for activation code within the editor and I can just ctrl+f in a sqf and get what I'm looking for.
Scripted and Editor-placed triggers are exactly the same, in the Editor it's just a UI for doing the same commands and manipulating the same object.
The real thing that scripting unlocks is using other detection and waiting commands, and event handlers, instead of triggers at all
Don't see an answer but there's no issue calling a function in a function
One of my most common triggers is ANY PLAYER, PRESENT. Is there a better detection method for this condition other than a trigger?
JIP entities are not synced so that is at least one reason not to use modules that require sync lines.
server side respawn Vehicles modules are ok
Vehicle respawn module had several bugs which took like five years before patching.
Resync also requires the module rechecks or is notified. Something I haven't really seen a BI module support.
If you need support JIP stay away from the combo of BI modules and synchronization.
hmm i never had 1 thing go wrong in that case hmmm
yeah m8 i have not seen 1 bug
but then i only use vanilla
Until 2022 the vehicle respawn module would only respawn it once
well it works great now it respawns my chopper over and over and over
i do remember someone made a respawn Vehicles script back in the day
and we hade to use that yes
but the respawn Vehicles modules work really great now
i love Arma 3 woohoo
Is it possible to use respawn templates with the params on lobby screen? For example if I wanted to add a param to the lobby screen that could adjust the amount of tickets in the respawn template?
https://community.bistudio.com/wiki/Arma_3:_Respawn
Very cool! So what does respawn = 3 do? Is that 3 tickets?
Thanks! I'll start messing around with this to see how it works.
No thanks, the code you gave is enough for me to play with. Having fun with it now.
As a fun fact, when I have missions with limited respawns, I always give players at least 1 personal respawn and then the team their total respawns. It gives a personal buffer of respawns for reckless players or MASS CAS events
not me: i'm mean that way: lol just kidding ๐
i like to set it to 10 respawns really ๐ i only make 10 player missions ๐
then you are careful not to die
i like it when theres only 1 life left then your really careful ๐
took me a long time to get all that correct: and the onPlayerKilled.sqf also: so like when the tickets run out: i have it set that each player that dies goes into spectating mode ๐
so they can see the other guys fighting
the best way is to give respawns as objectives are completed
to replenish the pool
sort of like old school insurgency/insurgency sandstorm
tried this but it didn't work either
it lands and turn off its engine
heli landAt [helipad, "LAND"]
Yeah I tried landat and it worked, I also had to raise the trigger that fires engineon false a bit above ground
Thnx
But isn't this the same as using the LAND waypoint that comes with 3den?
No, because it uses a bis function instead afaik
FSM OR SQF???
I'm currently making a looping script for a soldier. I have a question: is it better to use FSM or just SQF with waituntil?
Pick whichever you want/easier to write and maintain
He ordered an attack on an orange. The orange was killed. Now he's the terror of all fruits. What's funny is he can't forget that the target was destroyed. Apparently there's some kind of bug causing the object to disappear and turn into pieces.
_unit=cursorObject;
_unit doFire t2;
ticket time?
I have a question ? Is it possible to set the "owner" of a projectile ? Like if you spawn a grenade with "createvehicle" for example or even a bullet.
Do you mean setOwner or setShotParents?
oh yeah sorry, i meant "setShotParents" yeah, because the "owner" of the projectile is already on me since i'm making it on my side.
it seems to be the command i was searching for so thank you ๐
FSMs run every frame or similar, so if it's not something that needs every-frame checking then waitUntil + sleep is preferable. But if it's just one soldier then it doesn't really matter.
Be aware that setShotParents is a bit of a weird command that's heavily affected by projectile locality and doesn't always work as you might like
(see https://feedback.bistudio.com/T178981, still hoping for https://feedback.bistudio.com/T180763)
setShotParents being SE is so weird that I think I checked whether it was true.
Shot hit/damage is always assessed locally to the shooter, isn't it? So isn't that where the parent matters?
Tl;dr: a simplified unit
apparently yeah, is it supposed to work on grenades too ? Because i thought it was only setting who "threw" the grenade and that you will get kills when that grenade exploded and kill enemies but apparently it doesn't work. I was executing that command on the local side, after that i tried to "remote exec" on the server and even with a global exec it still doesn't work so as you said, i think it doesn't work like i thought ๐
nevermind, it seems to work, it's just that i'm using prairie fire cs grenades or "tear gas" grenades and apparently, they don't register kills, at least i tried to throw one with my player like normal without using a script and it doesn't register so that's maybe why. I will just do more tests to make sure it's because of that
Might just do setDamage without setting the instigator
yeah probably, i wasn't able to see what script it was using or if it use a script, i checked the magazine and there is no "event handlers", i will re-check that too
Any EHs would be on the ammo, not the magazine
yeah the only place where there was that "EventHandler" class was like you said in the Ammo class of the grenade, however i re-checked and it is empty. All events are the projectile events here : https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Projectile_Event_Handlers ? or there is more ?
Does the grenade create any submunitions?
I don't have SOGPF installed so I can't really investigate myself oh apparently I reinstalled it at some point
maybe after it starts to create the "tear gas", i didn't check that to be honnest
It's the particle effects
The EffectsSmoke property in the ammo config leads to a particle type in CfgCloudlets which is configured to behave as fire
Any way to detect when AI gets stuck?
I don't think particle effects damage can be given an owner
oooh ok
No good way. If you're giving them move orders then the best approach is usualy to check whether they've managed to move significantly from their previous position after some time.
But note that with vehicles they're often not permanently stuck in that case. Often driving AI will go into a state after a near-collision where they inch backward or forward while waggling their wheels from side to side. After a few minutes they reset and progress to their waypoints.
If a unit hasn't moved then it's a pretty safe bet that it's permanently stuck.
There are cases where a unit will loop between two positions when attempting to board a vehicle, however.
With vehicle AI there are also cases where it looks like it's trying to do a three-point turn but keeps turning the wrong way and hitting the same building in the same place.
Sometimes "PathCalculated" EH fires with path of length of 0, but no always
Yeah that's just one case of many possible ways that units or vehicles can fail to move.
In one house AI was moving in circles, unable to leave the house
They usually manage that unless they're actually wedged into scenery.
Moving into buildings and moving to upper floors are the usual fail cases.
upper floors is just a clear bug but good luck getting anyone to look at it.
They failed move down stairway just couple steps long from ground floor
I gave up trying to make a perfect replication because the other bugs kept getting in the way.
I tested other houses of the same class on the terrain, but wasn't enable to reproduce it. Only this one in particular is broken ๐
Terrain height underneath does matter.
It shouldn't. That's at least one of the bugs.
I didn't notice any relation to floors
You can watch it with calculatePath. When AIs cross room boundaries it often does a recalcuation for some reason, and the recalculation uses the wrong Z values.
But there are other issues. Even when the path is correct it doesn't mean AIs can traverse it reliably.
Stuck on such small stairway.
๐คฃ
There is like no wall blocking them. Maybe it's the bench down there ๐
yeah likely. Minor Z transitions are a general risk factor though.
What do you do when you detect stuck AI. Move them to the next position on their path?
Depends.
I think the only stuck AI routine I currently have on units is for NPCs that are following a player, so I just yoink them.
There are a few for vehicles. Some bounce to next waypoint, some give up and go into the despawner.
Want to write some custom escape logic but the tools suck.
How to check if units fits into position? I mean no other objects blocking
No good way :P
findEmptyPosition looks like it could do it
https://community.bistudio.com/wiki/findEmptyPosition
It'll likely generate false negatives.
For vehicles it generates false positives but that seems less likely for units.
Just trying it out, it seems to work well
And now I am in rock ๐คฃ
Technically it did find clearance on ground for "CAManBase" ๐
Being completely inside an object is straight up difficult to check with Arma commands.
Raycasts won't necessarily hit anything.
If you're not placing in buildings then you can do a raycast from above.
But that will block valid cases like being under a canopy.
Or like this
You can do a proximity check for objects but unless you're near the arbitrarily-defined center then it won't help.
I check if object has building positions to get idea if it's a house, but it's not always good. Sometimes even terrace can have building positions or even craters
Also AIs can't necessarily path from building positions. Common fail there is the middle position on the small cargo towers.
It's placed too close to the handrail or something.
Anyone know how to use this command?
https://community.bistudio.com/wiki/BIS_fnc_setRespawnDelay
I want to use it to adjust the respawn delay from the MP lobby param screen. I played around with it a little, tried to pass 30 (seconds), but got an error for number, expected code.
number is second param
What is the first index for?
[{true},30,"Delay in effect"] call BIS_fnc_setRespawnDelay; // Delays every respawn by 30 seconds
Thanks! I'll give this a shot:
private _respawn_delay = [paramsArray, 1, -1, [0]] call BIS_fnc_param;
[{true}, _respawn_delay, "Delay in effect"] call BIS_fnc_setRespawnDelay;
Is there anything else that needs to be done to set this up? I tried your example but it won't overwrite my respawn settings defined in the editor. I've got it in initServer.sqf.
I've gave example based on wiki, which is pretty bad for this function
Can't help much more without spending time by tyring it myself
It uses setPlayerRespawnTime, which has local effect
question that has been probably asked by so many players, but not many of them tried to ask online (found only 1 reddit post lol): is there any way to re-order units, that are still alive? If you have units 2, 3, 4, 5, 6 and unit 3 and 4 die, then you got 2, 5, 6. This becomes a problem is you got 10+ units, and sometimes you need to switch between pages to just select 1 guy, if let's say your squad is now 2, 3, 4, 5, 6, 7, 8, 9, 25. As far as I tried to study the wiki, there is no such function to like setUnitNumber but maybe I am missing something?
afaik you can't change the respawn delay
I looked it up in the function viewer. Seems pretty simple really. Not sure why it isn't working.
so show me then, I couldn't find anywhere, can you change the respawn delay midgame?
you can change that 1 time to whatever
ok i made a little script whil we were talking
but keep in mind this is just part of my team respawn script ok
?
I don't know about a direct method but simply rejoining all the units to the group works.
units group player joinSilent group player;
well, that's player-local.
ok
So it'd need to be executed on the player's client who needs their group re-ordered.
oh yeah it works
Might also reset some things that you don't want to reset :P
yeah this will need to go through some testing, but this is what I needed! thanks
paramsArray#3 โค๏ธ
see i like to have many options for when im teaching Arma 3 to people so i can make it as hard as i want or as easy as i want
like that @flint topaz up there see
i never did it that way before ๐
what don't you like @fair drum ? i edited that thumbs down i forgot a line
like i said that only runs if all respawn tickests are gone
oh thx m8 @flint topaz
How do I ensure players are falling from the sky with a parachute equipped? When I set the altitude (after force setting a parachute) the character just falls instead of going into the parachute / skydiving animation
well i can send you my para jump script if you like
https://community.bistudio.com/wiki/Arma_3:_Actions#OpenParachute maybe? The parachut's also a vehicle you could spawn I think.
I'd be happy to look at it if possible ๐
sure m8
That forces the parachute to open, I want to give players the freedom of choice though
oh i have it set to a 70m Alt in mine so you never splat on the ground lol ๐
Oh, you want them to have a parachute, not for them to open the parachute?
I've already added the parachute to them with addBackpack - I want them to be able to basically use it. When I teleport the character to say 2000m the character is in a default falling animation rather than the 'freefall' / skydive animation
Units should normally automatically go into the freefall animation, maybe after a second or two of falling. If they're not, something else must be interfering.
Another mod or script might be doing https://community.bistudio.com/wiki/setUnitFreefallHeight on them, for example.
i think there is a default para jump thingy in Arma 3 right
but i made my own
lol i even made a para eject script: so you can eject out of a chopper and para to the ground ๐
Is this valid?
while {!alive player} do {
// code
};
Why?
well im not sure but i always did that way i forgot why
I feel like it needs to be wrapped in a Killed EH.
i guess i was useing _player as a var
If I just put it in a SQF it will only run once, not continuously right?
That would probably be a sensible way of starting it, because if it starts while the player is not dead, it will immediately exit, but it's not essential for the code to be valid.
You could also start it by any other means that happens to occur while the player is dead.
i would use a if statement inside the while do loop ๐
loops like this need sleep btw, because the condition cannot change all of a sudden.
your while loop can run several times per frame without sleep which is not what you'd want
Be very careful using loops generally, EHs are typically always a better idea for most use cases
I don't even remember, but I think for respawns you would need to readd the EH for the new object.
Most, perhaps even all, object-attached EHs persist across respawns for player units
Is there a specific EH for when a player is Killed? Or maybe use the SQF onPlayerKilled?
Most EHs placed on a player will persist
Yes there is
player addEventHandler ["Killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
}];
There's no EH for specifically detecting player deaths. You could use onPlayerKilled.sqf, or assign a killed function in the respawn template, or just have a check in your Killed EH.
I think people should really read the question more closely
Yes? If you want it to โspecifically detect playersโ just assign it to the player?
Would Killed event handler not be for that?
Any instigated death should be handled in that
You can use it for that, but you have to manually identify the player to add the EH to; it's not specifically for that. It's not a dedicated mission EH like entityKilled that specifically identifies player deaths.
i do it in the onPlayerKilled.sqf really tbh
What do you mean by manually identify the player?
Thatโs semantics
ver name
Whatโs his purpose? To get back on track
It was the point of the question. The alternative they were considering is onPlayerKilled.sqf, which is essentially a mission EH; object EHs are not equivalent.
Everyone gave valid solutions to my question but Nikko answered the actual question. But thank you everyone.
As long as you arenโt using a loop for this Iโm happy
It's an object EH, not a mission EH. You can't just plop it in and let it automatically fire for any player death; you have to get player and attach the EH to it. It's not impossible, but it does require you to build something to do it right yourself. Also, the player unit can be switched in ways that object EHs don't follow.
So any EH solution works
lol plop ๐
The main thing I was really getting at is that they are clearly already aware of the Killed EH, since they were already talking about it, and were looking for something more specific than that
I do love development for how many different ways you can solve a problem, but also I do hate it for it aswell sometimes.
If there's one piece of advice from me you can follow, it's "don't uncritically trust me, I'm regularly wrong"
That's fair. Our usage is in MP where we are never switching the unit, or would allow it due to security reasons.
well you were never wroung with teaching me so well you know
OnUserSelectedPlayer does appear to fire for all cases where the player unit changes btw. Joining, respawning, selectPlayer.
I don't think there's any similar client-side handler though, oddly enough.
wow that looks cool
well Actually i don't remember anyone being wrong when they were helping me
i love you guys ๐
Are values required to be numbers?
class RespawnMode
{
title = "Respawn Tickets Mode";
values[] = { player, missionNamespace };
texts[] =
{
"Per Player",
"Global"
};
default = missionNamespace;
code = "";
};
Those are just going to be strings when evaluated
Parameters values can only be numbers
Just use 0 and 1 and select from an array in whatever script uses them
Ok, so I will set them to a number then do a check based on the number and assign the variable what I want.
* or if, switch etc
private _respawn_mode = [paramsArray, 2, -1, [0]] call BIS_fnc_param;
if respawn_mode = 0 then { respawn_mode = player } else { respawn_mode = missionNamespace };
Is select better than this?
You should use param or params rather than BIS_fnc_param. Those are the command implementations of the same thing; they're inherently faster.
Personally I like to use e.g. respawn_mode = [player, missionNamespace] select _respawn_mode as I find it's tidier. It's also more easily extensible if you decide to add more than 2 options.
Using select as a ternary operator is also faster than using an if in circumstances of a generic string, int, etc due to if being considered a type.
Does this look valid? I am trying to get the third param (2) from paramsArray.
private _respawn_mode = paramsArray param [2];
respawn_mode = [player, missionNamespace] select _respawn_mode;
Looks fine
I was running that code initially from initServer.sqf, but since player won't work on the server I moved it to initPlayerLocal.sqf. But now that I think about it if someone JIP then it probably would reset the tickets that were chosen at the start of the mission. Having a hard time thinking of the solution here.
private _ticket_amount = paramsArray param [1];
private _respawn_mode = paramsArray param [2];
_respawn_mode = [player, missionNamespace] select _respawn_mode;
[_respawn_mode, _ticket_amount] call BIS_fnc_respawnTickets;
I can pass an object to the function. When I do player it keeps track of them from initPlayerLocal. But I have 8 players so how could I put 8 variable names in there?
BIS_fnc_respawnTickets is global effect and it's an adder, not a setter. In shared ticket mode you should run it on the server only. (Or on one machine only; the server is the best machine to pick for initialisation)
Is there different command if I wanted to give each player only 3 tickets?
In per-player mode it's fine for every machine to run it, using player as the object. Each machine will handle its own player's tickets.
It's only in shared ticket mode that you want to make sure only one machine runs it for each ticket modification event (e.g. initialisation). If every machine does it for the same event, they're all modifying the same counter, so you could end up with tickets * machines being added
Okay yeah, that's what I was thinking too. But as you can see I've attempted to give the players a choice on the params at the lobby.
And I can't put it on the server if I want per player mode right? So that means I need to also put it in initPlayerLocal.sqf with some sort of gate to stop it from running if players JIP, I guess?
Am I explaining myself well enough?
No, it just means you make it run only on the server if it's in shared mode
Use something that also runs on the server (init.sqf for example) and have a check
This is one way, there are others:
if ((_respawn_mode == 1) && !isServer) exitWith{};```
Hmmm, I think I understand. I'll give this a shot tomorrow! Thank you.
If playSound3D is created in the server, can it be terminated using stopSound and it terminates the sound for all?
Likely not according to BIKI. It should be better to playSound3D locally and let clients handle it, IMO
Does anyone have a working example of how they use kbTell for something in vanilla? I'm struggling to get the parameters right here; my current line is
BIS_ardefenderc kbTell [TNY_Dummy, "ta_tanks_m03_am_incoming", "ta_tanks_m03_010_am_incoming_ARDEFENDERC_0"];
which matches with what the BIS_fnc_kbTell kicks out, which works fine and plays the correct audio; I confirmed that the right topic was added with kbHasTopic afterwards. But I'm trying to write my own wrapper function for kbTell right now and I cant get any variation of the line to properly output audio. As far as I can tell I've done everything right:
- The sender and reciever are both units in the game world and both have the topic added to them
- The topic is
_mission + "_" + _topicNamewhich after I ran BIS_fnc_kbTell and it worked normally, that topic was added to both units - The sentence ID line is visible in the log from BIS_fnc_kbTell:
["%1 / %2 / %3: %4 > %5 (channel: %6; variant: %7)",_mission,_topicName,_sentenceId,_from,_to,_channel,_listSentencesVariants select _s] call bis_fnc_logFormat;
"ta_tanks_m03 / am_incoming / ta_tanks_m03_010_am_incoming_ardefenderc_0: BIS_ardefenderc > BIS_arhq (channel: radio; variant: )"
No clue what's going on here. I really just need one working example of how to use the command and what exact config values it references so I can build something off of it; I havent gotten anything outputting properly with just the command yet.
Don't forget you can open BIS_fnc_kbTell in the function viewer to see how it does it
Hey folks, does anyone know a good way to check if a playerslot is used in a multiplayer session?
I was thinking about giving all playerslots some variable and checking if alive, but it throws an error when the slot is not in use (because obviously the variable does not exist) but I can't think of anything more clever than that, so I was hoping maybe one of you would have a better idea.
isNull (missionNamespace getVariable ["playerSlotName", objNull]); // true if slot is not filled
Ah damn, I forgot "isNull" existed. Thank you. ^^
yes Tiny what did you want to say ?
Yeah I've pulled it all the way apart and I've ran it with what I put in the message I believe to be the exact inputs that BIS_fnc_kbTell is providing the function but no dice. I'm probably just gonna end up copying the function and trimming away as much as I can until it stops working cause I'm out of ideas and that should be the perfectly correct syntax
oh that stuff i don't know about
i never used kbTell stuff
i hope someone in here replys to you mate
Hello, does anyone have a script to respawn with gear that was on death? I'm new to mission building things and ACE and 3den didn't work a few times, so i kinda need a script just in case
thank you
A player can hear from two radio channels simultaneously, right?
But can it speak in two channels simultaneously too?
- yes 2) you can try binding two channel PTT keybinds and pressing them both at the same time, and seeing what happens, but I'm almost certain the answer is no; only one channel can be selected at a time
Got this worked out by the way. kbTell has a parameter thats labeled as optional but seems to be required based on my testing
Hello, i have a question about AI falling out of vehicle when they die, i dont really know how to make them stay inside. Does anybody have a solution to this problem?
I think that's a mod/script doing that in the first place.
Really? Do you maybe know some mods that would be doing that.
It just looks ugly for screenshots
Antistasi maybe
Im not using that at the moment.
yeah by default they stay in the vehicle
Maybe its ACE medical, that would make sense for multiplayer purposes
No
ACE has their own unload system.
so do we play a wss sound file: the same way we play a ogg sound file ?
or is it diff
is it possible to create like a script for that, so it locks them in the vehicle?
I think whatever script made them go out would still push them out.
Try cutting your mod list down as much as possible.
most peopl want them to fall out
but by default vanilla game they stay in the vehicla
Until someone gets in
roger yes
alright thanks
i always look at thier dead body burning up in the vhicle lol
Hey, I need help with CBA events for the DIRT mod. I'm trying to make the textures appear on units using the init so I can make a screenshot but I have no idea how to make use of the features. There is documentation on his Github (though I cannot send links apparently). Any help is appreciated.
i want to do that also but i am not being able to hahaha
well i don't use any mods so you know my game works perfretly ๐
How many mods are you using? Ideally, you should always know what each one does and why you want it. Try to stay under like 40 mods.
omg 40 holy
thats the best solution haha
idk like 53-56 modpack, i am in a community so thats their modpack
oh man
For some reason some people make their mods in like 10 different parts.
its some maps and like basic mods like ACE cup, some maps, gear mods
good luck with that m8
them mods seem to be ok tho
i always have 3 people for sure in my community : me myself and i: and other people join lol ๐
I mean i listed trough all off them and none seems to be doing falling out of vehicle
thats great
lol
my community was on a break for like a year and no one wants to play anymore except 4 of us๐ญ
nice
4 is fun
you just have to shoot more enemy thats all ๐
i found 2 of the most Awsome Terrains in the workshop: really nice : no cup or anything:
yea hahaha, we want to become international community idk if that would work
drop the names
1 is called Lybor and the other is called prei_khmaoch_luong
khmaoch is great for vietnam missions
yes really cool map
but i would like to take them really thick tress out of the map i always get stuck on them when im prone lol
hahahaha yea that happens sometimes
lol ๐
but all in all its a great Terrain
other then them Terrain: i only use vanilla game and i can make the enemy look like VC ๐
or really close anyway
i use the weapoms for the Old Man DLC on the enemy ; but i don't own the DLC ๐
Thats great, i must use mods cause i cannot make like serbian or yugoslav forces with vanilla game
yea in eden editor you can do everything hahaha
yes sir
You can use the actual Vietnam DLC stuff without owning it too if you use the compatibility data, which is linked in the DLC tab of the launcher.
i don't want to go that far they may take that stuff away if i do lol ๐
Who would take away that stuff?
You should do it today! The DLC are 70% off and CDLC 50% off.
the amount its not a worry: its if i want to clog up my clean vanilla game ๐
Lou Montana helped me with KBTell a year ago, before I found a different solution. I think they wrote the BIKI on it too. Try shouting out to them.
CDLCs work like mods. If you don't choose to load them, they aren't loaded and the game behaves as if they don't exist.
oh yeah nice right
Yeah I did see that while searching the discord, I ended up finding out what was wrong, a param labeled as optional wasnt actually optional. All good now
i do Actually have 1 mod and its a Huey Chopper mod but i never use it ๐
unless i feel frogy
i think my vanilla vietnam missions look better then the DLC's
if you can use a littel brain washing kinda lol ๐
Vanilla Vietnam what?
i found that no one really cares what any thing looks close to: when the bullets start flying ๐
@hushed turtle Vanilla Vietnam missions
from selecting great places on the terrains and useing all the stuff in the vanilla game i can make it appear like vietnam
On Tanoa?
no no even Altis
or the other terrains i talked about
i can make you feel like you are anywhere: with my command of the editor ๐ well i cant make you feel like your in space ๐ or can i ๐
lol Awsome ๐
what i find helpful is the hide modules
like some of the names of my missions are USMC Insertion Nam: NVA VC Attack: and ummm COOP Nam USMC: oh and VC Island: ๐
them missions a very well liked i was told by my clients
as a matter of fact i had the most fun in them Arma 3 missions
each time we had 9 guys
i think the fun-est Mission was the USMC Insertion Nam:
and theres only like 78 enemy in the whole mission But: well you know ๐
oh hay guys don't get me wrong none of this would be posiable with out all the help i got from you guys here in this channel:
thx so much for all the help from you Awsome people
to many to name'
Decided to bring an old project back to life. Working on some command and control stuff for a special mission/sandbox campaign I've been working on. Might eventually make the command and control things just its own damn mod at some point. But here's a little sneak peak of some script work.
Hey everyone, I hope that out of all the channels, I hit the right one here. I'm currently trying to edit the radar values of the CSAT Chronos Radar, the short of it is, that the thing is way too powerful and is picking up assets in my mission, it has no right too (Objects completely obscured by terrain for example). My simple solution, well I thought it was simple, was to look for resources that would allow me to edit the radar, that is where I stumbled across the Sensors Config Reference, which does exactly what I'm looking for. I want the radar system to basically ignore anything that is below a certain altitude, and whilst were at it id love to change some other values.
From my admittedly extremely limited knowledge of scripting, Ive at least been able to understand that this is not something I can set in the assets ini, in eden, but it something I need to set in the config. Considering this if for MP that is well above my level of competency. Here is the question, does anyone know a work around to achieve what im looking for, or has any further resources I could look into (I have not been able to really find anything relevant that isn't majorly outdated in regards to how to set up a SAM / Radar system in the way I'm looking to do it)
I should add that I've also been throwing these questions into multiple AIs like GPT and have not gotten any further, they just don't have that in-depth level of understanding about Arma I guess.
Thanks ๐
hey guys
I've been trying to set up a "regular" camera position for a playable dog unit
using what's suggested here seems to work fine https://www.reddit.com/r/armadev/comments/3xsi3e/retain_unit_control_after_calling_cameraeffect/
however I get a lot of stuttering and weird movement...any other ways?
Making a function to replace some composition-based spawning, and it works except that the helicopters full of troops arrive at the landing zone, hover, then mark the waypoint complete.
Scripted-in passengers inside have "GET OUT" waypoints at the planned LZ, tried both adding at moment of creation and when the helicopter was shortly to arrive, makes no difference.
Even when I manually work the helicopter around to touch down via new waypoints, the passengers dont disembark, though I added a little loop to force them out faster than the default speed for utility's sake.
I swesr I read something about Get Out waypoints and vehicle or groups needing a commander/leader, but they both do z the helicopters are fully crewed, the teams are properly grouped.
Any thoughts?
You can't edit asset configs for missions, but you can make a script to ignore targets, I'm working on a prototype of this for my liberation version and so far it's working. Radar will ignore targets below 200m altitude and > 10km.
That actually sounds exactly like what im trying to do! Would you be willing to share that?
Sure, but I'm not on pc rn
That's fine. This is for a Campaign we are starting mid January, so I got plenty of time. I might be able to figure it out, I didn't think of that approach. Did you do this direct in eden init or did you handle it with an sqf?
All you need to do is to have a loop to check the radar's sensor, like getSensorTargets and work with ignoreTarget command
that's basically what my script does
Ahhhhhh, thats so smart. So youre just skipping the whole radar set up and just checking the value it posts and forcing the ai to ignore the target below a certain value. Ill see if I can figure it out. But that helps a lot! Thank you so much!
Alright, managed to fix the infantry transport somehow, but now the slingload helicopters are doing the same thing -_-
I just wanted to let you know that this worked like a charm! Thank you so much man, the only wierd thing is when using the radar + sam, the sam lock drops and relocks with the loop, which the tungusta I used to test with didnt. But its not a huge deal as its still able to fire and the missle tracks just fine. So I can just call that, broken outdated tech doing wierd things and call it a day. Thank you again, this saved me so much time!
You have to ignore targets for launchers as well
//within a Switch type
_vicType = selectRandom ["cwr3_o_uaz_dshkm","cwr3_o_uaz_ags30","cwr3_o_uaz_spg9"];
_vic = createVehicle [_vicType, (getposasl _trans vectoradd [0,0,-10]),[],0,"none"];
_trans setSlingLoad _vic;
//After the switch type
_vic = getslingload _trans;
_vicGroup = createGroup [east,true];
_vicGroup createVehicleCrew _vic;
_trans setSlingLoad _vic;
_wp1 = _vicGroup addWaypoint [_tgt,0];
_wp1 setwaypointtype "MOVE";
//_crewGroup is the _trans pilot group
_wp1 = _crewGroup addWaypoint [_halfwayThere,0];
_wp1 setWaypointType "MOVE";
_wp2 = _crewGroup addWaypoint [_tgt,0];
_wp2Type = "UNHOOK";
if (isNull getSlingLoad _trans) then {_wp2type = "TR UNLOAD"};
_wp2 setWaypointType _wp2type;
//Loitering gunship
if (_type == "MI24") then {
_wp5 = _crewGroup addWaypoint [_tgt,0];
_wp5 setWaypointType "LOITER";
[_crewGroup,_wp5] setWaypointLoiterAltitude 100;
[_crewGroup,_wp5] setWaypointLoiterRadius 500;
[_crewGroup,_wp5] setWaypointtimeout [180,180,180];
_trans limitSpeed 75;};
//Bugging out
_wp3 = _crewGroup addWaypoint [_halfwayBack,0];
_wp3 setWaypointType "MOVE";
_wp4 = _crewGroup addWaypoint [_endPos,0];
_wp4 setWaypointType "MOVE";
//final approach
waitUntil {_trans distance _tgt <500};
_helipad = createVehicle ["Land_HelipadEmpty_F",_tgt,[],0,"none"];
{_x addCuratorEditableObjects [[_helipad], true]} foreach allcurators;
If (isNull getSlingLoad _trans)
then
{
_trans landAt [_heliPad,"Get Out"];
//Yes, I have to use this or it flies off
WaitUntil {isTouchingGround _trans};
{doGetOut _x} foreach (crew _trans - units group driver _trans);
{moveOut _x; unassignVehicle _x; sleep 1} foreach (crew _trans - units group driver _trans);
waitUntil {sleep 1;
count fullCrew [_trans,""] == count units group driver _trans;};
}
Else
{
Waituntil {isNull getSlingLoad _trans};
};
//Exfil orders and deletion when back to the starting point
https://community.bistudio.com/wiki/BIS_fnc_showSubtitle
hi
wanted to know is this remotexec'd by default or should i do it?
page doesn't have GE tag so i'm guessing it will only appear to whoever initiates it only correct?
It's most likely LE since almost all UI commands/functions are LE.
holy shit my RPT file whent down to 47 lines: after i defined the Roles in My missions: wow Awsome
?