#arma3_scripting
1 messages Β· Page 121 of 1
selectRandom/Weighted selects one of the elements in the array you give it. It will only return nothing if the array you give it is empty.
The way it's implemented in the posted code, selectRandom can return nothing because it can receive an empty array from the previous stage. If it was just a defined array and selectRandom, then it would always return something.
private ["_dist"];
_dist = round(player distance (getMarkerPos "BPatrolPoint"));
[] spawn {
waitUntil { (player distance (getMarkerPos "BPatrolPoint") < 15) || !alive player };
if (player distance (getMarkerPos "BPatrolPoint") < 15) then {
//Calculate reward
_reward = round(6.5 * _dist);
deleteMarkerLocal "BPatrolPoint";
[playerSide, "Base"] commandChat format ["You received %1 for patrolling! Your next point has been marked", _reward];
life_patrol_in_progress = false;
};
};
I keep on getting an error that that #_dist undefined variable in expression. What exactly have i done wrong? I tried both private and params for _dist at the beginning
you are spawning a different scope, so the variable is unknown in there
either pass it as a parameter or define it in that scope
so i tried doing params at the beginning of the script. would i then do
[] spawn {
params["_dist"];
...
};
as such?
[_dist] spawn {
You'd have to pass the parameter into the spawn, like this:
[_dist] spawn {
params ["_dist"];
...
};
ok thank you both, will try
thanks guys, it worked. i better stop coding at 3am π
don't code while tired! indeed ^^
Hey people, quick question about the removeItem command. Empirical experience seems to be that items removed via this are taken in order uniform>vest>backpack. I was wondering if this is actually documented anywhere for a definitive answer?
Yes, removeItem, mistyped that. Order matters because of academic curiosity.
ive been thinking the same, hopefully devs can shed some light on that one
Considering the wiki does not state on the wiki, im not too sure. Give me about 5 minutes to do some testing
Can confirm it follows uniform -> Vest -> Backpack. I'll attempt to add a note to the wiki page about it
if provided, the information will be added π
I'll do it π
thanks lou
added, thanks!
cheers
setObjectViewDistance -1
``` that doesn't reset it? like setViewDistance would do
okay so BIS_fnc_guiMessage just crashed my game
Good morning to everyone.
I am looking for someone to help with a script that will correct players that log on late using support roles. As of now the Issue Is that when the server first starts up, players that select the "Officer" role can use supports. That role has been linked to support request module In EDen editor. The Issue Is when new players connect to this role they no longer have access to It.
I found a script from 2014. The Issue with using this script Is when used It give ALL roles (Not just officer) the ability to use support functions.
I will place the line of code In here for someone to review. Thank you.
_this select 0 synchronizeObjectsAdd [SupportRequesterO];
SupportRequester synchronizeObjectsAdd [_this select 0];
BIS_supp_refresh = TRUE;
publicVariable "BIS_supp_refresh";
if (typeOf (_this select 0) isEqualTo "O_officer_F") then {
[_this select 0, ArtilleryRequester, ArtilleryProvider] call BIS_fnc_addSupportLink;
[_this select 0, CasRequester, CasProvider] call BIS_fnc_addSupportLink;
[_this select 0, TransportRequester, TransportProvider] call BIS_fnc_addSupportLink;
[_this select 0, AmmoRequester, AmmoProvider] call BIS_fnc_addSupportLink;
[_this select 0, HelicasRequester, HelicasProvider] call BIS_fnc_addSupportLink;
};
_this select 0 synchronizeObjectsAdd [SupportRequesterB];
SupportRequester synchronizeObjectsAdd [_this select 0];
BIS_supp_refresh = TRUE;
publicVariable "BIS_supp_refresh";
if (typeOf (_this select 0) isEqualTo "B_officer_F") then {
[_this select 0, ArtilleryRequester, ArtilleryProvider] call BIS_fnc_addSupportLink;
[_this select 0, CasRequester, CasProvider] call BIS_fnc_addSupportLink;
[_this select 0, TransportRequester, TransportProvider] call BIS_fnc_addSupportLink;
[_this select 0, AmmoRequester, AmmoProvider] call BIS_fnc_addSupportLink;
[_this select 0, HelicasRequester, HelicasProvider] call BIS_fnc_addSupportLink;
};
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
you could try moving the code above the if statements into the if statements
you called it didnt you :P
Did you call it from unscheduled?
For example, the first one has
_this select 0 synchronizeObjectsAdd [SupportRequesterO];
SupportRequester synchronizeObjectsAdd [_this select 0];
BIS_supp_refresh = TRUE;
publicVariable "BIS_supp_refresh";
Before the if statement that checks if the unit is an officer if (typeOf (_this select 0) isEqualTo "O_officer_F") then {
Im not 100% sure it will work, but you can try moving the above code into the if block, and the same with the second portion.
I will give this a try.
I will be giving It a test run now.
How can I get a config entry for a location?
// All below is fine
_sectorLocation = position _sector;
systemChat str _sectorLocation;
_location = nearestLocation [_sectorLocation, "NameCity"];
_locationName = text _location;
systemChat str _locationName;
// This gives me an error:
_cfgPath = configFile >> "CfgWorlds" >> worldName >> "Names" >> configName (_location);
systemChat str _cfgPath;
Whats the error it gives?
configName takes a config, not a location π
bingo ^^
I'm confused. Then how do I get the path for an entry? I suppose I can't use nearestLocation as it doesn't provide a way to get it's cfg name for an entry?
Lemme try, it says it takes an object
thats not a location
Right
why are location data types so scuffed in this game
Β―_(γ)_/Β―
anyways you need this
Exactly what I needed!
@winter rose Having an Issue using the spectator module. I am trying to gather a script that can be Injected that will force Its operation when selected. Do you happen to know anything about this module?
nope.
Alright thank you
@opal zephyr This Is an observe script I managed to gather from offline on a forum. Not sure If this should be placed In the Inti section of the module to help. Normally any other game mode will work with the spectator slot, but on warlords It keeps them on the black screen. I assume conflict with the coding somewhere.
// press number 5
// https://community.bistudio.com/wiki/DIK_KeyCodes
[]spawn{
waitUntil {!isNull (findDisplay 46)};
disableSerialization;
(findDisplay 46) displayAddEventHandler ["KeyDown", {
params ["_displayorcontrol", "_key", "_shift", "_ctrl", "_alt"];
if((_key isEqualto 0x06))exitWith {["Initialize", [player]] call BIS_fnc_EGSpectator;}
}];
};
// or
//player addAction ["Spectator", {["Initialize", [player]] call BIS_fnc_EGSpectator;}];
// press esc to exit
[] spawn {
while{true}do{
waitUntil {!isNull findDisplay 49};
["Terminate"] call BIS_fnc_EGSpectator;
uisleep 3;
};
};
!code
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
when it sayus client leaves the mission in MP
is that when the client goes to the lobby, or when the client disconnects from the server 
when they disconnect
its playerdisconnected
although actually
its probably player disconnected from mission
else disconnect handlers for code wouldnt cover lobby returns
you can test it yourself in a local hosted MP mission
Anyone has a simple script for Halo drop with a timer?
Something a player can request and the option appears In the top left hand corner or maybe even attach to an object.
Heya, does someone know if ace had an "Smoking Engine, when engine damaged" Feature around 2017 and is it still there? If no any other simple Ways to at such feature?
thats a vehicle configuration thing
Cant find it :/
Can you be more precise please?
the answer to your first question is no
Has anyone ever run into an issue where certain scripted UI things - specifically holdActions and showNotifications - become super laggy? For example, holdActions taking twice as long to complete as they should and having their progress circle update in chunks, rather than smoothly.
I've got a mission where they're normal, and a lightly modified copy of that mission where they're laggy, and I'm going slightly insane trying to figure out why, since none of the changes have anything to do with that, and it still happens even if I comment them all out
dunno but I guess they're scheduled?
can you try using the action in the first scenario after doing this?
for "_i" from 1 to 1000 do {
[] spawn {while {true} do {for "_i" from 0 to 1e5 do {true}}};
}
After doing that, the actions don't progress at all (and I also lost the ability to open the action menu)
Scheduler crunch was on my mind, but I can't locate any change I made that actually added any more scheduled stuff
which terrain do you use?
some are known to add many scheduled stuff
like cytech
run diag_activeScripts (or was it diag_activeSQFScripts?) to see what they are
This script did not work. Trying to accomplish 2 things with the script. 1) Players that rejoin the "Officer" slot will be able to use support roles. 2) Make It so that ONLY officers will activate this script. 3) Make It so that the officers can only call for support If they have a radio back pack on and equipped. Any feed back thank you. Line of code Is down below...
if (typeOf (_this select 0) isEqualTo "O_officer_F") then {_this select 0 synchronizeObjectsAdd [SupportRequesterO];
SupportRequester synchronizeObjectsAdd [_this select 0];
BIS_supp_refresh = TRUE;
publicVariable "BIS_supp_refresh";
[_this select 0, ArtilleryRequester, ArtilleryProvider] call BIS_fnc_addSupportLink;
[_this select 0, CasRequester, CasProvider] call BIS_fnc_addSupportLink;
[_this select 0, TransportRequester, TransportProvider] call BIS_fnc_addSupportLink;
[_this select 0, AmmoRequester, AmmoProvider] call BIS_fnc_addSupportLink;
[_this select 0, HelicasRequester, HelicasProvider] call BIS_fnc_addSupportLink;
};
if (typeOf (_this select 0) isEqualTo "B_officer_F") then {_this select 0 synchronizeObjectsAdd [SupportRequesterB];
SupportRequester synchronizeObjectsAdd [_this select 0];
BIS_supp_refresh = TRUE;
publicVariable "BIS_supp_refresh";
[_this select 0, ArtilleryRequester, ArtilleryProvider] call BIS_fnc_addSupportLink;
[_this select 0, CasRequester, CasProvider] call BIS_fnc_addSupportLink;
[_this select 0, TransportRequester, TransportProvider] call BIS_fnc_addSupportLink;
[_this select 0, AmmoRequester, AmmoProvider] call BIS_fnc_addSupportLink;
[_this select 0, HelicasRequester, HelicasProvider] call BIS_fnc_addSupportLink;
};
activeScripts for numbers, activeSQFScripts for names
yeah I forgot which is which 
use syntax highlighting when pasting code here
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
Issue identified: I had not added more scheduled stuff, but I had refactored an existing scheduled item, and a sleep had ended up on the wrong side of an if inside a while loop, resulting in the while running without suspension when the if returned false
// OK
while {alive _this && f_var_coldBreathLoop} do {
sleep (4*(1 - getFatigue _this) + random 1);
if (vehicle _this == _this) then {
// Code
};
};
// ========
// NOT OK
while {alive _this && f_var_coldBreathLoop} do {
if (vehicle _this == _this) then {
sleep (4*(1 - getFatigue _this) + random 1);
// Code
};
};```
Trying to make mortars more effective in my coop mission - if a player loads a laser-guided mortar into an Mk6 ("8Rnd_82mm_Mo_LG") and it explodes on any tank or APC, I want to drop an armor-piercing round on top of that vehicle as well. Hoping to use eventHandlers to do this but I'm very new to them... any help would be appreciated
!code
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
Not !code will do what it does
Write upper part of the bot said, you'll get bottom part of the bot
'''sqf
if (typeOf (_this select 0) isEqualTo "O_officer_F") then {_this select 0 synchronizeObjectsAdd [SupportRequesterO];
SupportRequester synchronizeObjectsAdd [_this select 0];
BIS_supp_refresh = TRUE;
publicVariable "BIS_supp_refresh";
[_this select 0, ArtilleryRequester, ArtilleryProvider] call BIS_fnc_addSupportLink;
[_this select 0, CasRequester, CasProvider] call BIS_fnc_addSupportLink;
[_this select 0, TransportRequester, TransportProvider] call BIS_fnc_addSupportLink;
[_this select 0, AmmoRequester, AmmoProvider] call BIS_fnc_addSupportLink;
[_this select 0, HelicasRequester, HelicasProvider] call BIS_fnc_addSupportLink;
};
Im not understanding. Doing something wrong here.
''' <- this is yours
I see. I just could not press enter to send It.
if (typeOf (_this select 0) isEqualTo "O_officer_F") then
{
private _officer = _this select 0;
_officer synchronizeObjectsAdd [SupportRequesterO];
SupportRequester synchronizeObjectsAdd [_officer];
BIS_supp_refresh = true;
publicVariable "BIS_supp_refresh";
[_officer, ArtilleryRequester, ArtilleryProvider] call BIS_fnc_addSupportLink;
[_officer, CasRequester, CasProvider] call BIS_fnc_addSupportLink;
[_officer, TransportRequester, TransportProvider] call BIS_fnc_addSupportLink;
[_officer, AmmoRequester, AmmoProvider] call BIS_fnc_addSupportLink;
[_officer, HelicasRequester, HelicasProvider] call BIS_fnc_addSupportLink;
};
if (typeOf (_this select 0) isEqualTo "O_officer_F") then {_this select 0 synchronizeObjectsAdd [SupportRequesterO];
SupportRequester synchronizeObjectsAdd [_this select 0];
BIS_supp_refresh = TRUE;
publicVariable "BIS_supp_refresh";
[_this select 0, ArtilleryRequester, ArtilleryProvider] call BIS_fnc_addSupportLink;
[_this select 0, CasRequester, CasProvider] call BIS_fnc_addSupportLink;
[_this select 0, TransportRequester, TransportProvider] call BIS_fnc_addSupportLink;
[_this select 0, AmmoRequester, AmmoProvider] call BIS_fnc_addSupportLink;
[_this select 0, HelicasRequester, HelicasProvider] call BIS_fnc_addSupportLink;
};
Ahhhhh
Thank you
So the red Is Incorrect?
Red?
Trying to figure out what Is wrong with this line of code.
I have been beating my brain In for hours.
How it is wrong? Errors?
Not functioning as required.
That doesn't tell us what is your need and how it doesn't work as intended
This script did not work. Trying to accomplish 2 things with the script. 1) Players that rejoin the "Officer" slot will be able to use support roles. 2) Make It so that ONLY officers will activate this script. 3) Make It so that the officers can only call for support If they have a radio back pack on and equipped.
Hell I could live without request 3.
I just need players to be able to connect to the role and have support option avlb.
How do you run this code?
The code has been placed into init.sqf directly?
Yes at the bottom.
This is why. The code doesn't recognize who is the player unit/role
Where would this needs to be placed? Or Is It a variable that needs to be named?
player is the command to get player unit
I figured that the "O_officer_F" role would work
Yes the players unit that they are playing as?
Pretty much player returns player unit object depends on the computer
It might explain why before the line of code gave EVERYONE the ability to call support roles.
All I did was move a part of the line of code upward.
What should be done Instead?
init.sqf does not have _this argument after all
I put my best two braincells together on this and came up with... something. It's not exactly the cleanest, and I didn't test it with that exact ammo type, but with the vanilla Mk6 rounds, it would destroy a tank - given enough direct hits. Laser guided might help.
if (!isServer) exitWith {};
this addEventHandler ["Fired",
{
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
if (_magazine != "8Rnd_82mm_Mo_LG") exitWith {};
[_projectile] spawn
{
params ["_projectile"];
private _list = [];
while {count _list == 0} do
{
_list = position _projectile nearObjects ["tank",5];
if (speed _projectile == 0) exitWith {};
};
if (count _list == 0) exitWith {};
private _pos = getpos _projectile;
private _vel = velocity _projectile;
private _dir = getdir _projectile;
_extraCharge = createVehicle ["Sh_125mm_HEAT", _Pos, [], 0, "CAN_COLLIDE"];
_extraCharge setvelocity _vel;
_extraCharge setdir _dir;
};
}];
That's really helpful! Thanks! So the script is replacing all launched mortar rounds with 125mm HEAT projectiles instead?
I'd suggest to use setProjectileOwner... or I don't recall name rn but so the scripted shell will be recognized by the game as someone's shot
I came up with a solution that works (decently) for now thanks to this! Basically, if a laser guided mortar ends up landing a direct hit on <something>, an AT missile automatically spawns above the target and impacts exactly where the mortar hit, essentially making it an anti-tank mortar round.
this addEventHandler ["HitPart", {
_target = ((_this select 0) select 0);
_shellType = str (((_this select 0) select 6) select 4);
_hitPos = ((_this select 0) select 3);
hint str(((_this select 0) select 4));
if (_shellType isEqualTo str("M_Mo_82mm_AT_LG") && ((_this select 0) select 10)) then {
[west, "HQ"] sideChat "Hi there";
_missile = createVehicle ["M_Scalpel_AT", _target modelToWorld [0,0,1], [], 0, "CAN_COLLIDE"];
_missile setVectorDirAndUp [[0,0,-1], [0,1,0]];
_missile setMissileTargetPos _hitPos;
_missile setDamage 1;
};
}];```
Looks like you got something together, if it works it works π
Yeah, my script just plops an extra 125mm HEAT round at the exact same space; the original shell still hits, but does nothing really to actual armor.
I'm having some trouble with the procedural texture function to provide real time camera feeds
When specifying width/height at the start, e.g. #(argb,W,H,mips), values of 8 for width and height (the default) produce the full camera image, as far as I can tell
But changing the width/height seems to have no effect on the image size or resolution.
What exactly you've done and your goal?
So, I probably need to rollback and the more I mess with things the more it is screwing up.
I was following this tutorial to create some cameras and display them to screens in game. https://www.youtube.com/watch?v=2PippMaKHGk
The tutorial worked pretty well, except for two parts: the first is that I can't seem to get the camera's field of view to rotate properly so I can aim it at a point of interest (it is fixed in position and rotation; I'm struggling to aim it in the editor)|
So this time we're looking at live camera feed and how to do it in ARMA. I recently showed to some people how I made a shoothouse with cameras and a fancy Captain Price desk where I can watch the live feed at.
Also, helmet mounted cameras are a bonus.
Chapters:
00:00 - Intro
00:06 - Setting up assets
01:17 - Camera lens reference points
02:33 ...
The second problem I am having is that editing the procedural texture options often produces unintuitive or bizarre effects
Where say, changing the aspect ratio causes the picture to become a blurred mass of white and then disappear or something similar
This is a graphical/render issue and not related with script itself
I figured
OK, the issue I am now having is that I cannot seem to pitch a camera down
OK, I figured this out. It seems if you want to change the pitch of a camera, you must use cameraSetDir; using setVectorDir will not take. Then you need to commit the changes using camCommit. You can set position normally but not pitch.
I forgot camSetDir is even a working command. A camera actually is just an object so vectorDir and Up can do it, unless camera related commands overwrite it
params["_nearbyVeh"];
_nearbyVeh = nearestObjects [player, ["Car", "Tank", "Air"], 5];
if isNil { _nearbyVeh } exitWith { hint "There are no vehicles nearby!" };
The goal of this code is to check to see if the player is near a car or anything.
So since nearestObjects [player, ["Car", "Tank", "Air"], 5]; returns [], is that why my code wouldn't be hinting?
If I run
if !isNil { _nearbyVeh } exitWith { hint "There are no vehicles nearby!" };
It will hint all the time, even when i am next to a vehicle.
How would i check if _nearbyVeh is empty or not?
count _nearbyVeh
An empty array is not nil, just it doesn't contain anything
Also that params usage does nothing
thx polpox
Getting so used to getOrDefaultCall with hashmaps makes me wish for a getVariableCall for entities
Or getVariable ["var", 0, false, true]?
i did
What are these arguments?
i mean, i would expect it to either throw an error or not work, but not crash
Not sure which is smart to have another argument or diff command
apparantly it happen with the arsenal function too?
Hmm, perhaps it could work by having a third argument as an indication that default value should be called if variable is not found?
Third as in #2 or #3? #2 is already occupied
getVariable ["var", {123}] - return {123} code if "var" is not found
getVariable ["var", {123}, false] - call {123} if "var" is not found and just return it
getVariable ["var", {123}, true] - call {123} if "var" is not found, write into "var" and return it
Did you think about broadcast for setVariable?
Yeah
Then yeah this could work
Ticket please time I guess?
Gonna make it now
My cat... you're now green why not just do it yourself!!
Commented with my proposal
whats the most efficient way to find all enemies close to a group? nearEntities on each unit of the group and enemy state check?
if you want speed you can loop through all the enemy groups and check only the leader distances to other leaders
unlikely to be the most efficient way - especially if you have many groups
but with nearEntities you may loop hundreds of entities while with group looping only tens of
why hundreds? the engine pre-filters with the provided type first
depends how many units you have, that was just an example
best case would be to get access to the engine lists - but asking about whats available
well you can of course use nearEntities but there are few similar commands and I dont know which one is the fastest
i tried also with targetsQuery, targets with different setups
like nearestObjects
nearEntities with targetKnowledge check after seems most "efficient"
so what are you trying to achieve here, if ok to ask?
see
I mean what you do with all the enemies?
determine a suitable spotter
Is there any way to hide the binoculars while doing the binoculars animation? I want to use that pose for my "map in hand" script
No, it's not a script's responsibility
What about getting the same animation? When I try to use it via playmove or switchmove it does it for a second and then just drops it...
What I said, on the other words, it is an animation's responsibility
Thanks, attached to the hand it is for my "map shown in hand script"
If it is to tell other players βhey I'm watching a mapβ yeah I guess you can just use attachTo
Yes, I already do, but I also wanted an animation that goes "well" with it... the binoc animation state was perfect, but without the binocs of course
you can make a new animation config that uses the same rtm, but doesn't use any weapons (iirc weaponIK = 0)
Can that be done without mods? (From the mission folder)?
No
why don't you just remove the binocs? and add them back again once they exit the anim?
I only do Vanilla or CDLC missions, can't use mods, so unless there is way to remove the binocs without mods I am scrwd π₯Ή
try using disableAI "ANIM" and disableAI "MOVE"
then do the anim player switchMove "anim"; player playMoveNow "anim"
Tried ```sqf
player disableAI "ANIM"; player disableAI "MOVE"; player switchMove "amovpercmstpsoptwbindnon"; player playmoveNow "amovpercmstpsoptwbindnon";
Animation stays for a second and then goes back to normal
with just playmove "amovpercmstpsoptwbindnon" it stays longer but goes back to default again
even with player disableAI "ALL"? 
Yes, I don't know how it is holding that animation when pressing B
I meant just remove the binocs from inventory
Let me try!
you can also try:
player switchMove "amovpercmstpsoptwbindnon"; player playmoveNow "amovpercmstpsoptwbindnon"; onEachFrame {player playmoveNow "amovpercmstpsoptwbindnon";}
``` 
That works just that the player is no longer able to move
Was he supposed to?!
Yes, I am trying to replicate this in vanilla:
Without mods of course, the bino state when you press B is the closest I could find that lets you move and crouch like you are holding a map
It's not possible
Knowing that is good enough so I don't waste my time trying to find a way
Well you should really consider using mods with your missions. You can just make a shared mod that is used by all your missions. There are not a lot of things you can do with missions alone
Can someone help me; _taskName = "Liberate Villages";
_villageName = "Pavlokhov";
if (!(taskState [_taskName, _villageName])) then {
taskSetState [_taskName, _villageName, true];
_liberatedVillages = 0;
{
if (taskState [_taskName, _x]) then {
_liberatedVillages = _liberatedVillages + 1;
};
} forEach ["Pavlokhov", "Novoshny", "Solnevny"];
hint format ["%1 Villages Liberated! Move on.", _liberatedVillages];
if (_liberatedVillages == 3) then
hint "All villages liberated!";
};
};
its says : Missing ";" in line 5-6
!code
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
Ive got a problem it says missing ";"```sqf
_taskName = "Liberate Villages";
_villageName = "Pavlokhov";
if (!(taskState [_taskName, _villageName])) then {
taskSetState [_taskName, _villageName, true];
_liberatedVillages = 0;
{
if (taskState [_taskName, _x]) then {
_liberatedVillages = _liberatedVillages + 1;
};
} forEach ["Pavlokhov", "Novoshny", "Solnevny"];
hint format ["%1 Villages Liberated! Move on.", _liberatedVillages];
};
how do i correct it?
Read BIKI article
https://community.bistudio.com/wiki/setTaskState
I'm quite new to programming, so how do i fix that issue ? just replacing ? And what the task state would be Succeeded right ?
Some lithuanian arma player
Then don't ask that player to write one. This script is not going to run anyways for various issues
oof, thats bad. Could you guys help me make a new one then ?
Well, if we know what is your intention/things you need to prepare
Oh don't ask me to do so. It's 1AM already here
Alright, Good night !
Sure let me explain : Its about a ukrainian special forces unit, who were told the task to liberate following three villages from occupants : "Pavlokhov", "Novoshny", "Solnevny". (thats the correct order). In these Villages are OPFOR Russian units placed and the have their ambient acitons going on until they spot the Ukrainian at the Village Entry (Probably a Trigger there). They open fire and a combat starts. When there are no OPFOR units left in the first villages area they'ill be assigned to recover from battle (Heal and stuff, just a hint though) And then when all are good to go again go to Novoshny, and execute the same actions. This Until 3/3 Towns have been cleared. The UAF Team consists of 7 Soldiers btw. When its finished, the mission ends.
How do I make ORBAT Groups for more than 3 divisions?
More of an #arma3_config question but the short version is that it's like this:
class TopLevel1
{
class T1SecondLevel1
{
class T1S1ThirdLevel1
{
};
};
class T1SecondLevel2
{
};
};
class TopLevel2
{
class T2SecondLevel1
{
};
};```
The matching pairs of `{};` enclose all the things that are sub-classes (sub-units) of that class. Want something that comes from a new class instead of being a subclass of the current one? Close that class `};` and start a new one.
could be native code that is executed somewhere in em
if (typeOf (_this select 0) isEqualTo "O_officer_F") then {
_this select 0 synchronizeObjectsAdd [OpforCommander];
OpforCommander synchronizeObjectsAdd [_this select 0];
BIS_fnc_addRespawnPosition = TRUE;
publicVariable "BIS_fnc_addRespawnPosition";
[OpforCommander] call BIS_fnc_addRespawnPosition;
};
Trying to add a line of code to Initplayerlocal that will force the respawn module connected to certain roles to work.
BIS_fnc_addRespawnPosition = TRUE;
This won't work. You can't overwrite an existing function
if (typeOf player == "O_officer_F") then {
[player, OpforCommander, "OPFOR Commander"] call BIS_fnc_addRespawnPosition;
};
This should do what you want.
I will try this out.
Do I add the to playerlocal or Inti in eden editor?
initPlayerLocal.sqf
thank you.
Will this make It so only OPFOR can spawn on that officer?
Trying to avoid blue for spawning on It.
Every player of that type can spawn there
Just that faction? Alright thank you.
The line of code did not work.
Once I disconnect from the server and rejoin the slot I no longer act as a spawn point.
When we first start the server everyone can spawn on the officer. Once a player leaves the slot It seems to desync the respawn module. A new player or same player will connect to the Officer slot and the respawning on that player no longer works.
I've got a script/addon that I'm working on and I'd like the keybind to specifically not work if the Zeus interface is up. How would I do that?
The line of code works. I found the Issue with what I did wrong. I gave the module the var name rather then the player. Issue resolved now I can go get drunk. Thank you.
Is there a reliable way of adding randomised damage level to buildings on mission start?
I've done it before a long time ago but I don't remember how I did it.
setDamage and random?
Yeah I don't remember how I did it.
It was using a game logic iirc
and on mission start, the code would run and apply a random level of damage to buildings within a specified radius.
Buildings, signs, trees etc
Game Logic is not really related with it. It does nothing but pretty much the source of a script
nearestTerrainObjects to get near terrain objects (well as the name implied), forEach to iterate them, setDamage or maybe setHit to apply damage
Yeah I was told you could use anything as long as the code was in the init and a trigger was used.
Well besides that's true they are not the only way to execute scripts
Aye
I know I made the mission and I saved it but I have hundreds of missions that I've made and just mashed the keyboard
god damn this is getting smexy
i need to eat something though cause im feeling light headed
Question... How do i detect if a player is using a set CBRN uniforms????? Can i do this via a config path???
Compare to your defined classnames or I suppose you could do a config lookup comparison if it's from a specific mod
So I'm building an underground bunker.
Out of curiosity, is there a way for objets placed to work "floating" ?
Like 1000m above ground?
Most large structures don't have physics behaviour and can be placed at any altitude.
Physics objects also don't care and will be fine as long as they have something under them to stop them from falling.
If you're talking about units going into freefall when at high altitude, that's nothing to do with the objects. That's a property of the units themselves, and can be adjusted with the setUnitFreeFallHeight command.
Can anyone help me with a vehicle spawning scipt
What are you trying to achieve?
So in mike force there are dedicated spawns for vehicles. I want to add a vehicle spawn with a different vehicle that they don't have in the spawns. This is the code that they had attached to the spawn point when itriedto adjust it ['light_transport', 0] call vn_mf_fnc_veh_asset_3DEN_spawn_point
Are you creating your own spawn point, or adding to an existing one?
I am trying to edit a existing one
if u have free time I could stream u my eden
I've done a little tinkering on modifying Mike Force, but I settled on simple addAction for spawning in vehicles - and in the latest version of the scenario, it's really only needed for the F-100 variants that aren't made available already.
Adding to the existing system is a chore and a bit beyond me, sorry XD
Do u mind showing me that script so i cna use it
Thank you chief
And can AIs targets units 1000m above them?
hey, i wrote a script to get a mortar unit to fire on a random position in a trigger, however, when i call it, nothing happens except for the hint (which means at least im calling the function correctly i guess). Im not even getting an error message π¦ Does anyone know why that might be?
// your code here
params ["_mortar", "_target","_rounds"];
for "_i" from 1 to _rounds do {
_postarget = getMarkerPos "_target";
_trg = createTrigger ["EmptyDetector", _postarget];
_trg setTriggerArea [100, 100, 0, false];
_pos = _trg call BIS_fnc_randomPosTrigger;
_mortar doArtilleryFire [_pos, "8Rnd_82mm_Mo_shells", 1];
hint "Function was executed!";
};
Im calling it like this:
[Mortar01,FT01,8] call CBF_fnc_mortarFFE;
Edit:
Okay when im standing right next to the funny mortar man he say "Cannot execute, adjust coordinates." but it def is within range, if i get in i can reach the marked position easily
Probably, if they get line of sight or are otherwise made aware. They can certainly target vehicles at that range and use sniper rifles. Depending on the angle, they might not be able to actually hit anything - I don't think humans can aim directly up in Arma, and most vehicles can't either.
If you have a floor on your sky construct, it shouldn't be a problem.
Your getMarkerPos is wrong. It's looking for a marker literally called "_target"
do they even acknowledge targets that are farther than 700m without being inside a vehicle?
You have it looking for the string "_target" when you should have it looking for the string contained in the variable _target
Also, you're creating a new trigger for every round fired, and never cleaning them up. Create one trigger at the start of each fire mission, and delete it afterwards.
I'm pretty sure they can spot and engage targets further away if they have a sufficiently good optic on a rifle, and they'll definitely use launchers that have that kind of range.
I dont think I've ever managed to make AI engage that far away vanilla wise, always assumed it was something regard cost of use of weapon something something and the fact that they cant land clear shots
launcher i have seen using the lock one ones
i gotta test now π€
Rifles do have config "maximum range" values. I imagine they'll be more likely to try it with an LRR than a SPAR-16
I tried using the marksman dlc weapons since I assumed that "reached farther" config wise but no luck
maybe they have to acknowledge the target to be able to engage it
sorry, cant english today
lol
params ["_mortar", "_target","_rounds"];
_postarget = getMarkerPos _target;
_trg = createTrigger ["EmptyDetector", _postarget];
_trg setTriggerArea [100, 100, 0, false];
for "_i" from 1 to _rounds do {
_pos = _trg call BIS_fnc_randomPosTrigger;
_mortar doArtilleryFire [_pos, "8Rnd_82mm_Mo_shells", 1];
hint "Function was executed!";
};
deletevehicle _trg;
I switched it up to this, now hes complaining Error 0 Elements provided, 3 Expected in line 3 :/ does he not get the marker position or whats up?
Markers are referred to by string names. Is FT01 a variable containing the marker's string name, or did you type FT01 in the marker's name field in the Editor? If it's the latter, change it to "FT01" in the function call
FT01 is the global variable i gave to the marker in the editor - he is just firing one round instead of 8 now but at least he is doing it
The marker "variable name" field in the Editor is not a global variable name, despite the caption. It's just a string, as used with marker commands. You can save it to a global variable, e.g. markerName = "my_marker_name"; but by default it's not, so you need to provide that as a "string" to marker commands.
yeah, i did so now, poor guy now knows what hes shooting at at least - cant count tho.. is there a way to pause script execution in a function? when i tried the "concept" of the script in the console i made him sleep for 5 after each round, then he delivered them all.. doesnt work in the functions tho :/
You can use sleep between rounds, you'll just want to spawn the function instead of call, to make sure it's running as a scheduled thread
Works like a charm now! Thank you for helping me out π
Got it, thank you!
I forgot that there is no patch so that I can do something like that with attachto π«’
I'm thinking about it, I'd just like to do it for a multitude of vehicles
If this is the wrong area then my apologies, but I figure because it deals with the debug console ingame it'll suffice.
I have a player who has disconnects, until he can solve them I need a way to teleport him somehwere on the map where he last was easily. Is there a suitable console command for this? I know, for instance, onMapSingleClick "vehicle player setPos _pos; onMapSingleClick '';" and derivatives of that, what I need is a console command to go teleport only a specific player (By name, ideally) where I click on the map
Is there a way to get the relative direction of a marker to another marker? like in
_reldir = player getRelDir tank;
but instead of getting the relative direction of the tank you get the relative direction of a marker?
getMarkerPos m1 getDir getMarkerPos m2
How can I hide a model of a vehicle without affecting functionality? For the rest of the players, it should remain visible.
if by "name" you mean variable name, you can just replace vehicle player with vehicle varName
if you mean their in-game name, you can probably just search:
onMapSingleClick toString {
{
if (name _x == "name") then {_x setPos _pos};
} forEach allPlayers;
onMapSingleClick ""
};
Hello π
I have a script that works just fine, but i would like to improve it. It is written in initPlayerLocal.sqf: ```sqf
if (_key == DIK_RCONTROL && {vehicle player != player && { side player isEqualTo west } }) then {
createDialog "univrz";
};
if (_key == DIK_RCONTROL && {vehicle player != player && { side player isEqualTo west } }) then {
if(vehicle player isKindOf "Tank" || vehicle player isKindOf "Air") then {
createDialog "dialog1";
} else {
createDialog "dialog2";
};
};
That's an interesting idea to put an if inside another if but let's say we're talking just about land wheeled vehicles since other vehicles (boats, helicopters, ...) are not used on my server. I would like to define 2 or 3 vehicle class names. If player sits in one of these, a dialog 1 should open up, if player sits in any other, dialog 2 should open up.
How would that be possible?
Another || for third class branch
If you want exact match, change isKindOf to == and to typeOf vehicle player
["class1", "class2", "class3", ...] findIf {vehicle player isKindOf _x} >= 0
["class1", "class2", "class3", ...] findIf {typeOf vehicle player == _x} >= 0
Or another way of doing it instead of lots of || checks
I'll see what i can do, thank you.
hey there, i have no exp. in scripting. I just want to run a recruit and a respawn skript i saw on youtube. What iam doning here wrong? For both i need this in the init.sqf: [] execVM "bon_recruit_units\init.sqf";
[] execVM "respawnmkr.sqf";] Now my Scenario is crashing.
```sqf
// your code here
hint "good!";
```
β
// your code here
hint "good!";
... i didnt save as .sqf after editing... well then, nevermind thx for fast response
Trying to use a spectate code to force the spectate module to start on a dedicated server.
// description.ext
respawn = 3;
respawnTemplates[] = { "MenuPosition", "Spectator" };
// initPlayerLocal.sqf
// --- Enable full spectator in respawn screen
{
missionNamespace setVariable [_x, true];
} forEach [
"BIS_respSpecAI", // Allow spectating of AI
"BIS_respSpecAllowFreeCamera", // Allow moving the camera independent from units (players)
"BIS_respSpecAllow3PPCamera", // Allow 3rd person camera
"BIS_respSpecShowFocus", // Show info about the selected unit (dissapears behind the respawn UI)
"BIS_respSpecShowCameraButtons", // Show buttons for switching between free camera, 1st and 3rd person view (partially overlayed by respawn UI)
"BIS_respSpecShowControlsHelper", // Show the controls tutorial box
"BIS_respSpecShowHeader", // Top bar of the spectator UI including mission time
"BIS_respSpecLists" // Show list of available units and locations on the left hand side
];
params ["_unit", "_container"];
private _weaponsConfig = configFile >> "CfgWeapons";
private _unitRifle = primaryWeapon _unit;
private _ARifle = ("toLowerANSI getText (_x / 'cursor') in ['arifle'] && {getNumber (_x /'type') in [1]} && {getNumber (_x /'scope') == 2}" configClasses (configFile /"cfgWeapons")) apply {configName _x};
private _ARifleinbox = (weaponCargo _container) arrayIntersect _ARifle;
private _compatibleMags = compatibleMagazines [_unitRifle, "this"];
private _compatibleMagsinbox = (magazineCargo _container) arrayIntersect _compatibleMags;
private _compatibleMagsArifleinbox = compatibleMagazines [_ARifleinbox, "this"];
private _compatibleMagsforArifleinbox = (magazineCargo _container) arrayIntersect _compatibleMagsArifleinbox;
private _rifleLoaded = count (primaryWeaponMagazine _unit) > 0;
private _amountofmags = {_x in _compatibleMags} count (magazines _unit + primaryWeaponMagazine _unit);
Error position: <compatibleMagazines [_ARifleinbox, "this>
Error Array type, expected String
Who can say what's wrong with it?
_ARifleinbox contains an array, because that's what arrayIntersect returns. compatibleMagazines expects you to give it a classname string.
private _ARifleinbox = (weaponCargo _container) select _ARifle;
@hallow mortar this way?
or selectrandom...
I'm not really sure what you're trying to do overall, but you can't do...that.
_ARifle also contains an array - of Configs, I think string classnames - and you can't use that as the right-hand argument for select.
killzonekid's camera follow script:
_null = _this spawn {
_missile = _this select 6;
_cam = "camera" camCreate (position player);
_cam cameraEffect ["External", "Back"];
waitUntil {
if (isNull _missile) exitWith {true};
_cam camSetTarget _missile;
_cam camSetRelPos [0,-3,0];
_cam camCommit 0;
};
sleep 0.4;
_cam cameraEffect ["Terminate", "Back"];
camDestroy _cam;
};
}];```
Gives me an error on line `_cam camCommit0;` saying "Error undefined behavior: waitUntil returned nil. True or false expected."
Any idea how I can fix this?
I think adding false directly after the camCommit line will have the right effect.
If you're curious, this is caused by a change to how waitUntil works, presumably after the script was written. Previously, returning a non-bool value as the last result in the waitUntil check (or nothing, in this case), while not recommended, would effectively behave as if you'd returned false. Now that unsafe practice is handled with a script error.
I get: Error camcommit: Type Bool, expected Number
After the camCommit line, not after the command itself.
also it seems the script doesn't work at all in multiplayer
oh ok thanks give me a moment
No reason it shouldn't work in MP (for your missiles, not other people's). It won't work with vehicles, but that's not because of MP - it's because the Fired event handler must be added to the vehicle, not the gunner, if you want to detect vehicle weapons firing.
works thank you π
turns out I was using this wrong, it works if I replace player with the custom object name defined in editor but not if I replace it with this
in multiplayer, that is
ok new problem in multiplayer, it shows the missile camera view to every player
Where did you put the code?
(and what kind of weapon are you trying to work with?)
onto the player character, trying to get it to work with manpads
If you put it in an object init field, then this should work, because in that context, this contains a reference to the object the init field belongs to.
Do you want it to work for that specific unit only, or for any player who uses a MANPADS?
i only want the player to which the script is assigned to see the view of the missile flying
Right, but do you want that functionality to be available to all players for their own missiles, or just to one specific player?
just that player
Right, so:
Use this addEventHandler ...
Inside the EH, right before the _null = _this spawn { line, add
if (!(player == _this#0) or {!(_this#6 isKindOf "MissileBase")}) exitWith {};
The object init field means the event handler is added, and can fire, on every connected machine. This is fine, because the unit could change machine if people swap slots. However, that also means we need to ignore events where the unit is not the local player unit. And...we also need to check whether the unit is actually firing a missile, otherwise you'll get a cool camera every time you fire your gun.
thanks, I can't test it now with another player, but it seems tobe working so far
Does anyone know of a way to be in more places than one as far as the audio engine is concerned?
Like an audio version of remote cameras?
wut?
They want to be able to hear a live feed of audio from some other place, at the same time as the audio from where their main camera is currently located.
One of those things that's not a complicated concept, but is probably very complicated if not outright impossible in Arma.
setposasl otherposition setposasl actualposition oneachframe π
Can someone assist me in a script to disable third person view in drones. Something simple
addEventHandler ["VisionModeChanged" worked when disabling thermals..
But I cant nail the right one for drone pilot. getinman doesnt seem to work
There's no EH for camera mode specifically. You can use a User Action EH to detect the camera switch actions, or a KeyDown display EH that checks for whether the camera switch inputAction is being pressed and returns true if so.
KeyDown EH example:
(findDisplay 46) displayAddEventHandler ["keydown",{inputAction "tacticalView" > 0}];
(findDisplay 46) displayAddEventHandler ["keydown",{inputAction "personView" > 0}];```
(you would want to `&&` a check for whether a UAV is currently being controlled as well)
~~Dang alright, I would assume this is easily bypassed by changing key? ~~
NICE
Thanks!!!!!!!!
Much appreciated I was looking for this
So a drone is essentially a remote controlled unit?
Makes sense now
Hey do you guys know if you can make a script to unban a specific player?
Drones are vehicles, but they have a special kind of secret invisible crew. When you control a drone, you're controlling those crew. If you place a drone without crew in the Editor, you can't control it.
I was always curious about that
If this is because you've been banned and you want to unban yourself, I'm not telling you :U
No my friend is trying to unban me
He did #exec unban and all that stuff
It's a dedicated server
He can't find banlist.txt and stuff
Check battleye user folder
#exec unban "UID here" should work. Note that only the UID (numerical Steam ID) will work, you can't unban by name.
Does it need the quotes
Yes
Yeah he tried that
Didn't work
Everytime I try to join it says "You were banned"
He even tried exec clearbans
Was it a BattlEye ban or a normal ban?
It depends
On server
Profile > Users > HOST > bans.txt
Wdym on server
Well if he did it it wasn't BattlEye
Did you try restarting the server after doing the unban?
Yes
Is it rented system
Yup
Inside the user profile on the server panel is where he needs to look
This may be more of a #server_admins issue than a scripting thing
Yeah well you guys are the only ones chatting so I figured I might ask
All good try above it will work
Where's the user profile server panel
Is it in arma 3 or is it a file explorer thing
@hardy valve
Anyone good at Arma 3 UnitCapture? Im trying to make a small cinematic. Figure as its sorta scripting that this is the chat for it.
try being more specific with your question
Really weird to explain, just help with creating cinematics using the script UnitPlay
And unit Capture
yeah. I got some video feed in a ui and it would be great to have the audio from that location, too, but I wasn't getting my hopes up.
Hey guys I am trying to edit a mod to have it create grenade launcher rounds casings when firing
I've narrowed down the area of the code to here:
Theres a check I can run ingame count ace_casings_casings which is not increasing when firing grenade launcher rounds.
if (!isNull objectParent _unit) exitWith {};
private _modelPath = GVAR(cachedCasings) get _ammo;
if (isNil "_modelPath") then {
private _cartridge = getText (configFile >> "CfgAmmo" >> _ammo >> "cartridge");
//Default cartridge is a 5.56mm model
_modelPath = switch (_cartridge) do {
case "FxCartridge_9mm": { "A3\Weapons_f\ammo\cartridge_small.p3d" };
case "FxCartridge_65": { "A3\weapons_f\ammo\cartridge_65.p3d" };
case "FxCartridge_762": { "A3\weapons_f\ammo\cartridge_762.p3d" };
case "FxCartridge_762x39": { "A3\weapons_f_enoch\ammo\cartridge_762x39.p3d" };
case "FxCartridge_93x64_Ball": { "A3\Weapons_F_Mark\Ammo\cartridge_93x64.p3d" };
case "FxCartridge_338_Ball": { "A3\Weapons_F_Mark\Ammo\cartridge_338_LM.p3d" };
case "FxCartridge_338_NM": { "A3\Weapons_F_Mark\Ammo\cartridge_338_NM.p3d" };
case "FxCartridge_127": { "A3\weapons_f\ammo\cartridge_127.p3d" };
case "FxCartridge_127x54": { "A3\Weapons_F_Mark\Ammo\cartridge_127x54.p3d" };
case "FxCartridge_slug": { "A3\weapons_f\ammo\cartridge_slug.p3d" };
case "FxCartridge_12Gauge_HE_lxWS": { "lxWS\weapons_1_f_lxws\Ammo\cartridge_he_lxws.p3d" };
case "FxCartridge_12Gauge_Slug_lxWS": { "lxWS\weapons_1_f_lxws\Ammo\cartridge_slug_lxws.p3d" };
case "FxCartridge_12Gauge_Smoke_lxWS": { "lxWS\weapons_1_f_lxws\Ammo\cartridge_smoke_lxws.p3d" };
case "FxCartridge_12Gauge_Pellet_lxWS": { "lxWS\weapons_1_f_lxws\Ammo\cartridge_pellet_lxws.p3d" };
case "FxCartridge_9mm": { "A3\Weapons_f\ammo\cartridge_small.p3d" };
case "": { "" };
default { "A3\Weapons_f\ammo\cartridge.p3d" };
};
GVAR(cachedCasings) set [_ammo, _modelPath];
};
I'm wondering what it is about this logic that is stopping grenade launcher rounds from being excluded from this (the script defaults to using a 556 casing if it doesnt have anything else to choose
case "": { "" };
Have you checked what value the grenade launcher has for cartridge?
Why you need to do this though?
the ace casings module does not include grenade launcher casings, I want to include it
I have created a cfg patch which adds a value to the cartridge,
I meant why you need to have such switch cases. Usually the model is defined in configFile >> "CfgVehicles" >> "FxCartridge_9mm" >> "model"
I didn't write the orignal script, but I think that they are setup as exceptions as the
private _modelPath = GVAR(cachedCasings) get _ammo; uses the cached Casings. Im not sure
Yeah, that's ACE's script.
heres me trying it ingame, if I just firing grenades the variable does not go up, only with rifle rounds
I don't see why what you've changed wouldn't "work". Maybe hook FiredMan yourself and see what's happening.
ok good idea, i've never actually done that before. can i do that through the debug menu?
blinks
Probably because 40mm HE doesn't even have cartridge model?
You're messing with ACE and you never added an EH? :P
player addEventHandler ["FiredMan", {
diag_log str _this;
}];
Should dump data to the RPT each time you fire.
amazing lad, thank you for that
ACE is actually using CBA_addClassEventHandler so maybe there's some screwup there.
16:28:11 "[B Alpha 1-1:5 (gabes),""CUP_arifle_M4A1_M203_CCO_Laser"",""M203"",""Single"",""G_40mm_HEDP"",""CUP_1Rnd_HEDP_M203"",164151: ugl_slug.p3d,<NULL-object>]"
hmm wonder what the null object is
nah I editied grenadecore and it adds the paramater to a few different grenades
you can see here its ok
Ok, restart the mission and try this one instead:
["CAManBase", "FiredMan", {
diag_log str _this
}] call CBA_fnc_addClassEventHandler;
sorry
give me a sec
16:37:28 "[B Alpha 1-1:5 (gabes),""CUP_arifle_M4A1_M203_CCO_Laser"",""M203"",""Single"",""G_40mm_HEDP"",""CUP_1Rnd_HEDP_M203"",164377: ugl_slug.p3d,<NULL-object>]
Would it be possible to make it so it only shows for units in the trigger?
We ran into an issue where it shows for everyone and if more than one person is in the trigger it repeats adding another action and clogging up the screen
Dunno then, should work. The ACE code is trivial.
hm ok, i'll go back to them about it, cheers for the help around it
what do you have in the rest of the trigger as far as settings?
Any player, present, repeatable
anybody and player in thisList for condition
Anything else?
(getPosVisual (vehicle player)) vectorFromTo (getPosVisual _obj)
seems quite expensive going by profiling - any more efficient way for this?
// Get the 2D direction from player to object
how complicated would it be to make Arma save player-drawn lines? I swear there was a mod for it but now I can't find it and I'm pretty desperate to have this somehow implemented be it in a mission or as a separate addon.
If you only want 2D then would getDirVisual work? Or does it have to be a vector?
private _elevationOffset = [_viewDir, _tDir] call SPE_fnc_get_elev_diff;
SPE_fnc_get_elev_diff =
{
params ["_v1", "_v2"];
private _computeTheta =
{
params ["_x", "_y", "_z"];
if (vectorMagnitude [_x, _y, _z] == 0) exitWith
{
0
};
acos(_z / (sqrt(_x^2 + _y^2 + _z^2))) - 90
};
(_v2 call _computeTheta) - (_v1 call _computeTheta);
};```
([_angle, _elevationOffset, _ww, _hh] call _fnc_get_marker_coords) params ["_xx", "_yy"];
// Set the control square position
_marker ctrlSetPosition [
_xx,
_yy,
_ww,
_hh
];```
its to determine the position of a control - the control indicates the relative position of a target to you in a top radar bar (like in OFP)
Shouldn't be that hard
If the vertical component doesn't matter, then I would try using the bearing from getDirVisual, and doing a linearConversion between 0-360 and the left/right limit coordinates of the HUD element
Don't actually know if it would turn out faster, but that's the direction I'd take to test it
Also isn't there a top compass bar function that's Contact-exclusive for some reason? When are we getting that moved to platform :U
yeah BI added that. i think its available to some tanks - not quite sure when
does anyone have a script that lest you load a cargo box into a truck, like B_CargoNet_01_ammo_F into the back of B_Truck_Flatbed_F?
Lookup the boxloader mod
I made a mod for that. It's a simple function that one could implement into any mission.
It just occurred to me that this might be awkward to adapt for the player's facing direction. So maybe getRelDir and you can bug BI for a render scope version of that
Quick question if anybody knows how can i access the compass number on GPS so i can control it ?
hi, wondering if i can talk to someone about some config.cpp functions for a faction. stuff related to giving specific identities to some units (ex. miller) and creating a new identity pool for generic units
It's a UI control. You can look it up in config (it'll be part of the GPS panel class) and see where it gets its data, as well as a control ID you can use to target it with setters
RscCustomInfoMiniMap (IDD 311) > controls > Heading (IDC 198)
just post the questions you have and someone will get to it eventually. also, post it in #arma3_config, not here
is there a script to show how fast your Vehicle is going ?
onEachFrame {
hintSilent format ["%1 km/h", speed vehicle player];
};
thanks am making a life server speedo meter π
Should probably use eachFrame EH rather than onEachFrame, to avoid conflicts
ok thanks guys just making a hpp for it π
What are gunbags? Are they backpacks? I cant seem to find the correct variable to delete them if a player spawns a specific bag
Do you mean component bags for static weapons, or something else?
Yea exactly
private _backpacksToRemove = ["backpack to remove"];
while {true} do {
{
private _unit = _x;
{
if (backpack _unit in _backpacksToRemove) then {
removeBackpack _unit;
};
} forEach allPlayers;
sleep 1;
} forEach allPlayers;
};```
I use this but for component bags it does nothing
I removed all the classes cause the list is super long
Well, they are backpacks, so it should work. Bear in mind that in is case sensitive, so you'll need to either toLower everything or make doubleplus sure your classnames have the correct cases.
Yeah I went over them a bunch of times did backpack player; on debug etc.. the classes are correct for some reason its not doing anything. The strange part is it used to work
The others work fine, like remove weapons etc.. the pushback list for the arsenal hides specified classes.. it just wont remove the bag
Why do you have two layers of forEach allPlayers btw?
// Function to update the display
speedDisplayUpdate = {
params ["_ctrl"];
private _speed = round(speed vehicle player);
if (_speed < 0) then {
_ctrl ctrlSetText "Reversing";
} else {
_ctrl ctrlSetText format ["%1 MPH", _speed];
};
};
// Function to create RscText control using the defined class
createRscTextControl = {
params ["_display"];
private _display = findDisplay _display;
if (isNull _display) exitWith {};
_textControl = _display ctrlCreate ["RscText", -1];
_textControl ctrlSetPosition [0, 0];
_textControl ctrlSetSize [0.3, 0.037];
_textControl ctrlSetFont "PuristaMedium";
_textControl ctrlSetSizeEx 0.03921;
_textControl ctrlSetBackgroundColor [0, 0, 0, 0];
_textControl ctrlSetTextColor [1, 1, 1, 1];
_textControl ctrlSetText "";
// Continuously update the display
while {true} do {
private _ctrl = _textControl;
_ctrl call speedDisplayUpdate;
uiSleep 1; // Adjust this delay as needed to control the update rate
};
};
// Call the function to create RscText control on the display with ID 46
if (!isServer) then {
[] spawn {
waitUntil {!isNull (findDisplay 46)};
createRscTextControl 46;
};
};``` can not get a dialog to work with this what is wrong ?
Where did you put this piece of code?
i have maked a sqf in editer and a hpp to make it top center of the screen
So you put this in the Editor mission init field?
Okay, "made an SQF in the Editor" confused me, because you can't make external SQF files in the Editor
on crap sorry i worded wrong
So, your dialog.hpp, I assume, contains the config classes for a dialog?
Config is different to SQF script and you can't really have both in same file. The dialog config needs to go in description.ext, which is a config file loaded before the mission initialisation phase. The SQF code does belong in a .sqf file, probably init.sqf.
Also, createRscTextControl 46 is wrong. You've made a function called createRscTextControl, but then you're trying to use it like it's a normal command instead of a function. You have to use it with call or spawn, the same as when you call speedDisplayUpdate.
BTW, it's good practice to prefix function names with fn_ or yourtag_fnc_ to clearly identify them as functions and avoid naming conflicts.
im checking it out now.
I've tried a few different things and still cant seem to get it to work
private _backpacksToRemove = [""];
while {true} do {
{
private _unit = _x;
if ((backpack _unit) in _backpacksToRemove) then {
removeBackpack _unit;
};
} forEach allUnits;
sleep 1;
};
I've determined the issue is it is conflicting with this
while {true} do {
{
_unit = _x;
if ((currentWeapon _unit) in _weaponsToRemove) then {
_unit removeWeapon (currentWeapon _unit);
} else {
{
if (_x in weapons _unit) then {
_unit removeWeapon _x;
};
} forEach _weaponsToRemove;
};
} forEach allUnits;
sleep 1;
};```
Do I need to change something, if so what would that be. Im learning
I think recently introduced EH is good enough to do this job, no need to excessive while loop
So implementing this with an event handler is a better option? I'm not familiar with how to do that but I will research it
Also thanks for all your mods I love the arsenal extension etc...
In the meantime is there something I can adjust to not have compat issue with these 2?
If these are being done in the same file and not being spawned as separate threads, then it's less of a conflict and more "the second one waits for the first while loop to be done, and it never is". You don't need two separate loops - you can put both removal things in the same forEach allUnits. (or in the same event handler, which Polpox is right to bring up)
That makes sense.. The other scripts I use spawn with a waituntil for the arsenal. These ones were kind of just pasted
And its only these 2, where one doesnt work with the other
I appreciate the info
Also why I suggested EH is such loop is actually easy to consume spec, FPS, more like other scripts' process speed, if you have much of it. One example is, Warlords but in local hosted game, it can have a lot of "script lag (note, not FPS lag)" and pretty much scheduling these scripts is the reason
It's hard to explain why EH is always good to have, but basically it does it when it does, and doesn't do anything in other times
Meanwhile your scripts checks every second, every unit and its backpack or whatever
Right.. so better to not add an additional loop. With the event handler, should I use "post init"? I would do inventory opened but I think that would be exploitable
What I linked is the one
Oh sorry I clicked the lower embed and it took me to main site
(That's SlotItemChanged if your browser failed the specific section target)
So now I can just add event handler to serverinit/ local init sqf's? Probably best to do server side?
One thing of downsides of EHs are - slightly hard to understand what it does and how to handle everything
Can't make a snippet right now, hey it's your job Nikko
I'm not sure what the locality of SlotItemChanged is. It claims "global argument", but it seems like something that might only fire where the unit is local
I'd assume it happens on a computer where the unit is local, but might need to test and leave a note
Okay the current ones I use are ran in local sqf and they work fine I will place in same sqf as previous scripts
Thanks for the info
This is one case where I'd suggest using Editor init fields. Because player units can not exist at mission start, and then be created later, and can change locality after being created, it's useful to add the EH at the time of creation (rather than mission start) and to add it on all machines.
For example, placing this in the Editor init field of every playable unit:
this addEventHandler ["SlotItemChanged",{
params ["_unit"];
if !(local _unit) exitWith {};
// now check for illegal items and remove them
if (backpack _unit in kcs_var_illegalBackpacks) then {
};
// ...
}];```
You guys are awesome thanks. I will mess around with this.
In the future, I'd like to know how to implement EH's into mods, but I need to buy a 3d model first before I open that can of worms
hello there, got a very newbie question as i am not very experienced in the scripting, i play with my friends a lot of Escape missions like the classic Escape Altis etc. and i was thinking of trying to expand the world by spawning more types of locations as the mission starts.
i have made a composition of objects but i am not sure if it is possible to make it spawn at random location as the mission starts? i was able to figure out to do that with one object, but not quite a composition. not sure if thats something doable through Larrows guide or not.
Thanks for answers π
Hello all,
I'm stumped, so coming to ask here, but I'm looking for a way to close the ace arsenal on a player.
I.E I want to do an action, or a zeus self interact and it should close the ace arsenal for anyone who has it open.
I'm not sure if this is possible and I've no idea where to even start.
There's an eventhandler to pass the display ID on Ace Arsenal open.
I tried to closeDialog and closeDisplay on that, and it didnt work.
I also tried to find the ui element variable name with uinamespace getvariable "ace_arsenal_display" (total punt), and that also doesnt work
Any help would be appreciated
Thanks,
ctrlParent ((findDisplay 1127001) displayCtrl 1001) closeDisplay 1
Why not (findDisplay 1127001) closeDisplay 0? π€¨
doesnt appear to work
Weird
@fair drum @hallow mortar
Asking you now since I'm genuinely curious.
I know we can make "Custom" buildings and stuff and I was wondering.
Can this also include scripts?
what you mean? Anyone can make a script
Guess I'm not following what you're asking
If I head into Editor
I make the building + script
Then save it on "Custom"
Might work in editor, probably not in Zeus though
If the script is in the building's init field, then it will be included when you place the composition in the Editor.
If you place it in Zeus, it can be included with the following caveats:
- The mission or server's
zeusCompositionScriptLevelconfig setting must be set to2(it is not, by default) - The init field will be executed only on the machine that placed the composition, not globally like a normal Editor init field.
I see, thank you!
Thank you for the explanation. π
I wonder if I can create a server-sided mod that tells on slack that a scenario has started and frequently reports the progress.
I am looking at http://killzonekid.com/arma-extension-url_fetch-dll-v2-0/. I am not sure if this supports doing POSTs.
( Maybe I don't have to )
Otherwise write your own extension
writing things for Windows, not going to happen.
It's beautiful!
What does this mean when using BIS_fnc_ambientAnim? What will happen if logic is created?
microsoft rabble rabble rabble..
A Game Logic is a type of virtual entity that's used as a placeholder for various scripting stuff. It has a physical position but is invisible and invincible, and has no AI.
However, while it doesn't really do anything on its own, it does have a little bit of simulation cost, so it's best not to go overboard with creating too many of them.
Note also the reference to using a global command. This means that if you run the function on all machines, as many logics will be created as there are machines, because each machine is doing createUnit and creating a new logic (which is created for everyone and not just on that machine) for their copy of the function. So be careful to only execute the function on one machine.
Alright, thanks
private _friendlyGrenades = (player nearObjects ["GrenadeHand", 30]) select {
(getShotParents _x) params ["_vehicle", "_unit"];
side group _unit isEqualTo side group player
};
if (count _friendlyGrenades > 0) then {
{
private _dis = 30;
private _displayName = [getText (configFile >> "CfgAmmo" >> typeOf _x >> "displayname")];
private _pictureArr = [getText (configFile >> "CfgAmmo" >> typeOf _x >> "picture"),[1,1,1,1],.7,0];
private _pos = visiblePosition _x;
_pictureArr params ["_picture","_color","_size","_shadow"];
// drawIcon3D ["\A3\ui_f\data\map\markers\military\circle_CA.paa", [0.9,1,0,1], _pos, 1, 1, 0, "Grenade!"];
if ((lineIntersectsSurfaces [AGLToASL positionCameraToWorld [0,0,0], eyePos _x, player, _x, true, 1, "VIEW"] isEqualTo []) && {player distance _x < _dis}) then {
drawIcon3D [_picture, _color, _x, _size, _size, 0, format["%1 %2m %3", _displayName, ceil(player distance _x), _displayName], _shadow, .025, "PuristaMedium", "center", true];
};
nil;
} count _friendlyGrenades;
};
extDB2 could work, on the other side having phparma2serverstatus poll the server could work.
this sqf _displayName = [getText (configFile >> "cfgMagazines" >> _x >> "displayname")]; doesn't work because _x is an object, how could I make that work?
The script is run inside a sqf addMissionEventHandler ["EachFrame", {
the error is sqf Type Object, expected string for that _displayName line
Use typeOf _x - or configOf if you want to save typing out some of the config path
Ok, using typeOf _x fixes the error but both _displayName comes as "" and I get no picture from _pictureArr
It's CfgAmmo not CfgMagazines
using configOf would've fixed that too :P
Though since it is CfgAmmo, it might not have a displayname or picture
...wait, did you change one of those messages? One says CfgMagazines and one says CfgAmmo
Still nothing https://i.ibb.co/Z2Wb6Yc/grenade-GUI.png
Well what Nikko said
CfgAmmo items may not have a displayname or picture, since they can't normally be held in inventory
ok but this one does
"this one"?
The regular grenade, I know because it is displaying on the custom UI I have over there in the pic at the bottom center
_displayName = [getText (configFile >> "CfgAmmo" >> configOf _x >> "displayname")];``` now throws this error: Type config entry, expected string.
configOf already returns confg
Also yeah, as I said, what Nikko said. Usually CfgAmmo doesn't any text to describe what it is but in CfgMagazines
configOf is not the same command as typeOf, you can't just swap it out directly in place, it works differently.
typeOf returns just the classname of the item and it's up to you to provide the rest of the config path.
configOf returns the full config path of the item, and if you also provide the full config path of the item, the game will get confused.
Ok got it, so in order to get the picture used for that nade and its name I need to do two separate commands?
What?
This, read this again
if an item has a displayname, then the way to retrieve that regardless of which config the item belongs to, is getText (configOf _item >> "displayname");
But an item is not guaranteed to have a displayname, and if it doesn't then there's no command that can resolve that for you.
* same for picture
Reverse-associating an ammo type to its magazine is essentially impossible, because ammo types can appear in multiple magazines (not to mention submunition types...).
If displaynames and pictures aren't available (seems likely), then the best solution might be to simply determine whether it's a frag/smoke/chemlight, and display a generic name and icon based on that.
Is it possible to unbind the scroll wheel from the Context Menu/disable the scroll/context menu entirely?
Managed to make it work with this fnc: ```sqf
VAL_fn_getDisplayName = {
private ["_suppliedtype","_type", "_cfg_type","_data", "_displayName"];
params ["_suppliedtype"];
if ((typeName _suppliedtype) == "OBJECT") then {
_type = (typeof _suppliedtype);
} else {
_type = _suppliedtype;
};
switch (true) do {
case(isClass(configFile >> "CfgMagazines" >> _type)): {_cfg_type = "CfgMagazines"};
case(isClass(configFile >> "CfgWeapons" >> _type)): {_cfg_type = "CfgWeapons"};
case(isClass(configFile >> "CfgVehicles" >> _type)): {_cfg_type = "CfgVehicles"};
case(isClass(configFile >> "CfgGlasses" >> _type)): {_cfg_type = "CfgGlasses"};
};
_displayName = getText (configFile >> _cfg_type >> _type >> "displayName");
_displayName
}; ```
It works with smoke grenades but not the regular hand grenades so those indeed don't have a displayname π€£ π€£
Is there a method via scripting or otherwise to thin out all wooded areas across any map?
yes
you can use nearestTerrainObjects to get the tree/bushes/etc and then put it into an array, and select randomly to delete
across the entire map?
yup
you can use worldSize and the examples on that page for the position and radius required to cover the whole map
how will it affect performance on a multiplayer server?
Well you would just be doing it once at the start right?
yes
then it would be a small, maybe noticeable spike when it happens and that would be it
I'm wondering if transmitting potentally tens of thousands of deleted trees would be an issue
with each player joining
ah, not sure, you would have to test it. But I dont think it will be a big deal
Here is a simple example of a script that will delete 50% of the trees and bushes on the map
_objects = nearestTerrainObjects [[worldSize/2, worldSize/2], ["BUSH","SMALL TREE","TREE"], sqrt 2 / 2 * worldSize, false, true];
for "_i" from 0 to ((count _objects)/2) do{
deleteVehicle (selectRandom _objects);
};
apologies, deleteVehicle wont work, it needs to be hideObjectGlobal
would it work to use hideobject on each client presuming each client removes exactly the same treese?
You would have to hide it manually for whenever someone joins, hideObjectGlobal takes care of all of it for you
I'm just wondering if it wouldn't be better for network congestion to have the clients each remove the trees on their own end.
well, i myself would have wrote the extension myself
You could also throw these commands in too to make sure theyre truly disabled:
_objects = nearestTerrainObjects [[worldSize/2, worldSize/2], ["BUSH","SMALL TREE","TREE"], sqrt 2 / 2 * worldSize, false, true];
for "_i" from 0 to ((count _objects)/2) do{
_o = selectRandom _objects;
_o enableSimulationGlobal false;
_o allowDamage false;
hideObjectGlobal _o;
};
You still need to pass an array of the trees to hide to the client, would work fine as a global array and then the client would hide it. I dont see it being any more to just use hideObjectGlobal
one thing we will need is to make sure the same treese are removed every time the game runs. Which means we'll need to sort out how to seed the random number generator before removing the trees.
Oh you need it to be the same every time you launch the mission?
i wasn't going to pass an array, just have them do it randomly, but all with the same seed
yeah but it's not clear to me from reading the wiki how the seeding actually works.
If I were doing this elsewhere I would first set a seed, then call a bunch of random numbers, but I don't see how exactly to do the same thing in arma
You could do it with a seed if you want, something simple would be to just delete every other entry from the first entry. And sort the array first
that could result in a really obvious checkerboard pattern
Hmm... could do it that way. But I don't suppose you know how to seed the random generator.
you could probably do it with a little bit of code
Fixed the damn thing! Working as intended now! : https://i.ibb.co/zbdKj2x/grenade-GUIFIXED.png
seems easier
βοΈ Thanks Nikko! That gave me they idea on how to make it work, it looks damn awesome too
I feel like I'm blind, is there a command to draw a line on the map as if a player had done so?
I just want to pre-mark sectors by script.
As far as I know the only way to do it is the seed random [x, y] form, but I'm not even sure that works sufficiently.
I can say that may work for that situation, but since that randomization is very bad...
We may want a perlin-driven ramdomization
So there's no way to set a seed, and then generate a bunch of random numbers using that seed, so that you get the same sequence every time?
I'm not saying there is zero way
I can suggest that 0 random 0 syntax, that isn't bad way IIRC. You can sum up (maybe with some coef per XYZ axes) positions and call it a random seed
Could I just start at 0 for seed, and increment it by 1 between each call?
Well your call
I just want to understand that will produce the same sequence every time the script is ran.
I know, and if both value is same, it should
So like my idea is _aSeedThatIsProducedFromAPosValues random 1 so it can produce same randomized 0-1 value, if the terrain object is not moved upon an update
I thought about that, but that won't appear any more or less random than just incrementing the seed by 1 in between each random call, right?
and in both cases, it should be repeatable
I don't know how it is randomized well. Only thing I know is I want to avoid Syntax 4
Maybe I'll try to visualize the syntax 3
So emulating someone having drawn a line lowers framerate?
I havnt used it before, but that is what it says
The other draw functions need to be ran every frame, its possible drawLine does too, if thats the case then thats likely where the performance drop comes from
If nearestTerrainObjects is used without sorting, is it guaranteed to return the same list in the same order, given the same arguments, and the same objects present on the map?
I do still want to suggest sum position and call it a seed
If there is a concern, do worry after test - it's easy to try both method
yeah that might be a better option if it allows avoiding sorting the list
is hideobject reversable?
Yes
are objects that are hidden with hideobject continue to be simulated in any way while hidden? I.e., can things collide with them, can they take damage from weapons?
do ai ignore them as if they aren't there?
I'm struggling to find a command to unhide an object
Hey, is there a script to change the ammo type for a weapon? So example, if I have a AAF M2, can I change it from 12.7mm to like, 20mm? Asking cause I want to make a K-Car type vic for an op I'm doing and since theres isn't really a 20mm turret that can be used for it, wanna know if it was possible
Does anyone know the display and control IDs for the minimap?
I want to add a drawIcon event handler to the minimap.
Is there any possiblity that the same (seed random num) call can produce a different number on different machines?
Look at the hideObject wiki, theres a syntax that adds true and false to the end
Does anybody know of any reason why this idea wouldn't work well? Do you know of any reason why things could go wrong with the simulation?
To cull trees on each client and server separately to avoid network traffic.
Unless your code is wrong, most unlikely. There is near to zero possibility to have same terrain but having different object placements
something like this?
{
if (_forEachIndex random 1 > 0.5) then { _x hideObject true };
} forEach _trees;
what i've done is:
if ((_seed random 1) < 0.5) then {
_x hideObjectGlobal true;
};```
Nothing seems very wrong
i presume there could be a diagonal pattern if trees are snapped to a grid or something
I'd suggest to multiply X and Y, maybe Z too with different prime numbers
bear in mind that seeds >16m are going to alias.
The _forEachIndex one would be fine if Arma's seed hashing is good enough. It probably isn't though :P
yes
what is somearray
{
private _apple = _x;
{
systemChat str _apple;
systemChat str _x;
} forEach pears;
} forEach apples;```
should work fine
what is the point in that
just use str
shouldnt be
not finding the config then probs
most likely
Everything seems to be going fine with the tree thinning script you guys helped me with earlier. Just one other question. I want to make sure there's no circumstance in which an object could fail to be hidden with the hideobject command.
Also, with terrain objects returned by nearestTerrainObjects, is it possible to test for an exact kind of object? Say I wanted to remove a specific kind of tree.
But my experience doesn't really allow the use of VS.
GCC or G++ will be just fine and dandy
Hello. How can I force this script to use the value sent to the chat when calculating the amount?
[
"d20",
{
_act = _this select 0;
_r0 = round (random 20);
_allR = _r0 + _act;
_rD20 = format ["%1 ΡΠΎΠ²Π΅ΡΡΠΈΠ» Π±ΡΠΎΡΠΎΠΊ %2 %3 %4 %5", name player, _r0, _act, "=", _allR];
[_rD20] remoteExec ["systemChat"];
}
],
CHAT:
!d20 5
_act = 5; (from chat)
_r0 = 12; (random number)
_allR = _r0 + _act;
_rD20 = format ["PLAYER ΡΠΎΠ²Π΅ΡΡΠΈΠ» Π±ΡΠΎΡΠΎΠΊ 12 5 = 17", name player, _r0, _act, "=", _allR];
[_rD20] remoteExec ["systemChat"];
CHAT:
PLAYER ΡΠΎΠ²Π΅ΡΡΠΈΠ» Π±ΡΠΎΡΠΎΠΊ 12 5 = 17
Not quite sure your context. What is your first code, what is your second code, and what are the results?
Code
What do I want to get when I do this
Do... what
I want to enter a command and a number into the chat, based on which the final amount will be calculated
So uh, if somebody wrote !d20 5 in the chat, will return PLAYER ΡΠΎΠ²Π΅ΡΡΠΈΠ» Π±ΡΠΎΡΠΎΠΊ 12 5 = 17?
I do not even see _r1 mention in your code though
Yes, but 5 is any number from the player, and 12 is a random number
And what is this code and how do you run
I tried to enter r1 instead of _act, I thought it would help
Chat commands. This command is needed for RP actions.
DnD system
I mean more context. Do you mean you run this on a HandleChatMessage MEH?
It is nearly impossible to suggest a fix when I only can assume
Used system
test_mission.vr\InitPlayerLocal.sqf
[] execVM "scripts\chat\init.sqf";
test_mission.VR\scripts\chat\init.sqf
Screen 1
test_mission.VR\scripts\chat\config.sqf
pvpfw_chatIntercept_debug = false;
pvpfw_chatIntercept_commandMarker = "!"; //Character at the front of the chat input to intercept it
test_mission.VR\scripts\chat\commands.sqf
pvpfw_chatIntercept_allCommands =
[
[
"d20",
{
_r1 = (_this select 0);
_r0 = round (random 20);
_allR = _r0 + _r1;
_rD20 = format ["%1 ΡΠΎΠ²Π΅ΡΡΠΈΠ» Π±ΡΠΎΡΠΎΠΊ %2 %3 %4 %5", name player, _r0, _r1, "=", _allR];
[_rD20] remoteExec ["systemChat"];
}
],
];
No, there is one camera
Uhh, first of all, why you don't just use HandleChatMessage instead of this overcomplicated way?
https://community.bistudio.com/wiki/Arma_3:_Mission_Event_Handlers#HandleChatMessage
A dozen commands have already been implemented here π¦
I cut out the extra code
Let's make it easy.
_r1 = (_this select 0);
_r0 = round (random 20);
_allR = _r0 + _r1;
How do I get _allR to count the sum of _r1 and _r0?
What is _this there after all
Crutch
What?
Do you mean a string?
Yes
Then you are trying to + ing a String with a Number which is invalid
Shame.
Any news on r2t respecting the ratio parameter?
no
Does anybody know if it is possible that spawned vehicles could collide with hidden objects, and cause the vehicles to explode?
hidden objects should be passthrough
Almost certain that you can't hit a hidden object
is it possible there could be a small delay before those collisions wouldn't happen?
well I had some problems with hidden objects collision but most of the time they work... or not
It probably is easier to answer a question: what makes this question
I've seen some vehicles exploding without apparent cause. Need to test if there are other reasons they could be exploding. I'm hoping it's not the hidden objects.
Is that vehicle exploded upon the spawn?
haven't been able to tell that yet. Just fielding this question to see if anybody has an idea while I investigate several other things.
what kind of objects are you hiding?
New problem
[
"d20",
{
_r1 = _this select 0;
_r0 = round (random 20);
_arr = [[_r0, _r1]];
_finalsum = count (_arr select 1);
_rD20 = format ["%1 ΡΠΎΠ²Π΅ΡΡΠΈΠ» Π±ΡΠΎΡΠΎΠΊ %2%3%4%5", name player, _r0, _r1, "=", _finalsum];
[_rD20] remoteExec ["systemChat"];
}
],
trees, bushes, some rocks, and a lot of junk found around towns.
If you're using the Hide Terrain Objects Editor module, then yes, there is a very brief period during mission initialisation where hidden objects still have collision and can collide with other objects
so terrain objects, I hide a lot of those in my mission. and haven't noticed problems..
You can at least answer these:
- Is the explosion happened before or after you hide
- How do you run hide script
so far we've noticed explosiosn happening near the start of the mission, which is when terrain objects are also hidden. Since we're hiding a LOT of objects, I'm wondering if there's just a lag time before the collision system catches up to it.
The hide script is run on the server as well as on every client, using hideobject, on initialization. (We found this massively faster than using hideobjectglobal).
_arr doesn't have two elements, selecting the second element won't work
I don't understand what you are trying to do
what is inside _r1 ?
I need the sum of the random number and the number entered in the chat
_r1 - chat
_r0 - random
r1 is a string I assume
Yes
so parseNumber _r1 to turn it to a number, and then just + them together
@drifting sky I'm personally using hideobjectglobal
we found to do the same thing with hideobject was somewhere around 100x faster.
I actually wanted how is your script called
could be part of the problem though
Have you tried executing the script preInit?
well, we're making changes to a really complex mission that we've only just started to try to understand. By, how it's called, what do you mean exactly? In all other respects, the hiding script seems to be working perfectly. We're not sure that the vehicles are actually colliding with the hidden objects.
init.sqf or initPlayerLocal.sqf or... somehow
well, for the client, it's a chain of a bunch of functions that is originated by a remote execution.
Then how is that remoteExec ran
The reason that why I'm asking this is, I'm assuming that you're running the hide script in Scheduled environment
Which will not done everything in a frame
i put the hide stuff inside of an isnil {}
But where is your isNil
i'm trying to track that down exactly
Ehh...
it all seems to start on the server with a preinit function located in description.ext cfgfunctions
which in turn spawns another function, and I put the hide code at the end of that spawned function, inside of an isnil
So your preInit function runs a spawn, and the spawn has the bunch of codes, and the isNil is located on the very last line of the spawn?
but all this should happen well before any ai or vehicles are generated
yes that seems to be the case.
Then don't wrap it in spawn
well, if it's all triggered in a preinit function, wont that mean that objects won't yet be initialized? I presume that means terrain objects as well.
I figured the spawn was to give the object initialization time to happen.
Even though I'm not really sure when it happens during the init order but I'm very suspecting that the spawn delay can cause object clip before the hide is done
https://community.bistudio.com/wiki/Initialisation_Order
Yeah I'll look into this as a possiblity, but I don't think this is the case, because I think it's like a minute or two before any vehicles are spawned, but I'll put some kind of message in to find out when the hide objects section completes. Thanks for the idea.
Have you enabled Dynamic Simulation?
I do believe it is on
Could be one reason why it does happen afterwards
i'm having difficulty imagining how that would work
My theory:
- Terrain objects initialized
- The vehicle spawns
- Within a frame it can collide with a terrain object
- And afterwards the simulation has stopped due to DynSym
- DynSim enables the system when it decides to do
- Boom
I actually have zero clue how a Dynamic Simulation works though
I'll have to print some kind of message when vehicles are spawned to see if any of them are spawning before the hiding is done.
Honestly if this is a case, I'd suggest to disable Dynamic Simulation first
So you know the delay is caused by that or not
alright. thanks for you help.
Thanks
may i ask why?
because microsoft is bad
anyone profiled yet if a switch case with strings (up to 25 characters long) with 51 cases is in relevant ways slower than number based switch case? or are both way too low for the engine processing to matter?
not afaik (and that's quite specific :D)
iirc it was about the same
Btw if you have this many cases, maybe using a hashmap could be faster
switchHashmap = createHashMapFromArray [
["string1", {call case1}]
,["string2", {call case2}]
,["string3", {call case3}]
];
args call (switchHashmap get "string1");
That might be true, but VS is great tho
VS is a great tool and microsoft a very big company with a lot of different branches
it's stupid to not use a good tool because you despise the company as a whole.
^
yeah good point. similiar question is true for hashmap. as its in engine, probably even less difference
Got curious and profiled it:
private _cases = 51;
caseCode = {player};
caseDefault = {objNull};
switchHashMap = createHashMap;
private _str_cases = [];
private _num_cases = [];
private _exitwiths = [];
for "_i" from 1 to _cases do {
_str_cases pushBack format ["case ""%1"": %2;", format ["string%1", _i], caseCode];
_num_cases pushBack format ["case %1: %2;", _i, caseCode];
_exitwiths pushBack format ["if(testnum == %1) exitWith %2;", _i, caseCode];
switchHashMap set [format ["string%1", _i], caseCode];
};
_str_cases pushBack format ["default %1", caseDefault];
_num_cases pushBack format ["default %1", caseDefault];
_exitwiths pushBack format ["%1", str caseDefault select [1, count str caseDefault - 2]];
switchStrDo = compile (_str_cases joinString "");
switchNumDo = compile (_num_cases joinString "");
exitWithsCode = compile (_exitwiths joinString "");
testnum = 51;
teststr = format ["string%1", testnum];
[
"hashmap"
,diag_codePerformance [{
call (switchHashMap getOrDefault [_str, caseDefault]);
}]
,"switch string"
,diag_codePerformance [{
switch teststr do switchStrDo;
}]
,"switch number"
,diag_codePerformance [{
switch testnum do switchNumDo;
}]
,"if exitWith"
,diag_codePerformance [{
call exitWithsCode;
}]
];
=> ["hashmap",[0.00113407,100000],"switch string",[0.0079667,100000],"switch number",[0.00799422,100000]]
testnum = 1;
=>
["hashmap",[0.00112441,100000],"switch string",[0.00105729,100000],"switch number",[0.00103412,100000]]
switch has tiniest performance gain in its best case scenario
Massively worse in all other cases
π
8x faster is quite significant. that said bit surprised it isnt more. probably the low amount of cases
["hashmap",[0.00107414,100000],"switch string",[0.138902,7200],"switch number",[0.138423,7225]] for 1000 cases searching for last 1000th case
So in total, unless you're doing complex switch true do { case checks, hashmap is a better tool for code branching
Could hurt readability a bit though
fnc = {
switch(_this) do {
case "SOME_STATE": {123};
case "OTHER_STATE": {321};
default {555};
};
};
vs
switchHashMap = createHashMapFromArray [
["SOME_STATE", {123}]
,["OTHER_STATE", {321}]
];
switchDefault = {555};
fnc = {
switchHashMap getOrDefault [_this, switchDefault];
};
question
im making a randomization script that randomizes a units uniform, vest, etc
however when doing it locally for some reason the grenades break
so im thinking of making everything remoteexec
will this have a big impact on frames?
@warm coral Without knowing your script we can't recommend anything
(_this select 0) addBackpack (selectrandom [
"UK3CB_B_Largepack",
"UK3CB_B_Largepack_Des",
"RD54_6B3",
"rhs_rd54",
"rhs_rd54_vest",
"rhs_sidor",
"",
"",
"",
"",
"",
""
]);
i did it like this in an sqf
and did the same for headgear, facewear, uniforms, vests, weapons
private _unit = _this select 0;
private _backpack = selectRandom [
"UK3CB_B_Largepack",
"UK3CB_B_Largepack_Des",
"RD54_6B3",
"rhs_rd54",
"rhs_rd54_vest",
"rhs_sidor",
"",
"",
"",
"",
"",
""
];
[_unit, _backpack] remoteExec ["addBackpack", _unit];
This should make sure that the backpack is added where the unit is local
No impact.
It might cause a brief hitch if you do a huge number of them at once, or if you're doing this constantly....but you shouldn't
If you want to be more compact, put the whole gear assignment process into a function (https://community.bistudio.com/wiki/Arma_3:_Functions_Library) and remoteExec that, rather than remoteExecing each command individually
is there an eventHandler that check if mine was triggered (training mine) ?
does anyone know any script to disable teleporting units ability in zeus gamemaster?
do you know how to use it? as it is attached to projectile, not mine
Mines are actually ammo
Editor-placed mines start out as vehicles though, so if that's what you're using, you might need to do a little bit of stuff to wait until it's been replaced with its ammo counterpart
I use VS everyday ;)
Why is it ignored anyway?
And if the param is ignored, why not just remove it?
Which reminds me... should still anotate the wiki page.
Hello Folks, I am trying to make a campaign for some people and need an arsenal that has limited quantity. I have seen this done before with Antistasi, where people can add items to the box, but I am trying to make it so what is in the box already gets added to the arsenal.
I built out their inventories and don't want to have to make the players dig through the base arma inventory system for attachments and ammo. The only built in options I can find make it so there is unlimited stock in the arsenals. Is there a solution for this alredy? I am terrible at scripting.
You could use the curator cost system to only enable the modules you want, i.e. everything else besides the teleportation. For moving AI units you can adjust the action coefficients.
https://community.bistudio.com/wiki/Arma_3:_Curator
antistasi uses a custom arsenal, its not ACE or vanilla Arma 3 which is how it gets it's limited quantity.
it uses JeroenArsenal
https://github.com/Jeroen-Notenbomer/Limited-Arsenal
Awesome, thank you!
How do I create the bat file to have the p drive?
https://community.bistudio.com/wiki/Work_Drive
or alternatively, use HEMTT instead (as long as you are not doing map making stuff)
setVariable already can tell everyone the variable. No need to remoteExec'ing
SQF threads that have slept (waited? not sure) longest get scheduler priority.
you mean there is no way to disable or remove teleport? even by scripting or modding?
The curator interface is written in SQF and Arma UI config, I think, so in theory if you can find that part of the interface then you could override it with a mod.
So obviously drawline has to be executed every frame, is there no way to just draw a line once as if a given client had drawn it? Is it marker data under the hood, or what?
I'm wishing for a way to import more complex drawings into a scenario
or to save drawn lines for the next mission
Those are markers.
If you check allMapMarkers then you can see the format of the user markers.
Is anybody able to tell me exactly what post and pre init are?
What makes your question?
the documentation only states that pre and post are relative to object initialization. Does that mean ALL objects including terrain objects?
Good question actually. I really don't know when terrain is initalized
I don't also know how to make sure/check. Maybe somebody knows.... Deed?
Bet the terrain and its objects are always there
I'm looking at the initialization order https://community.bistudio.com/wiki/Initialisation_Order
I'm really confused about "Persistent functions are called "
First, is there a difference between things that are "executed" and things that are "called"? A difference other than whether they are "scripts" or "functions"?
Secondly, how can persistent functions be called before the mission has fully initialized? initPlayerLocal.sqf, and init.sqf haven't executed yet. I'm trying to figure out how that makes sense.
I've already read that. It didn't explain in any way that I understand why persistent functions are called where they are in the initialization order, as opposed to being called at the end of the initialization.
"When a command or function is executed through remoteExec or remoteExecCall, it can be flagged as persistent. If it is flagged, the statement is stored in the JIP queue on the server (under its unique JIP ID). When a player joins a multiplayer session that has already started (JIP stands for Join-In-Progress), all entries stored in the JIP queue are executed on that player's machine. "
Also https://community.bistudio.com/wiki/Arma_3:_Functions_Library
Yes I understand that part. What I don't understand is how it makes any sense to execute JIP queue functions before the mission is initialized on the client.
This is a fairly late in initialization order, you already have whole world setup and you can operate everything
All of these are yet to be initialized when functions in the JIP queue are called.
modules
initPlayerLocal.sqf
postinit functions
init.sqf
the only general mission code initialization that seems to happen before that is preinit, which if I understand correctly, happens before any objects have even been initialized.
Any recommendations detecting the opposite of LandedTouchDown eh where its the AI taking off?
also, the wiki page uses both "called" and "executed". I want to be sure I understand if there are differences between those temres besides whether the thing being "called" or "executed" is a script or function, or something else.
Well, you gotta build your mission around this, if you need to wait until some module is initialized or init.sqf is complete, add a check or queue in your persistent functions
Same thing
https://community.bistudio.com/wiki/isRemoteExecutedJIP
There is this flag to check if RE function is executing during this initialization order step if you require special order
Also preinit should already have both terrain and mission objects in the world
Its a way to access objects before anything else scripted in the game does
https://community.bistudio.com/wiki/publicVariable
This says publicvariable variables are sent to JIP clients "before the first batch of client-side Event Scripts (such as init.sqf) is run. "
I presume that also applies to variables which have been made "public" via setVariable.
Actually I'm not sure when they arrive, maybe after preinit? π€
Probably before preinit since objects arrive from server anyway
and yes, setVariable with public flag is the same thing as publicVariable
Bug I guess, forgotten, smth
On this page: https://community.bistudio.com/wiki/serverNamespace it says:
"This namespace is only available on the server for the server's uptime duration (same as uiNamespace). Server event handlers, which are available in server config, all use this namespace."
What event handlers are they talking about?
"which are available in server config"
https://community.bistudio.com/wiki/Arma_3:_Server_Config_File
onUserConnected, onUserDisconnected, onHackedData, ...
Ah I was confused because the words event or handler weren't actually located anywhere on that page
I'm trying to imagine what other possible uses there might be for the servernamespace. Any insights into that?
@mint goblet devops with a huge linux/bsd/solaris background during the day, arma addict during the night. So while I can find my way through a meriad of clouds and rest APIs, windows development still boggles me.
is there away to add beacon lights to other cars ? ? unmoded
Any good way to get player's weapons for saving?
?
I mean what's the best way to get player's primary weapon, secondary weapon and launcher?
there is the https://community.bistudio.com/wiki/attachTo command that can attach objects to other objects, if that's what you mean
Take a look at this: https://community.bistudio.com/wiki/primaryWeapon
Maybe even: https://community.bistudio.com/wiki/weapons
sort of i mean like the offroad beacon
it may be that isnt found as separate. beacon did not give me any results
What is a good empty/low-cost object to use for scripting?
Im making a custom marker script, and I want to use a object to mark the position. This lets me use mission objects like units or vehicles for markers, but I also want to use a "empty" object for a miscellaneous position mark. This also lets me register it in the zeus interface to move it manually.
empty helipad π like good ol' days
My fav
hmmmm. i dont why i didnt remember that one.
Is there a way to prevent mission parameters to be automatically initialized by BIS_fnc_initParams in singleplayer that I am not aware of?
don't start the mission
but why - any issue in SP?
Always default values
I am not saying it's broken. But since there is no native way of editing the values in singleplayer I wanna write my own system so the player can edit this settings
But as parameter initialization is forced it will execute functions in the parameters twice.
Which is problematic
oh, I see
IDK if there is a #ifdef __SINGLEPLAYER__, if so you could wrap the options in description.ext
This is not the point
I wanna use the same set of parameters
I just wanna handle initialization differently in SP
I guess I'll make a ticket, the fix is easy and breaks nothing
I get that
but you could have an alternative system with values but no method call or something (well unless it's revive settings and such vanilla stuff)
but yeah, a singleplayer button with "set mission parameters" would be nice :3
Vanilla stuff is indeed one problem.
Thank you!<3
Hello, yesterday i wrote a script but it doesn't work. I tried several alternations but none of them helped. I believe i made 2 independent mistakes in there. Can someone help me fix it please? This is written in initPlayerLocal.sqf : ```sqf
player addAction ["Impound vehicle", {
params ["_target", "_caller", "_actionId", "_arguments"];
_impoundstart = player modelToWorld [0,0.2,0.7];
_impoundend = player modelToWorld [0,2.2,0.7];
_vozidlokodtahu = lineIntersectsObjs [_impoundstart, _impoundend, _caller];
if (_vozidlokodtahu isKindOf "LandVehicle" && {vehicle player == player}) then {hint "TEST It works!";} else {hint "TEST Impound failed!";};
}, nil, 1.5, false, true, "",
"_this getVariable ["fw_mohuodtahnout", false] == true",
3, false, "", ""];
when i replace condition for if with true and at the same time replace condition in addAction with just true then the function appears in game and gives me the hint "TEST it works!" But when i add back those conditions, one or the other or both of them, it doesn't work.
@limber panther there are several things wrong with the script, here's a list of them, hope it helps: 1) lineIntersectsObjs returns array of objects but isKindOf wants only one object. 2) quotes around fw_mohuodtahnout should be ' because its inside " quotes 3) the fw_mohuodtahnout variable must be set true on the vehicle for the script to work
I'm such a dumbhead, i forgot to write select 0 hold on i'll test it right now
u should also cover the case of there being no objects found
first you should fix the quotes
@proven charm @little raptor thank you for your ideas, the variable is set the whole time, that's fine, for the array i actually forgot to include a line selecting 1 item so thanks for the tip and i did replace "" with ' '. Currently the script does show me the action properly but i am not getting any hint, something must still be wrong. Here's what it currently looks like: ```sqf
player addAction ["Impound vehicle", {
params ["_target", "_caller", "_actionId", "_arguments"];
_impoundstart = player modelToWorld [0,0.2,0.7];
_impoundend = player modelToWorld [0,2.2,0.7];
_detekovanavozidla = lineIntersectsObjs [_impoundstart, _impoundend, _caller];
_vozidlokodtahu = _detekovanavozidla select 0;
if (_vozidlokodtahu isKindOf "LandVehicle" && {vehicle player == player}) then {hint "TEST It works!";} else {hint "TEST Impound failed!";};
}, nil, 1.5, false, true, "",
"_this getVariable ['fw_mohuodtahnout', false] == true",
3, false, "", ""];
make sure _detekovanavozidla has objects before proceeding: ```sqf
if(count _detekovanavozidla == 0) exitWith { hint "No objects there!"; };
ok but to which section of the script should i place this?
right below lineIntersectsObjs
allright now i get it, i'll test it now, hold on
Ok i am getting the no objects there hint at all times, what should i do next? I thought i should get the hint "TEST Impound failed!" when there's no suitable vehicle.
lineIntersectsObjs takes ASL pos
you're providing AGL
also it's better to use lineIntersectsSurfaces instead
omg you're right
also I'm not sure what you're trying to do exactly
do you want to look at an object and "impound" it?
i did that in the past already i completely forgot about that
@limber panther glad to see your making progress. I have to go so good luck with the script π
thank you very much i appreciate your help
have a nice day
yes it's supposed to be a beginning of a much larger script, when a player (with set variable that permits him to do so) looks at a vehicle, he should be able to use addaction to activate script which should let him decide what to do with that particular vehicle that he's looking at, either delete it, impound it, or other, for starter i wanted to get this working so i placed there just hints to see if it works
well what you do rn always shows the action. it's better to use something like cursorObject instead
also it would be nice to show the type of the vehicle to the user
player addAction ["Impound vehicle", {
params ["_target", "_caller", "_actionId", "_arguments"];
_vozidlokodtahu = cursorObject;
if (_vozidlokodtahu isKindOf "LandVehicle" && {vehicle player == player}) then {hint "TEST It works!";} else {hint "TEST Impound failed!";};
}, nil, 1.5, false, true, "",
toString {
alive cursorObject && {
_this getVariable ['fw_mohuodtahnout', false] && {
_this setUserActionText [_actionId, format ["Impound Vehicle (%1)", getText (configOf cursorObject >> "displayName")]];
true
}
}
},
3, false, "", ""];
also you should add a distance check too
those are great ideas, thank you very much for your help
it's probably better to use a function for that:
fn_canImpoundVehicle = {
params ["_veh"];
alive _veh && {_veh isKindOf "LandVehicle" && player distance _veh < sizeOf typeOf _veh / 2}
};
player addAction ["Impound vehicle", {
params ["_target", "_caller", "_actionId", "_arguments"];
_vozidlokodtahu = cursorObject;
if ([_vozidlokodtahu] call fn_canImpoundVehicle && {vehicle player == player}) then {hint "TEST It works!";} else {hint "TEST Impound failed!";};
}, nil, 1.5, false, true, "",
toString {
[cursorObject] call fn_canImpoundVehicle && {
_this getVariable ['fw_mohuodtahnout', false] && {
_this setUserActionText [_actionId, format ["Impound Vehicle (%1)", getText (configOf cursorObject >> "displayName")]];
true
}
}
},
3, false, "", ""];
that looks sophisticated, i'm speechless, thank you for your assistance, that's really nice from you
How does one make addaction that wont execute again?
_this addAction ["<t color='#FF0000'>Cool Action",
{
params ["_target", "_caller", "_actionId", "_arguments"];
//A bunch of code
_this select 0 setVariable ["bs_break",false];
},
[], 7, true, false, "", "_this == driver _target &&" + "!(_target getVariable['bs_break',false])"];
I kinda have code that I am pretty sure adds addaction every tim you enter the vehicle, and it starts to duplicate, I thought adding "!(_target getVariable['bs_break',false])" in a condition would prevent it from appearing again
you already have in params _actionId so i would suggest using that, check out remove action script
https://community.bistudio.com/wiki/removeAction
you can use remove action and tell it to remove your action using that _actionId parameter
_this addAction ["<t color='#FF0000'>Cool Action",
{
params ["_target", "_caller", "_actionId", "_arguments"];
//A bunch of code
_target removeAction _actionId; // Remove Action
},
[], 7, true, false, "", "_this == driver _target"];
@cobalt path
you should add the condition outside the addAction
You missunderstand I do not want to remove it after usage.
Issue I had is that when I scroll wheel it would have:
Cool Action
Cool Action
Engine Off, and it would keep duplicating
if (_this getVariable ["M_ActionID", -1] >= 0) exitWith {};
_actionId = _this addAction ["<t color='#FF0000'>Cool Action",
{
params ["_target", "_caller", "_actionId", "_arguments"];
//A bunch of code
},
[], 7, true, false, "", "_this == driver _target"];
_this setVariable ["M_ActionID", _actionId];
M_ActionID would be something custom I type in?
yeah
I am having trouble making this work
what's the problem?
Nvm I am figuring it out, I am replacing it with if else
I'm trying to run a randomization uniform/headgear script on a unit's spawn, but to do so with a delay. It's for escape so I need escape's on-spawn scripts to kick in first.
I have the randomization script working fine. "(_this select 0) execVM ""\Africa_Mjanzi_INDFOR\kifonja_gear_randomizer_A.sqf"""; but I cannot get a waituntil or slee because suspending is not allowed.
is there no way to tell it to just wait a moment before activating? Right now it competes with the other escape script, so I get some of their on-spawn stuff but some of their on-spawn stuff doesn't kick in.
put the sleep in the script itself
if you don't have access to the script, spawn the code
"_this spawn {sleep 1; (_this select 0) execVM ""\Africa_Mjanzi_INDFOR\kifonja_gear_randomizer_A.sqf""}"
Alright, I'll give that a try. Thank you Leopard
I am getting an error "Error Foreign error: Unknown enum value: "Deleted"
blablabla line 78
The code is _uv80 addMPEventHandler ["Deleted", {.........
Am I missing smth? I am pretty sure there is an event handler parameter called "Deleted"
"Deleted" is a valid normal EH type, but not a valid MP EH type. https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#Multiplayer_Event_Handlers
Thanks
No.
A normal event handler can be used in MP, as long as you're aware of its locality. You might remoteExec it if you wanted it to be added on all clients from a script that only runs on a single machine. But that doesn't give it the special properties of an MP event handler. The ones that are specifically designated as MP event handlers have special logic for their activation (see the descriptions on the page), and just using remoteExec to add an EH on all clients doesn't replicate that.
hey guys. is there a way to add a holdAction to a memory point? addaction has that. can't find a way to do it with holdaction.
I don't know. It probably depends on the EH and which parts of the functionality you want to replicate. I don't think you could achieve everything like that.
It would probably be better to just understand the EH in question and be smart about how you add it and what it does.
Trying to do it for projectiles is a bit dubious regardless because many types of projectiles have multiple local copies - it doesn't matter if one client deleted a bullet when everyone else still has theirs (and sending the _projectile object reference would be useless, because it'll be different on each client)
Also, for setVariable you need to specify a namespace and close that var name string
