#arma3_scripting
1 messages Β· Page 554 of 1
is there a version of countSide allPlayers that counts player that are waiting to be revived too. Because their side is set to CIV?
count civ side?
if I need all Players on WEST side, also those who are waiting to be revived?
ah thanks
also i think i could have used side group _player, because the group stays WEST. (could not have used playerSide, because this happens on the server)
π
Hi, I am trying to build an MP slingloading mission. I am trying to track when a certain box is being slingloaded by the player's heli, but not having much luck. This is what I am using:
vehicle player addEventHandler ["ropeAttach", {
params ["_object1", "_rope", "_object2"];
if (_object2 == "C_IDAP_supplyCrate_F") then {
systemChat "attached";
testSling = true;
};
typeOf
If I want to add a scripted helicopter waypoint to land somethere, what do I need to do?
I tried
private _wp1 = super_31 addWaypoint [getPos helipad_1, -1];
_wp1 setWaypointScript "A3\functions_f\waypoints\fn_wpLand.sqf";
But this results in a hover over the landing zone
setWaypointType "LAND" @spice axle
It will not work, as the setType results in no movement of the helicopter
how can I get a units individual group member ID? Ex: Alpha 1-1:2, the second unit in the group would return that as a string.
then create another MOVE waypoint before
I found a for me better working method but thanks
hey guys how would I produce an intro similar to this? https://www.youtube.com/watch?v=3jXmKcAiV8Q
I want the player to walk along a path like in this intro where they can control the head but I control the speed they move at
I already have triggers set up for the voices to play (im going to play it as a radio transmission not a second ai moving with the player)
Basically i have someone briefing the player via custom audio that plays and I want to ensure that the PC doesnt move too fast and trigger additional voices before the first one finishes
I am getting an error, not sure what I am doing wrong
disableSerialization;
params [
["_mode", "Initialize", ["Initi>
2:40:40 Error position: <params [
["_mode", "Initialize", ["Initi>
2:40:40 Error Params: Type Nothing, expected Array
2:40:40 File modules\nemesis\scripts\fn_camera.sqf [Sandbox_nemesis_fnc_camera], line 148
disableSerialization;
params [
["_mode", "Initialize", ["Initialize"]],
["_params", [], [[]]]
];
oh ok, will check it out. Thanks!
Does anybody know of a script that exists (or how I would create such) in which I can have a random unit (nonplayer) stood there, where you can load preset loadouts from such unit on the scroll/interaction menu.
Really? I cant particularly find the keywords to find such
["open", true] call bis_fnc_arsenal
Thats for arsenal. I'm moreso looking for the following as a thing:
"Get Rifleman" -> Loads a preset Rifleman Loadout without going into Arsenal. Just insta give
yes
you can export a script from arsenal using the export button
which will do that
Okay, so how would I attach that in script to a unit?
Okay I shall give it a go
clearItemCargo this;
clearMagazineCargo this;
clearBackpackCargo this;
this addWeaponCargoGlobal["rhs_weap_aks74u", 2];
this addWeaponCargoGlobal["rhs_weap_rpg7", 1];
this addMagazineCargoGlobal["rhs_30Rnd_545x39_7N6M_AK", 40];
this addMagazineCargoGlobal["rhs_rpg7_PG7VL_mag", 6];
this addMagazineCargoGlobal["rhs_rpg7_OG7V_mag", 3];
this addMagazineCargoGlobal["rhs_100Rnd_762x54mmR_7N26", 5];
this addMagazineCargoGlobal["rhs_10Rnd_762x54mmR_7N14", 15];
this addMagazineCargoGlobal["rhs_mag_9x18_8_57N181S", 20];
this addMagazineCargoGlobal["rhssaf_mag_brd_m83_white", 10];
this addMagazineCargoGlobal["rhs_mag_rgn", 10];
this addItemCargoGlobal["ACE_fieldDressing", 30];
this addItemCargoGlobal["ACE_elasticBandage", 30];
this addItemCargoGlobal["ACE_quikclot", 30];
this addItemCargo["ACE_packingBandage", 30];
this addItemCargoGlobal["ACE_epinephrine", 30];
this addItemCargoGlobal["ACE_morphine", 30];
this addItemCargoGlobal["ACE_adenosine", 15];
this addItemCargoGlobal["ACE_atropine", 15];
this addItemCargoGlobal["ACE_bloodIV", 10];
this addItemCargoGlobal["ACE_bloodIV_500", 15];
this addItemCargoGlobal["ACE_bloodIV_250", 15];
this addItemCargoGlobal["ACE_tourniquet", 10];
this addItemCargoGlobal["ACE_personalAidKit", 2];
this addItemCargoGlobal["ACE_surgicalKit", 2];
this addItemCargoGlobal["adv_aceCPR_AED", 1];
this addItemCargoGlobal["ACE_Canteen", 20];
this addItemCargoGlobal["ACE_MRE_BeefStew", 20];
this addItemCargoGlobal["ACE_EntrenchingTool", 1];
this addItemCargoGlobal["ACE_bodyBag", 10];
this addItemCargoGlobal["ACE_wirecutter", 1];
this addItemCargoGlobal["ACE_SpottingScope", 1];
this addItemCargoGlobal["ToolKit", 1];```
this is my inventory script for my vehicle, and it works fine, but it duplicates whenever someone joins the server.
so 10 bandages turn to 50 when 4 people join my server
i have no idea why this is happeing, and i want the amount to remain fixed to what i set it to be. any solutions?
The init box gets executed for every player. Wrap it in a if (isServer) then { ... }
i dont understand, could you please dumb it down for me?
{
clearWeaponCargo this;
clearItemCargo this;
clearMagazineCargo this;
clearBackpackCargo this;
this addWeaponCargo["rhs_weap_aks74u", 2];
this addWeaponCargo["rhs_weap_rpg7", 1];
this addMagazineCargo["rhs_30Rnd_545x39_7N6M_AK", 40];
this addMagazineCargo["rhs_rpg7_PG7VL_mag", 6];
this addMagazineCargo["rhs_rpg7_OG7V_mag", 3];
this addMagazineCargo["rhs_100Rnd_762x54mmR_7N26", 5];
this addMagazineCargo["rhs_10Rnd_762x54mmR_7N14", 15];
this addMagazineCargo["rhs_mag_9x18_8_57N181S", 20];
this addMagazineCargo["rhssaf_mag_brd_m83_white", 10];
this addMagazineCargo["rhs_mag_rgn", 10];
this addItemCargo["ACE_fieldDressing", 30];
this addItemCargo["ACE_elasticBandage", 30];
this addItemCargo["ACE_quikclot", 30];
this addItemCargo["ACE_packingBandage", 30];
this addItemCargo["ACE_epinephrine", 30];
this addItemCargo["ACE_morphine", 30];
this addItemCargo["ACE_adenosine", 15];
this addItemCargo["ACE_atropine", 15];
this addItemCargo["ACE_bloodIV", 10];
this addItemCargo["ACE_bloodIV_500", 15];
this addItemCargo["ACE_bloodIV_250", 15];
this addItemCargo["ACE_tourniquet", 10];
this addItemCargo["ACE_personalAidKit", 2];
this addItemCargo["ACE_surgicalKit", 2];
this addItemCargo["adv_aceCPR_AED", 1];
this addItemCargo["ACE_Canteen", 20];
this addItemCargo["ACE_MRE_BeefStew", 20];
this addItemCargo["ACE_EntrenchingTool", 1];
this addItemCargo["ACE_bodyBag", 10];
this addItemCargo["ACE_wirecutter", 1];
this addItemCargo["ACE_SpottingScope", 1];
this addItemCargo["ToolKit", 1];
}```
this isnt working
Syntax error
Can't just leave away part of the solution you're given and then expect it to still work
oh, im missing then
now only the host (me) can see whats inside
everyone else is complaining that the inv is empty
addItemCargoGlobal
No wrap it in if (local this) then {...}
Why? Is the inventory updated for every unit?
what?
What's the cost for using the global variant
~ $300
#350
how do I say,
[1,2,3] select any;
or
[1,2,3] select all;
no, that's what I mean! perfect thanks!
[1,2,3] select all;
[1,2,3] select [0, 3]
Best way to keep the time set as the same over and over again? (Want it to keep it day).
This is what I have so far:
fn_time.sqf:
while {true} do {
sleep 5;
skipTime 1;
sleep 5;
_date = date;
_date set [3, (_date select 3) - 1];
setDate _date;
sleep 20;
};
executed on the server. Thanks in advance!
why?
Don't want night time
Doesn't that just accelerate the time? I don't want it to get to night time at all
it is a multiplier
you can make 1 hour last as 10 hours
or 10 hours as 1 hour
how long your server is up
It could even be 24/7
no arma server runs for this long
you will need to restart eventually
It's not exactly my server so idk when it restarts, I could ask tho.
but if you slow your time 10 times, this is what 0.1 multiplier will do, you can run 240/7
that should be more than enough, thank you
@still forum , any comments, concerns or scathing indictments?
east_grp =["O_soldier_AR_f","O_soldier_AR_f","O_soldier_AT_f","O_heavyGunner_f","O_soldier_AT_f"];
west_grp =["B_soldier_AR_f","B_soldier_AR_f","B_soldier_AT_f","B_heavyGunner_f","B_soldier_AT_f"];
Destination=[baseMark1, baseMARK1, baseMARK2, baseMark3];
MMF_fnc_soldiers=
{
params ["_spawnLOC", "_spawnNUM", "_spawnSide", "_typeUnit", "_spawnState", "_goTo", "_applyIR"];
_grpCount = _spawnSide countSide allUnits;
if (_grpCount <20) exitWith {
new_grp =[ getPos _spawnLOC, _spawnSIDE, _typeUnit, [],[],[],[],[_spawnNUM, 0],180] call BIS_fnc_spawnGroup;
lead_grp=leader new_grp;
new_grp setBehaviour _spawnState;
new_grp allowFleeing 0;
new_grp deleteGroupWhenEmpty true;
_wp = new_grp addWaypoint [(getPos _goTo), 0];
_wp setWaypointType "hold";
if (applyIR==1 && _spawnSide==WEST) exitWith {{ IRLight = "NVG_TargetC" createVehicle [0,0,0]; _x removeMagazine "B_IR_Grenade";
IRLight attachTo [_x, [0,-0.03,0.07], "LeftShoulder"];} forEach units new_grp;};
};
};
[baseMARK1, 1, WEST, west_grp, "SAFE", Destination select 1, 1] call MMF_fnc_soldiers;
Otherwise how am I gonna keep track of and delete all those IR lights when the unit dies?
you are using global variables in places where you REALLY should use local variables
also please fix your indentation. there is a forEach and I have no idea where it starts its a total mess
and why do you use applyIR global variable, while you have a _applyIR local variable?
for removing the IR lights, maybe setVariable onto the unit, and add a killed eventhandler
@still forum , "places where you REALLY should use local variables" may I have an example?
new_grp for example. do you really want to know what was in that variable after you called that function?
oh, okay, yes I probably do in many cases
need the name
in the mission script the group would often (but not always) receive a new name for later reference
whatt about IRLight
it only needs to be deleted
for new_grp, you should return the group instead if you want to keep it. that would be a lot cleaner.
oh, okay, yes I probably do in many cases
I assume you'll spawn more than one group, in which case new_grp gets overwritten
yes, I know that, I can name new_group after creation to something else if neccessary
then use a local variable and do the same with that?
if you are in scheduled and maybe spawn multiple groups at once, the variables might overwrite eachother while the script runs
which is total nonsense
so the mission script is scheduled but the scripts are not
my mission script is a bunch of calls
_grpCount should have private keyword
_wp too
lead_grp you don't use that variable in your code
that's to select the leader in the mission script
here's an example of the old mission script, I plan to replace the single calls with array calls (using params like we discussed)
if (scene_Type==5) exitWith {
if (scene_State==1) exitWith {
currentMARK=baseMARK1;
player call MMF_fnc_stripITEMS;
playIntro=3;
[]spawn MMF_fnc_intro;
spawnState=0;
spawnNUM=4;
baseMARK1 call MMF_fnc_soldierWEST;
baseMARK1 call MMF_fnc_coverTRAP;
baseMARK2 call MMF_fnc_soldierEAST;
baseAREA2 call MMF_fnc_soldierEAST;
scene_state=2;
sleep 1;
systemChat "Defend the Base!";
sleep 4;
systemChat "WAVE 1 INCOMING";
waveNUM=1;
};
you are mixing global and local variables together which looks like you might've made a mistake. Which you actually did with "applyIR"
I'd say split them apart, use local variables. And just explicitly set the global at the end, so that its clearly visible that its intended
ye
maybe also add a comment explaining what its for. In case you come back to your script in 2 years
this script will come with documentation
better?
MMF_fnc_soldiers=
{
params ["_spawnLOC", "_spawnNUM", "_spawnSide", "_typeUnit", "_spawnState", "_goTo", "_applyIR"];
private _grpCount = _spawnSide countSide allUnits;
if (_grpCount <20) exitWith {
_grp =[ getPos _spawnLOC, _spawnSIDE, _typeUnit, [],[],[],[],[_spawnNUM, 0],180] call BIS_fnc_spawnGroup;
_grp setBehaviour _spawnState;
_grp allowFleeing 0;
_grp deleteGroupWhenEmpty true;
private _wp = _grp addWaypoint [(getPos _goTo), 0];
_wp setWaypointType "HOLD";
newGroup=_grp;
leadGroup=leader new_grp;
if (_applyIR==1 && _spawnSide==WEST) exitWith {
{ IRLight = "NVG_TargetC" createVehicle [0,0,0]; _x removeMagazine "B_IR_Grenade";
IRLight attachTo [_x, [0,-0.03,0.07], "LeftShoulder"];} forEach units _grp;
};
};
};
This way I can say something like,
waitUntil {!alive leadGroup}; call bis_fnc_endmission;
MMF_fnc_soldiers=
{
params ["_spawnLOC", "_spawnNUM", "_spawnSide", "_typeUnit", "_spawnState", "_goTo", "_applyIR"];
private _grpCount = _spawnSide countSide allUnits;
if (_grpCount <20) exitWith {
private _grp = [getPos _spawnLOC, _spawnSIDE, _typeUnit, [], [], [], [], [_spawnNUM, 0], 180] call BIS_fnc_spawnGroup;
_grp setBehaviour _spawnState;
_grp allowFleeing 0;
_grp deleteGroupWhenEmpty true;
private _wp = _grp addWaypoint [(getPos _goTo), 0];
private _wp setWaypointType "hold";
newGroup = _grp;
leadGroup = leader _grp;
if (_applyIR==1 && _spawnSide==WEST) then {
{
_IRLight = "NVG_TargetC" createVehicle [0,0,0];
_x removeMagazine "B_IR_Grenade";
_IRLight attachTo [_x, [0,-0.03,0.07], "LeftShoulder"];
} forEach units _grp;
};
};
};
yes
@still forum Thanks for your help
MMF_fnc_soldiers=
{
params ["_spawnLOC", "_spawnNUM", "_spawnSide", "_typeUnit", "_spawnState", "_goTo", "_applyIR"];
private _grpCount = _spawnSide countSide allUnits;
if (_grpCount <20) exitWith {
_grp =[ getPos _spawnLOC, _spawnSIDE, _typeUnit, [],[],[],[],[_spawnNUM, 0],180] call BIS_fnc_spawnGroup;
_grp setBehaviour _spawnState;
_grp allowFleeing 0;
_grp deleteGroupWhenEmpty true;
private _wp = _grp addWaypoint [(getPos _goTo), 0];
_wp setWaypointType "HOLD";
newGroup=_grp;
leadGroup=leader new_grp;
if (_applyIR==1 && _spawnSide==WEST) exitWith {
{
IRLight = "NVG_TargetC" createVehicle [0,0,0];
_x removeMagazine "B_IR_Grenade";
IRLight attachTo [_x, [0,-0.03,0.07], "LeftShoulder"];
} forEach units _grp;
};
};
};
you just ignored all the minor corrections I posted π€
how to disable auto-ejection of players from vehicle which will explode soon?
allowCrewInImmobile - not work, disableAI - not work, behavior - not work, only agents works?
running any mods?
no, vanila
blufor apc - marshal
setHitPointDamage ["hithull", 1] -> all players will disembark, except agents
set them unconscious
player must be able to disembark manually (press V, or eject action)
need to disable this "auto-eject" behavior
are they in a group?
one-man group
Not sure if you can disable it
I mean when you desrtroy the vehicle with set damage 1 there is no more places to sit
it has sits, and i can even GetIn to this vehicle before its explode
this behavior does not work on agents, but it requires too many additional scripts (Inventory, Actions and etc)
agents are simpler things, they have no behaviour if I remember right
so just to make sure
you are talking about player characters, not AI controlled characters?
yes, about players, but this behavior also works on AI with disableAI "ALL"
when vehicle takes a lot of damage enough to explode, players should not "auto-eject", because explode happen with delay and players can run away
but they should be able to do it manually
is the driver player?
no matter, player can be driver, gunner, commander or in cargo
Is that even a vanilla behaviour for players.... it is for AI but player?
Unless it's something ACE disables
yes its works on any unit (AI and player on AI) except agent
are you absolutely sure @strong shard that you got no mods on
if I set marshal to setdamage 1 it just explodes
instantly
setHitPointDamage ["hithull", 1]
alright that works. and seems like its automated command as you said
so likely you cant alter this behaviour
its likely somewhere in the behaviour FSM
ok, thanks, will try to transfer players to agents
unless you lock the vehicle, or maybe setUnloadInCombat?
I said maybe because it is clearly not sure it is related. but locked vehicle might work
What's the best way to get the class name of a unit's backpack without items?
For instance a unit has a "B_AssaultPack_rgr_Repair" backpack which is pre-filled with some items, its parent class is "B_AssaultPack_rgr" which is I want to get
sub-string it :p
IDK, I think some get parent config command/function exists
@winter rose we try this - not work, lock - player should be able to manually get out
you could trick it by adding a "dismount" action, but that's all I can bring to the table
@winter rose bis_fnc_basicbackpack seems to do its job
noice!
Yeah actually it iterates the parent classes until it find one without items, right how I was going to do it...
Is it possible to create a local infantry unit?
Or actually, whole problem I am solving: I spawn a unit, initialize its loadout from a 3rd party script, then I read its loadout with SQF functions like vest, backpack, primaryWeapon and similar, after which I delete the unit. Maybe I could somehow replicate the same with a dummy object or whatever? Creating the unit for that looks like a waste of resources for me.
@still forum ,"you just ignored all the minor corrections I posted"
Not on purpose, I thought I got 'em all.
the only thing I missed that I can see is making _grp private
we're moving on anyway... π
Hi again, I return with more questions (apologies). I am working on an MP mission based around slingloading (amongst other things). I'm having some issues with the ropeAttach and ropeBreak EHs. When testing live (on the server), I am getting systemChats that establish that my scripts are firing (based on a simple addAction). However the EHs do not fire from within the script. I was wondering if I need to store the EH code in a specific place..? I thought I could just embed them in the script, but no dice.
vehicle player addEventHandler ["ropeAttach", {
params ["_object1", "_rope", "_object2"];
if (typeOf _object2 == "C_IDAP_supplyCrate_F") then {
// systemChat "attached";
"attached - testSling = true" remoteExec ["systemChat", 0, true];
testSling = true;
vehicle player removeEventHandler ["ropeAttach", 0];
};
}];
@rough dagger apologizing for a pleasant introduction, you'd be a great Canadian
When testing this in local MP (just on my machine), I was getting 4 hits ("attached") when I picked up a crate, so I found that removing the EH straight away sorted that issue out. But I still cannot understand what I am doing wrong in the MP setup
I'm not sure about the syntax on your EH though, sorry
fair play - I struggle with this stuff
But, it did all seem to work fine on my local machine
Maybe the EH runs only on the machine where it is added to the object?
if it works well locally that's a good start!
But I think you are running it on player's machine?
good question for the forum and people love slingload topics anyway
I am testing first on my local machine, then when it works I upload it to my server..
people love slingload topics anyway really hahaha
don't ask me why...
However the EHs do not fire from within the script.
What do you mean...
I was wondering if I need to store the EH code in a specific place..?
A specific place like what? π€· Your code looks fine, you can addEventHandler and pass a { ... code ... } to it directly. Or you can pass a global variable which resolves to code.
Thanks Sparker - what I meant was that the EH is part of the code: scripts\missions\slingloading.sqf
but should any EH be 'housed' for lack of a better term in initPlayerLocal or something? Or initServer? Or should it not really matter?
Most important, you attach the EH to an object, and the object must exist by that time
So what do you actually attach the EH to? It looks like you must attach it to helicopter, right?
right .. so I call the script when sitting in the heli, and the EH is attached to the vehicle I am in - I realised that if I triggered the script (as it is) without being in a heli, nothing would happen, so I made sure I am in a heli when the script is run, so the EH has a landing zone so to speak
I have a camera controlled by a keyhandler and a dialog over it. There is 1 issue, I have a search bar and backspace doesn't work anymore. I think it has to do something with the key handler. Any way to make backspace work like normal?
SOLVED: Make so backspace returns false
Ok so what's the problem with your event handler again? It doesn't work on a dedicated server?
correct (sorry that wasn't clear)
When do you run the addEventHandler code?
And on which machine? on player's machine? are you sure?
when sitting in the MH6, via addAction
Ok so it's player's machine π€
well just try to do a diag_log from the event handler to see if it's even being executed
vehicle player addEventHandler ["ropeAttach", {
params ["_object1", "_rope", "_object2"];
diag_log format ["ROPE ATTACH: %1", _this];
};
}];
will do, thank you.
This is the full code, btw:
_slingContent = [14418,16150];
deleteMarker "slingContent";
_spawnArea = createMarker ["slingContent", _slingContent];
_spawnArea setMarkerShape "ELLIPSE";
_spawnArea setMarkerColor "ColorGreen";
_spawnArea setMarkerSize [100, 100];
_spawnArea setMarkerAlpha 0.9;
slingMission1 = true;
if (slingMission1) then {
"slingMission 1 is live" remoteExec ["systemChat", 0, true];
_pos = [14791.5,16620.3];
deleteMarker "sling1";
_targetArea = createMarker ["sling1", _pos];
_targetArea setMarkerShape "ELLIPSE";
_targetArea setMarkerColor "ColorRed";
_targetArea setMarkerSize [100, 100];
_targetArea setMarkerAlpha 0.9;
vehicle player addEventHandler ["ropeAttach", {
params ["_object1", "_rope", "_object2"];
if (typeOf _object2 == "C_IDAP_supplyCrate_F") then {
// systemChat "attached";
"attached - testSling = true" remoteExec ["systemChat", 0, true];
testSling = true;
vehicle player removeEventHandler ["ropeAttach", 0];
};
}];
vehicle player addEventHandler ["ropeBreak", {
params ["_object1", "_rope", "_object2"];
if (_object2 inArea "sling1") then {
vehicle player removeEventHandler ["ropeBreak", 0];
"nice drop - in tha zone - slingLoad points added" remoteExec ["systemChat", 0, true];
RGG_slingLoadScore = RGG_slingLoadScore + 1;
} else {
"no good - try again" remoteExec ["systemChat", 0, true];
};
}];
};
removeEventHandler ["ropeAttach", 0]; you are assuming noone else will add that handler. but you don't know that
C_IDAP_supplyCrate_F how can the player be inside a supplyCrate?
it's _object2 == supplycrate
π€
^^ the item I am slingloading
ah I just don't know how that EH works π
I'd say ropeAttach is a local EH. local to the vehicle attaching the rope?
without reading the wiki that is
I assume it's local but he said that he's running addEventHandler locally on player's PC through addAction
yeah well "vehicle player addEventHandler" is deffo local
Not sure if this is relevant, but the wiki does not state local or global? Maybe I am misreading this though
right
Yes if it doesn't state something it doesn't mean that something is true or false, more likely something is unknown
It is one of the newer ones I guess
OK, I'll diag_log and see what that shows
nice one guys, I appreciate the help and interest π
you know you can debug that thing with the debug console without restarting the server and re-pbo-ing the mission file?
there are many things about this I do not know, that is deffo one of them X)
thank you
Do you have CBA? It has a debug console which is actually useful
I've not used that. It is loaded, for some mods, so I can check that out. By the way, I am not PBOing my mission, I'm just loading the files to FPT (is that wrong??)
You know about the debug console, right?
You must put this into your description.ext to enable it for everyone:
enableDebugConsole = 2;
FPT? You mean FTP?
sorry, typo yes π
and I normally just log in as admin for debug, but makes sense to change that - good tip
Hmm but you export the mission from the editor, right?
I copy the mission file and related script files across from my local machine to my FTP server, then start the server to test the code.
My understanding was that if you test locally, even in MP (through the editor), you are actually testing as the server, so anything that works on your local machine even in 'MP', is not a true reflection of realty - as I am finding out lol
That's correct, an arma with interface can be a client or a server or both
so when you test by hosting an MP game you are both client and server
right
so you can debug the server's perspective of the game
I do it like this to save time:
Launch two armas from the launcher with different profiles
One arma hosts the mission from the editor
Another arma joins as client
Can debug both server and client view of the mission
If client and server side code is decoupled good enough then it should work fine with that
very nice workflow .. ArmA devving takes ages to process, so any workflow tips are very much appreciated π
Yes, that way you just change code, restart the mission from editor, without making a .pbo
and transfering files and doing other stuff...
makes sense. I have not tried your system, as I was not aware you could log in twice (i.e. a second client). I'll give that a try, that will save 'a lot' of time X)
Yes just make a second profile through the game start menu, then in launcher parameters find the 'Profile' parameter
sweet!!!
ta mate, gonna get on that ^^^ and also research diag_log - I have heard of this but never used it
π€ diag_log is better then logging into chat, because there is a known bug when chat stops being displayed at all π’ in multiplayer
ok .. this MP stuff brains my damage
I use logexpert to watch the rpts live http://www.log-expert.de/ it's very convenient for our purposes
Can also filter messages, etc
So I'm having an issue with passing a variable while having disableSerialization enabled and disabled all at the same time. For whatever reason, it is passing a nil value instead of the object its suppose to pass. Anyone have a similar issue?
no problem... how are you passing it and how is it defined before u pass it
nevermind, I figured it out. I simply got rid of the with uiNamespace do around it. That seems to have worked
i figured it might have something to do with a namespace switch and it being a local variable in both scopes, the calling and function that received it
Hey all, have any of u used the survivable crashes mod? I have two problems with it and would like to maybe change it. But i need help
One problem (the biggest one) is that ai straight up dissapear on a crash
the second is that the heli bounces on crash. Any fix for these?
How do I intercept an event when a player drags an inventory item from an external container(not from his own inventory) onto the ground?
Neither Take nor Put event handlers get triggered, or are they supposed to be called but it's a bug?
What would I do to make a trigger only activate for a player if a specific unit is still alive.
is there away to detect when someone does an action? I want to know when someone does the actionBackFromUAV which is "Release UAV controls"
https://community.bistudio.com/wiki/action/Arma_3_Actions_List#BackFromUAV
@swift merlin I'm sorry you don't approve of my question. None of the answers on google helped because I'm inexperienced, but I eventually got it to work.
For anyone curious, my issue was I had
if (alive dad) then ["Rebel", "Vadim, NO!"] spawn bis_fnc_showsubtitle;
^Unit name
The solution was I didn't have the {} around the my subtitles, so I was receiving syntax errors. I thought I had made a mistake somewhere else and was asking for help because of it. Sorry.
I needed the trigger thing for that, but I found a work around.
@bitter lark maybe start with showing the error next time
@edgy dune try https://community.bistudio.com/wiki/inGameUISetEventHandler
how do I get bool value from description.ext ? is it possible to retype it to BOOL ?
class CfgCustom
{
class first
{
isEnabled = true;
}
}
_isEnabled = [missionConfigFile >> "CfgCustom" >> "first", "isEnabled", false] call BIS_fnc_returnConfigEntry;
this only return Array, String or Number - Attribute value
@ivory lake that also return only Array, String, Number or nil
iirc generally 'bools' in configs are just 0 or 1 anyway
so you're probably better off doing that and using https://community.bistudio.com/wiki/BIS_fnc_getCfgDataBool or your own
!issuewarning @swift merlin crossposting
Done.
i have 1 question: is there a script to change the mission parameters live like during a game? if its technicly possible?
what kind of mission parameters?
parameters from slot selection.
no.
But the mission scripts proably copies the settings into global variables, which you can edit.
yea
this is what i meant
so the global variables u can edit live during game? who does it work. do i need a script what is overwriting that?
ok thanks a lot
Is there any way through script to open the normal action menu? showCommandingMenu is great for everything else, but I need a way to bring the scroll wheel menu up.
I dont think there is
oof
why do you need it?
I'm trying to add a 'Backspace' that goes back to the normal scroll menu, since the submenu is available directly from there.
I dont quite understand?
I have a flow with commanding menus.
It's not the end of the world if I can't it would've just helped with the flow.
by scrollwheel menu you mean the useraction list right?
Yeah, https://community.bistudio.com/wiki/isActionMenuVisible is a function that directly deals with it but it's just a check.
@tough abyss ah thank you, that name of that function is not what I thought it would be π€·
is diag_fps and family meaningful on the server to judge the performance/quality state of the server?
few fps == bad performance.
Same as on clients
Nothing, you can die with less damage than 1
just do *101 instad of 100 or so π
Hey all, have any of u used the survivable crashes mod? I have two problems with it and would like to maybe change it. But i need help
One problem (the biggest one) is that ai straight up dissapear on a crash
the second is that the heli bounces on crash. Any fix for these?
We have a bug on our server where for some reasons task dont show up on the map when spawned in. it only happens everynow and then. but the only way we can fix it is to restart the server. any advice on what would cause tasks to stop showing up for everyone on the server?
any advice on what would cause tasks to stop showing up for everyone on the server?
BI's task system is kind of unreliable
hey guys, connot get a clear answer on the forums and my tests does not really work out so asking here in hope for a quick answer.
how can I get the following to work?
_hour returns any.
KLT_fnc_skiptime = {
params ["_type"];
_type remoteExec ["skipTime"];
if (_type == 1) then {_hour = "Hour";} else {_hour = "Hours"};
[
[
[format ["%1 %2 Later",_type,_hour], "<t align = 'center' shadow = '1' size = '1' font='PuristaBold'>%1</t><br/>"]
],
safeZoneY + safeZoneH / 1.3,
safeZoneY + safeZoneH / 1.2
] spawn BIS_fnc_typeText;
};
if I run this from the debug it works perfectly fine..
_hour ="test";
_type = 1;
[
[
[format ["%1 %2 Later",_type,_hour], "<t align = 'center' shadow = '1' size = '1' font='PuristaBold'>%1</t><br/>"]
],
safeZoneY + safeZoneH / 1.3,
safeZoneY + safeZoneH / 1.2
] spawn BIS_fnc_typeText;
Thanks
totally unneccesary but wtf xD
@obsidian violet private "_hour"
hmm, within the if statement?
No,just above the if. That or sqf private _hour = ["hours", "hour"] select (_type == 1);
Also, your variable "_type"β¦ the name is not helpful at all
_type will be amount of hours to skip so a simple value. why wouldnΒ΄t that be helpful?
Because how in hell is it a "type"?
_hours or _hoursToSkip or _skipDuration idk, but something else
oh do you mean the name of it haha, well thats true, I can change the name when I get it to work π
use my second code instead of your if and you should be good. Also, always private your variables on declaration.
Wilco!! Thanks π π
So I'm trying to learn how to make a proper headcam script, and I know that requires the use of all the vector related commands in order to make it work proper. I was wondering if anyone had a guide on how to use all the different vector commands and what not?
@tame lion well, I found that CBA_fnc_headDir is a good start, however it doesn't have vertical direction
I have been playing with retrieving that, but it is far from reliable
the hardest part is attaching an object to the head/helmet, because it's a "static" position relative to the spine, so it doesn't move correctly
of course, for a camera, you could simply place an invisible object in front of the head (ASLToAGL eyePos player) which acts as a camera, and then calculate where the player is looking at (eyeDirection player)
Doesn't attachTo let you attach something to head?
I've tried using attachTo for head placement. It doesn't exactly rotate properly with head
the head point is a fixed point, and doesn't move with the head
eyePos is the closest thing to a position of the head with movement
I guess this is a good place to start:
onEachFrame
{
_beg = ASLToAGL eyePos player;
_end = (_beg vectorAdd (eyeDirection player vectorMultiply 100));
drawLine3D [ _beg, _endE, [0,1,0,1]];
};
From here you can calculate the Pitch/Yaw/Bank from _beg and _end
https://i.imgur.com/poFJTSD.png is it possible to get more info than this for the errors that appear at the bottom of the screen? Nothing shows up in my rpt logs :/
look at the source of the bis func mentioned
Trying to make an addon that allows the player to knock themselves out. I made two SQFs one that adds an action and another that knocks the player out. I got it to work in a mission but not as an addon.
sleep.sqf
player addAction ["Sleep", "sleep.sqf"];
knock_out.sqf
[player, true, 8, true] call ace_medical_fnc_setUnconscious;
Should I go to #arma3_config ? I've been at it for a while and at a loss on how to get the SQFs to run.
CfgFunctions in your config.cpp.
You want the addAction in a postInit
So am I barking up the right tree with this in the config.cpp
class Extended_PostInit_EventHandlers { class CAManBase { class CAManBase_Init { init = "[_this] execVM 'knock_out.sqf';"; }; }; };
with
requiredAddons[] = {"ace_medical","cba_events"};
at the beginning?
so 'scripts\knock_out.sqf'
sadly no
How do you pack your mod pbo?
The Arma 3 addon builder
in the options of it you can configure the prefix
if you have a "scripts.sqf" directly next to your config.cpp in your pbo.
Then the final path will be
prefix\scripts.sqf
for prefix you should pick something unique, usually the same as the pbo filename
disregard, I have found a method.
I bascially created a new camera, attached the camera to the object. Object controls work fine and everything works fine. Although there is for whatever reason a massive amount of stutter.
Ugh, I'll continue tomorrow, I figured out that it wasn't copying the SQFs to the PBO and I had to manually add the file type... Way more confusing then just doing it in a mission.
@exotic flax I've actually tried that example script. It's close, however it pants the camera in the center of the head. That's why i was thinking there might be a way with vector modification to somehow replicate a modelToWorld type effect off of the head
Only other thing i could think of is if it's possible to hide part of a model (eg: the "head" selection of the body) while the helmet cam is active
Unfortunately, the command hideSelection only seems to workon simple objects
Can setVehicleReportRemoteTargets be used on infantry?
I want to be able to use it with the regular infantry laser designator
For use with the datalink system
try and tell us!
I've read that it can, but it didn't work for me
Is there any way of retrieving a zoom level set via ctrlMapAnimAdd? Generally just getting the zoom level of a CT_MAP control.ctrlMapScale achieves this π
@tame lion I've tried as well to attach an object to the head (or in my case helmet) which would move correctly based on head movement. However, since the head doesn't has it's own position and direction, this doesn't work.
And hiding the head is also tricky... because it would mean the unit wouldn't have a head at all (because it's by the object, not only though PiP)
Yah but if i could hide the head only locally on the client using the interface, that could somewhat help. I'm not building it as a hud element, only as part of a dialog that covers almost the wholescreen
with an attached camera it would make sense to also see a part of the head/helmet
but with a virtual camera it would make more sense to just place it in front of the head and then have the same direction as the units eyes
Yeah at this point I'm just trying to find a means to an end
what would the syntax be if I wanted to replace ""SAFE"" with something like "behaviour group this"?
_wp setWaypointStatements ["true", "[this, ""SAFE""] call mmf_fnc_patrolNAV;"];
it's just this,
_wp setWaypointStatements ["true", "[this, "behaviour this"] call mmf_fnc_patrolNAV;"];
nope, just this,
_wp setWaypointStatements ["true", "[this, behaviour this] call mmf_fnc_patrolNAV;"];
is anything more known about moonIntensity or moonPhase? search turns up nothing
and ingame moon doesnt seem to reflect (any more) real world
at least websites on the net give different outcomes
(need full moon for Baranow Poland around 8th 1944)
if terrain coords are correct, and you set the correct date/time, it should give the correct moon
well it used to with OFP yes
but it seems the code is no longer correct
from what i can tell A3 touched it to integrate it for simulWeather
which may broke it
so use the utils command and find the date with the correct moon π
I don't have the map, so can't tell what is wrong...
setApertureNew
but I do know that moons are present in Arma and do work correctly... perhaps it's the wrong time, or the terrain is not optimized for it
optimized?
@winter rose will try
the prob is when there is still some sunlight AI is still crazy with spotting
aka incompatible to spec ops night mission design
what value would you suggest?
I really don't know, you would have to fiddle with it
"foo" in "foobar";
``` should that return true? It results in a script error
It should, if your arma version is above 1.95.146032
needle in haystack (Since Arma 3 v1.95.146032)
Is there a way to set the turret direction?
@spice axle
You can get the current roation with something like:
_vehicle AnimationPhase "MainTurret"
it should be possible to set the direction with:
https://community.bistudio.com/wiki/animate
_vehicle animate ["MainTurret", 0.5, true];
havent tested it, so no guarantee it works
Will test it give me a mom
MAybe I'm doing something from but I tested several things and nothing happend
hm, then you could try putting in an AI, and force him to just watch a into a certain direction
https://community.bistudio.com/wiki/doTarget
(and remove the AI afterwards)
I don't know. It is not working for me ok I found my problem, it is working now, thanks
Hi, I'm going to apply this http://www.armaholic.com/page.php?id=33618 script. And I'm basically copying what I heard on my homepage. However, it is not known what variables the editor applies to the map. The basic mission pack is the Ghost - Enemy Assault.
It doesnt matter how the markername is called it just have to be the same as here
[player,"MarkerNameFromEDITOR",20] spawn zlo_fnc_CreateZone;//[PLAYER,MARKERNAME,RADIUS]
@jolly wolf but I'm not sure if that was your question
Marker - Properties [parameter name] May I fill in here?
the variable name like here https://gyazo.com/8144dbd5a1d59ec6bc9ec47fe77f234d
How does one control the degree to which the "Zoom In" etc. keys zoom?
I don't think you can... perhaps through some ui event handler and custom scripts, but I bellieve it's hardcoded
It's configured in weapons/turrets optic config. Not really controllable beyond that.
Hi everyone. I have a complete beginner question. How do I display the output of commands of my debug console?
My situation: I am trying to find the type and category of an object. Commands such as typeOf and BIS_fnc_objectType are the obvious answer, but executing them locally in a debug console shows no output. How do I do this?
typeOf cursorObject @acoustic abyss
@winter rose Thankyou! But, I don't know the shortcut key to opening up debug console and local execution, so couldn't use cursorObject. I am now using :
hint str [ foo ] ;
-when I am playtesting the mission. But this is a pathetic workaround. How do I normally get the output of " foo " in the editor screen?
does a command with global effects will execute for every player connecting to the server?
using isServer wont make it work in a dedicated server
im refering to createVehicle btw
The shortcut to open debug console is "Esc"
If the console is enabled at all that is
does a command with global effects will execute for every player connecting to the server?
no. It means the result it creates is visible for every player
Hello guy, IΒ΄ve been trying to make a video. Can we help me anyone? Can I add this intro video to exile server? Thank you for your responses.
I have been trying to figure this out for some time....
I have ran and tested these lines in debug console and know that they work. I need help creating a script to loop through an array of x,y and radius and then have it execute when the server starts.
_location=[5789.38,10383.6];
_radius=50;
_terrainobjects=nearestTerrainObjects [_location,[],_radius]; {hideObjectGlobal _x} foreach _terrainobjects;
how would I go about this
loop through an array? forEach
{
_x params ["_location", "_radius"];
<...>
} forEach [[[5789.38,10383.6],50], [[5789.38,10383.6],50]]
yes loop through an array one like this.
private _locations=[[5789.38,10383.6],[5724.87,10404.2],[5793.5,10421.4],[5759.32,10444.9],[5798.47,10468.9],[6895.849,7453.282],[6895.849,7453.282],[5822.715,10783.907],[5830.870,10187.938],[5845.938,10223.338],[5840.145,10143.083],[5876.150,10186.08],[5878.213,10210.816],[4985.84,11373.3],[4961.61,11323.8],[5755.97,10696.4],[5755.66,10717],[5755.51,10731.1],[5479.933,9977.303],[5469.477,9947.218],[5761.33,10628.7],[5730.21,10625.1],[4676.46,9315.29],[3875.18,9667.09],[5836.25,10830.8],[5938.71,10645.7],[5835.59,10545.3],[5805.89,10579.7],[4634.15,9265.12],[4712.04,9263.93],[4054.704,9105.791],[9877.941,13536.048],[4048.31,8318.89],[4073.25,8294.63],[6921.5,7584.5],[8262.4,11990.3],[8356.62,11957.9],[5935.47,11051.4],[5948.38,10987.6],[5922.09,10983.3],[5922.09,10983.3],[5918.39,10993.2],[5918.39,10993.2],[5763.97,10586],[5756,10567.3]];
where does radius come from? thats not in there
that would be
{
_location = _x;
...
} forEach _locations;
When trying to addAction to a player, how can I add it to the player (I'm trying to do it in a remoteExec from the server right now)?
When trying to addAction to a player
how can I add it to the player
By adding it to the player π€
I mean pass player as object which will get the action added
I just assumed that the player object would get interpreted on the server, then sent as the "wrong" object to the user. Testing rn π
"player" doesn't exist on a server, the comand returns objNull
From the serverside there is no "the player"
best would be to add a function which will be run locally on a player's computer and add the action to player
From the serverside there is no "the player"
except if server is also client*
assuming your remoteexec looks like [player, [...]] then yes. that doesn't work.
Server will make player command return objNull, which means youre trying to add action to objNull
You can either just remoteExec "call" or.. you can manually find the target object that you want out of allPlayers
will the player object in allPlayers be the same across connected clients?
yes
Great, I'll give that a try! π
if (!isServer) exitwith {};
rdfInf = {
_infSpawns = selectRandom ["inf1","inf2","inf3","inf5","inf6"];
_squad =[getMarkerPos _infSpawns,EAST, (configfile >> "CfgGroups" >> "East" >> "rhs_faction_vdv" >> "rhs_group_rus_vdv_infantry" >> "rhs_group_rus_vdv_infantry_squad")]; //call BIS_fnc_spawnGroup;
//[_squad, getmarkerpos, 1000] call BIS_fnc_taskPatrol;
};
[rdfInf] remoteExec ["rdfInf",2];
Any hints on why this isen't working.
the call is commented out
lol. i just saw that too
why is your remoteExec passing a COPY of the function as argument to a function?
im trying to spawn a inf grp on a dedicated server.
Your function doesn't take any arguments. Thus you also shouldn't pass any to remoteExec
through a add action
It worked! Big thanks!
@lavish hamlet Might this be what you're looking for?:
// all clients will have their ammo set to 1 for their current weapon
{player setAmmo [primaryWeapon player, 1];} remoteExec ["bis_fnc_call", 0];
So in your case:
rdfInf remoteExec ["bin_fnc_call", 2];
rdfInf remoteExec ["bin_fnc_call", 2]; no on 3 levels.
1st its BIS_fnc_call, not bin.
2nd use "call" instead of the old bis func.
3rd just remoteExec the function. remoteExec ["rdfInf", 2]
atleast that should work too. Not sure if it's really limited to CfgFunctions only
So, it's stupid. But does it work? (Out of curiosity)
what works? If you correct the bin/bis typo, your code works yes
Oh, didn't even realize that there was a typo. But cool, thanks
but its very inefficient
you are always going the redirect via the bis fnc, which means it also has to spawn the script and add it to the scheduler.
and you are always sending the content of the script function over the network, every time you call it
Yeah, I see no practical use for it. Other than possibly for testing π
Is there a way to make a script local to the server, and thus never sent to the client? (To reduce network traffic)
Creating the script outside the mission (server root folder) and then including it using "\path\to\script.sqf" ?
Only as a server-side addon
You can't include anything not from a .pbo
Except if you enable file patching as a startup aprameter
I would say that your idea is quite good but pointless in the modern world, when we have abundance of bandwidth and our code weighs like... kilobytes?
but sometimes you don't want people to see your code
network traffic reduction not worth it. But if you want to hide it then different story
Ah sorry I have misread it, he says never send it to client
I was thinking about a different thing π sorry
your responses seem valid to me tho
@still forum I have a second array to get the radius. sorry I fell asleep with the gf.
you can use _forEachIndex variable, inside the loop to know at which index you are
and use that to select from your radii array
okay so i have this
private _locations=[[5789.38,10383.6],[5724.87,10404.2],[5793.5,10421.4],[5759.32,10444.9],[5798.47,10468.9],[6895.849,7453.282],[6895.849,7453.282],[5822.715,10783.907],[5830.870,10187.938],[5845.938,10223.338],[5840.145,10143.083],[5876.150,10186.08],[5878.213,10210.816],[4985.84,11373.3],[4961.61,11323.8],[5755.97,10696.4],[5755.66,10717],[5755.51,10731.1],[5479.933,9977.303],[5469.477,9947.218],[5761.33,10628.7],[5730.21,10625.1],[4676.46,9315.29],[3875.18,9667.09],[5836.25,10830.8],[5938.71,10645.7],[5835.59,10545.3],[5805.89,10579.7],[4634.15,9265.12],[4712.04,9263.93],[4054.704,9105.791],[9877.941,13536.048],[4048.31,8318.89],[4073.25,8294.63],[6921.5,7584.5],[8262.4,11990.3],[8356.62,11957.9],[5935.47,11051.4],[5948.38,10987.6],[5922.09,10983.3],[5922.09,10983.3],[5918.39,10993.2],[5918.39,10993.2],[5763.97,10586],[5756,10567.3]];
private _radi=[50,20,30,50,20,20,20,30,30,30,10,20,8,50,20,20,20,20,5,10,20,20,50,99,15,40,50,20,35,25,100,20,50,50,100,100,50,50,25,10,5,5,45];
if (count _locations != count _radi) exitWith { hint "invalid grid" };
{
private _location = _x;
private _radius = (_radi select _forEachIndex);
{hideObjectGlobal _x} forEach (nearestTerrainObjects [_location,[],_radius]);
} forEach _locations;
A) Will this work
B) Where would I execute this to have it run once on server startup before anything loads on the map
initServer.sqf
with execVM correct
or preInit in CfgFunctions with isServer check
no
execVM will execute later
if you don't want to use cfgfunctions
use call compile preprocessFile "file.sqf"
i dont mind if its more efficient i just dont know how
call compile.. in initServer.sqf should work fine enough
Oh I thought I answered that. apparently I didn't
looks good to me π
Maybe look at
if you wanna check it out. I'll leave now o7
cya
@still forum no go went about it with the call compile and the nearest terrain objects are not hidden will try with cfgFunctions
Ive noticed some objects might not work with hiding
im back π when i run this ```sqf
if (!isServer) exitwith {};
rdfInf = {
_infSpawns = selectRandom ["inf1","inf2","inf3","inf5","inf6"];
_squad =[getMarkerPos _infSpawns,EAST, 5] call BIS_fnc_spawnGroup;
[_squad,getmarkerpos "patrol", 1000] call BIS_fnc_taskPatrol;
};
remoteExecCall ["rdfInf",2];
through an addaction on a laptop on the server it wont work. but if i copy the code the the debug console and run on server it works.. could someone point me in the right direction ?
i have a question ? i'm in the tank i press "T" for assign a target and when i use the "assignedTarget" i don't see the target but if go to the order menu and i assign manually the target it work so why when i press "T" in a tank i don't see the assigned target ?
Same problem as this guy
https://forums.bohemia.net/forums/topic/188473-change-squad-name/
Any fix?
see answers of that same topic...
None of they help, since I dont have CBA in this mission.
well, CBA is the only way to change the squad names in the lobby
@exotic flax Did you ever figure out how to use XEH after respawn?
Because I currently have my addon working but when I respawn my Action is no longer available.
yes, at least it's now working as I wanted π
// config.cpp
class Extended_Respawn_EventHandlers {
class CAManBase {
class onPlayerRespawn {
respawn = "_this call TAG_fnc_onPlayerRespawn";
};
};
};
// fn_onPlayerRespawn.sqf
params ["_unit", "_corpse"];
[_unit, _corpse] spawn {
params ["_unit", "_corpse"];
// execute code
};
true
the extra spawn in the sqf is needed, because the script runs at the same time as the unit got created; so it should wait for that
Thanks chief I'll give her a try and work from there
although for actions (like player addAction []) a postInit should be enough, since it will trigger the moment an unit is created (included respawning)
IDK, I tried it and when I respawned I lost the Action
@astral tendon put @squad name in the role description on the squad leader. something like 1: Squad Leader@Corpsmen , This will change the initial squad name (e.g. Alpha 1-1) to Corpsmen in the multiplayer lobby, you don't even need to change the Alpha 1-1 group name
@grave stratus I dont have CBA on that mission, it does not work.
oh.then i dont know
Is there a script command I can use to open a vehicles inventory in the normal dialog?
@lavish hamlet because server doesnt know anything about that function until you define it serverside
I'm having another dumb moment. What is the way to reference an object that I called the script on? (Ex. A script that creates a whitelist for an arsenal)
Currently I have it setup as:
[bftarsenal, _bftarray] call ace_arsenal_fnc_addVirtualItems;
bftarsenal addAction["<t color='#2ecc71'>Open Arsenal</t>", {[bftarsenal, player, false] call ace_arsenal_fnc_openBox;},[],1200, true, true, "","true", 2,false,"",""];
But obviously, can't have multiple objects named as bftarsenal.
@copper raven so if i definere the fnc in serverinit.sqf then i Will be able to Call the fnc from an addaction from a Client and it Will run server side ? Im at work so cant test it π
remoteExecCall
@lavish hamlet you sure you want unscheduled? But I guess debug console is unscheduled too, so that should work.
Hello all. Im using an event handler. "FiredNear"... Anyways ive looked for awhile now. I want to have it create a group for passengers. Then force them to leave that vehicle. The problem im having is how do define the passengers or cargo? Everything i try seems ill without result.
@still forum i really dont know π but in this case i need to be able to spawn 4 kind of targets on a tranings map that is closed to my community.
@sudden yacht Just get all the people that are in cargo: https://community.bistudio.com/wiki/fullCrew
eg.
{
if(!isNull (_x select 0) && (_x select 1) == "cargo") then {moveOut (_x select 0);};
} forEach (fullCrew _vehicle);
@carmine maple would using the alternate syntax with filter of "cargo" be easier? can't test it now, but fullCrew [_vehicle, "cargo", false] might make the if not needed. Can't test right now, just read the wiki page on fullCrew
Is animateSource works with simple objects?
try and thy shalt see!
is there a way to read out the radar targets from a vehicle? Or do I have to loop over allVehicles and check knowsAbout?
or rather nearTargets? I'm thinking about writing an awacs script for Sabre's E-2 and Unsung E-2
@round scroll https://community.bistudio.com/wiki/targetsQuery ?
thanks, gonna try that
I need some help! I've tried everything but im still not able to get ai to spawn on a dedicated server using an addaction. any help would be greatly appriciated. everything work when its local but as soon as i try to get the server to run the functions nothing happens.
what exactly do you do?
Description.ext
onLoadName="RDF Trænings Map";
onLoadMission="RDF Trænings Map";
respawn = 3;
briefing=0;
debriefing=0;
enableDebugConsole = 1;
EnableAI =0;
class CfgFunctions
{
#include "RifleTargets\cfgfunctions.hpp"
};
class CfgRemoteExec
{
class functions {
mode = 2;
class rdf_Jtac_fnc_infspawn {
allowedTargets = 2;
};
class rdf_Jtac_fnc_armorSpawn {
allowedTargets = 2;
};
class rdf_Jtac_fnc_lightArmorSpawn {
allowedTargets = 2;
};
class rdf_Jtac_fnc_vehicleSpawn {
allowedTargets = 2;
};
};
};
initserver.sqf
rdf_Jtac_fnc_infspawn = compile preprocessFileLineNumbers "scripts\RDF_Jtac\infSpawn.sqf";
rdf_Jtac_fnc_armorSpawn = compile preprocessFileLineNumbers "scripts\RDF_Jtac\armorSpawn.sqf";
rdf_Jtac_fnc_lightArmorSpawn = compile preprocessFileLineNumbers "scripts\RDF_Jtac\lightArmorSpawn.sqf";
rdf_Jtac_fnc_vehicleSpawn = compile preprocessFileLineNumbers "scripts\RDF_Jtac\vehiclespawn.sqf";
infspawn.sqf
//if (!isServer) exitwith {};
rdfInf = {
_infSpawns = selectRandom ["inf1","inf2","inf3","inf5","inf6"];
_squad =[getMarkerPos _infSpawns,EAST, 5] call BIS_fnc_spawnGroup;
[_squad,getmarkerpos "patrol", 1000] call BIS_fnc_taskPatrol;
};
remoteExecCall ["rdfInf",2];```
vehiclespawn.sqf
```sqf
if (!isServer) exitwith {};
_vehspawn = selectRandom ["veh1","veh2","veh3","veh5","veh6"];
_vehicle = [getMarkerPos _vehspawn,0,"rhs_uaz_open_vmf", EAST] call BIS_fnc_spawnVehicle;
[_vehicle select 2, getmarkerpos "patrol", 1000] call BIS_fnc_taskPatrol;```
remoteExecCall ["rdfInf",2];```only works if the other machine also knows the function
then i change rdfinf to rdf_Jtac_fnc_infspawn the line i have in the initserver.sqf ?
and this is the addaction part ```sqf
removeAllActions rdfjtac;
rdfjtac addAction ["Spawn Infantry",rdf_Jtac_fnc_infspawn];
rdfjtac addAction ["Spawn Vehicle", rdf_Jtac_fnc_vehicleSpawn];
rdfjtac addAction ["Spawn Light armor", rdf_Jtac_fnc_lightArmorSpawn];
rdfjtac addAction ["Spawn Armored", rdf_Jtac_fnc_armorSpawn];
quickfix, put ```sqf
rdfInf = {
_infSpawns = selectRandom ["inf1","inf2","inf3","inf5","inf6"];
_squad =[getMarkerPos _infSpawns,EAST, 5] call BIS_fnc_spawnGroup;
[_squad,getmarkerpos "patrol", 1000] call BIS_fnc_taskPatrol;
};in `initServer.sqf` and in `infspawn.sqf` only putsqf
remoteExecCall ["rdfInf",2];```
rdfjtac addAction ["Spawn Infantry", {remoteExecCall ["rdfInf",2]}];
or maybe
rdfjtac addAction ["Spawn Infantry", "remoteExecCall ['rdfInf',2]"];
no time to read wiki
the quickfix did nothing. π¦
if you manually execute the remoteExec on your client in the debug console with local exec. Does that work correctly?
what does rdf_Jtac_fnc_infspawn contain?
rdf_Jtac_fnc_infspawn = compile preprocessFileLineNumbers "scripts\RDF_Jtac\infSpawn.sqf";
so before lou's fix it was the infspawn.sqf script.. now it just contains the remoteexeccall part
doesn't tell me what it contains
so its just
rdf_Jtac_fnc_infspawn = {remoteExecCall ["rdfInf",2];}
essentially?
yes after i moved the rest of the spawn script to initserver.sqf.
didn't answer my question above whether remoteExec manually works
it works.. rdfjtac addAction ["Spawn Infantry", {remoteExecCall ["rdfInf",2]}];
or maybe
rdfjtac addAction ["Spawn Infantry", "remoteExecCall ['rdfInf',2]"]; bot of em.
so your issue was rdf_Jtac_fnc_infspawn then
Yes.. obviously
initserver.sqf
only runs on server.
rdf_Jtac_fnc_infspawnis only set on server.
But all your actions are on client
Anyone recomends a stand alone vanila script for pylons?
Sure, just spawn a RoadCone_F
Or a RoadCone_L_F and attach a lightpoint to it
Maybe even loop it!
What?
I believe he means dynamic loadouts π
Can't recommend a script. But I can recommend the wiki pages required to write one
I believe he means dynamic loadouts
That was my joke, yes.
I already know those wiki pages, is just that I don't have the time to work it, or even the knowledge to do a good public script, I already got roasted enough about my bad scripting.
I only know of the ACE UI
tbf... doing a single Google search already gave me 3-4 different scripts/mods which have a custom loadout system
on the first page...
Oh. Well then.
Some of they are quite old posts from the forum, so I would like to know from the community about a good one that is also updated and used in public servers.
Anyone know of a way to get an insignia on a soldier's left arm in multiplayer?
get*
Alright, now here's another question: How do I depending on a characters variable name assign them a unit insignia?
What do you mean by " depending on a characters variable name"?
A switch of str player could do it if you just mean a list per name.
when i create a task in the eden editor do i have to assign a variable name to prevent issues with armas task framework? its for a multiplayer server. my tasks stop spawning for some reason after a few tasks or half dozen spawn. the task id is set and its always unique. so m49_task_1 for task ids.
I solved it:
if (vehicleVarName player == "Troop_Medic") then {[player, "CTRG15"] call BIS_fnc_setUnitInsignia};```
how do i delete every object in an array i got by using BIS_fnc_objectsGrabber? because it detects it as an array, not vehicle.
if (isServer) then {
_objectsArray = [
["CraterLong",[227.18,-103.525,-0.0641394],135.155,1,0,[-1.94189,-0.815603],"","",true,false],
["CraterLong",[230.895,-107.867,-0.0767827],136.893,1,0,[-2.33426,-0.482941],"","",true,false],
["CraterLong",[235.338,-112.971,-0.237772],135.085,1,0,[-7.26152,-1.80381],"","",true,false]
];
[[9889.314,9661.053], 0, _objectsArray, 0] call BIS_fnc_objectsMapper;
_objectsArray spawn {
sleep 1;
waitUntil { (["Task_001_02"] call BIS_fnc_taskState) == "SUCCEEDED" };
{deleteVehicle _x} forEach _this;
};
};
_objectsArray doesn't contain any objects
I guess use nearestObjects at the coordinates?
BIS_fnc_objectsMapper returns an array, but you never use the return value?
well the objects returned by BIS_fnc_objectsMapper are in .p3d file format
i've tried it using copytoclipboard, it returns the objects .p3d file name
You can't copy the object directly to the clipboard.
oh
thats why it returns something like this? [249766cc900# 355688: cncblock.p3d,249766cfc60# 355689: cncblock.p3d
That.. is an array of objects
objects turned into strings
Yep, debug names for objects is what you get because you are outputting strings.
you already have the correct code for that. forEach and deleteVehicle
ah okay
i gave a variable name to the BIS_fnc_objectsMapper and use forEach to that instead of the array from BIS_fnc_objectsGrabber and it works
i didnt know that i cant directly copy and objects to the clipboard
that's why i didn't try it
π
thanks guys
π
!issuewarning @jolly wolf crossposting
Done.
When messing with coordinate space for the AttachTo command, is there a easy debug or way for me to get the places I need via just attaching and moving in the editor? I would like to show progress of equipment being loaded into a truck, but I'll be using a lot of boxes.
perhaps some getpos main object, getpos attached object offset calculation
I couldn't quiet get the exact points but eyedballed it enough to offset decently
My next question is, how can I stop a plane at a certain point in it's Taxi? I tried disabling both MOVE and PATH AI on waypoint.
Or does it have to be the vehicle I need to disable these and not the pilot?
might need some setvelocity shenannigan. planes dont have much in the way of brakes I think
engine off perhaps
and stop command on pilot
I never got AI manned planes to taxi the way I want in arma 3, gave up on it and scripted it
on the awacs functionality queried earlier, the targetsQuery command seems to like to get the pilot, the plane itself seems to know nothing on targets π (driver _awacs) targetsQuery [objNull, sideUnknown, "", [], 0]
anyone know a clean way of sorting a list of vehicle classnames into categories ? (Helicopter / Car / Tank , etc)
You could do something like a switch Statement with a isKindOf and then the base Helicopter, car, ...
@wary vine
isKindOf is Object based right ?
switch (true) do {
case (_x isKindOf "BaseCar"): {
_arrayCars pushback _x
}}
Im just on the phone but in this direction
There is a syntax error but yes
ah ok sorry havenβt read this Part
private _types = [
["Tank", []],
["Truck_F", []],
["Car", []],
["Unknown", []]
];
("(getNumber(_x >> ""scope"")) isEqualTo 2" configClasses (configFile >> "CfgVehicles")) apply
{
private _parents = ([_x, true] call BIS_fnc_returnParents);
private _first_index = _types findIf {(_x select 0) in _parents};
private _type = if !(_first_index isEqualTo -1) then
{
((_types select _first_index) select 1) pushBackUnique (configName _x);
} else
{
((_types select ((count _types)) - 1) select 1) pushBackUnique (configName _x);
};
};
copyToClipboard str _types;
``` this works, to an extent, i just have be careful what order I put the types in.
otherwise, tanks will be in "Car"
again, object based, its pretty annoying there is no default function that I know of that gets the vehicle category from a classname, like the editor does
How does editor understand the object category actually?
I don't know, probably engine based./
it's a variable in the class
I have scanned through the config, and couldn't see anything that stood out.
Might have some luck finding answer in #arma3_config
hmm
however, that will also include all custom categories
hmm, this might work for me slightly better, thanks π
but if you just want to get a list of all cars, tanks, planes, etc. it would make more sense to use BIS_fnc_objectType, because that will check the vehicle itself through its simulation type
Yeah, i needed it via classname though, not object. unfortunatly.
_myType = "B_MRAP_01_F" call BIS_fnc_objectType;
see example of BIKI page
isKindOf even works for both (objects and string)
just because it has the word "object" in it doesn't mean it only accepts objects... it usually means it returns the object (as a string)
lega_fnc_pShop_sortVehicles =
{
params [
["_vehicle_array", [], [[]]]
]
private _sorted_array = [];
_vehicle_array apply
{
if (_x params [
["_classname", "", [""]],
["_id", -1, [0]]
]) then
{
private _vehicle_type = _x call BIS_fnc_objectType;
private _type_index = _sorted_array findIf {(_x select 0) isEqualTo _vehicle_type};
if !(_type_index isEqualTo -1) then
{
((_sorted_array select _type_index) select 1) pushBack _x;
} else
{
((_sorted_array select _type_index) select 1) pushBack _x;
_sorted_array pushBack [_vehicle_type, [_x]];
};
};
};
_sorted_array;
};
``` something like that should be a bit better then.
private _sorted_array = [
[
["vehicleclassname", databaseid],
["vehicleclassname", databaseid],
["vehicleclassname", databaseid] .....
]
] call lega_fnc_pShop_sortVehicles;
why not store the vehicle type in a custom list or even database? makes it way easier to control
Hi all, I am trying to start a script when a player connects via mission eventhandler player connected. How would I properly reference the connected player (and pass this on into the script, so a script can recognize his position on the map?
the params are: "params ["_id", "_uid", "_name", "_jip", "_owner", "_idstr"];"
well... if I'm correct that triggers before someone is actually in-game, so it's not attached to an unit
hm oh ok
i tried to waituntil the player spawned in with: waituntil {lifeState _player != "DEAD-RESPAWN"};
it would make more sense to use an init or respawn event handler which has the entity available, which should be a player
_player stands for ID, UID Name, tried a couple
but yeah it seems that MEH is the wrong way
you could always set a variable to the mission namespace and the moment someone gets in-game retrieve that value and put it on the player
although all those params can also be retrieved at a later stage, so a bit useless (unless you want to prevent someone from getting in-game)
I think i ll completely change the approach
i am spawning in loot based on a players position Y. once the player moved X away from Y, old loot is deleted and new loot at new position Y is spawned
old position Y and the previously affected lootarea gets an area marker as blacklist - so no new loot will spawn there for a while, and if 2 players are nearby, this should avoid too much loot spawn at the same place.
i execute this script on the client only
but the array of "blacklist" areas where no loot should spawn was ofc not available to other clients
i think i ll just add this blacklist area array as public variable
so all clients feed their blacklist areas into the same public variable
and access the same for blacklist area checks
why not handle it by the server?
If a player enters an area, spawn loot at n points.
If more players get in the area, ignore spawn (unless last spawn was n minutes ago).
If no player is in area, and loot has been there for n minutes, remove loot.
and each area has a maximum amount of points which may contain loot
i wanted to let the server handle it indeed
thats why i looked into the mission eventhandler player connected
in order to start that lootspawn loop for every player
but the spawning of loot should be relative to the players position, and be continuously spawning
so if i manage to start the script from the server for all players, the blacklist marker issue is solved, as the blacklist array is created on the server and only the server needs to read it
most loot systems work by having a marker at the loot locations (eg. city) and the moment a player gets close to it, it will spawn in stuff
that's why on the old DayZ mod the server would sometimes lag when you entered one of those areas π
sure thats one approach of course
in the larger context of my project that would not be an ideal solution however
that's something I can't decide π
hence my approach to base the loot economy on player position. so the mod (the project) can be used on any terrain
anyway - got two ways to approach it and will give it some more thought;)
thanks for the feedback!
you're welcome, that's what this discord is about
can someone point me in the direction of how to loop through all CfgVehicles to spawn 1 of every sides infantry? ive......got.....an.....idea
is the idea worth the time explaining the thingy for you π
{
_x createVehicle [0, (5*_forEachIndex)];
} foreach ((configfile >> "cfgvehicles") select { _x isKindOf "Man"});
something like this (not tested)
@exotic flax thx ill start with that.
The idea is, im tired of having to figure out what things are and are not for what side because arma doesn't provide a full proof way for each uniform, gun, helmet, etc. It would be great if we/I had a scrip that placed every unit for each side, then looped through their load out for primary, rpg, uniform, helmet, what ever else an spit out an array for me. i can do all of that easy except knowing how to spawn 1 of every type of MAN for just one side. Then ill post it and we can all use it everytime they release some DLC. unless someone was kind enough to do this already.
yeah duh, do you want to read each one. no thanks quick script and run go get a cupa and array is waiting for your when your done. copy paste to your framework and now you know what stuff belongs to each side.
and even the classnames will say which side it belongs to (B = Bluefor, O = Optfor and I = Independent)
for uniforms?
yup
U_B_CombatUniform_mcam
of course, there are also items which are not tied to a side...
so you want to write a script after writing down all the diff variances in armas naming conventions. na mate this is simpler.
huh? how is it simpler to A) read the wiki and B) read the classname
not to mention... in scripts it's even easier... just use side
or better; get into the editor and it's already separated by side
you options require tons of time, the point of the script is you write it once and share. just hope on single player run it your done.
like gear is not side specific, so you won't be able to retrieve that anyway
i need a complete list of side for every item with out knowing how arma does everything. they are all right there on the units.
excatly mate. but we all know there are hats and helmets we dont want to some players wearing in the AO.
nvm all good it got it
and uniforms and backpack only have side specific ones due to the items inside
Iam stupid and can't figure this out, maybe someone here can solve this problem or give me a tip π΅
Problem starts at line 87.
https://pastebin.com/QXqmcUF5
how do i get the sea-level for a position returned by BIS_fnc_findSafePos so i can teleport a player that is in the ocean to the ground level with out dying. this is way harder than i thought it would be.
ATLtoASL
@sharp grotto is there a [upgradeObject] in your sql_custom file ?
whats your rpt show
and your extDB logs?
also obviously to differentiate between the 2 when you set _IsExileOnly = false; is there a [upgradeObject_Wood] in your sql_custom file ?
@random crescent
here is my code. if they are in the water, they die when brought back to land.
private _safeloc = [_markerpos, 1, 10, 2, 0, 0, 0] call BIS_fnc_findSafePos;
_player setpos _safeloc;
funny. vanilla ?
@winter rose huh?
Vanilla = base game, no mods @exotic tinsel
do you know how to help me? how do i get the z for a x,y pos? so they dont teleport in to the ground.
The code you provided works as intended.
private _markerpos = (getMarkerPos "myMarker");
private _safeloc = [_markerpos, 1, 10, 2, 0, 0, 0] call BIS_fnc_findSafePos;
player setpos _safeloc;
yes, but when i execute it on a player who is in the water they die when sent back to land. how do i prevent that?
You can disable player damage when you do. As I said, I am executing it without dying here.
what if you allowDamage false: then setpos then allowDamage true;?
oh just wrote that then it showed me stickies msg
Also @exotic tinsel Lou asked if you're playing vanilla, because mods can influence this.
From now on, whenever people ask if you're playing vanilla, you can safely assume this is why.
Once you know the term Vanilla, it's crystal clear @exotic tinsel.
Strange behaviour from the game then, I have never had that
well because of the sarcasm and some times hostility in the channel here against noobs, its hard to know if i was being called vanilla, @winter rose we have talked about this, i know you understand.
and your message was "funny. vannilla?" so sometimes hard to tell when im just being made fun of here.
im tabbing out of channel to go debug this.
No sarcasm intended, also I have hostility against noobs (a.k.a people not knowing what they do but "knowing more than you"), but I welcome and help newbies, be sure of that.
None of us meant this in a bad way, you'll get to know the souls that do and don't after a while.
(β¦being called "vanilla" is a sexual insult at most π)
i was executing this script from the server. sending it to the client to be executed made it work with out death.
dont know why but its fixed
Noice
Hey what is the Command to find the AI piloting a helicopter?
@proud carbon driver
Pilot = driver Heli?
yes
Thanks man π
Didn't know you could call a human "vanilla" learn something new every day.
as long as you do not mean "serve the human with vanilla" you should be fine i guess π€·
vanilla humans then also are probably humans without modification π€
without tatoos for example
as that would be a retexture mod π
I am then physically vanilla, no bodymod, no tatoo, no jewels, just some natural tan π
you vanilla!
So which of those meanings do you mean
boring π
Which I am extremely, or not at all π
depends on how much you love these dad jokes
I'm trying to have a soldier in the back of a medical HEMTT for scenery purposes. The problem: this soldier will not stop dismounting the vehicle as soon as the mission starts. I've set up setUnloadInCombat (not that the vehicle is in combat anyway), and the soldier has its AI disabled, and the vehicle is locked. Are there any other commands I'm missing that could help?
and the soldier has its AI disabled
Already done. Still dismounts on mission start.
The vehicle is already set to Locked in the editor.
_unit disableAI "FSM";
_unit setBehaviour "CARELESS";
and perhaps this topic can help: https://forums.bohemia.net/forums/topic/180920-prevent-ai-cargo-from-leaving-vehicle/
disableAI is already set to "ALL" which should include FSM. The unit is already set to Careless.
I'm working on trying createAgent right now. Luckily I can read things people have already written.
the unit is clearly receiving the disableAI, as it stops animating as soon as it finishes getting out of the vehicle
and, you know, disableAI is literally the only thing in the unit's init field so I'm not sure what issues there could possibly be
Creating an agent and moving it into the cargo works.
I've got a question regarding the HandleDamage EH - the wiki page states that, with HandleDamage,
Only the return value of the last added "HandleDamage" EH is considered.
so if I understand this correctly, if I add two EHs onto a unit, only the return value of the second EH will matter? meaning I can return any damage value I want in the first EH, and it wouldn't matter?
yes.
see, now I'm a little concerned - the theory (being that the last EH overrides all) doesn't seem to apply when put into practice in my test
I have a unit that I'm adding a simple HandleDamage EH onto, which always returns 0 (which should make the unit invincible)
however, the ID returned for the EH is 1, meaning there is already one other EH present on the unit before mine - which shouldn't be a problem, since the last EH should be the one that matters
unfortunately this isn't the case; my unit still takes damage
if, however, I run _unit removeAllEventHandlers "HandleDamage"; prior to adding my EH, the unit becomes invincible...
worth noting, I am using the dev branch (v1.97.146056)
does anyone know what could be causing this?
hm... turns out ACE3 was somehow responsible for it
HandleDamage works fine without it
ACE should add a handleDamage EH after yours
not before
EH id being 1, doesn't mean there are no EH's after yours
and ACE always returns 0 because it has its own damage handling
thing is, I'm adding my EH ~1 second after spawning the unit to give other mods/scripts a chance to add their own EHs first, thus hopefully making mine last
and the other weird thing is, if I clear all HandleDamge EHs immediately before adding mine (so still ~1 second after spawning the unit), my EH works properly, implying that the issue was something added before my EH
I'm not sure what to make of this though
I use the following in the init of an unit:
[_unit] spawn {
params ["_unit"];
// wait for ACE to set the EH's
sleep 1;
// disable "all" HandleDamage event handlers (required to bypass ACE)
_unit removeAllEventHandlers "HandleDamage";
_unit setVariable ["ace_medical_HandleDamageEHID", nil];
// add custom HandleDamage event
};
yeah that's basically what I just tested with ACE, and that did the trick
the other solution is not using ACE, but that's an even worse approach (because I want to use the mod)
however what I want to know is why ACE's HandleDamage EH is behaving in such an odd way... I mean it's essentially ignoring the usual EH rules, in that it bypasses custom EHs that were added afterwards
can anything be done to fix that?
it's not ignoring it, it simply doesn't output any damage
and all damage is handled by the ACE injury system
then why can't I add an EH onto the unit after ACE and return a custom damage value there? shouldn't that override ACE's HandleDamage EH, or am I missing something?
ACE's EH adds damage to it's own injury system, and then returns 0 for the next EH (or engine)
so any modifications after ACE are useless since damage is already set
oh, by "after" I mean having my EH added after ACE added its EH, which in turn should mean (still going off the wiki description) that my EH, being the last, is the one that dictates the returned damage - instead of any EH before mine
but ACE doesn't use the vanilla damage system
aha, now that is what I was thinking
The HandleDamage EH is inherently broken, which is why it behaves weirdly in ACE.
I thought they cascaded, that would make more sense for mod compatibility (imo)
but even then... if ACE medical gets in play the amount of damage doesn't matter anymore... because you're already wounded
Them cascading is probably a bug. Some other EH's don't do that
I'll need to do some proper testing, because I'm fairly convinced the modified damage that one EH returns isn't the same damage that another EH will receive
HandleDamage should return the (modified) damage so it can cascade
to me it seems like currently every EH gets the original damage value, which would explain why ACE bypasses my EH
yeah, "should" is the word here π
ACE simply ignores it because it uses its own damage system; so no matter what you do, you will always have ACE wounds unless you reduce/remove damage before ACE EH triggers
that's precisely what I was trying to achieve
If code provided returns a numeric value, this value will overwrite the default damage of given selection after processing. Return value of 0 will make the unit invulnerable if damage is not scripted in other ways (i.e using setDamage and/or setHit for additional damage handling). If no value is returned, the default damage processing will be done. This allows for safe stacking of this event handler. Only the return value of the last added "HandleDamage" EH is considered.
I'll give it another test and if it turns out to be bugged, then I guess I'm just shit out of luck
what I'm gathering from the wiki is:
EH 0 EH 1 EH 2
(added first) (added last)
>>----------->>----------->>----------->>----------->> order in which EHs were added
HOWEVER:
<<-----------<<-----------<<-----------<<-----------<< order in which EHs execute```
and by that logic, if EH2 sets the damage to any specific value - let's say 0 - then it would make sense for EH1 and EH0 to receive the modified value (in this case, 0) rather than the original damage value
but again, I'm only speculating here, I still haven't tested this
okay, yeah, it appears to pass the original damage on to the next EH rather than the modified one... this sucks
then the EH script doesn't return a value
I don't think that's the issue, since my EH runs first
it's the fact that stacked EHs don't pass the modified damage value to one another, even when returning a value
kinda seems like a poor design choice to me
what I'm gathering from the wiki is:
nah, shouldn't.
its a for loop. from 0 to array length
Alright, once again I have found a speed bump: The unit insignia (patch) on the left arm disappears after respawning the second time. It works fine on the first respawn but after that there's no insignia again.
I admit I don't know. Vanilla ?
No, I'll test that right now though.
Using only CBA and ACE I can replicate the issues.
Same with pure vanilla.
I suppose it might be worth mentioning that the only way I was able to keep the insignia after respawn was by having the same insignia with two different class names.
This is both my initPlayerLocal.sqf and onPlayerRespawn.sqf:
if (groupId (group player) == "Alpha 1-1") then {[player, "AQ"] call BIS_fnc_setUnitInsignia};```
`AQ` is from description.ext.
I admit I don't know. Vanilla ?
Not even been 12 hours since your last insult, you monster @winter rose
I live however I want!! π
When using moveTo on a spawned agent, is it normal for the unit to just charge away towards the north? (Both spawned and issuing moveTo on the server)
(Ambient life, disabled the default AI)
Tried to setDir on the unit, noticed that it's running forward, not just to the north.
How to change the value inside of array? like
_array = ["one","two"];
(_array select 1) = "zero";
_array
```;
I want to make "two" become "zero";
thanks
Anyone got any ideas on how to make a unit insignia permanent, i.e. stay after respawn?
use the respawn EH ?
respawn EH or onPlayerRespawn.sqf I'd say
It turned out I was experiencing a ArmA moment where I have to use both Respawn EH and onPlayerRespawn.sqf but with different class names in those files. (I have a mod with the insignias and also have them defined in description.ext)
does anyone know how to save byte with sqf to file
Only through addons
Well, you can save those through diag_log
but only to the .rpt file
I dont think that is possible
unless you fill it with loots of lines
or if you mean like just the edges then that can be drawn with lines
you just have to calculate each point and linve between them
Right yeah, I could do a bunch of lines intersecting to represent a plane
You can create a map control with everything hidden (ShackTacs HUD uses that for example) and draw a polygon on there.
when are mission placed triggers first executed/evaluated in regards to mission init.sqf?
ref: https://community.bistudio.com/wiki/Initialization_Order
I guess created in "Expressions of Eden Editor scenario attributes are called" and initialized in "Modules are initialized", so before initServer.sqf
unless you place them with scripts, then it should be direct (after a single frame)
and does undefined trigger conditions break now/in 1.96?
I'd say module initialization too. But you'd really need to test that I'd say
Why would they?
undefined var in trigger should be same as before
my last test of that mission was a year ago
there is a tank group linked to the first WP with a GV as true condition (aka to move on)
the GV is only set via init.sqf and spawn in another script
it appears the trigger breaks/wont get activated once the GV turns true later in the mission
is it set to false in init.sqf?
not yet. thats why i am asking
First time it checks and there is an error because it is not defined, it won't retry after
Is it a publicVariable?
!issuewarning @cobalt charm crossposting
Done.
@winter rose no error, SP
From experience I would say the trigger fires 0.5s after mission start
as it turned out, its not an init order issue, but only one of the four AI tanks of the group starts to move π¬
anyone know a good way to know what weapon the pilot from a vehicle is using
weaponState and currentWeapon wont work sometimes
wont work sometimes
What do you mean?
for example if i'm plane it works just ok
but if i'm in a dual seat helicopter it only works if there is a gunner
weaponTurret or other *Turret command @tough abyss
*weaponsTurret
You could probably use assignedVehicleRole to get the turret path of your unit but it may need to be run on the server.
oki doki will try thatr
Is there any easy way to fill all of the cargo seats of a heli that's airborne?
what do you mean "fill" them?
Put units in every seat
Sure, iterate all cargo seats, createUnit, moveInCargo, etc...
https://community.bistudio.com/wiki/fullCrew would be a place to start
How do I depending on a player's UID assign an object texture? Currently my code looks like this:
_uidPltCO = getPlayerUID Platoon_CO;
if (playerUID == _uidPltCO) then {player setObjectTexture [3,"Patches\OEF-CP_Karlsson_2LT.paa"]};```
`playerUID`was just a shot in the dark and doesn't actually exist.
I was looking for some advice about MP. I currently have this as a simple distance check, and works ok in SP (I accept it is probably not best practice..):
someBoolCheck = false;
while {true} do {
_posAthira = getMarkerPos "AthiraMilBase";
_metersAthira = player distance _posAthira;
if ((_metersAthira <500) && (!someBoolCheck)) then {
hint "you are roughly 500m away";
// some other code
someBoolCheck = true;
};
sleep 20;
};
If I wanted to run this in a true MP setting, how would I apply this check to all players?
Would I add a link to this script via initPlayerLocal?
how do I make this right?
waitUntil {sleep 3; player getVariable ["scoreBLUE", 0] > 99 or player getVariable ["scoreRED", 0] >99};
I can see it's clearly the or that's wrong but why?
{sleep 3; ((player getVariable ["scoreBLUE", 0] )> 99) or ((player getVariable ["scoreRED", 0]) >99)};
maybe?
@tough abyss , yeah that's totally it, thanks!
winCOND=[]spawn{waitUntil{sleep 3; ((player getVariable ["scoreBLUE", 0] )> 99) or ((player getVariable ["scoreRED", 0]) >99)}; systemChat format ["%1", player getVariable ["scoreBLUE", 0]];};
any way to detect if you have blackscreen from cutRsc and family?
{_x assignAsCargo t34_1;} forEach units group this; {[_x] orderGetIn true;} forEach units group this;"
AI wont get in if you as player (GL/effective commander?) are in said vehicle - this used to work BI π
@wraith cloud Thanks! Works perfectly!
_wp4 = (group _Pilot) addwaypoint [getPosATL _LZnew, 0];
_wp4 setWaypointType "UNLOAD";
_wp4 setWaypointStatements ["true", "_HeliS land 'LAND';"];```
for some reason my Heli wont land on the USS freedom. the code above is what used to work in a previous script. could someone assist please?
In Arma II how did people remotely execute code like we do now with BIS_fnc_MP and remoteExec?
So, say I want to have a specific player with the variable name "engineer" and I wanted said player to climb a radio tower where a trigger is at. How would I make it to where when the Engineer is standing in the trigger, he gets a hold user action to repair it (which just activates a trigger progressing the mission.), but if the engineer leaves the trigger area he loses the prompt?
addAction, removeAction
hi there - is there a way to use setVelocity on units that are dead or unconscious? (i think it's basically just that ragdoll is on)? I'd like to script units being blown out of a bunker, but I can only apply setVelocity once the uit has fallen to the ground
Hum, no it should work - maybe put them slightly above ground level @burnt cobalt
(continued from #arma3_config)
@velvet merlin I'm not sure how useful this will be to you, but my code for getting vehicles unstuck is:
// If the vehicle has been stuck reversing at <3km/h for a while, give it a forward boost
if (_speed < _stuckSpeed and {_speed > -_stuckSpeed}) then {
if (_time - _lastMoveTime > _delayUntilStuck and {isTouchingGround _veh}) then {
_lastMoveTime = _time;
_unstuckSpeed = [10, -10] select (_unstuckSpeed > 0);
_forceMul = getMass _veh / 100;
_centerOfMass = getCenterOfMass _veh;
for "_i" from 5 to 20 do {
_speed = speed _veh;
_veh addForce [_dirVeh vectorMultiply ((_unstuckSpeed - _speed) * _forceMul * _i), _centerOfMass];
sleep 0.02;
};
};
} else {
_lastMoveTime = _time;
};```
*(edit: fixed the indentation)*
with
private _delayUntilStuck = 2; // in seconds - how long a vehicle may be stuck in reverse before we give it a push
private _stuckSpeed = 3; // in km/h - if the vehicles moves slower than this speed, we consider it as "stuck"
ngl, it's quite ugly, and the numbers are rather imperical (they're the result of lots of trial and error, so not much logic behind them), but it works
the comment at the top isn't 100% accurate either anymore, since it will either apply forward or backwards force (it alternates between the two)
@half inlet thanks! why addForce instead of setVelocity? also why the 15 repetitions - needs to create enough sustained force?
and do you run this scheduled/unscheduled and per vehicle, or one global loop?
-
addForcebecausesetVelocitywould allow a kart to push a tank out of its way π -
15 repetitions because, from my testing, that seemed like a high enough amount to get the vehicle going, but not too much so as to impede the AI in its driving/steering routine
-
the script runs in scheduled environment (as otherwise
sleepwouldn't work) and is "attached" to the vehicle
also, the reason for the seemingly random loop indexes is because I use _i as a force multiplier inside the loop, to act as a linear buildup for the force's strength
think of it as a function in the form y = ax + b
@half inlet the main design question is how to check the state for all vehicles continuously
people here usually recommend unscheduled and one loop for all vehicle (rather per vehicle) - once necessary you can still spawn a "thread" for the addForce
little optimization idea:
- _forceMul and _centerOfMass one could also cache per (vehicle) type
- one only needs to update the _lastTime once it gets too slow, and only once its in this state, one needs to reset if again above the threshold
oh, for sure, this snippet of code is still just a draft in its current stage, one that I'm going to revisit in the future (once I fixed some of the more important issues)
it's also part of a bigger script that handles the vehicle's driving using setDriveOnPath, and it needs to run frequently (about 3 times per second) to do its job properly, so I decided to do it in a scheduled environment
I'm not expecting to have more than a dozen vehicles using this script at any given time (on average it's more like 3 to 4 vehicles), so performance wise it's not a big concern (yet π )
is there a way to spawn a Module from a menu in Eden tools? create3denentity or some such?
oh, was easier than I thought: e = create3DENEntity ["Logic", "uns_ModuleCarpet", getPos player];
how do I get the pos for the current center view of the player in Eden?
screenToWorld [0.5, 0.5] was just a quick google away, sorry for the noise
is there any check i can do to see if there is music playing? im trying to make it so there is tense music playing when player group is safe/aware behaviour, and combat music when they go to combat behaviour, and when the behaviours revert, the tense music starts playing again
question on updating a setVariable'd variable in a module in Eden - how do I get the UI of the module to show the new value of the variable. The following code works in debug console, but the module still shows the old variable value for bomb in the UI: sqf e = create3DENEntity ["Logic", "uns_ModuleCarpet", screenToWorld [0.5, 0.5]]; systemChat str (allVariables e); systemChat str (e getVariable "bomb"); e setVariable ["bomb", "flip"]; systemChat str (e getVariable "bomb");
e.g. the last systemChat prints flip, with the UI showing uns_bomblauncher_dl, the default
probably the setVariable is the wrong approach for persisting a change in the module in eden?
decided to put this on the forum: https://forums.bohemia.net/forums/topic/226173-configuring-a-module-in-eden/
Anybody know if there is a way to switch
who can access a uav terminal
I want my Indie guys to be able to access the VLS thru the terminal
but seems to be hard find
yes, in a way.
that helps
do you think this would
unit enableUAVConnectability [uav,true];
would UAV in that case be the name of the UAV
Okay thanks
I think i got it
unit enableUAVConnectability [uav,true];
would be "this enableUAVConnectability [VLSU,true];
nvm
didnt work
I donno cant figure it out
unit enableUAVConnectability [uav,true];
where would I put that
one which unit
on
the vls or the guy
or in like initserver
Welp
well if anybody knows how to make UAVs controlled by any faction let me now
nvm I did it
This is the code I used ran thru an addaction sqf
player remoteControl gunner UAV1;
gunner UAV1 switchCamera "Internal";
and now my prob is I wont lock onto indie lasers
but they are the enemy
ill find another way around it
I could just make a remote designator accessible with the VLS
from nato
cant you just make the VLS indep?
not as far as I know
try deleting the blufor VLS crew and putting in indep drone crew
through code?
what is the code or what could I call the little loading animation
you know the circle
for force respawn and in some campaign missions
whats that called if I wanna find the code for it
not sure I can just grab a drone crew in the editor
or delete it
on a vehicle you can hover over the guys symbol and delete
but no such thing on a uav
Is there much difference performance wise between sending data via: addPublicVariableEventHandler and remoteExec'ing?
It's unlikely/unknown, but doing so with remoteExec is always better in terms of functionality
Unless it's some trivial data which is read-only on client
Although... if you are just doing remoteExecCall which will only setVariable somewhere inside, well, it's a few more SQF commands
Is there an equivalent to https://community.bistudio.com/wiki/screenToWorld but gives it in absolute 3d space instead of restricting it to the terrain?
@tiny wadi Just use AGLToASL on its output
Or do you mean that it has problems above water?
Well the command returns 0 for elevation regardless of where you click is the main problem
I want similar function to how the Eden editor can still place an object in space even if you donβt click on the terrain
get view direction from eyes, and just use math to get position in whatever distance you want
cameraViewDirection, eyePos, vectorMultiply
Land_Pallet_F ?
https://community.bistudio.com/wiki/BIS_fnc_getVehicleCustomization
How to use this information to instal customization in another vehicle
does it matter where I execute missionNamespace setvariable [foobar];
i.e. do I explicitly need to execute that on the clients and the server in my script or is a variable in missionNamespace automatically updated across all machines?
@marsh storm the command has local effect; if you create a mission variable, you can broadcast it with publicVariable
@winter rose thanks!
any exemple on copy and paste customizations to another vehicle?
wat
I have a Angara that has a black texture with camo net and nother that has has default configuration, I want to copy the customization of the black Angara and pass to the default Angara, how to do it?
maybe from the Eden edit menu, Ctrl+C / Ctrl+V? IDK
in game?
ye
this is how im doing now
{
{
_VehicleLoadout = [_x,""] call BIS_fnc_exportVehicle;
_x setVariable ["Loadout",_VehicleLoadout];
[_x] call RTG_fnc_VehicleSafeSpawn;
Private _code = {
_Loadout = ((_this select 0) getVariable "Loadout");
(_this select 0) call compile _Loadout;
_VehicleLoadout = [(_this select 0),""] call BIS_fnc_exportVehicle;
(_this select 0) setVariable ["Loadout",_VehicleLoadout];
[(_this select 0),(_this select 1)] call RTG_fnc_VehicleSafeSpawn;
};
Private _value = _x getVariable "bis_fnc_modulerespawnvehicle_data";
_value set [3,_code];
_x setVariable ["bis_fnc_modulerespawnvehicle_data",_value];
} foreach (synchronizedObjects _x);
} foreach (allMissionObjects "ModuleRespawnVehicle_F");
It works, but I was said that call compile is evil and bad, so I would like other alternative.
its does not uses the same array as BIS_fnc_getVehicleCustomization
then IDK
if you have a loadout script as text, then you need to call compile to execute it
Sometimes there is no alternative
This may sound like a stupid question but... If I have a file with lots of functions, for example:
Function1 = {
//Do stuff
};
Function2 = {
//Do stuff
};
Function3 = {
//Do stuff
};```
How do I 'load' that file, do I need to compile it or anything or is including it into the cfg functions enough?
If you wanna do it the right way: https://community.bistudio.com/wiki/Arma_3_Functions_Library#Adding_a_Function