#arma3_scripting
1 messages ยท Page 267 of 1
Here my custom setVariable/getVariable to allow this functionality on simple objects: http://pastebin.com/DssX35zh @meager granite @native hemlock it co-exists with normal setVariable but override it.
if i want to make it for trees near markers would i do it like that ?
'[] call tag_fnc_isTargetTree && player distance (getmarkerpos "testmarker") < 20',
okay if i want to do this with multiple markers should i use
getmarkerpos in ["blabla","bla"]
?
okay thank you for the help ๐
yeah i want to use this in roleplay because the standard is shit for gathering ๐
nice ๐
okay
maybe i give it a try ๐ not sure ^^ have no time today
how can i get the best ingame voice quality ? if i use vonCodecQuality should i use high numbers for good quality ?
no idea, but high numbers sound always good to me
okay ๐
anyone know if it's possible to override a vehicles top speed without editing the modpack or for example a default car?
There is a function like isSimpleObject?
BRPVP_isSimpleObject = {
_this setVariable ["sot",false,false];
_this getVariable ["sot",true]
};
cant you just test the object variable? if it has typeOf == "" or contains : .
@indigo snow its another way... wich is better? just a function race can say hehe
Just want to say my custom setVariable/getVariable runs perfect (the code i posted is old) and i can even use it in general if the isSimpleObject is fast enough.
So i rulez... and I'M the master ๐
Does anyone know if its possible to script rack mount radios in ACRE? IE once you get in a vehicle you have access to a specific radio? once you get out you can't use it anymore?
I've never used ACRE, but it sounds totally possible via script
Any thoughts on how? If theres an event handler for entering and exiting a vehicle I'd assume you can just add the radio item on entrance and remove it on exit
About Trees: There is also now nearestTerrainObjects command https://community.bistudio.com/wiki/nearestTerrainObjects
nearestTerrainObjects [player, ["Tree","Bush"], 10];
Would that be helpful for when someone gets in a vehicle?
the event does fire when a vehicle is entered or when a soldier enters a vehicle respectively
or leaves
@rocky cairn , using CBA?
Yes
ok, wait
// init.sqf
#define BACKPACK_RADIO "a_classname_i_can't remember"
#define VEHICLE_TYPES ["b_mbt_01_cannon_f"]
["vehicle", {
params ["_unit", "_vehicle"];
if (toLower typeOf _vehicle in VEHICLE_TYPES) then {
// enters a vehicle with radio
_unit addBackpack BACKPACK_RADIO;
} else {
// leaves a vehicle with radio
if (backpack _unit == BACKPACK_RADIO) then {
removeBackpack _unit;
};
};
}] call CBA_fnc_addPlayerEventHandler;
you have to fill in the macro classnames yourself
I can't remember any of them
Awesome. Thanks!
b_mbt_01_cannon_f etc. must be lower case
@rocky cairn ACRE2 will get vehicle racks soonish, they are currently WIP ๐
@little eagle that script will replace whatever backpack you had though
no, it will be dropped on the ground. that's what addBackpack does
Yea but acre doesnt use backpacks is i think what jonpas is trying to tell you
Idk. He asked for backpacks ยฏ_(ใ)_/ยฏ
it's not like the script isn't easily customizable
Hey guys, I have a problem with playing a sound locally. So this works playSound3D ["a3\sounds_f\sfx\blip1.wss", player]; and plays it globally or within the raidus, but doing say3d ["a3\sounds_f\sfx\blip1.wss"]; does not work.
Could I define that sound in there?
Or does that not work with sounds like that that are in ArmA originally and not the mission file?
does work with mission, but you have to define a class in CfgSounds
So this would work ? class CfgSounds { sounds[] = {}; class hint { name = "hint"; sound[] = {"a3\sounds_f\sfx\hint-4.wss", 1.0, 1}; titles[] = {}; }; };?
try it
If put on buildings with usable doors, the Event Handlers AnimChanged, AnimDone and AnimStateChanged runs when a door is opened/closed?
Doubt it, those event handlers are for player animations which are handled differently than object animations. Should be easy to test though
so before i spend a long time doing this...has anyone written a perlin/simplex/guassian noise generating script?
Hey, whats the best way to take a spawned group and have them load into any vehicles that are in their group?
I'm spawning various random enemy groups, they all have vehicles, but some have 1, some have 2
_groupVar = [ getmarkerpos _closestSpawn, EAST, (configfile >> "CfgGroups" >> "East" >> "rhsgref_faction_chdkz" >> "rhs_group_indp_ins_72" >> "RHS_T72baSection")] call BIS_fnc_spawnGroup;
wp = _groupVar addWaypoint [position (leader _groupVar),0];
wp setWaypointSpeed "Full";
wp setWaypointType "GETIN";
wp setWaypointBehaviour "safe";
That's what I'm trying, but they seem to have 1 or 2 get in and the rest just run next to the vehicle.
This should assign vehicle to the group and they will get in\get out automatically
Though it might be best to manually assign some units to driver\gunners
what could be used to reliably and consistently identify a "slot" in a game? UID identifies a client, but not AI. netid identifies and object, but it changes during the respawn, while the entity could still be considered the same, it only changed it's "vehicle"
so any thoughts?
@native hemlock i asked because none of it worked. No deal so.
anyone know how to use setConvoySeparation command?
thanks
I have a troublesome LOAD waypoint. It's attached to an AI helicopter which is suppose to wait for a group to LOAD and then go to the next waypoint which is MOVE. For some reason the condition I've set is only fulfilled with only 1 player in the group. If there is more than one, the condition isn't met. I'm using this code for the condition: "{_x in chopper1} count (units group player) == {alive _x} count (units group player);"
I've also tried hardcoding it like (unit1 in chopper1), which works. but if I do: (unit1 in chopper1) AND (unit2 in chopper1) it doesn't work.
Well, apprently it doesn't work if I'm doing (unit2 in chopper1) alone either, unit2 in this case being an AI. Making me think that for some reason the waypoint doesn't respond to any AI's being inside the chopper.Seeing it only works with me, the player. I haven't tested with other players yet, but it should react to the AI as well right?
@high glade Shot in the dark: But any luck with ((unit1 in chopper1)AND(unit2 in chopper1))?
does anyone have a simple script at hand to lock player slots for specific players by their UID?
i find only one version online and there the responses indicate tat itis buggy
A simple way would be to name your units, then check on init whether their UID matches that of the slot (hardcoded)
If you named a unit unit_1
Then str player will return "unit_1"
not always. I think stuff like the Zeus module assigns different vehicle var names
does #kick work with the UID?
if so, what do you think about this: ```//nul = [this] execVM "scripts/UIDBlocker.sqf";
//Execute this script on reserved units in the editor
_unit = _this select 0;
if (isPlayer _unit) then {
_uid = getPlayerUID _unit; //get the player unique ID
_whitelist = [
[134223131312,"PlayerName"],
[131313131313,"PlayerName"]
];
_found = "";
{
if (_uid == _x select 0) then {_found = _x select 1};
} foreach _whitelist;
{
if (_found == "") then {
hint "This is a reserved slot, please choose a different one. You will be kicked from the server. Sorry for the inconvenience.";
sleep 10;
[{serverCommand format["#kick %1",_uid];}, "BIS_fnc_spawn", false] call BIS_fnc_MP;
};
};
pretty sure it only works with the nick name
then i guess i need to get me the name of the unit somewhere in there
You can always just use:
findDisplay 46 closeDisplay 0
to end the local mission
as long as it's a machine with interface
i suppose kick will do. if i get the name of the unit that the player is using, that should do the job no?
findDisplay 46 closeDisplay 0
That's what you want
The problem with serverCommand is, that it requires a logged in admin to work
doesn't work on the dedi itself afaik
But if you use
findDisplay 46 closeDisplay 0
the mission just ends for this client
ok and i just put thatthere instead of the line with servercommand?
yeah
entire line i mean
yeah
ok will give that a try. thaks
i run it on the server
ok, then use this:
{findDisplay 46 closeDisplay 0} remoteExec ["call", _unit];
so you close the mission display on the client and not the server
alright... i suppose ill have to look closer into what that means at some point ^^
it sounds important
but something is weird
hint "This is a reserved slot, please choose a different one. You will be kicked from the server. Sorry for the inconvenience.";
why do that on the server?
it makes no sense to show it on the server
you have to show that to the client
findDisplay 46
reports the mission display
closeDisplay 0
closes it with exit code 0
-> mission ends
really simple
im adapting from another code. what it is supposed to do is kick the unauthorized player back into the assignment screen
or off the server guess
ah ok
hm. how would i know that ? :D
๐
i mean its a script executed on the server
then it runs on the server
or does it run on every machine?
if so it does some pretty redundant stuff and does n network traffic
how would i even make or prevent it do that?
well, how is the script executed in the first place?
i intended to put nul = [this] execVM "scripts/UIDBlocker.sqf"; in the unit init field
and the script is in that missions scripts folder, which is on the server
then it would check out the unit and so on...
the init box runs on every machine
So you have 30 connected machines, right?
And each of them sends the BIS_fnc_MP thing to all others
30 messages to 30 machines
900 times the same line executed
i see i see
๐ฎ
so call BIS_fnc_MP; sends out stuff to all clients, hm?
in your case yes
But BIS_fnc_MP is also deprecated
Should use this instead:
https://community.bistudio.com/wiki/remoteExec
and your line would be a better solution for the time being?
looks better and is faster
i see..
and your line would be a better solution for the time being?
No, you have to sort out where you want to execute the script first
otherwise everyone get's kicked just because someone entered an illegal slot
yeah.
so ill have to run this somewhere from the server init
not putting lines in units i mean
is there an onplayerconnect eventhandler or so?
this one, but it does not report the slot you picked
initPlayerServer.sqf would be the best place I think
initPlayerServer.sqf Executed only on server when a player joins mission (includes both mission start and JIP). See initialization order for details about when the script is exactly executed. [player
[player:Object, didJIP:Boolean]
so you're first line in the script would be:
params ["_unit", "_didJIP"];
and then you have all you need
you just have to remote execute the hint and the kick
I'd say you just define a function that does this in init.sqf (so every machine has it)
and then you remotly execute that function from the server via remoteExec
would look pretty clean. few lines and easy to comprehend
i do not have a initPlayerServer.sqf
is that also something i should know of?
damnit i just managed to set up mods straight on this thing, now i have to rewrite all my scripts ^^
If you don't have it, then it uses an empty dummy version from the game files
just create one
listed where?
this events scripts link you just gave
Not for init.sqf and some of the .sqs things
those are hard coded engine wizardry
but yeah, as long as you don't have them, they basically do nothing
serverCommand works server side IIRC
a few exceptions which you should never use as your own file. I think they're not listed there though
Also, why not end mission locally ๐ ?
That's what I told him
with the closeDisplay thing
I still think that is the simplest
As of Arma 3 v1.39 serverCommand can be used on dedicated server and headless clients. This requires a password, both set in server.cfg and passed to the command itself.
i must say, i am entirely confused now, but wll see if i can get it figured out
just discard everything you have atm and think you know atm. It's way more contrived than what you want and should use
that includes discarding the eventhandler, right? ^^
yeah. use the event script instead. initPlayerServer.sqf
it runs for each player that connects but only on the server
right.. ok. ill start form there ^^
ok so what comes out is i create that file: initPlayerServer.sqf
and into it i put ```_unit = _this select 1;
_uid = getPlayerUID _unit; //get the player unique ID
_whitelist = [
[134223131312,"PlayerName"],
[131313131313,"PlayerName"]
];
_found = "";
{
if (_uid == _x select 0) then {_found = _x select 1};
} foreach _whitelist;
{
if (_found == "") then {
"This is a reserved slot, please choose a different one. You will be kicked from the server. Sorry for the inconvenience." remoteExec ["hint", _unit];
sleep 10;
{findDisplay 46 closeDisplay 0} remoteExec ["call", _unit];
};```
_unit = _this select 1;
is wrong according to the wiki
0
yeah or use
params ["_unit"];
which is less horrible
I'm not sure how if (_found == "") then { exactly works
Can just RE endmission, as to avoid whitelisting call (if you're whitelisting)
Will also allow for a nice message
_found = ""; @little eagle
endmission can have a message?
yeah, but I don't see any connection to slots
atm it just kicks everyone except those that are white listed
its only because i have that _found variable
and my whitleist has UID with name
i use it for customyed welcome message
so it is = "" intially, and if the UID matches wth the whitleist, it becomes =Playername
yeh, you can use a template from description.ext
a shit thats true... before it was meant to be placed in the init of the units
so i shall name some units
yeah, that sounds like a good idea
and can use the manually made ones. then i can also custom equip them
I hope you see now how this is simpler
yes, its good learning ^^
so this initserverplayer.sqf just comes into the missin folder i suppose?
same place where init.sqf is, yes
_unit = _this select 0;
_reservedunits = ["reserved1","reserved2","reserved3","reserved4","reserved5"]
_uid = getPlayerUID _unit; //get the player unique ID
_whitelist = [
[131313131313,"PlayerName"],
[131313131313,"PlayerName"]
];
_found = "";
{
if ((_unit in _reservedunits) and (_uid == _x select 0)) then {_found = _x select 1};
} foreach _whitelist;
{
if (_found == "") then {
"This is a reserved slot, please choose a different one. You will be kicked from the server. Sorry for the inconvenience." remoteExec ["hint", _unit];
sleep 10;
{findDisplay 46 closeDisplay 0} remoteExec ["call", _unit];
} else {
format["Welcome %1. Good hunting!",_found] remoteExec ["hint", _unit];
};
missing ;
argh!
also, you want the variables of these, not strings
if ((_unit in _reservedunits) and (_uid == _x select 0)) then
->
if ((_unit in _reservedunits) and (_uid == _x select 0)) exitWith (no need to cycle through the rest)
you're currently checking if _unit, an object, is in an array of strings
that will never be true
copy that.
looks odd tho
_reservedunits = [reserved1,reserved2,reserved3,reserved4,reserved5];
:D
hmm doesnt seem to do the job
add some debug with diag_log and watch where it goes wrong
serverlog shows this
_reservedunits = [reserved1,reserved2,reserved3,reserved4,>
20:19:41 Error position: <reserved1,reserved2,reserved3,reserved4,>
20:19:41 Error Undefined variable in expression: reserved1
20:19:41 File mpmissions\ALiVE_Template_NoScr.Tanoa\initPlayerServer.sqf, line 4
yeah, that's a problem
i guess that might be because th eplayable npcs are not around when no player uses them
to the variable doesnt exist
says earlier 20:18:53 DATA: Restoring player data for reserved2
thats when i connected
_reservedunits = [
missionNamespace getVariable ["reserved1", objNull],
missionNamespace getVariable ["reserved2", objNull],
...
];
i guess that might be because th eplayable npcs are not around when no player uses them
yeah, exactly
consider a group with a player only. When a player respawns, what happens to the group? If he's still linked to the grop, e.g. group player will return this same group? Or it gets destroyed?
same group
I think they only delete them if you use join(Silent) and the previous group was empty
not sure about AI only groups where everyone dies
can cfgweapons store variables in anyway? or cfgMagazine?
hm still no effect, but this time i dont see error messages either
@hallow spear You mean, can you attach variables to specific instances of a weapon?
so they keep them if dropped and picked up later?
@proven crystal add debug with diag_log
where and how do i add that?
diag_log format ["text %1 - %2 - %3", var1, var2, var3];
eg: diag_log format ["The player is %1", player];
yes, commy2. I am hoping to save data to specific inventory items, weapons/ammo too
so they can be on ground with variables as well
Stick it in your code where you're wanting to watch for what's happening. diag_log will output to the RPT
@hallow spear You're out of luck then. Not possible
i thought so. I got excited when I saw you responding. if anyone.. itd be commy. Ok thanks. I'll make something up
maybe in Arma 4 ยฏ_(ใ)_/ยฏ
it can work with vests/ uniforms and backpacks, if you get the containers
and magazines have magazine IDs, though they get reset when opening the Arsenal, respawning and all that
will dag_log output in the servers logfile too?
im running that on the server, no rpt there afaik
there always is a RPT
only logfile im aware of is the screenlog...
which says screenlog.0
but its probably a txt
but it shows the stuff
.rpt
ok. anyway, what it says is 21:07:15 Error in expression <if ((_unit in _reservedunits) and (_uid == _x select 0)) then {_found = _x selec> 21:07:15 Error position: <== _x select 0)) then {_found = _x selec> 21:07:15 Error Generic error in expression
it says script kaput
i see zet. but vatz kaput viz it?
[131313131313,"PlayerName"]
];
_found = "";
{
if ((_unit in _reservedunits) and (_uid == _x select 0)) then {_found = _x select 1};
} foreach _whitelist;```
my whithelist are arrays of uid and a name in string format
what is _uid?
the UID of the unit. wait
_reservedunits = [
missionNamespace getVariable ["reserved1", objNull],
missionNamespace getVariable ["reserved2", objNull],
missionNamespace getVariable ["reserved3", objNull]
];
_uid = getPlayerUID _unit; //get the player unique ID
_whitelist = [
["131313131313","PlayerName"]
];
_found = "";
{
if ((_unit in _reservedunits) and (_uid == _x select 0)) then {_found = _x select 1};
} foreach _whitelist;
{
if (_found == "") then {
"This is a reserved slot, please choose a different one. You will be kicked from the server. Sorry for the inconvenience." remoteExec ["hint", _unit];
sleep 10;
{findDisplay 46 closeDisplay 0} remoteExec ["call", _unit];
diag_log format ["UID not on whitelist, player kicked"];
} else {
format["Welcome %1. Good hunting!",_found] remoteExec ["hint", _unit];
sleep 10;
};```
Return Value:
String
can't == strings and numbers
131313131313 would also be above the single float precision, so it looks suspicious
so id have to put that fake number in the whitelist into ""?
yeah. strings
aight...
made the correction also above. lets see if this works. but this is last try.its half past 2 already over here and i gotta work tomorrow
... Australia? Asia?
Asia
but was worth staying up. thanks for the help already
learned a few things again
dammit still logging on...
i found an open bracket that never closed.... i hope that was the last bugger then....
very likely. never closed bracket doesn't report errors, because splendidTM
congratz
So I've never made event handlers before, so I'm not sure how to get the syntax right. I want to do this:
Add this to run against anyone that gets in vehicle setCaptive false
And add that command to this event handler this addEventHandler ["GetIn",{hint "You are considered hostile now"}];
lgtm
not sure how to combine the two commands together
put a ; at the end of each line
use shift+enter to go to another line in the editor's init window
hey im trying to display the crew of my vehicle and deperate them by a comma.
trying it like this:
_crew = crew vehicle player;
_text = "";
if (_crew isEqualTo [player]) then {
_text = format ["%1",name (vehicle player)];
}
else
{
{
_text = _text + format ["%1,",name _x];
}foreach _crew;
};
hint str _text;
but the output is "John Collins, other crew, other crew, other crew,"
the problem is the comma at the end i dont know how to remove it
put the comma in front so it won't be at the end. ๐
but then the output is ",John Collins, other crew, other crew, other crew" ๐
oh right, misread the if
Maybe:
{
_text = _text + format ["%1",name _x];
if (_foreachindex < (count _crew) -1) then {_text = _text + ", "};
}foreach _crew;
it worked thanks ๐
yeah, but im trying to use the command draw icon. the problem is actually the crew is not beeing displayed right.
http://pastebin.com/j3v0RTGN
for bigger Scriptparts -> pastebin.com pls, thx =}
okay
and thats why i hate
if()then{
Instead of
if()then
{
the crew is not beeing displayed right<- That means what?
it is displayed multiple
- why "visiblePosition" ? getPos is enough same with "direction" (getDir)
_unit = _x;
if ((vehicle _x) == (vehicle _unit)) then```
you are checking " vehicle _x == vehicle _x " (just using _unit instead of _x the 2nd time)
yeah that worked but if i leave the vehicle it shows on the map that im in the vehicle
Of course it works, since you are checking if True == true or A == A or BANANA == BANANA
The "else" would never be used.
so i would do it like this ?
((vehicle _x) == _unit)
for example
This would check, if the unit is the unit itself or a vehicle atm
(like sitting in cargo or Driverseat, or any other seat inside a vehicle)
okay
e.g.
if(vehicle player != player) then
{
systemchat "in a car"
}
else
{
systemchat "on foot"
};
Yep, or that.
https://community.bistudio.com/wiki/objectParent
if my crew get out the text is "John CollinsEdwar Jackson".
so the text is first the name of the player and then the unit name. i dont understand this shit xD
visiblePosition is render timescope unlike getPos
if it's in a draw EH then i think visiblePos is correct
so if i do it like this : http://pastebin.com/khUDbH90
the crew is displayed multiple times consecutively
so uh weaponCargo only returns base weapons, not attachments etc
is there a way to get the full and true contents of an ammobox
/ vehicle
thx aaron
np aaron
That works on ammoboxes? Wanted to look into that.
Does it also work to pack backpacks including uniforms?
Would like to have ready made backpacks waiting to deploy
It's read , but not write
http://pastebin.com/j3v0RTGN
the inner while loop is unsuspended, so you're iterating through it ~1200 times every frame when the map is opened
Hello there! I've got a safezone is a coop mission, that deletes bullets from weapons, but people then decide to use mounted guns on vehicles. Is there a way to remove those when fired inside a certain circle?
same way you do it for soldiers, but you attach the event handler to vehicles
Or you wait for 1.66 and use firedMan instead of fired
okay so right now when a unit fires a mounted gun, the eventhandler is placed on the vehicle instead of the player?
@little eagle How could i change this ? any iddeas ?
On my mission players can create objects, and most of the objects are created as simpleObjects. As you may know, simple objects are created with a z positioning that is wrong. To fix this z error i can have a list of z adjusts for each kind of object, but i preffer to create the object as a normal object first, calculate the z adjust, delete the normal object and recreate it as a simple object, and then apply the z adjust. With that i don't need to maintain a list of adjusts. Sadly this will make the engine create and delete lots of objects just to calculate the Z adjust, and i ask you if this can degrade performance or stability over time?
okay so right now when a unit fires a mounted gun, the eventhandler is placed on the vehicle instead of the player?
yes
How could i change this ? any iddeas ?
add a command to suspend the loop. there aren't that many to pick from...
if this can degrade performance or stability over time?
probably not. deleted objects should no longer afect performance
@little eagle thanks man! You are the MASTA!
is this the correct way to send a titletext to a client? ["bla", "BLACK IN",10 ] remoteExec ["titleText", _unit];
looks good
doesnt seem to do the job... i use 1 instead of 10 though... maybe too short for my loading screen...
Is there a way to prevent moving forward in a vehicle when setUnconscious true is used on a unit?
Blocking actionKeys "carForward" doesn't do stuff. is this just BIS being BIS?
probably
i dnt understand...
why does this not work?
[format["bla %1 ! /n %2",_found, _msg], "BLACK IN",10 ] remoteExec ["titleText", _unit];
format["Welcome %1. Good hunting!",_found] remoteExec ["hint", _unit]; works
@austere granite car movements are buggy. If you get in a car, pressing nothing, wait 1s, then press "CarForward" -> It works. If you get in the car, holding the CarForward button while doing that -> Car moves forward, even when its "blocked".
(i tried abit around, "simulating" an ignition.)
hm should it be [ [format["bla %1 ! /n %2",_found, _msg], "BLACK IN",10 ] ] remoteExec ["titleText", _unit]; maybe?
no... guess not
arma usually uses <br/> for linebreaks
only in TEXT
in STRING it's usually \n
although I think it only works for hint(Silent)
(tooltip linebreaks pls)
hello
{
UniformArray = ["CUP_O_TKI_Khet_Partug_02", "CUP_O_TKI_Khet_Partug_04", "CUP_O_TKI_Khet_Partug_03", "CUP_O_TKI_Khet_Partug_02"];
{
if((side _x) == civilian)then
{
removeVest _x;
removeHeadgear _x;
removeUniform _x;
_x unassignItem "NVGoggles";
_x removeItem "NVGoggles";
_x forceAddUniform (UniformArray select (random(floor(count UniformArray))))
};
}
foreach allunits;
};```
It randomises the uniform but the unit also sometimes gets no uniforms and stays naked.
What's the problem with it?
The linebreak shouldn't be the issue with titleText not executing, does it work with just ["Hi", "BLACK IN", 10] remoteExec ["titleText", _unit];?
{
UniformArray = ["CUP_O_TKI_Khet_Partug_02", "CUP_O_TKI_Khet_Partug_04", "CUP_O_TKI_Khet_Partug_03", "CUP_O_TKI_Khet_Partug_02"];
{
if((side _x) == civilian)then
{
removeVest _x;
removeHeadgear _x;
removeUniform _x;
_x unassignItem "NVGoggles";
_x removeItem "NVGoggles";
_x forceAddUniform selectRandom UniformArray;
};
}
foreach allunits;
};```
like that?
I think so. The formatting is fucked, so it's hard to read.
A little prettier
if(isServer) then
{
UniformArray = ["CUP_O_TKI_Khet_Partug_02", "CUP_O_TKI_Khet_Partug_04", "CUP_O_TKI_Khet_Partug_03", "CUP_O_TKI_Khet_Partug_02"];
{
if ((side _x) == civilian) then
{
removeVest _x;
removeHeadgear _x;
removeUniform _x;
_x unassignItem "NVGoggles";
_x removeItem "NVGoggles";
_x forceAddUniform selectRandom UniformArray;
};
} foreach allunits;
};
Are you sure those are all valid uniforms as well?
lgtm, but UniformArray should be a local variable or a macro
yeah and check if these classnames are correct
addUniform leaves you naked if the class name doesn't exist
(should log error in RPT though)
Ok I'll check it now
It could also be another script overwriting UniformArray and causing a race condition. shouldn't use a global for this
yeah
If you use allunits then it won't report corpses
idk if you plan on using any in your mission
no, only alive units
It should be fixed by using selectRandom if those classnames exist. The issue is with _x forceAddUniform (UniformArray select (random(floor(count UniformArray))))
whats the diffeence between allUnits and allAlive?
You would be trying to select decimal indexes from the array
no wait allalive doesnt exist i think im confusing stuff
allUnits probably counts only the alive units
selectRandom is better, but the correct way would have been floor (random (count UniformArray))
yeah. It should've been floor random count
not random floor count
count is always an integer
and if the count is 3
and you roll 2.6 with random
select will attempt to pick the fourth element
which does not exist as the count was 3
case closed
yw
could it be that the thing keeps the loading screen up until that message has been sent?
so it sort of doesnt consider the client fully loaded or so?
Did you try with just ["Hi", "BLACK IN", 10] remoteExec ["titleText", _unit]; to rule out the linebreaks? Is _unit definitely defined as well?
yes i have both messages in the there now. simple and complex. but this time it was a different mistake, as i also just switched from select floor random count to selectRandom
so trying again now with the smecode
nope not working
is there a way to spawn a helicopter on air with a started engine in a script?
format["Welcome %1. Good hunting!",_found] remoteExec ["hint", _unit];```
the hint comes through, the titletext doestnt
``` I have this, so it's instead CAN_COLLIDE?
cant see an error in the log either
yea
maybe titleText doesn't work with remoteExec? I think it has to have an entry in CfgRemoteExec to work
ah dayum... cant they metnion that somewhere
do you know how to create a progressbar? Is it hard to do?
I know how to work with GUI alittle but couldn't figure out the progressbar thing
I made one for AGM back in the day, which was ported to ACE
Yeah, I know there are alot of progress bars in ACE :p
it's the same one over and over again
Can I take their as an example?
GPL v2
not that anyone will stop you if you use it for yourself and don't release it...
illl try cutText and see if that does anything different
you could be right about the loading screen
Maybe the command just doesn't work there
or it's overwritten at the end of it by a cutText "" or something like that
now i have hint - sleep - titetext - cuttext - hint
lets see what comes through
interestingly i can see only the last hint
What are you running this from?
execVM "mission_scripts\civCloths.sqf";
This executing this
{
_UniformArray = ["CUP_O_TKI_Khet_Partug_02", "CUP_O_TKI_Khet_Partug_04", "CUP_O_TKI_Khet_Partug_03", "CUP_O_TKI_Khet_Partug_02"];
{
if((side _x) == civilian)then
{
removeVest _x;
removeHeadgear _x;
removeUniform _x;
_x unassignItem "NVGoggles";
_x removeItem "NVGoggles";
_x forceAddUniform selectRandom _UniformArray;
};
}
foreach allunits;
};```
I added the execution command to the init.sqf file but it doesn't work.
I'm spawning units via scripts since I'm using headless client. So I placed the line right after the spawning part.
ok im very sure now, that nothing but hint works
maybe you loop over allUnits before your script has them created ๐ค
If the spawn script is another execVM
they race against each other
and the civCloth.sqf wins since it does work but none of the units gets the uniforms?
so what can I do
is there a way to make the execVM work only after the rest did
but later create new ones
I'm executing the command after the spawn
_handle = execVM "blah";
waitUntil {scriptDone _handle};
?
will it work if I do it this way?
_handle = execVM "mission_scripts\civCloth.sqf";
waitUntil {scriptDone _handle};
ohoh ok sry I see
it won't work if you use spawn or execVM inside that spawn script though
as those would also run in parallel
yeah, you have to wait for all of these
also
some inventory commands require the unit to be local
if you create them on the HC
and do the gear stuff on the server
they won't be local to the server, but the HC
so stuff like addUniform works
but addBackpack doesnt
and addWeapon bugs out the whole system
how :I
You dug yourself into a hole by using the scheduler. ยฏ_(ใ)_/ยฏ
welcome to race condition hell
Could always just use call ๐
What about addBackpackGlobal
Doesn't work all the time, iirc.
I remember, that some commands must be executed on the Client, even when they have the suffix "global" to its name. Something was strange there
I have a question whether the following script is set up correctly: It is called from the init of a vehicle (script name garagekey.sqf) and it is supposed to be a key to unlock/lock a vehicle ```
0 = this execVM "scripts\garagekey.sqf"
while(true){
if(Authenticated) then {
if(_this lock == 3) then {
this addAction["Unlock Vehicle", {target (_this select 0) setVehicleLock "UNLOCKED"}, "", "", false, true, "", "", 2, false];
}
else{
this addAction["Lock Vehicle", {target (_this select 0) setVehicleLock "LOCKED"}, "", "", false, true, "", "", 2, false];
};
};
};```
I'm not sure whether using the while loop is necessary. Maybe the script only fires when people are close? is the _this used correctly? It is supposed to point to the vehicle the script runs on
Loop is not necessary and you can define your entire if inside the addAction parameters so that the action only displays when the condition is met.
this addAction["Unlock Vehicle", {target (_this select 0) setVehicleLock "UNLOCKED"}, "", "", false, true, "", Authenticated, 2, false];?
Authenticated is a local boolean
You are saying this should do? _this addAction["Unlock Vehicle", {target (_this select 0) setVehicleLock "UNLOCKED"}, "", "", false, true, "", Authenticated && _this lock == 3, 2, false]; _this addAction["Lock Vehicle", {target (_this select 0) setVehicleLock "LOCKED"}, "", "", false, true, "", Authenticated && _this lock != 3, 2, false];
I'm not sure whether to use this or _this
_this
for all instances or just some?
IIRC _this always works in script and this when in the unit init
ah right thanks!
is the condition part set up correctly? bool + lockstate Authenticated && _this lock != 3
_vcl addAction ["Unlock", {(_this select 0) setVehicleLock "UNLOCKED"}, nil, 5, true, true, "", "Authenticated && locked (_this select 0)"]; should do it (not tested)
make sure that the variable "Authenticated" is set before.
Won't there be a problem with _vcl... yeah, that
yea, just noticed xD
I've done that more than I care to admit to.
how would I make the unlock of the vehicle global then instead of local?
what is https://community.bistudio.com/wiki/load meant to represent?
loadUniform/Vest/Backpack is percentage of load vs capacity, yet load seems to be some absolute value
@tough abyss according to the BI page it's boolean but can also return 0-3
depends on the syntax
even more funny that https://community.bistudio.com/wiki/loadAbs is just load * 1000 ...
if I place it in the init of the vehicle (so not through sqf) would it be global?
No. Placing the addAction into the init will ensure everyone can see the action, but will not synchronize the results
hmm... then how do I make it sync?
unless there is a better way to achieve the main goal: Unit members can unlock locked heavy armoured vehicles once a request from a stranger has been accepeted by them to use the heavy armoured vehicles. If such is not the case, the vehicles should remain locked
@willow basin Authenticated is a bool assigned on playerinit
Use remoteExec to run the code on all machines
gotta love this...
diag_log["_actualMass != _desiredMass",_actualMass != _desiredMass,_actualMass,_desiredMass,_actualMass isEqualTo _desiredMass];
["_actualMass != _desiredMass",true,8,8,false]
["_actualMass != _desiredMass",true,9.86,9.86,false]
["_actualMass != _desiredMass",true,15.44,15.44,false]
["_actualMass != _desiredMass",true,25.8,25.8,false]
["_actualMass != _desiredMass",true,102.14,102.14,false]
["_actualMass != _desiredMass",true,386.78,386.78,false]
just reading those values from config space
_actualMass = 0;
_magazinesAmmo = magazinesAmmo _unit;
{
_magazinesMass = getNumber (configFile/"CfgMagazines"/(_x select 0)/"mass");
_actualMass = _actualMass + _magazinesMass;
} forEach _magazinesAmmo;```
_desiredMass = 0;
{
_magazinesMass = getNumber (configFile/"CfgMagazines"/_x/"mass");
_desiredMass = _desiredMass + _magazinesMass;
} forEach _magazinesClassAllLower;```
Floating point imprecisions something something?
hey any idea how i could create a dialog when the map is opened ? i tried it but i cant moved the map when the dialog was created :/
createDisplay on to display where map is?
@steep matrix
The factor is in the configs.
class CfgInventoryGlobalVariable {
maxSoldierLoad = 1000;
};
BI already changed it at least once from 1200 to 1000.
tried cutRsc doesnt seem to work ๐ฆ
This mass cap is bugged though. You can go over it if the backpack etc. allows for it
Use createDisplay, Basti
The total mass cap is shown as a bar in the inventory ui. Everyone ignores it and it does nothing. It indirectly affects fatigue by shifting load
i think i just need to set movingEnable = 1; in my dialog ๐
No, the map will always be in front, uunless you create a subdisplay via createDisplay
The marker menu works just like that
@little eagle Would it work like this ?
[]spawn {
openMap true;
(findDisplay 12) createDisplay "mapTest";
};
findDisplay is a bit bugged. the array it reports is only update one frame after a display was created.
So you might have to add a sleep 0.01; and pray the game runs not faster than 100 FPS
idk if it works. try it
= 100 fps is an edge case ๐
alternatively
waitUntil {!isNull findDisplay 12};
and then hope the scheduler doesn't screw with you and you end up with two at once thanks to the previous loop still running ๐
cant see the dialog
if i create the dialog with cutRsc and with closed map it works. so the dialog is right
has to be at root level in config
cutRsc has to be in CfgInGameUi or something like that
check the config
converting to mass read from config to string allows correct comparison. still dont get why it fails for some values
other float values for mass of other equiipment work just fine
probably floats being floats
okay i got it work so the dialog is created. but now i cant press any button
[]spawn {
openMap true;
waitUntil {!isNull findDisplay 12};
0 cutRsc ["testHud","PLAIN"];
};
in testHud is movingEnable = 1;
@steep matrix if you're trying to get the (PhysX) mass, it's not defined in configs (configFile anyway) ๐ฆ
@dim owl I don't think you can interact with (cut)Rsc's, that's what dialogs are for
tried it also with
openMap true;
waitUntil {!isNull findDisplay 12};
findDisplay 12 createDisplay "testHud2";
but then i cant move the map and with
openMap true;
waitUntil {!isNull findDisplay 12};
findDisplay 46 createDisplay "testHud2";
i can move the map but its buggy
did you try createDialog?
ALiVE's "advanced markers" uses createDialog
but no clue if you can move the map around when it's active
no i cant when i use createDialog
what are you trying to build?
mission or mod?
mission
hhmm okay
- add a full screen control to your dialog and track mouse dragging on it, then use https://community.bistudio.com/wiki/ctrlMapAnimAdd to do map changes
- use cutRsc to display the current state of your options and when the player hovers over it (if it's detectable, it probably is though) overlay it with
createDialog
maybe there are more but that's what I can think of ๐
hmm okay.
another option is to use https://community.bistudio.com/wiki/ctrlCreate and it's related commands to extend the map display instead of creating a new dialog
@halcyon crypt not its about weight (mass in configs)
@halcyon crypt Thank you! ctrlcreate work ๐
how would i make a eventhandler if a checkbox is checked or unchecked ? (via script)
thx ^^
one question ๐ why does this eventhandler not work ?
_mycontrol ctrlAddEventHandler ["onChecked",{systemchat str _this}];
no systemchat is showing ๐
I'd try with diag_log instead
ctrlAddEventHandler ["onChecked",{diag_log format ["%1",_this];}];
?
nothing happend
@halcyon crypt
What is _mycontrol's value?
wait i think i found the error. one second...
Control#1010 is the value
didnt found the error xD
_cb_felder = _display ctrlCreate ["RscCheckbox",1010];
_cb_felder ctrlSetPosition [0.0978125 * safezoneW + safezoneX, 0.434 * safezoneH + safezoneY, 0.0154688 * safezoneW, 0.022 * safezoneH];
_cb_felder ctrlCommit 0;
_cb_felder ctrlSetChecked (profileNameSpace getVariable ["filter_felder",false]);
_cb_felder ctrlAddEventHandler ["onCheckedChanged",{diag_log format ["Checkbox checked: %1",_this]}];
_display is findDisplay 12
lose the "on"
"CheckedChanged" instead of "OnCheckedChanged"
when doing EHs by script anyway
okay thanks ๐ it works !
When using the event names listed below with the ctrlAddEventHandler, ctrlSetEventHandler, displayAddEventHandler or displaySetEventHandler commands, the prefix "on" in the name must be removed. (e.g. 'ButtonDown' instead of 'onButtonDown')
big fat exclamation mark ๐
@little eagle But why is the SliderPosChanged EVH not working ?
_slider_size ctrlAddEventHandler ["SliderPosChanged ","['size',_this select 1]execVM 'mapfilter.sqf'"];
idk. _slider_size is not a slider?
also, execVM in an event handler that can fire every frame ๐
its a RscSlider
try putting your code in {} instead of ""
tried
_slider_size ctrlAddEventHandler ["SliderPosChanged ",{hint format ["%1",_this select 1]}];
for testing but nothing happens
you'd think the game would print RPT warnings if you try to add events that don't exist ๐ค
๐
Here's a question I've had since 2012. Does the 'db' you see frequently in description.ext CfgSounds actually mean something? Does it stand for the current effects volume? I never actually tested this but I wonder..
All vehicles have the option "Rearm on 'Vehicle name'" if they have mags and stuff on their gear?
This break my vehicle/box gear protection done with Event Handlers...
๐ฆ
you can turn it off with a config
or block it with
https://community.bistudio.com/wiki/inGameUISetEventHandler
I wish there was a add version of this command, so it could be used outside of missions
Eye Mazing! A new hope! I'm trying to avoid go moddy.
hy Guys how should i Start with Scripting in Arma? is there some good Sources of Knowlegde?
@little eagle thanks for the new hope!
@little eagle thanks, im not completly new to Scripting, i worked with Lua, Python and C befor i know what the Basics are like Strings, Variables (global, local) etc etc.
but i see that i have a hard time getting an understanding on what the Syntaxes are
but i see that i have a hard time getting an understanding on what the Syntaxes are
example?
The overall Syntax of SQF and the Shaining of the Scripts
like Calling something when something else is happening
then CPP files and there part in the Mod + Pre and post init
The overall Syntax of SQF and the Shaining of the Scripts
do you know what nullary, unary and binary commands are?
player <- nullary command
vehicle _unit <- unary
_unit addWeapon "arifle_MX_F"<- binary
@little eagle i will need to dig in Arma 3 files to block this default action menu?
When i look at a Script i Understand what is Happening and what iut dous but like i said i dont understand where to start and how i Chain everything
the unary and nullary commands are evaluated from right to left.
the binary commands have lower priority, so the other ones are evaluated first
exceptions are the usual math rules. * before - and the usualy stuff with min and max
Normally you woudl have like [Serverinit > PlayerConnect > PlayerInit] but i dont really get the Method on how to start on that.
i will need to dig in Arma 3 files to block this default action menu?
maybe. but you can use it with scripting alone. Idk what the action name is. Try logging it
You mean this?
https://community.bistudio.com/wiki/Initialization_Order
Thanks a lot.
My over all comment: i dont want Efusion :P
ya and that is what the Pre and Postinit would be?
from what i know Preinit should be finished befor Postinit is doing something.
What would you recommend where i could start on? to get an understanding of Initialising a Mod and doing stuff?
What about the config.cpp?
i dont really want to do Mission stuff itself more like Arma3 life, in the Mod Direction
config.cpp just sits there. there is no execution order for that
If you want to make missions, then you can't do anything with .cpp files
you have the description.ext as config and very few configs from .cpp are supported there
like CfgSounds
But not CfgVehicles or CfgWeapons
check the wiki. it's all there...
he wants to do mods
doesn't sound like it
[5:44 PM] Zuck3rFr3i: i dont really want to do Mission stuff itself more like Arma3 life, in the Mod Direction
Life is a mission, right?
Exile for example
because everything that i would want to script would go on a Exile server
well, like @little eagle said, the wiki is your best friend
or just unpack some mods and check what they do I guess
going from level 0 to level 10 won't happen in a day
ya i did, i also checked the Wiki but lets say, i would want to create a system that allowes players to Completely Disassemble a Engine, would that be a Mod or a Mission?
i Know that like i said i have Programming experience in Lua, Python etc, i know what Booleans are, Strings, ints, floats, Eventhandlers, and allround Mathematiks
There is no magic guide to Arma modding. And if someone made one, I'm pretty sure it's bad.
Everyone that knows stuff about this has learned it the hard way by trial and error and by putting a lot of time into it.
only thing i need to know, lets say, i would want to create a system that allowes players to Completely Disassemble a Engine, would that be a Mod or a Mission?
ya i did, i also checked the Wiki but lets say, i would want to create a system that allowes players to Completely Disassemble a Engine, would that be a Mod or a Mission?
that could be both
so it dousnt matter if i create Like 100 Missions and let them run?
you're more limited in what you can do with a mission generally
you can only run one mission at a time
so i would need to get started on CPP files to create Mods?
If you want a mod, then you need at least one config.cpp file, yes
alright got it, thank you all for the Help.
how could i return itemstest and itemtest2 as array together ? try it with this
class CfgTest {
itemstest[]= {"test1","test2","test3","test4"};
itemtest2[]= {"test1_1","test2_1","test3_1","test4_1"};
};
("true" configClasses (missionConfigFile >> "CfgTest"));
but that does not seem to work
It's a config
Ah, my bad.
Do you want to return all arrays ever to be present in CfgTest?
yeah so it returns both arrays
right
Probably not the most efficient way, and not guaranteed to work as I kinda took it from a script I wrote a few weeks ago but:
private _entriesCount = (count _config) - 1;
private _array = [];
for "_i" from 0 to _entriesCount do
{
_array append (getArray (_config select _i));
};
_array```
how do you syntax in Discord btw?
append ?
The variable is named _entriesCount , but it's actually count minus one ๐
I code deceivingly ๐
@little eagle all fixed with this small code:
_object = _this select 0;
_canActOver = _object call BRPVP_checkAccess;
if !(_canActOver) then {
["You can't act over this object...",3,10,677] call BRPVP_hint;
};
!_canActOver
"];```
Uhul!
I like the syntax like this:
private _array = [];
{
_array append getArray _x;
} forEach configProperties [missionConfigFile >> "CfgTest", "isArray _x"];
_array
@tough abyss I think you need a check if the take-magazines-action was chosen.
also you have to escape the quote marks
thank you @little eagle and @thin pine
@little eagle this action name can be different for mod vehicles like CUP vehicles?
No, I think it's whatever the pick up action is in CfgActions
class CfgActions {
class None {
priority = 0;
show = 1;
showWindow = 0;
hideOnUse = 1;
shortcut = "";
text = "";
textDefault = "";
textSimple = "";
};
class Rearm: None {
text = "Rearm at %%1";
showWindow = 1;
priority = 5.1;
textDefault = "<img image='\A3\ui_f\data\igui\cfg\actions\reammo_ca.paa' size='1.8' shadow=2 />";
};
};
should be "Rearm"
"Rearm at %%1"
this is the one you mean, right?
it's not dynamic
the actions are enums in the engine. you can't have any more than what are hard coded
well except for addAction, which are named "USER_XYZ" or something like that
This UIEH is amazing, and its is from the very old days!
it sucked before KK added all these params in _this
it's only usable in A3 really
And the function is only a setter. no mod compatibility at all
I'd make a wrapper for CBA, but having that would break all the missions that use it bare
So not worth it
I wouldn't recommend it in a mod. You'd overwrite or be overwritten by other mods / missions
For a mod I would just disable the action
it's not like anyone uses it anyway
I had to disable it once for ACE
because it bugged out our items
to have ACE items be shown in the Arsenal
they have to be minedetectors with 0 detection range
long story
but the mine detector was broken
and it was added as a secondary weapon instead when using "Pick up"
ok it wasn't "Rearm at", but a similar action
basically this bug:
https://forums.bistudio.com/topic/151099-scripting-discussion-dev-branch/?p=3119626
Page 57 of 58 - Scripting Discussion (dev branch) - posted in ARMA 3 - DEVELOPMENT BRANCH: Wrong? Wrong it was removed? I dont think so. Wrong it was duplicating functionality? This is why it was removed. You said: >playerControlled was added and removed because it was duplicating existing functionality. If I remember correctly you could get the same results with cameraOn. But the changelog says: >Arma 3 1.24: New command playerControlled (like the playe...
If you want to disable the action, and can afford to make it a mod
class CfgActions {
class None;
class Rearm: None {
show = 0;
};
};
this will remove it essentially
not sure if AI can still use it. no idea
This is a lot better to do, but i just come from mod version of BRPVP to mission version due to make things simple.
People was having trouble to activate the mod.
(now they have trouble to deactivate others mods.... :P)
I wouldn't recommend it in a mod. You'd overwrite or be overwritten by other mods / missions
For a mod I would just disable the action
you have to keep this in mind
that's all
someday they'll make the add version
or not
@little eagle i will clain BRPVP not to be compatible with other mods unless i make those basic checks.
And necessary workarrounds.
I don't think there is a way to work around this
You can ask BI for something, but they're busy flooding the library with commands no one asked for
https://community.bistudio.com/wiki/isRemoteExecuted
https://community.bistudio.com/wiki/isRemoteExecutedJIP
Those two functions return true or false? BRPVP_func1 = {if (random 1 < 0.5) then {true} else {false};}; BRPVP_func1 = {if (random 1 < 0.5) then {true} else {false}};
What differs then are the ";".
@little eagle but i can make my players/server admins aware of the side effects
or even turn of it in my side
if (random 1 < 0.5) then {true} else {false};
there is no point in this construct
might as well be
random 1 < 0.5
the last ; is optional at the end of a scope
Some leave it out to indicate a return value, but it's not strictly needed.
the last ; is optional at the end of a scope
Some leave it out to indicate a return value, but it's not strictly needed.
they differ from a ";"
I wrote the answer
i see
Sorry
I noticed sometimes i use it, other times not. Small shock.
Now everything explained. Thanks a lot.
check out this example:
my_fnc_addToArray = {
params ["_array", "_value"];
if (_value in _array) exitWith {};
_array set [count _array, _value];
};
my_fnc_addToArray = {
params ["_array", "_value"];
_array pushBackUnique _value
};
the first one has no return value. the last statement is ended with a ;
the second one reports the new array size. it has no ; at the end of it's scope
yes it has
pushBackUnique reports the new position (or -1 if it's already in)
it's not needed this way, but that's what some do
This is ok too:
params ["_array", "_value"];
_array pushBackUnique _value;
};```
Wait, it will not return value?
it will
ah... ok.
it's just a convention for readability
since SQF has no return command (bar breakOut constructs)
it just returns whatever the last thing in it's previous scope was
yes
Not sure where i readed this ";" could cause problem... not in the wiki (or it was updated).
it won't cause problems
it just looks a bit weird as it's not at the end of the line in that case
Can i use Regex Replace in Notepad ++?
I need to round numbers in a array of numbers, 35000 elements (numbers) on the SQF file.
This to make the mission file smaller
Since i have 12.3563453453 but 12.35 or 12.36 is enough
Just asking... if not i will make Arma 3 do it.
i was able to find .356345(...) but not change it
The same question at stack overflow: http://stackoverflow.com/questions/7584113/rounding-using-regular-expressions
@tough abyss You can yeh, there is an option to tick
private ["_reserved_units"];
waitUntil {!isNull player};
waitUntil {(vehicle player) == player};
// Variable Name of the Player Character to be restricted. //
_reserved_units = [xxxx];
if ((player in _reserved_units) && !(Authenticated)) then
{
[servercommand password] serverCommand format ["#kick %1",name player];
}; ```
Why does it not kick someone off the server?
do I need to use #exec [servercommand password] serverCommand format ["#kick %1",name player]; ?
serverCommand has to be executed on a machine that has admin rights
or the server if you use the alternative syntax and a password that is written in the server.cfg
well main thing I need it to do is kick someone from a script :/
How would you suggest I do that?
{findDisplay 46 closeDisplay 0} remoteExec ["call", _unit];
or just:
findDisplay 46 closeDisplay 0;
if the script already runs on the local machine
does that kick people off the server or to the lobby?
lobby
hm what about off the server?
idk. I don't think something like that exists
I can crash the game if you want that, haha
hmmm.
I have infistar running, so I could give them a public variable that is in the array of badvariables and have that kick them off
but rather not depend on it..
well, how does that kick them?
something like this maybe? [ _target, "fnc_forceDisconnect", _target, false] spawn BIS_fnc_MP;
it's just a script, you could copy their method
what is fnc_forceDisconnect ?
you could use that line too
fnc_forceDisconnect = { sendAUMessage [[netId _this], "ConnectTo: 127.0.0.1"]; };
this is what google found
But I'm pretty sure sendAUMessage is scraped or not implemented
probably. The problem I'm trying to get rid of here is people using a locked slot (e.g Raptor Team Leader [ 160th Locked ]) but they ignore it and think they are entitled to use it. However it kills them and puts them back into the lobby, however they just join in it again. This causes a huge pile of bodies inside the spawn area...
it's really frustrating when keeping some order on the server
Perhaps instead, you could use a titleText to block their screen with a "This slot is locked" message?
but they'd still be in there
I'm trying to give them a message and then kick them off the server as people just ignore the warnings
Was just about to recommend https://community.bistudio.com/wiki/serverCommand
I was thinking a local sidechat message actualy
yeah that's the problem
the check is local
wouldn't know how to make that serverside run constantly
can I use your code in a local script?
nah, on the machine with admin access
not sure about the alternative syntax though
Idk. To me it sounds like you'd want to kick them into the lobby if they chose the wrong slot. that way they can at least choose a different one
not in this case. I've had too many people just spamming the slot to join
20 bodies in the spawn is too much
I think you're tackling the wrong problem
I've used the soft approach for too long
why not delete the corpses?
it does that after a few minutes, but the player will just keep joining and joining and the script will keep killing him and sending him back
like he thinks he can break it after a few tries
Sounds like someone really dumb or really bored
actually looking for something that prevents them for spamming the slot
one day I'll hook into the lobby ui
but it will probably require a mod
We already took over the main menu in ACE. It should be possible
there are no ui threads
Wasn't onEachFrame running one more frame when you exit into the lobby?
Go hardcode, script your own lobby
lol
well, that should solve it
Yeah, will use skipLobby and everything handled by the mission scripts
Apex campaign uses exactly that
And that's why skipLobby was made
okay so I've a mean way to deal with it
Actually, working on same thing for OA as well (lobby is filled with dummy slots though)
And going to have character selection screen:
http://images.akamai.steamusercontent.com/ugc/394421705865197602/A029B71BB31B197BF93D26A7976397632CB3E99E/
Infistar scans on bad variables. Added one to the list called slot_spam. If someone joins a locked slot, I code slot_spam = true; publicVariable "slot_spam";
That should get them kicked off
@tough abyss will above code assign slot_spam to only the player or every player on the server?
Just do everything through server and you'll be fine
Ask server, whatever pvar gets there first gets the slot
woops
thanks
almost risked a kick on the complete server population
because with 30-35 players on the server I can't check everytime who's joining a locked slot and ban them
is it possible to run the check serverside instead of local?
running that in initserver?
ah right
yeah I'm looking for something that works without the badvars list, something I can implement on missions without Infistar
For now the screen just goes black, their input is disabled and everyone gets a message that the player joined the locked slot and a request to admins to ban him
@dusk sage @split coral thanks a lot.
@meager granite this nice thing is for what mod/mission?
Also you did your own object ocllusion?
Arma objects oclusion dont work with user spawned objects?
@tough abyss is it possible to forward a name to the server so it can be used in a script there to kick a player?
of cause
@tough abyss but, sorry, i wasn't asked, and i don't know the circumstances , depending on those it may not be possible.
is it in an sqf script local to the client getting kicked ?
is the kick demanded through sqf code ?
Basically once a player joins the server it is assigned true or false for a boolean (initplayer). If they join a certain player slot that is locked, I want some script to warn them and then kick them off the server, however this script seems to be needed to run serverside to function with the server commands
You can use endMission locally
Without needing to pass to server
But if you insist on doing that, you need to use remoteExec
true but players will just rejoin in the locked slot
And get returned again?
It won't make a difference if you kick via server or endMission locally
Unless something funky is happening
endMission allows them to rejoin, doesn't it?
can you change something on the basic problem ?
that there are slots that some arent allowed to use ?
Yo so when i try and put down the A3L prison gate, the big on. Then it says, when im on my server "Plant C4 Charge", and there is 5 cops online, and do have all the stuff to do it, but why does it not work?
it's literally 'Raptor XXXXX (e.g grenadier etc) [ 160th LOCKED SLOT ]
Can't tell them any more
so, its a mil sim, with special people and abiletys.
yes
interesting.
is it public ?
ok, so its not eventbased, and you want perk slots for vip.
You can create a function that kicks the calling player, then use execRemote to call from the client on the reserved slot check
no it's basically just reserved slots for unit operators
how about i make you call that func ?
would be awesome
i could kick who ever i like .
I'm still learning a lot on the ArmA 3 scripting
yeah but we have 30-40 people on the server so logging in as admin and finding the names and then kick takes too long
You can disallow that in the description.ext RageBone
considering remoteExec lockdown, that could be ok, but ho do you get the person to kick ?
i cant remember magic vars that tell you who remote called that
well
Something like [player] remoteExec ["my_fnc_kickMe", 2]
serverCommand format ["#kick %1",name _player];```
it's not the bodies I'm against. They are taking up slots for members
you get the Unit, you can delete it there
so kicking is the only option
how big is backend, in terms of extensions and persistency ?
?
extDB ?
well, extDB has RCON capabiletys, and you could cause a kick through that
is a DB Behind it ?
probably not
no, nothing connected to it
If you use my remoteExec solution, be sure to set it up with allowedTargets = 2; so it'd be harderfor players to kick other players.
As documented: https://community.bistudio.com/wiki/Arma_3_Remote_Execution#Config_location
I have no experience setting up FNCs
Actually, would using the initPlayerServer.sqf event script work? Since it's run on the server, every time a player joins.
https://community.bistudio.com/wiki/Event_Scripts
OPC reports no unit
nope
Oh jea, owner is that what i use
initPlayerServer.sqf gets passed the player object
oh jea. you are right +
which file goes first, initplayerserver or initplayerlocal?
the "same time" one on server, one on client
problem: its local in the mission
_infoSquad = _infoArray select 0;
_squad = _infoSquad select 1;
_infoName = _infoArray select 1;
_name = _infoName select 1;
_email = _infoSquad select 2;
//--------------------- Reserved Slots
Authenticated = false;
if (_email == "XXXXXX") then {
Authenticated = true;
};``` would that work in initplayerserver?
otherwise Authenticated is not assigned before the script is run
Problem: Auth var global
fair enough..
which file goes first, initplayerserver or initplayerlocal?
undefined. they are two scheduled scripts that run against each other and even are on different machines
initPlayerServer.sqf would look something like:
params ["_player", "_didJIP"];
auth_check = {
/*CODE*/
}
private _auth_result = [] call auth_check;
if (_auth_result ) then {
serverCommand format ["#kick %1",name _player];
};
the full code into the if?
_auth_result a bool?
_infoArray = squadParams player;
_infoSquad = _infoArray select 0;
_squad = _infoSquad select 1;
_infoName = _infoArray select 1;
_name = _infoName select 1;
_email = _infoSquad select 2;
//--------------------- Reserved Slots
private _authenticated = false;
if (_email == "XXXXXX") then {
_authenticated = true;
};
_authenticated
};```
ah right!
auth_check = {
_infoArray = squadParams _player;
_infoSquad = _infoArray select 0;
_squad = _infoSquad select 1;
_infoName = _infoArray select 1;
_name = _infoName select 1;
_email = _infoSquad select 2;
//--------------------- Reserved Slots
private _authenticated = false;
if (_email == "XXXXXX") then {
_authenticated = true;
};
_authenticated
};
private _auth_result = [] call auth_check;
waitUntil {!isNull player};
waitUntil {(vehicle player) == player};
// Variable Name of the Player Character to be restricted. //
_reserved_units = [s22,s40,s44,s42,s41,s46,s43,s45,s47,s32,s34,s38,s39,s35,s37,s36,s33,s3,s4,s2,s5,s6];
if (!_auth_result && (player in _reserved_units)) then {
serverCommand format ["#kick %1",name _player];
} else {
_GlobalHint = format["<t align='center' size='2.2' color='#FF0000'>%1<br/></t><t size='1.4' color='#33CCFF'>%2</t><br/>has joined the server. To get involved, visit TS.JSFAR.COM</t><br/>",_squad,_name];
[_GlobalHint] remoteExec ["AW_fnc_globalHint",0,false];
};```
remove line 3
I saw a couple of dancing videos in arma 3? How does it work? It's animation activated with scripts?
line 4, change to _player
corrected^?
@tough abyss yes, normaly Life servers with some scripts for that
Looks good to me. Now all that's left is to try it.
I assume the real code has a series of if (_emails ?
Can I find the animations in the animations viewer in the debug window?
Are they located there?
Not sure I can combine it like this? ```params ["_player", "_didJIP"];
auth_check = {
_infoArray = squadParams _player;
_infoSquad = _infoArray select 0;
_squad = _infoSquad select 1;
_infoName = _infoArray select 1;
_name = _infoName select 1;
_email = _infoSquad select 2;
//--------------------- Reserved Slots
private _authenticated = false;
if (_email == "XXXXXX") then {
_authenticated = true;
};
_authenticated
};
private ["_reserved_units_admin", "_reserved_uids_admin", "_uid_admin"];
private _auth_result = [] call auth_check;
waitUntil {!isNull player};
waitUntil {(vehicle player) == player};
waitUntil {(getPlayerUID player) != ""};
_uid_admin = getPlayerUID player;
_reserved_uids_admin = ["some UID"/* Me */];
// Variable Name of the Player Character to be restricted. //
_reserved_units = [s22,s40,s44,s42,s41,s46,s43,s45,s47,s32,s34,s38,s39,s35,s37,s36,s33,s3,s4,s2,s5,s6];
_reserved_units_admin = [s1];
if (!_auth_result && (player in _reserved_units) or (player in _reserved_units_admin)&& !(_uid_admin in _reserved_uids_admin)) then {
hqSideChat = format ["Player '%1' tried using a locked slot! He will be kicked off this server.", name player];
[hqSideChat] remoteExec ["AW_fnc_globalSideChat",0,false];
serverCommand format ["#kick %1",name _player];
} else {
_GlobalHint = format["<t align='center' size='2.2' color='#FF0000'>%1<br/></t><t size='1.4' color='#33CCFF'>%2</t><br/>has joined the server. To get involved, visit TS.JSFAR.COM</t><br/>",_squad,_name];
[_GlobalHint] remoteExec ["AW_fnc_globalHint",0,false];
};```
what script file is this?