#arma3_scripting
1 messages Β· Page 609 of 1
you might be chasing a rainbow
so you have journal data, where is that data? Server or client?
(client, as in a connecting client)
(server, as in the host, with interface or not)
and does this need to run in MP or SP environment?
@astral dawn what is the purpose?
I have described it above in my message which describes the in-game notepad with notes (it's like... an GUI edit box). Notes are added by in-game events, and such events might happen quite often, so I can't save client's notepad data on each such event.
are you sure you want to do that?
If client is self-hosting or plays in SP it's only way π€·
also, im not sure of these note's validity, but there is a note there Variables are also saved when the game is quit.
but why do you need to save so much data?
this fights against all reason
12MB of text is MASSIVE
no, 12MB is not text of the note
it's size of profilenamespace (vars.arma3profile file), because it also stores save game data (state of the game world)
what are you saving then?
what are you saving then?
state of the game world
no, it's a GTA-like save game thing
a what now?
like... like they do in Antistasi or Overthrow
yes. But when you do saveProfileNamespace it saves whole profileNamespace.
yes?
It also saves it on quit
and you shouldn't save mission variables into profile namespace
https://community.bistudio.com/wiki/saveGame
IIRC standard saving is not really functional on dedicated server
what?
Don't remember much though
ok, so this is ONLY dedicated server?
No, I never said that my mission is only for dedicated server... it can be run on DS, self-host, or in SP
do what?
do all three at once?
it's done π€·
because all three of them are basically completely different beasts
almost same π
i wish
not much difference really. Only respawn is not working in SP
and loaded when the profile is loaded
what youre doing sounds really weird and destructive, but i guess that's what arma modding is about
Question for anyone that is familiar with ACE arsenal. Is there a global variable that tracks what unit is currently being modified in an ACE arsenal?
just keep an eye on those variables, might piss off some people with massive file-sizes
@tame lion player
XD
but you can also open up an arsenal on a remote unit through their scripting
i see
that's a different thing which you didnt mention, probably
open up their script and see?
something like a current_arsenal_unit or to that affect
just keep an eye on those variables, might piss off some people with massive file-sizes
I made an extension for file i/o for this case π€· But I still want to support saving to profileNamespace.
And save game data isn't so huge really. BI's format to binarize things adds very much wasted space.
have you tried ace discord?
hmm for what exactly?
speaking to crown
don't recall that name unfortunately, but what should I talk to them about?
ohh is wiki down... right now π¦
i was talking to crownmedic, not you
sorry π
ace_arsenal_center
they have Slack
i dont know, these days everyone has a discord or something
@astral dawn - Have you tried https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/addMissionEventHandler#Ended?
Failing that, how about hooking the 'onDestroy' event of one of the UI elements?
Maybe something like that will work.
(Just speculating, can't test right now :( )
No I haven't. Nica has found that profileNamespace should work on closing the game though. Which seems to be the case for editor at least.
Ah, yeah, that should do it as long as it's not a crash. Could also offer the player an explicit save option, so they can choose to lag while profile namespace saves if they want.
(Also - 12MB is a pretty sizeable vars file!)
12MB per save, we had to limit it to 4 saves per profile
Hey guys. I want players to respawn with their loadout they built during briefing and I am trying to use the following script. However when i try and test it on mp (hosting local to test) it doesnt work, any answer?
initPlayerLocal.sqf
[missionNamespace, "arsenalClosed", {
player setVariable ["Saved_Loadout",getUnitLoadout player];
hint "Selected gear saved!"
}] call BIS_fnc_addScriptedEventHandler;
player addEventHandler ["Respawn",{
0 = [_this select 0] spawn {
params [["_player",objNull,[objNull]]];
waitUntil {sleep .2; alive _player};
_player setUnitLoadout (_player getVariable ["Saved_Loadout",[]]);
};
Because dead player and respawned player isn't equal so Saved_Loadout after the respawn contains nothing
Ok and thanks Polpox, so being a scripting idiot how do I fix? Do I need to define player UID?
(love your mods by the way for screenshots! And excited by the new wounded animations mod)
I think just declaring as global variable, which won't shared with other players?
And excited by the new wounded animations mod
Uh?
How do I do that?
Just dosqf Saved_Loadout = getUnitLoadout player;?
So just add that at the top of the script?
What?
player setVariable ["Saved_Loadout",getUnitLoadout player];```Instead of this, and replace this one too```sqf
_player setUnitLoadout (_player getVariable ["Saved_Loadout",[]]);```, you know how it goes
Ah ok think I got it thanks will try
I made MP mission, dead players becomes spectators.
How to finish the mission for spectators after the end of the game?
I use this on a trigger in activation:
["Spectators_red_win",true,true] remoteExec ["BIS_fnc_endMission", civilian];
And this in desctiption:
class CfgDebriefing { class Spectators_red_win { title = "MISSION COMPLETED"; subtitle = ""; description = "BLUFOR LOST"; }; };
What's wrong?
@warm hedge This doesnt work, again assume i am beinf stupid
["InitializePlayer", [player]] call BIS_fnc_dynamicGroups;
player execVM "Scripts\fn_ratings.sqf";
[missionNamespace, "arsenalClosed", {
Saved_Loadout = getUnitLoadout player;
hint "Selected gear saved!"
}] call BIS_fnc_addScriptedEventHandler;
player addEventHandler ["Respawn",{
0 = [_this select 0] spawn {
params [["_player",objNull,[objNull]]];
waitUntil {sleep .2; alive _player};
Saved_Loadout = getUnitLoadout player;
};
}];
Why you redefine it after respawning?
I am merely copying and pasting a script i found on BI that is meant to allow the fixing of loadouts. I am not a scripting wiz at all.
[missionNamespace, "arsenalClosed", {
Saved_Loadout = getUnitLoadout player;
hint "Selected gear saved!"
}] call BIS_fnc_addScriptedEventHandler;
player addEventHandler ["Respawn",{
0 = (_this select 0) spawn {
waitUntil {sleep .2; alive _this};
_this setUnitLoadout Saved_Loadout;
};
}];```Will do, not tested
@ebon citrus Didn't see your message until now because you @pinged someone else
thanks for the link, I will have a look at it π
I get undefined variable in saved loadout error
Did you closed Arsenal ever?
yes i close the arsenal
Because dead player and respawned player isn't equal so
Saved_Loadoutafter the respawn contains nothing
it does contain the same value corpse had
yes i close the arsenal
did the hint pop up at all?
@astral dawn
Is there a client-side event handler which runs on client and is triggered when client disconnects from server or goes back to game menu in a SP mission?
CBA, displayClosed EH on main mission display.
Or... just do it like DayZ, redirect the "Abort" button in the pause menu.
I am looking to color some VR cubes to my liking. However the standard wiki merthod
_block setObjectMaterialGlobal [0, "\a3\data_f\default.rvmat"];
_block setObjectTextureGlobal [0, "#(rgb,8,8,3)color(1,0,0,1)"];
only colors one side of the cube. Any tips on how to do a complete repaint of all six sides?
1st parameter in the array is the selection index
Thats what I thought as well but its not the case, or at least changing the selection does not solve the issue
Nvm forgot to change the rvmat for each selection, problem solved
Fixed it thanks @warm hedge
@copper raven thanks also I was using ACe arsenal hence my fatal flaw!
Is it possible to force retract a jet's gear in the 3Ditor? I am trying to make pictures of the jets loadouts by turning them upside down and opening all the bomb bays etc. and it just looks odd when the gear is down (or rather up in this case but you know, outside the vehicle)...
@vague geode spawn it in the air at altitude
@digital hollow But then it's moving meaning it is very hard to get a usable scrennshot. I am trying to take those pictures to use them in a loadout selection. I know that you can open and close all the bays with the animateBay-command but I don't know how to make the jet retract the gear. It does't have to work automatic in any way, shape or form (I also use the animateBay-command in the console by hand). As I said I am only trying to take pictures of the loadout in the VR environment/map.
Use the Splendid CameraTM to actually take the picture, it can freeze time by default
Hi, is there any way to simulate the load of a human player connected to the server? I want to measure performance for a mission of 70-90 players.
Fps?
how would i go about limiting the amount of kits active on CfgRespawnInventory?
edit: I'm a dumb dumb, take a look at BIS_fnc_addRespawnInventory for anyone else wondering
@short sparrow no
There are too many variables to take into account to simulate
It would be cool if BI would make a profiling client for servers that just does some lightweight stuff without running the hevay logic and interface
Oh you meant simulate, i thought measure lol
is it possible to do a raycast detecting ground in arma?
lineIntersects should be able to do that
Im new to SQF and need to apply a HandleDamage EH to all vehicles on an MP server. What should I look into for this?
remoteExec, addEventhandler, setVariable (?)
@spark turret why the setvariable?
Just remoteExec is fine
And ofcourse, addevenhandler
Is there a way to get a loadout from a unit and then use that data to add the loadout to a crate?
@tribal trellis https://community.bistudio.com/wiki/everyContainer
And then iterate through the containers and add the items into the box
You can also use getunitloadout and iterate through it and add items
But i dont get why you would want to do this
I was thinking using getUnitLoadout and then the array returned from that, adding that into a crate
It's for a quartermaster system I'm messing around with
You cant add it directly, no
It takes a loadout from a unit (so I can dynamically edit the loadouts, if I need to)
Rather than hard-coded loadouts
But what is your goal?
To set a loadout to a player?
One you can edit?
Just getunitloadout and setunitloadout
You can use the return from getunitloadout to set the loadout of another unit
Yeah I know that much, that's what I had before
But why does it need to be in a box?
Dont get me wrong, feel free to do it
I just mean that yiu might be going further than the ocean to fish
I'm just messing around with stuff, it doesn't necessarily need to be but trying out different methods
Or at least thinking of different methods
does anyone knows the difference between enableFatigue and enableStamina?
https://community.bistudio.com/wiki/Arma_3_Stamina @sacred turret
does the EH created with addPublicVariableEventHandler fire in single player?
i did, that's why i asked here.
https://community.bistudio.com/wiki/addPublicVariableEventHandler
specifically these π
but if i missed it, and you would be so kind to help me with where you found the info, that would help me
ah i see, so i did miss it
thanks for your help π
so messing around with the OPTRE corvette at around 10km in the air when I place my units inside and the games starts, the game goes WOH you are mad high, better make you act like you are freefalling
might have to make a teleporter instead
@fair drum The game acts weird if you spawn units in air (not on the ground) so youre better off having your stuff on the ground and then teleport it to the corvette
trying to use #include correctly in my description.ext so far I have:
#include "\config\CfgRoles.hpp"
I get an error that it cannot be found though the files are located in that path. and the folder containing config is the mission root folder
I also tried:
#include "config\CfgRoles.hpp"
and
#include "..\config\CfgRoles.hpp"
I figured out the problem, had issues with the file to be copied when it meets with the other file
another question regarding ACE Arsenal. I think I've stumbled across a bug possibly when creating a limited arsenal. Here is the concept: I'm allowing my players to start with a very limited arsenal, and over time they will be able to purchase upgrades for this arsenal to add more items. The scripting seems to work, however I am getting one problem with the arsenal interface. The compatible mags tab is not populating all mags that are compatible with the currently selected weapons like normal. Another issue is that all the grenades and explosives are showing up in the all mags tab. Magazines are still compatible if taken from this tab, so it's not a config issue.
did you add the allowed list by hand or did you use the script that ace provides to copy all the loadouts of every unit placed
I added it by hand
I'm trying a new method now that doesn't involve using ace_arsenal_fnc_addVirtualItems. Instead I am just using ace_arsenal_fnc_removeBox and then ace_arsenal_fnc_initBox using CBA_fnc_execNextFrame to add it back on the next frame. This will only happen whenever the players upgrade their arsenal
Ah well then I'm not too familiar with ace arsenal scripting. All I know is that the one time I tried to do a limited arsenal with the loadout finding script provided, it didn't add everything I needed.
well that didn't work, so now I'm gonna try this bit of coding.
[_arsenal_box, true, true] call ace_arsenal_fnc_removeVirtualItems;
[_arsenal_box, _array_to_add, true] call ace_arsenal_fnc_addVirtualItems;```
you can't go wrong with removing everything then adding the new thing back
you would think lol
you could be right on the bug issue. sometimes it misses stuff
I know I've made something similar work before in the past. I made a series of scripts that allowed players to have a "favorites" arsenal that only contained items they have favorited in it, allowing them to not have to sort through a ton of other items. That worked and allowed for compatible mags, so IDK why this isn't working the same way.
Anyone know if onPlayerRespawn.sqf is fired AFTER the spawn location is selected? Need to see how much scripting I have to do as far as finding a squad leader and spawning on his location in a drop pod. If it fires after, that would be nice as I can just make the squad leader a spawn point.
taken from description.ext on wiki:
respawnOnStart
Respawn player when he joins the game. Available only for INSTANT and BASE respawn types.
respawnOnStart = -1; // Default: 0
-1 - Dont respawn on start. Don't run respawn script on start.
0 - Dont respawn on start. Run respawn script on start.
1 - Respawn on start. Run respawn script on start.```
that might answer your question?
oh i gotcha now that I looked at it, lol
well there is one way you could test:
place a simple systemChat in the file and see when it pops up, before or after
mk after a few more failures, i'm still trying to figure out how to create a vehicle 10000 meters above a player... so far I have
"vehicle" createVehicle (getposATL player)
but I'm not sure how to add 10000 to the z axis on the corresponding [x,y,z]
I think I might have created the worst way possible of doing this:
private _podStart = [
(getPosASL player) select 0,
(getPosASL player) select 1,
((getPosASL player) select 2) + 10000
]
anyone got a more efficient way lol
i see now. guess that only works with arrays of 3 values. what if i had a 6 number array and want to add to the 5th number easily?
array set [index, value]
@fair drum false, it works with vectors with 2 or 3 elements
where can find a list like ["face_hub","neck","head","pelvis","spine1","spine2","spine3","body","arms","hands","legs","body"] but for vehicles?
which command will allow me to check the helmet slot?
headgear
@copper needle https://community.bistudio.com/wiki/selectionNames
Thanks Nica
Would anyone happen to know what causes vehicles to explode?
like the names of what have to take a certain amount of damage
depends if you have ace cookoff/ammo racking
typically its just hull damage
but with acecookoff you can have hull, ammo, and sometimes fuel damage
anyone know what the weapon "throw" and "put" is? I see it show up in various scripts
it's when you throw or put something, like throw a grenade, put a mine
Why would I list that in my CfgRespawnInventory?
@fair drum leave it out and see what happens
I already did and notice nothing. I'm still able to throw and place stuff with all the grenades and stuff in the inventory. Was just wondering why the generator script for cfgrespawninventory adds it to everything.
is a decent BI function to disable a center screen info message? like when an important character has died to information the player about it
What is the selection name of the hull on a vehicle? In the config it says it is "palivo" but the same is said for the HitFuel
@copper needle for what purpose?
Testing to see if the Hit selection is equal to the hull
There is no universal selection naming
BI vanilla stuff is quite consistent
But modded things can be anything
I am staying vanilla
Usually there is a hitHull hit point if I recall correctly
Ive tried that and it just doesn't seem like the correct name
It identifies the hull with that when using setHitPointDamage but not when finding if the place hit is equal to the hit selection
but HitHull does not detect the right thing
Would you happen to know where the hull is on an offroad?
What do you mean?
I need to be able to shoot at the hull to test the selection name so I need to figure out where the hull is. Does that help?
What is firegeometry? Sorry Im very new to this
Take a look here
You can get the selection aimed at far easier
Viewgeometry is usually complex
Simulating physics for this complex geometry is not always wise
So the firegeometry is like a more simplified version of the viewgeometry that is used for bullet collisions and such
Is there no easier way to find out what the selection name of the hull is? Is it not listed somewhere?
It's in the firegeometry LOD

Did you not read what i said
@copper needle https://community.bistudio.com/wiki/selectionNames
Here
I dont understand what youre trying to do
Maybe that would help
Would you care to explain?
"hit_engine","hit_fuel","hit_hull" seem to be the hull selections for the firegeometry
Sorry Im not trying to be rude I'm just confused. My goal is to detect when the hull is shot so that a HandleDamage EH can make sure that the hull does not go about 0.89 to avoid it exploding
Excluding wheels, glass etc.
Ill try all that thank you!
Hitengine going to red doesnt make it blow up
Hitfuel and hithull can
If i remember correctly
But those are not the health points @copper needle
You want to use this @copper needle
Why not just check if the engine hitpoints drop
?
Or hull
Trough the command i provided above
Honestly, i'm on my phone right now, so i cant do examples
Im just saying, the way i would do this
I think I understand what you mean. Let me give it a go
Jesus Christ. Well take care. I really appreciate the help!
Using getHitPointDamage got it to work perfectly thank you!
How would I add a HandleDamage EH to any vehicle that gets created in a multiplayer mission?
CBA XEH
If youre going to mod it, you might aswell add it to the init of a vehicle baseclass
Just make sure to add checks for when it should be triggered
Otherwise you might have it trigger in the main menu

I have a question. I'm still learning all the syntax and stuff (I'm used to C#) and I saw that for a method to return a value there's no explicit return statement.
I noticed that if I try to return inside a foreach loop it actually does not break out the loop nor the method itself, and it keeps on iterating.
Is there a way to explicitly return?
The last statement of a function returns the value
If you want to do a loop personally I'd save the value you want to return in a variable and then after the loop just do _myVar
So I'm forced to initialize the return variable at the beginning and modify it accordingly during the execution?
yeah exactly okay hahah
Yeah iirc
Inside your loop you can do if (myBreakoutCondition) exitWith { _returnVar = ... }
I don't know if for loops can return directly
apparently if statements can, so you are able to do things like _myVar = if () then { 1 } else { 2 }
@humble harbor (and somewhat @tame portal) to return a value from inside a loop, use https://community.bistudio.com/wiki/breakOut alt syntax
private _fnc =
{
scopename "myScope";
for "_i" from 0 to 1000 do
{
false breakOut "myScope"; // Break out of the context named "myScope", returning false
systemChat str _i; // is ignored as we broke out above
};
true
};
systemChat "Result:";
systemChat str ([] call _fnc);```
apparently if statements can, so you are able to do things like _myVar = if () then { 1 } else { 2 }
@tame portal
Wow that's odd
Okay thank you allππΌ @tame portal @queen cargo
@queen cargo I just wish there was a return statement
#define RETURN(VAL) (VAL) breakOut "function"
fnc_my_func = { scopeName "function";
// ...
RET(5);
};
there ya go
as alternative, use some SQF-replacement language
Nou made one
i did too
and some other guy i forgot the name of and possibly plenty others too
well atleast enscript has it natively
although enscript is also making some weird decisions about what's ok and what's not lol
hello everyone. i broke my mind, how can i kick players from lobby without starting mission using sqf? EventHandlers as OnPlayerConnect not working in lobby connections. and i cant get list of lobby players using allPlayers or #userlist? i need this for whitelist check.
and how to kick client with message using only server side code?
@narrow furnace Is this what you are looking for? onUserConnected
https://community.bistudio.com/wiki/server.cfg#Arma_server_only
https://community.bistudio.com/wiki/ArmA:_Server_Side_Scripting
onPlayerConnected is a mission event handler and is an event that works upon loading a mission, hence it cannot work on lobby connection.
Now I don't know how servers handle things but I would say that this section will most likely help you achieve what you are trying. Especially onUserConnected event.
Could someone link me to how WaitUntil has changes, as I'm using some 2013 code about ballistic tracers, and the WaitUntil is returning nil?
could be the code is broken some other way
@narrow furnace Is this what you are looking for? onUserConnected
https://community.bistudio.com/wiki/server.cfg#Arma_server_only
https://community.bistudio.com/wiki/ArmA:_Server_Side_Scripting
@crude vigil Looks like exactly what i need. i'll thy this. thx
could be the code is broken some other way
@young current of course, but I heard something aboutWaitUntilchanging that broke the normal way, or used way, ofWaitUntil.
Indeed, what page is this?
Thank you.
I've noticed that sometimes when a player dies, he gets ejected from the group and doesn't get put back in on respawn. What's the exact rules for this?
@fair drum Scripted or one of respawn templates?
More likely to find an answer on #arma3_editor or #arma3_scenario possibly.
Is there a command or a function to put every object created with createVehicle on the ground like the 3DEN Editor already does?
Might need to rephrase your question. Are you looking to place every single vehicle possible or what. createVehicle should already place things on the ground if you give it a [x,y] position and leave out the z
Car SetposAtl getPos x,y,0
Heya all, I am looking for a script that let's me define what loadout each player spawns with.
Let's say I have a .sqf file with the loadout, and I want to use it on a player (unit) with a variable name p1.
Any advice or links that could be of use?
setUnitLoadout
if you put that into the onPlayerRespawn.sqf it will reequip all respawning players.
or you can just call it from anywhere to reequip whenever you want
Thank you 
alternatively, look up cfgRespawnInventories and cfgRoles
Hey all. In the following code i receive a "generic error in expression" ```sqf
addMissionEventHandler ["EntityKilled",
{
params ["_killed", "_killer", "_instigator"];
if (isNull _instigator) then {_instigator = UAVControl vehicle _killer select 0}; // UAV/UGV player operated road kill
if (isNull _instigator) then {_instigator = _killer}; // player driven vehicle road kill
if (side _instigator == west && side _killed == Civilian) then
format ["Killed By %1", name _instigator] remoteExec ["hint"];
spawn FNC_record_civilian_death;
}];
game says first line, but not sure why
@spark rose what is this? spawn FNC_record_civilian_death;
also, your error is here: if (side _instigator == west && side _killed == Civilian) then format ["Killed By %1", name _instigator] remoteExec ["hint"];
you need closing brackets
and opening ones
can just have an if-then
largely overthought function to track civilian deaths using a global variable
if you dont want to pass anything, use [] spawn
okay roger
yeah the function just adds a +1 to a variable count so no need to pass
i may re-write to make it less clunky in the future
i borrowed it from someone else before i had any idea what i was doing
only marginally better now π
_trg setTriggerStatements ["this", 'hint "Waves starting..."; for "_i" from 1 to _attackTime do {sleep (_attackInterval * 60); _group = [getMarkerPos "enemySpawn", resistance, 10] call BIS_fnc_spawnGroup; _waypoint = _group addWaypoint [getMarkerPos "enemyTo", -1]; _waypoint setWaypointType "lambs_danger_rush";', ""];
where am I going wrong with this statement
The enemies don't end up spawning
No errors either
_attackTime = 5;
_attackInterval = 1;
I have some code before this which spawns an "initial group". That works fine.
hint "Waves starting..." runs but the rest doesn't seem to...
(unrelated)
I'm confused. Shouldn't a bullet fire a "Deleted" event on impact since it got null?
ahh I see
Yeah but at some point they have to, I checked and the event never gets fired
well, it doesnt get deleted then, does it
It becomes null but does not fire the event? :/
i know what youre trying to do
give me a moment, im digging up the BI-way of doing it
BI checks on each frame if the round is Null
with BIS_fnc_addStackedEventHandler
I made them global but it still didn't work
@tough abyss
i'd recommend using missionnamespace, though
instead of stacked event handler
missioneventhandler
sorry
@slate cypress show the code
if (_this select 1 == officer) then {
hint "Attack starting...";
attackTime = 5;
attackInterval = 1;
_initialGroup = [getMarkerPos "enemySpawn", resistance, 10] call BIS_fnc_spawnGroup;
_initialWaypoint = _initialGroup addWaypoint [getMarkerPos "enemyTo", -1];
_initialWaypoint setWaypointType "MOVE";
_trg = createTrigger ["EmptyDetector", getMarkerPos "enemyTo"];
_trg setTriggerArea [250, 250, 0, false, -1];
_trg setTriggerActivation ["ANYPLAYER", "PRESENT", false];
_trg setTriggerStatements ["this", 'hint "Waves starting..."; for "_i" from 1 to _attackTime do {sleep (_attackInterval * 60); _group = [getMarkerPos "enemySpawn", resistance, 10] call BIS_fnc_spawnGroup; _waypoint = _group addWaypoint [getMarkerPos "enemyTo", -1]; _waypoint setWaypointType "lambs_danger_rush";', ""];
}
else
{
hint "You do not have permission to use this command!";
}
that is the full contents of the sqf
it is called using addAction
what...
??
The initial group is and moving to waypoint
The consecutive groups aren't..
hint "Waves starting..." runs though
So the trigger is defo being activated
Why did attackTime become _attackTime in statement, same for other variable...
oh forgot to change that sigh
if you are going to use _myVariable, you need to define them first in that scope
π
yay arma crashed so i cant test it now
gotta restart
well actually, it didn't crash but i'm just mostly frozen
Mine is seen above :(
On my screen mine is above 
I ll give you the place , u added extra info, more worthy! 
Strange, I thought discord sorts it same for all
Ouch. I just realized this ```sqf
if (side _killer == (side player) && side _killed == Civilian) then
returns a civilian kill whenever you kill anyone
π¦
a dead unit is civilian indeed
Any way to stop secondary explosions on vehicles?
Ive tried using setDamage and making the useEffects false but it still causing the secondary explosion
@winter rose that makes me sad
@copper needle afaik does vanilla Arma not have secondary explosions, only ACE. No idea how to disable that, but I believe it is possible.
Yeah I think it's the ace cookoff thing
Im in vanilla Arma 3. When I _unit setDamage [1, false]; it destroys the vehicle and no initial explosion/fire is created. But after about 15-20 seconds an explosion goes off. Im attempting to prevent that explosion
Also to removeEventHandler I need to get the index of the event handler I am removing. How do I get that?
https://community.bistudio.com/wiki/addEventHandler --> _thisEventHandler if you will remove in the code of the event.
Can anyone provide/point me towards examples of uisleep?
@copper needle https://community.bistudio.com/wiki/uiSleep has an example and description
@humble harbor are you looking for scripts or configs? Because config stuff can be asked in #arma3_config although it's most likely a memory point in the model and some config stuff for how far it can rotate etc.
@exotic flax my bad
thanks @exotic flax
Is there a semicolon missing in if (_hullDamage > 0.9) then {_unit setDamage [1, false];}?
So like _noExplode = if (_hullDamage > 0.9) then {_unit setDamage [1, false];}; _delV = if (_tDamage == 1) then {uiSleep 10; deleteVehicle _unit;};
?
Was originally going to use it but no longer needed. They have been changed to just if statements
if (_tDamage == 1) then {uiSleep 10; deleteVehicle _unit;}; In this line Im trying to get the script to wait 10 seconds and then delete a vehicle. Am I using uiSleep correctly?
At the moment Im getting "Error Generic Error in Expression"
you need to execute it in a scheduled environment (spawn/execvm)
I dont understand what that means. Could you provide an example?
if (_tDamage == 1) then {_unit spawn {uiSleep 10; deleteVehicle _this};};
or you would spawn the function that snippet is from so it would wait for the unit to delete before proceeding.
That worked perfectly. Thank you!
@copper needle read it. You will need it:
https://community.bistudio.com/wiki/Scheduler
unknown direction
it always has a specific direction, or vector dir and up at least
setPos the object in the direction that it's facing
do you mean moving it 'forward' where it is facing even if it's facint up-east for instance?
I guess that's what you mean yeah
Check 'worldtomodel' and 'modeltoworld' commands on wiki
Also for your case you need to use setPosWorld instead of setPos
Im trying to use the "Eject" action to eject the whole crew of a vehicle, but in unit action ["eject", vehicle] I don't know how to set the whole crew as the unit. Any ideas?
use forEach
Works perfectly thank you!
Can I use format on the title parameter of an addAction in order to insert a wildcard?
What exactly you wanted to do? You can use format to addAction's text though
switch (VARIABLE) do {
case (west): {
_export = 1;
};
case ("west"): {
_export = 1;
};
case (east): {
_export = 0;
};
case ("east"): {
_export = 0;
};
};
I tried using or as case ((east) or ("east")) : { but its been a while since i've done scripting so perhaps i'm missing a fundamental here.
Wanting to combine it to make my file shorter
call {
if (VARIABLE isEqualTo west or VARIABLE isEqualTo "west") exitWith {
_export = 1;
};
if (VARIABLE isEqualTo east or VARIABLE isEqualTo "east") exitWith {
_export = 0;
};
};```?
@warm hedge I want to use a text substitution wildcard (%1) as part of a system that has random generation aspects. If format can be used, then I'm all good.
works the same yes
I have a question about (multiplayer) scripting
I'm +- new to arma 3 scripting so idk how to solve that problem.
So my problem is: We are going to launch our server on the 14th, but I need to make some ingame 'powerpoints'/slideshows on screens. It's really confusing for me what I actually have to put in init as code... Globaltexture or just texture, when I test the server in editor, singleplayer then it says: image.something not found
have the images in 1024 x 512 (or 2048 x 1024 etc), convert to paa via a3tools. Ensure they work in game. Use setObjectTextureGlobal and depending on the object you're setting, a billboard for example is 0 for the main area, you'll need the correct hiddenselection id. you can then use an addAction on an obj and then either use an .sqf file to add each one or just add each side as an addAction
so i.e
laptop has this addAction ["slide 1", {billboard setObjectTextureGlobal [0, "mySlideImage1.paa"}];
So the players who join musn't have the images in their files to see it?
No
The mission file is enough
its the path that matters
all scripts presume mission path unless an addon path is given.
so mymission.altis, if I have an image in the base (next to the mission.sqm) then I can call upon it ingame just as myimage.paa. If I place it into a folder call img so it becomes mymission.altis >> imgs I'd need to do img\myimage.paa
ok, so is it better to put the actual codes ingame (the laptop etc) or an .sqf file (I just can't work with it :/ )
ok
Up to you tbh, depends if you care if your inits look "clean"
all scripts presume mission path unless an addon path is given.
It doesn't make any difference in this specific example because it's correct for setObjectTexture, but there are some commands that have to be told the mission file path
'but there are some commands that have to be told the mission file path', ...? such as
playSound3D is the one that comes to mind. There's a couple.
None of them are ones you're using in this case though.
okay I thought mandatory
you can always use getMissionPath
But if you look at the wiki examples on a command you're using it will usually show you, you wont be the first person to encounter a path problem
How can even assure if it's working or not, will it execute noramllly if I test in multiplayer in editor?
just remember don't use that C:/blah because thats different on every client
k
put it on your server
test from your perspective
if you see it its working
the multiplayer editor button makes you a client and server, so you see everything
ok I hope it'll work otherwise cya inabit
π gl
Thnx
so
mymission.altis, if I have an image in the base (next to themission.sqm) then I can call upon it ingame just asmyimage.paa. If I place it into a folder call img so it becomesmymission.altis >> imgsI'd need to doimg\myimage.paa
@brave jungle wait one last thing π ... My scenario is an MPMission
that doesn't involve anything right
yeah thats fine
the client downloads the mission file
when it says receiving mission file
k
Hello everyone. Could someone give me an idea how to handle players that are connecting to a lobby? Unfortunately both onPlayerConnected and its stackable version don't work in the lobby and on a brifieng and also I can't get a list of players by using the allPlayers command in the lobby
@ancient wasp
https://discordapp.com/channels/105462288051380224/105462984087728128/739879496647311452
[Link includes a previous answer of mine to same question in this channel.]
@ancient wasp
https://discordapp.com/channels/105462288051380224/105462984087728128/739879496647311452
[Link includes a previous answer of mine to same question in this channel.]
@crude vigil Thank you for your reply. Yes I know this event onUserConnected but seems like it doesn't allow to use any user-defined scripts. When I try to use my function it complains about missing semicolons or something. Seems like it allows to use either kick or ban and that's it
What are you trying to do?
I need to call a custom script before I will decide to let a player join or not. A whitelist implementation specific for our server only
You cannot do that afaik, that events are not run in such environment where scripting commands work. I doubt you would be able to achieve what you want in lobby.
Are there any ways around? I have just seen this implementation on another server, but I'm unable to ask them how they did it
whats the recommend approach for dead bodies and weaponholders in SP in regards to performance?
just disable simulation when player is not close (ie 50m) or is removal still better?
@ancient wasp Youd need to implement such checks via RCON
thank you! I go to google
@ancient wasp Youd need to implement such checks via RCON
@tame portal Can I use this system in combination with my DLL for example? I just can't find out
I'm wondering if there is another way to switch rifle's weapon mode other than
player forceWeaponFire [(primaryWeapon player), "FullAuto"]
No
Thanks!
No
@warm hedge yes
https://community.bistudio.com/wiki/Arma_3_Actions#SwitchMagazine
i dont recommend it... but you can use it for example in mission init
W-woah, didn't knew that workaround
SwitchWeapon is a bit better for that
wow it gets me every time how inconsistent Bohemia is at naming things
QUESTION. Hello everyone. Is it possible to create a marker as a ring? (Circle with a hole) Thank you.
Does anyone know where I can find the memory points for the Greyhawk's TGP?
@jovial steeple what is tgp
The camera/designator thing.
@jovial steeple "laserstart" is the gunner camera position, "commanderview" is the gunner camera direction
@jovial steeple those names are gonna differ for every other drone because bohemia cannot name things properly
Thanks guys, will look through these. Im trying to attachTo somthing to it.
@jovial steeple thingToAttach attachTo [drone, [0,0,0], "laserstart"]
so I'm trying to get my scripts to be more efficient, rewrote my teleporter script. any way to get _landing variable into the code scope that is in the addaction?
params ["_teleporter","_landing"];
_teleporter addAction [
"Teleport to " + str _landing,
{
params ["_target","_caller"];
_caller setposASL getposASL _landing;
}
];
@fair drum hey there, in the documentation here https://community.bistudio.com/wiki/addAction you can see that there is a parameter called arguments that you can pass it in using. You can then access it using _this select 3 inside your action script
ah so in total it would be params [_"target","caller","_teleporter,"_landing"]
well actually, (_this select 3) select 1
You could do it in the params as you put there! If you were to do that though you would have to do it like this
params ["_target", "_caller", "_actionID", "_landing"]
Another thing, personally on the "Teleport to " + str _landing, line I would use the https://community.bistudio.com/wiki/format command
But I doubt in that case there are any significant differences to the two, I am just used to the C world of printf and python's format strings
Hey!
I'm getting this error
0:15:42 Warning Message: Sound A3\Sounds_F\sfx\alarm_independent.wss not found
0:15:42 Warning Message: Sound A3\Sounds_F\sfx\alarm_independent.wss not found
But I checked both https://community.bistudio.com/wiki/Arma_3:_SoundFiles and https://community.bistudio.com/wiki/playSound3D and it's still listed as a valid sound there. I've also validated my game files through Steam.
Even checked my own cfgSounds
name = "Alarm - Independent";
sound[] = {"A3\Sounds_F\sfx\alarm_independent",1,1};
titles[] = {};
Try a3/sounds_f_sfx/alarm_Independent.wss.
Ty, I'll try that
Nope, didn't work
0:57:23 Warning Message: Sound a3/sounds_f_sfx/alarm_Independent.wss not found
0:57:23 Warning Message: Sound a3/sounds_f_sfx/alarm_Independent.wss not found
0:53:16 Warning Message: Sound a3\sounds_f_sfx\alarm_Independent.wss not found
0:53:16 Warning Message: Sound a3\sounds_f_sfx\alarm_Independent.wss not found
0:48:06 Warning Message: Sound A3\Sounds_F\sfx\alarm_Independent.wss not found
0:48:06 Warning Message: Sound A3\Sounds_F\sfx\alarm_Independent.wss not found
0:43:56 Warning Message: Sound A3\Sounds_F_sfx\alarm_independent.wss not found
0:43:56 Warning Message: Sound A3\Sounds_F_sfx\alarm_independent.wss not found
0:15:42 Warning Message: Sound A3\Sounds_F\sfx\alarm_independent.wss not found
0:15:42 Warning Message: Sound A3\Sounds_F\sfx\alarm_independent.wss not found
Tested these so far
Weird thing is, when I test this in the editor:
playSound3D ["A3\Sounds_F\sfx\alarm_independent.wss", player]; // alarm
It works
[_target,"A3\Sounds_F\sfx\alarm_independent.wss",50,1] remoteExecCall ["life_fnc_say3D",RCLIENT];
params [
["_object",objNull,[objNull]],
["_sound","",[""]],
["_distance",100,[0]],
["_pitch",1,[0]]
];
if (isNull _object || {_sound isEqualTo ""}) exitWith {};
if (_distance < 0) then {_distance = 100};
_object say3D [_sound,_distance,_pitch];
Yeah, now I tried it with say3D and it's like no, not found
player say3D ["A3\Sounds_F\sfx\alarm_independent.wss",50,1];
This doesn't work
According to BIKI, say3D needs a classname not a file.
Does the game logic entity works with remoteExec?
Even checked my own cfgSounds
name = "Alarm - Independent"; sound[] = {"A3\Sounds_F\sfx\alarm_independent",1,1}; titles[] = {};
@solar shore Why not use this?
Yeah did something like that in my description.ext now
class storealarm {
name = "storealarm";
sound[] = {"A3\Sounds_F\sfx\alarm_independent.wss", 1.0, 1};
titles[] = {};
}
Ah nvm
player say3D ["Alarm_Independent",50,1];
Would work as well
Ty!
Don't even need to add it to my description.ext
@sacred turret What do you mean?
I want to add this action for everyone
player addAction ["Arsenal", {["Open", true] call BIS_fnc_arsenal}, {}, 0, false, true, "", "true", -1];
Preferably via game logic remote exec, is that possible?
Does game logic remote exec mean you want to place down a Game Logic in 3DEN and put that code into its init field?
Or are you using mods that extend the Game Logic to include some remote execution?
the first one, sorry for the answer delay
@sacred turret Answered in #arma3_editor, not sure if you noticed.
Is there any way to cache the map markers (or to load it by request before the map load)? We have serious problems with game hanging on map zoom, while drawing map markers. Moving the whole game folder to SSD helps a lot, but doesn't eliminate the problem.
Not that I know of.
Out of interest, how many map markers do you have?
But that's not that many...
@unreal scroll where's the lag?
im looking at this video and im not seeing the problem
How do you suppose I'll show how the whole game hangs? π
by recording it?
Hm... Can't imagine how it would help you. You just zoom the map, and it hangs.
If you don't zoom the map, and wait 20-30 s (other OT modders says they need to stare at the sea) - then it works well.
You see the map zoom at this video? Then just stop the video and imagine it hangs π This is how it looks like exactly.
but it doesnt
it looks EXACTLY like that?
but it hangs
so it doesnt happen to everyone?
Absolutely. The game stops to work. It is no more. Crashed. The ex-game.
"so it doesnt happen to everyone?"
Yes, all OT mods.
"any scripts?"
???
"what is OT?"
Overthrow
Mods as in modification or moderator?
Rephrase please.
Modifications
so whenever someone is running OT, they get this issue where the game crashes on map zoom?
Right
How long did you played it? I mean overall time?
about 10 seconds
π
That bug is a bug. It doesn't make the whole mod unplayable. It happens very often on game start, when you open the map. For HDD ~ 30-50%, for SSD for about 5-7%. Maybe it depends on campaign progress (more time = more markers).
Thanks, but I didn't ask where to report about it. I'm working on it, and I need to fix it.
Even if you would seen it, then you would need to dig into the map script.
And if the original mod authors and I wasn't able to fix it, then it is not so simple. But who knows...
tbf... showing a video where the issue isn't visible isn't a great bug report...
And I doubt it's Arma specific, just a bad script in a mission or mod...
it's not immediately obvious
Although adding a lot of map markers with scripts (especially those with onEachFrame) are FPS killers, so that is probably the issue here as well
"showing a video where the issue isn't visible"
As I said, you'll get nothing from such video, no any specific info. It would looks like the usual zoom in/zoom out, then it hangs. Never on the map draw, but only on markers draw.
Also there are no onEachFrame scripts.
https://github.com/ArmaOverthrow/Overthrow/blob/dev/addons/overthrow_main/functions/player/fn_mapSystem.sqf
https://github.com/ArmaOverthrow/Overthrow/blob/dev/addons/overthrow_main/functions/player/fn_mapHandler.sqf
If there is no such option like map caching, I wonder if there any way to optimize it...
@unreal scroll addMissionEventHandler ["Draw3D", { is just as terrible as onEachFrame since it also runs on every frame...
same as CBA_fnc_addPerFrameHandler
What could you recommend?
"same as CBA_fnc_addPerFrameHandler"
It can be run not only in every frame, btw. Any time interval.
I have some code which creates an area trigger in a given location. It then spawns enemies when the players activate that trigger once. The problem I am having is you can either have the trigger local to the player or global so everyone has a trigger on their machine. The problem with global is that enemies will be spawned several times... The problem with local is that enemies will only be spawned if that specific player activated the trigger (which they may not). Does anyone have a workaround?
CBA_fnc_addPerFrameHandler has an argument to set an interval (default 0), which will help a lot.
Although less dynamic markers will be the only real solution
"The problem with global is that enemies will be spawned several times..."
Use remoteexec/remoteexeccall, and run it on a server only.
Hi,
I am just dipping my toe into the scripting scene for ARMA and am trying to figure out what is going wrong with our script. The basic idea with it is to allow a Zeus to "hide" a player by double clicking on them, setting them to captive:
https://pastebin.com/aWeFaQ1Y
We are getting the following error and are having a hard time solving it. We want it to work on a multiplayer server:
https://pastebin.com/zxLDSe0e
@velvet moss you use double quotes within double quotes
this fixes the errors:
this addEventHandler [
"CuratorObjectDoubleClicked",
"_player = _this select 1; if(isPlayer (_player)) then {if(captive (_player)) then { [_player,false] remoteExec ['setCaptive']} else { [_player,true] remoteExec ['setCaptive']}}"
];
Oh man... I'm gonna be super embarrassed lol
@unreal scroll I could do that but it will be the same effect...
Every client will end up using remoteExec
The server will run it as many times as there are clients
Ah.... Then the simplest workaround: define some variable on first run, and check it.
I.e., from my own old scripts:
if (_leader getvariable ["OT_FOBdone",false]) exitWith {};
_leader setvariable ["OT_FOBdone",true,true];
(some code here)
If it is not tied with units/group, then use server setvariable
But it is always better to rewrite the script to make it launch only once.
Itβs a bit confusing. What is the idea behind doing that?
If the variable was sat, then the script doesn't run. Very simple.
MaxP couldnt reproduce
It all starts from addAction which a certain unit can use which will call an sqf file. In that sqf file, it will spawn an initial group of enemies which will move into a town. Once the players arrive at the town (any players since I donβt know exactly who), it will begin spawning waves
Oh so it is a debounce
and to answer your question, no, there is no "cache" for markers and i dont know what exactly that would even help and how
@slate cypress swap your SQF files and execVM's for functions
jsut a tip

execVM is good for one-maybe runs and testing
@ebon citrus As I said, thanks for helping.
@slate cypress "(any players since I donβt know exactly who)"
The better way: to execute the script via the action menu once, with remoteexec, then remove the action itself.
but as soon as you have 1 minute to make it a function, i.e. define it, you should
Mr. Grezvany13, thank you. That solved all the things.
Ah so
If I create the trigger on the server side local to the server, will this solve my issue
you can remove the action or leave it and use the hide-on-use
if you intend to run it more than once set a condition
Since then anyone can activate it, not just the person who used the action
if you dont, hideonuse
@slate cypress "If I create the trigger on the server side local to the server, will this solve my issue"
It is a good thing to create triggers ONLY on a server (except specific cases).
Makes sense π
unless you need them to be client side
Of course
Also regarding defining it as a function, is this better when executing it multiple times?
if a trigger needs to trigger visual or audio effects -> client side
everything else -> server side
@slate cypress yes, and more secure
Ok thanks for the tip π
execVM compiles and adds the script to the scheduler every time it is called
So itβs slower and itβs not always certain when it is run I guess
so not only does it need to recompile it, it also can be changed during runtime
which is... ok, for debugging
dirty debugging
but not so good if youre running an MP mission
functions are compiled once
yeah, functions you can also choose to either spawn or call
if you spawn them, you can add them to the scheduler
but by calling them, you can return values from the function
Yeah because iirc spawn is pretty much asynchronous
so as soon as you have time, i would recommend you take a look at the cfgFunctions
spawn adds the script to the scheduler
It doesnβt yield the current thread though right?
it returns the script handle
Yeah
So if the function yields and I use call, it will cause the thread to hang until the function has returned something?
Yeah
cant
well, can
but if the call is executed from unscheduled environment, then cant
youre aware of how the arma 3 scheduler works?
Iβm not too fond of it
Iβm not too fond of it
means I donβt know much about it
this is not interrogation, im just asking
ah, i see
you should
take a quick read through this article:
https://community.bistudio.com/wiki/Scheduler
it's arguably the most powerful tool in an arma 3 scripters arsenal
Thanks
Done
now you should know the difference between calls and spawns
Spawn puts the script into a scheduled environment. Call from a scheduled environment adds it to the scheduler whilst call from an unscheduled environment executes the script in one go without suspending
You also canβt sleep in an unscheduled environment but you can sleep in a scheduled environment
Sleep times arenβt guaranteed either due to the scheduler refreshing every frame so it depends on the local FPS
call from scheduled environment executes it immediately, not add it to the scheduler
it is still executed in scheduled environment, it just doesnt get added as a task
Oh
Are you able to sleep in that or no
but instead in sqf, you do [arguments] call function;
If in a scheduled environment
if it's called from scheduled environment, yes
think of them like boxes
unschedulked environment is one box
everything in it must be completed for every cycle
scheduled environment is like a box with multiple boxes in it
the scheduler will run as many boxes that it can and then repeat them if they werent finished
the scheduler prefers scripts which have been in the queue the longest when it runs
when you sleep in a scheduled script, the scheduler doesnt rerun the script again until the sleep is done
when the sleep is done, the scheduler continues from where it left off when it next time returns to that specific script
so a sleep doesnt pause the scheduler
it just makes the scheduler ignore running the script until the sleep has elapsed
the scheduler will continue to run other scripts
once a script is complete, it will get removed from the scheduler
I see
if youve ever used the threading module in python or similar programming languages, this will be easy to understand
the scheduler just switches attention between the different "threads"
http://sqf.ovh/ite/2018/01/21/ITE-the-scheduler.html
"call" doesn't add something to the scheduler, it just stays where it is
this is the type of information I AM looking for
thanks dedmen
call from scheduled environment executes it immediately, not add it to the scheduler
https://discordapp.com/channels/105462288051380224/105462984087728128/740400514671575040
interesting. so the difference between sqf and sqs is its length of the execution until suspended?
the difference between sqf and sqs is that sqs is deprecated
Is there any kinds of standard in allocating display idd? recently started making GUI and i've been wondering, does everyone just pick a number and hope it doesn't collide with other mods?
yeah something like this π¦
although I am not sure if you can do that, but if you can, create it with ID = -1 and store the handle in some uinamespace variable
that's best way for controls for sure, don't remember if displays can do that
it works for displays too. i'm using that method on a mod i'm working on
nice, so keep using it I guess
I've been thinking if mapping the addon prefix to a number would work
since we are already assuming prefixes are unique then mapping them one-to-one to integers would guarantee idds to be unique
it would require absolutely every single person creating displays to use this convention
which marker is the ellipse marker? not finding it in cfgMarkers
too little(few) people are using displays for it to be necessary
I want to return the clan tag of player, is there such a script command?
@eager pier i don't understand your algebra very well but wouldn't rotating the camera while it's moving cause conflicting positions? eg. moving left and turning right
also shouldn't camSetRelPos use relative position and not ASL?
Is there a way for a user to clear specific profileNamespace variables without a specific script? I've opened vars.Arma3Profile and it almost looks like a binarized file, not very easy for a common user to handle.
@eager pier Not sure what you mean by jitter, but if you're rounding numbers maybe it's causing the rotation not to be very smooth. (I didn't find any rounding in the script but just a heads up.) Also that uisleep I'm assuming is best solution, not sure what exactly is it purpose but could be causing undesirable delay. I'm aware sleeps is something very volatile in arma scripts.
Is there a way for a user to clear specific profileNamespace variables without a specific script? I've opened vars.Arma3Profile and it almost looks like a binarized file, not very easy for a common user to handle.
Yes it's binarized. Code to clear variables there is very simple though
Profilenamespace setVariable ["something", nil]
SaveProfileNamespace
Yeah that's the normal way. I guess there's no easy trick, since all variables are bunched together and not split by addon.
Some people are complaining my mod (which I haven't maintained in 2 years) isn't working properly. However I've tested and is working perfectly. I just need to get better feedback and do alternative troubleshooting. I'll suggest the person to create a temp profile with clear variables instead.
@eager pier Could it be that you re handling everything in 1 scope , maybe if you split positioning and direction handling in 2 different loops, that maybe fix your problem?
Apart from that, you are aware what you are trying to achieve is somewhat already available, right? Just wanted to notify in case you are not.
https://community.bistudio.com/wiki/camCommand with "manual on" parameter.
Although, I dont remember how exactly the controls of it are..
Is there a way to edit in-game (user-)actions from the action menu? For example change the condition for an action to appear in the action menu (e.g. the ramp of the Blackfish (Vehicle Transport) has to be open to unload all vehicles) or hide/remove them from the action menu completely to replace them with a custom one?
@vague geode Sadly no.
@crude vigil That is very unfortunate.
I would have liked to make the "Unload all vehicles"-action more realistic by either
only making it appear if the ramp is already open (I would have added an action for that like in the Blackfish (Infantry Transport)) or by
making the action open the ramp first, then ejecting the vehicle and closing the ramp again afterwards...
@vague geode we all have such dreams but sadly.... 
You could probably do something like that with a mod since you could overwrite the vanilla config. But that's a different channel and a much deeper issue.
Maybe I can suggest that change in a forum or the #game_design-channel although I don't know if that one is intended for such suggestions.
Making that change shouldn't be too hard since the code to open/close the ramp of a Blackfish for example is already there so if I am not mistaken it would be more or less just copy/pasting that code into the "action to be performed"-code of the vehicle transport variant...
@eager pier you use spawn
That runs in the scheduler
For scheduler related reasons, your code isnt running at 0.05s refresh rates
Prefer missionEventHandlers with eachFrame or draw3d
Those are ensured to run each frame
Unlike spawn
ALSO
Why in the name of lord are you readding the eventhandlers every cycle (my bad, you arent
But still
Move the code from the scheduler
Specificly, everything in the while-loop
Move it into an eachFrame missionEventHandler
Anyone got a script that checks if you are looking at a window?
@timid niche I think there's a function that get the object name of what you're aiming at, and I believe it works on terrain objects too, though windows might be tricky as they are part of a single entity.
https://community.bistudio.com/wiki/lineIntersectsWith probably using this, compare players current position with an offset one (10-15m) relative to player's direction
private _i = 0;
private _arr = [1, 2, 3];
_arr findIf
{
_i = _i + 1;
if (_i > 3) then { systemChat "Abort Endless Loop" };
_arr pushBack _x;
false
}```
could somebody check if this code outputs the "Abort Endless Loop" message?
The game crashes
same here
Error Max array size would be reached. Current size: 9999999, wanted size: 10000000.
well, game doesn't crash, just hangs for a minute and then spams "Abort Endless Loop"
Ah
Is it supposed that objectparent command works differently for clients and dedicated?
For on-foor units, on dedicated it always returns the unit itself, but null for client.
@eager pier Yes, it would require a change of structure. I do not know much about camCommand apart of its existence but since you are trying to recreate it, maybe you can work on top of it instead of creating it from 0 to match your needs. Just a thought, since I do not know what your purpose is.
I doubt spawn has anything to do with that issue. If it had been an issue, that problem wouldnt only occur solely when you both change position and direction but it would also occur individually(ie, when you change position only or direction only).
ohh ... crap ... sorry for that @warm hedge @exotic flax π
there used to be a throw in there but thought i should change that to systemChat to make result reading simpler ... forgot then that the throw should abort the loop
Which is faster, generally? < vs <=
neither?
Can I capture an Event when the player puts on NVGs, and also how to detect if player has NVGs switched on currently? player hmd returns the NVG classname regardless of whether they are on or not.
that's because hmd is just checking what's in the HMD inventory slot
https://community.bistudio.com/wiki/BIS_fnc_camera_getVisionMode seems like it might be what you need
oh, this is probably better https://community.bistudio.com/wiki/currentVisionMode
Thanks @hallow mortar. Now is there a way to intercept the "NVG on" event in a way similar to an Event Handler? I want to execute custom code when player puts on his NVGs.
I don't think there's anything for the event specifically. There are a few ways I can think of, though I wouldn't call them optimal:
-
run a regular loop to check the vision mode. Limitations: loop performance, possible lag between NVG activation and script execution, need to make sure it doesn't execute the code again after the first time it activates per NVG activation
-
write a UI Event Handler, onKeyDown, that checks the pressed key against the player's NVG actionKey and activates your script if it matches. Limitations: pain in the ass, may not account for all potential bindings
Yep, that's what I feared. Thanks for your help. I figured I can use onEachFrame as well, although it might be overkill.
That would activate when a player picks up NVGs, not when they activate them
I think I'll utilize onEachFrame, assuming it's clientside. I don't like it, but the custom code is very short and shouldn't affect performance much, if at all.
Hey everyone, I have a vehicle within Eden that has the Variable name "C7" When I try to hide this vehicle using either;
"this hideObject true;" in the init field
"C7 hideObject true;" from the in game execute field
They still both fail to hide the object whereas the wiki literally states: "Hide entity. Can be used on soldiers and vehicles, also on static objects. "
Source: https://community.bistudio.com/wiki/hideObject
SP or MP
the init field should work in either since it's executed on all clients
That being said, the editor attributes should have a visibility checkbox which I believe does work
Ill check that out after I've done the current test π
Show Model i see
now testing
As far as I can see, there isn't anything grammatically wrong with your implementation, so using the attributes checkbox is a workaround rather than a solution. I'd still like to get to the bottom of why yours didn't work but I'm not sure how
I suspected the type of vehicle, tested 2 vehicles since then so it may still be the case but I doubt it is
haha hide model doesnt work either
- MODs?
- Other scripts?
- What vehicle?
^ What mission?
Well, everything is custom so that's going to be a long list
Better to test in vanilla so you can make sure something's off on your environment
Something is off with variables, just tested deleteVehicle C7; and it didnt worked. i will continue testing and if i hit a brick wall ill go vanilla, see what happens there
Ugh, it is the caching script
Speaking of hideObject scripts, a while ago I discovered that this did not unhide the objects in question on dedi:
[obj_setup1,false] remoteExec ["hideObjectGlobal",2,true];```
(executed from the completion script of a holdAction)
Never figured out why and it's kept bothering me
Thanks for the tips guys π "Other scripts?" rang a bell and well, guess its time to look for a solution for that now
NikkoTJ just a wild guess but the unhide command has to be executed on the same machine as hide?
@spark turret hideObjectGlobal is a server-only command and is being executed on the server in both cases
to hide, by (if isServer) in init.sqf, and to unhide, by the target parameter of the remoteExec
Very interesting
Did unhide get overwritten by a JIP maybe?
You unhide, jip comes and runs init again hiding it?
No. The if isServer in init.sqf means that code is only run when the server runs init.sqf, which only happens once because the server cannot JIP. Also, I verified with someone who was watching at the time that the object never became visible at all.
This is a dumb question but... How do I get an object inside a script if it was placed in the eden editor with a variable name? I know there is vehicleVarName but that just returns a string. I want the object so I can give it an addAction. Many thanks!
Not exactly sure if I'm following. You have an object with the name object1 and you want to add a action to just that one? Or do you want to add action to every class type that this object is?
I simply want to addAction that specific vehicle but I want the object to be accessible via its variable name.
Ghosthawk - helo1
Inside sqf
//_helo1 = fetch ghosthawk here
_helo1 addAction["Whatever", {}];
helo1, no underscore
To be honest... That does make sense now that I engage my brain π Thank you!
private _arr = [];
private _cases = {
case 1: {_arr pushBack "inside 1"; "a"};
_arr pushBack "past case 1";
case 2: {_arr pushBack "inside 2"; "b"};
_arr pushBack "past case 2";
case 3: {_arr pushBack "inside 3"; "c"};
_arr pushBack "past case 3";
default {_arr pushBack "inside default"; "default"};
_arr pushBack "past default";
};
private _res = switch 2 do {
[] call {
[] call _cases;
_arr pushBack "past cases inner"
};
_arr pushBack "past cases call outter";
};
_arr pushBack _res;
systemChat str _arr```
result?
@timid niche https://community.bistudio.com/wiki/intersect
Anyone got a script that checks if you are looking at a window?
has anyone run into trouble with remoteExec and explosives? I noticed when I call remoteExec with the target arg set to the explosive object it doesn't work
this is the exact text in my function (_obj is the explosive) sqf [_obj, [_dir, _up]] remoteExec ["setVectorDirAndUp", _obj] , strangely if i call ```sqf
[_obj, [_dir, _up]] remoteExec ["setVectorDirAndUp", 0]
@tough abyss why do you need to remotexec it?
Also, is _obj a unit or an object
If it's not a playable unit or a vehicle with a player in driver, the script gets executed on the server
But i still dont see why you need remoteexec
setVectorDirAndUp has global effect
setVectorDirAndUp requires local arg
Yes?
so i thought i'd need to run it where the object is local
You can set it on one client/server and it updates to all clients
No, you dont
If the client knows _obj, it doesnt need to remoteExec
the wiki says the argument must be local though?
And since it's a private variable, i assume it does
am i not understanding local correctly?
οΏΌaΒ localΒ argument means an argument that is processed on the machine where the command is executed
Local argument, global effect
Actually bad example
But you dont need to remoteexec it
Just set it on one client and it does the job
alright gotcha
@tough abyss take a peek here https://community.bistudio.com/wiki/Multiplayer_Scripting
still weird how it works for other objects but not explosives though
@tough abyss take a peek here https://community.bistudio.com/wiki/Multiplayer_Scripting
@ebon citrus yep read it already
cool thanks
So for example, i dont think you can set vectorDirAndUp of a player from the server
Or a player controlled vehicle
The "processed locally" doesnt say much
What it tells me is that commands will use the return instead of the process
Would have to ask dedmen
so explosives are ok because they are spawned in by whoever was going to call setVectorDir?
arg local means for the command to take the effect properly it's arguments must be local to the machine that's executing the command. trying to remoteExec the ammo as the target won't work for the same reason you can't setVariable on an ammo
using ammo as the target in remoteExec won't run the command where the ammo is local?
correct
https://community.bistudio.com/wiki/owner if server side, https://community.bistudio.com/wiki/getShotParents maybe that if client side
actually now that i think about it, i think ammos in general have issues when you try to setPos etc on the owner machine, its better to just straight up run it on all machines so it syncs properly iirc
I am receiving a script error saying "scopename" is defined twice but the code still works perfectly fine.
How can I avoid the error? My code looks nearly identical to the wiki. The only difference is I don't have a top level while{true} like the example. Could that be the cause?
EDIT: Upon further inspection, the code doesn't actually work as expected. The if statement works perfectly fine and switching into the scope works but none of the hints or sleep saying what scope the code is in.
scopeName "main";
hint "inside main";
[] spawn {sleep 1; hint ""};
scopeName "loop";
hint "inside loop";
[] spawn {sleep 1; hint ""};
while {true} do {
if (player isEqualTo currentPilot objectParent player) then {
heli1 addAction ["<t color='#FF0000'>Player List", {call fn_openMenu}];
breakTo "main";
};
};
How can I avoid the error?
don't define scopename twice? π
Youre defining the name as "main" and then "loop"
The indentation in that block is really misleading.
Sure is
scopeName "main";
hint "inside main";
[] spawn {sleep 1; hint ""};
scopeName "loop";
hint "inside loop";
[] spawn {sleep 1; hint ""};
while {true} do {
if (player isEqualTo currentPilot objectParent player) then {
heli1 addAction ["<t color='#FF0000'>Player List", {call fn_openMenu}];
breakTo "main";
};
};
@rain mural check your brackets
That's the correct indentation for that code.
You can see the the "inside loop" bit, isn't actually inside, because of the way the brackets are placed.
https://community.bistudio.com/wiki/exitWith is enough there, actually, just use https://community.bistudio.com/wiki/waitUntil
what is fn_openMenu?
also, the correct syntax is [arguments] call function;
leave the arguments blank array if you dont intend on passing any
The scope indentation didn't copy over into Discord.
The issue I had with having a while{true} is it continuously spawned in an addAction on the helicopter causing MASSIVE frame drops. I only want one addAction to exist on the vehicle not 8 million but I need a constant check to see if the player is a pilot.
Thank you for the feedback and little improvements I can make. Much appreciated! π
add the check into the addaction condition field?
check example 5 https://community.bistudio.com/wiki/addAction
condition:
String - (Optional, default "true") script code that must return true for the action to be shown. Special variables passed to the script code are:
_target: Object - the object to which action is attached or, if the object is a unit inside of vehicle, the vehicle
_this: Object - caller person to whom the action is shown (or not shown if condition returns false)
_originalTarget: Object - the original object to which the action is attached, regardless if the object/unit is in a vehicle or not
β
condition is evaluated on each frame in non-scheduled environment.
condition is not evaluated if a dialog is open.
If action is added to an object (and not to player) condition will only get evaluated IF player is closer than ~50m to the object surface AND is looking at the object.
If action is added to player, condition is evaluated all the time.```
And the reason you post it in here is what? @brisk lagoon
Sorry I was lost couldn't find it my bad
I did have a look at that and tried it out with another check but I didn't really know what I was looking at, then I found the things about scopes. I shall try that now, cheers
I used the condition section and it works. Thank you guys for assisting me!
Dem peeps are ze bests
Indubitably!
also, this is the one and only(not really) valid place to use the init field
but dont let it get the jump on you
the init field is a mysterious fort of many pitfalls and traps
player addEventHandler ["Respawn", {
player moveInCargo respawnVeh;
}];
};```
how can i set this script up
so if respawnVeh's cargo is full
it will select respawnVeh2
and so forth
FYI @rain mural, this would be my implementation (if it helps):
private _fnc_addPlayerListAction = {
private _actionId = _this addAction [
"Player List",
fn_openMenu,
[],
1.5,
false,
true,
""
{
_this isEqualTo currentPilot vehicle _this
}
];
_this setVariable ["playerListAction", _actionId];
};
player addEventHandler ["GetInMan", {
player call _fnc_addPlayerListAction;
}];
player addEventHandler ["GetOutMan", {
private _actionId = player getVariable ["playerListAction", -1];
if (_actionId >= 0) then {
player removeAction _actionId;
};
}];
Disclaimer: Has never been run, may contain syntax errors.
It avoids running any extra per-frame checks when the player is out of a vehicle, even if they'd be quite cheap.
{
player moveInCargo _x;
if !(vehicle player isEqualTo player) exitWith {};
} forEach myListOfRespawnVehicles;
@runic pumice
Tries to move player into a vehicle, if the player is in the vehicle, it stops, if not, it keeps looping through and trying vehicles.
@cold glacier Ah I see. That would seem like a much better way of carrying out the task. Well, it gives you more control over everything.
_logic = respawnvarname;
_respawn = _logic getvariable ["respawn",[]];
_respawn = _respawn param [0,[],[[],""]];
if (typename _respawn == typename []) then {
if (count _respawn == 2) then {
_respawn call bis_fnc_removeRespawnPosition;
};
};
looking at this script, how did the author know what things you can put in the string after the getVariable? is there a list? secondly, can anyone explain the _respawn params. I know how params normally work, but I haven't seen this syntax
Sorry to be a pain. I have returned :P
My new error is error undefined variable in expression: jc_fnc_openvehiclemenu. I am basically trying to create a dialog menu when the addAction has been used. I have 4 main files (pretty small currently) and I cannot find what the error/undefined variable is and the error isn't very specific (maybe I haven't learnt how to decrypt them yet π )
initPlayerServer.sqf
waitUntil { !isNull player };
waitUntil {!(isNull (findDisplay 46))};
heli1 addAction
[
"<t color='#ffe600'>Player List",
{[player] call JC_fnc_openVehicleMenu},
nil,
1.5,
false,
false,
"",
"player isEqualTo currentPilot objectParent player",
-1,
false,
"",
""
];
fn_openVehicleMenu.sqf
params ["_player"];
if (!(isNull (findDisplay 693))) exitWith { closeDialog 2;};
createDialog "vehicleMenu";
waitUntil { !(isNull(findDisplay 693)) };
[] spawn JC_fnc_vehicleListRefresh;
fn_vehicleListRefresh.sqf
while { !(isNull(findDisplay 693)) } do {
{
lbAdd[1500, name _x];
} forEach switchableUnits;
sleep .1;
lbClear 1500;
};
cfgFunctions.hpp
class cfgFunctions {
class JC {
class vehicleMenu {
class openVehicleMenu {};
class vehicleListRefresh {};
};
};
};
Sorry for the large post
root/functions/vehicleMenu
My folder structure is:
Mission
functions - folder
vehicleMenu - folder
fn_openVehicleMenu.sqf
fn_vehicleListRefresh.sqf
gui - folder
defines.hpp
vehicleMenu.hpp
initPlayerServer.sqf
mission.sqm
I will look at yours now
I have another menu that I was working on and the format I used is the exact same and that menu works fine
I have them both side-by-side in VSCode
I have my functions in separate .sqfs
Not in a "grouped" file
Other menu I have that works
class cfgFunctions {
class JC {
class adminMenu {
class isAdmin {};
class openMenu {};
class playerSelected {};
class autoRefreshPlayerList {};
class teleportToPlayer {};
class healPlayer {};
class killPlayer {};
class freezePlayer {};
};
};
};
New menu
class cfgFunctions {
class JC {
class vehicleMenu {
class openVehicleMenu {};
class vehicleListRefresh {};
};
};
};
I don't get why one works and the other doesn't
They are setup the same
Folder structure and all
No, they are in Mission Folder\Functions
I am not arguing that. I am just confused why one version works and the other laid out the exact same does not
It baffles me π
Yes I meant that
Both menus are
root\functions\menu
What are they named?
My folder structure is:
Mission
functions - folder
vehicleMenu - folder
fn_openVehicleMenu.sqf
fn_vehicleListRefresh.sqf
gui - folder
defines.hpp
vehicleMenu.hpp
initPlayerServer.sqf
mission.sqm
file = "filepath from root";
add that before the function class defines
most definately
Right ok. So file refers to the subfolder they are in?
yes
the whole path from the root mission folder
if they would be in "functions", then use file = "functions";
for you, use file = "functions\vehicleMenu";
class cfgFunctions {
class JC {
class vehicleMenu {
file = "functions\\vehicleMenu";
class openVehicleMenu {};
class vehicleListRefresh {};
};
};
};
Ok fingers are crossed
one \ not 2
I have to escape it as it is in double quotes?
Ok
You shouldn't need the {} at the end of your class openVehicleMenu, you can just do
class openVehicleMenu;
Only reason you'd need it is if you're making a mod with preInit & postInit stuff
I am still receiving the same error:
'[player] call |#|JC_fnc_openVehicleMenu'
Error Undefined variable in expression: jc_fnc_openvehiclemenu
Not sure if it makes a difference, but put
class cfgFunctions {
class JC {
tag = "JC";
doesn't change anything
In this case yeah, but if he changes the value of the tag then yeah, it will make a difference
And tag = Nca will be converted to tag = "Nca" by the engine iirc
fair enough
wait
@rain mural you dont have description.ext?
where are you defining this config?
Oof
Ah percussive maintenance on my PC
Both would achieve the same goal though π€·ββοΈ π
i guess, well, be back if you have troubles
I shall.
At least I can be awarded biggest mug of the year π
Anyone know why synchronising an object to a module in the editor, and testing synchronizedObjects on the object doesn't show the module,
but testing synchronizedObjects on the module shows the object?
Funnily enough @ebon citrus, that fixed it π
but why does syncing 2 modules together show the other module when you do synchronizedObjects on one of the modules?
I tried to ask in there, but it's quiet atm, xD
XD
Hi guys.
Can't successfully comprehend some multiplayer / locality issues.
Could use some help if possible.
I have a string of code in my trigger OnActivation: [8, true] remoteExec ["fuelingTimer", 2]; // run function server side
This one string for my serverInit: timer = [] execVM "server\FuelingTimer.sqf";
And these inside my fuelingTimer:
fuelingTimer = {
params ["_time", "_on"];
_time = RK_fuel_timer;
_initTime = _time;
"booyah!" remoteExec ["systemChat", -2, true]; // broadcast message everywhere except the server
In my comprehension the scheduling and locality should go as follows:
- server init, run sqf script
- trigger activated: run fuelingTimer function
- from inside the fuelingTimer "booyah" should be broadcasted to all machines in MP except the server
But it fails on the step 3.
If I'll change OnActivation string to [8, true] remoteExec ["fuelingTimer", 0, true] everything runs, but later on messes with while-sleep things inside fuelingTimer which I want to avoid.
@storm sierra what module are you using?
Custom module inherited from Module_F
it could be that the module deletes itself after succesfully running?
nope, setting the module variable name to D, and testing D while mission runs it shows it as still there
I feel like it's an editor/scripting/config question tbh, but only scripting channel is active atm, haha xD
tested with same module yes, and they worked fine between each other
but not to any other objects
from the objects*
to the module
@dull drum You can't remoteExec fuelingTimer as it's not compiled as a function.
fuelingTimer is a code-block
a variable
not a function
so when you call what i presume is fuelingTimer.sqf
fuelingTimer = {
params ["_time", "_on"];
_time = RK_fuel_timer;
_initTime = _time;
"booyah!" remoteExec ["systemChat", -2, true]; // broadcast message everywhere except the server```
you are just defining a global variable
so you need to call the function
remoteExecing a variable with some parameters does nothing
youre also missing a closing bracket in fuelingTimer.sqf
that's copypasting issue
[8, true] remoteExec ["fuelingTimer", 2]; // run function server side does nothing
but it does if I'll change 2 with 0

