#arma3_scripting
1 messages ยท Page 362 of 1
I used actionkeys
// Add keydown eventhandeler to the display
private _keyDown = _display displayAddEventHandler ["KeyDown", {
params ["_ctrl", "_dikCode", "_shift", "_ctrlKey", "_alt"];
// if ctrl + J is pressed
private _keys = (actionKeys "tasks");
if (_ctrlKey && {(_dikCode in _keys)}) then {
keyDown EH might be better in some cases than waitUntil that other thang
So I was actually able to implement the InputAction thing
Im using it with push to talk, problem is it calls the script again if you press and release a key while holding another
so like
Capslock held -> in script called
Capslock still held + W -> nothing
Capslock still held, W released -> out script AND in script called again
Capslock released -> out script called
keydown EH might be worth a try
Sorry but, BIS function "BIS_fnc_EXP_camp_IFF" still available? where can I find the description?
Author: Thomas Ryan
Description:
Simple handling of the Support Team's scripted IFF.
Must be executed locally.
Notes:
- To always show the icon and name of a unit, use: <unit> setVariable ["BIS_iconAlways", true]
- Otherwise, icons can be hidden with: <unit> setVariable ["BIS_iconShow", false]
- And names can be hidden with: <unit> setVariable ["BIS_iconName", false]
Parameters:
_this: ARRAY - Array of Support Team units.
Returns:
True if successfully initialized, false if not.
*/
u can find it in the function browser.
thx, @robust hollow ๐
CfgDebriefingSections
Can this be custom for each side anyhow?
Anyone have experience?
Nvm I thought it can't be changed, but it can
@tough tartan Id simply assume the variable is true at the start?
Maybe check against that with a diag_log / systemChat
The syntax, at least, is correct
wait
I think I found my issue
no ๐ฆ
Even when I use [] spawn {}; it still bypasses the waitUntil
unless I'm using the spawn feature incorrect
did you log the variable's value?
what do you mean?
dump the value of testVar using diag_log or systemchat or whatever
it might simply be true
oh wait no, it's not seeming I just use the watch feature in debug to check the status of my variables
I've made sure
Essentially what I am trying to do, is when the script is executed it adds a KeyDown displayEventHandler to the player, and when it is used once it deletes it using displayRemoveAllEventHandlers, I just can't get the waitUntil to work
although I am using [] spawn {};
and yes, when the event handler is used it changed testVar back to false
I've just tried using [] call {}; instead of spawn, and still not working :/ I'm confused lmao
youre spawning the entire thing, right, and not just the waitUntil?
Yes
did you add some diag_logs to output the value of the player getVariable?
Maybe spawn and call don't work when executed in debug console? Only in a sqf file? Also about the output values, I'm just using the Watch section on the debug console which is the exact same thing
if the waituntil doesnt wait, that variable simply is true, and youve made a mistake in the way you structured your script
debug console works fine
so the watch fields show false ?
yes
and youre sure the part with the waitUntil is actually running?
Yes
I've just added an extra line below the waitUntil which simply hints me the word "test", and as soon as I execute the script I get hinted "test"
so clearly it's not waiting
can you also log the value of canSuspend from there?
Most certain, but If I'm correct that value isn't defined anywher?
its a command
then you cant wait
yes
and the code is in an unscheduled environment
But doesn't [] spawn {}; fix that?
yes
I am using spawn
then youre testing an old version of the script
if the code containing the waituntil is spawned, you can suspend
with the sole exception being if you wrapped it inside an isNil CODE check
It's not
the sole exception is the isNil check
then the bit containing the waitUntil isnt spawned
then you might be editing / testing in different locations
this is a hard rule, im afraid - spawned code can suspend barring minor exceptions such as the isNil command (and i dont know any other commands that allow that)
youre sure the waitUntil isnt inside the code argument of an addeventhandler inside the spawned bit?
[] spawn {
player setVariable ["AABBCC",false];
waitUntil {
sleep 1;
systemChat "loop";
player getVariable ["AABBCC",false];
};
};
[] spawn {
sleep 15;
player setVariable ["AABBCC", true];
};
Execute that in the debug console
wait I just tested, it has to do with the string inside of the waitUntil
seeming when I change it, in this case I changed it to waitUntil {not alive player}: it waits
I executed that and has script erros
apparently it is missing a '{'
It has to do with trying to check if the variable is false or not
I fixed it
waitUntil {!(player getVariable "testVar");};
Yea i see it
that works
I tried that before I even asked on the A3 discord but clearly wasn't spawning the script
that just implies your variable didnt have the value you expected it to be
now you wait till its false, instead of true
I always wanted it to wait until it was false
and always had it wait till it was false
then
waitUntil {player getVariable ["TestVar", false]}; is syntactically wrong, this stops waiting when testVar is true
Hence why i asked if it showed as false
That explains it
I got told by another person on this discord that ```
waitUntil {player getVariable ["TestVar", false]};
vice versa for waiting for it to be true
then my bad, it would of worked if I just changed the false to a true
but then why did you say the variable showed false
im very confused
you said it being false was expected, but you also expected to waituntil to keep looping even if it was false?
but you also wanted to stop waiting when it was false
no no no
From the start I wanted it to waitUntil the variable was false, but I was using the incorrect syntax and had it waitUntil the variable was true
thats why even with the [] spawn {}; it wasn't working, because the variable was set to false (which is correct) but it was waiting until the variable was true
I'm still confused why you were fine with the watch field showing false then
I asked specific questions to check what it should be, including you logging the value, and now it turns out like this ๐
Well I told you everything that you needed to know, which was correct information. Seeming my script is layed out when it is first executed it defines the variable to true, then adds a KeyDown EventHandler to the player, and when that EventHandler is toggled it sets the variable to false, then after the keyhandler is added to the player the waitUntil waits still the variable is false, meaning the player toggled the event handler.
When you asked me to check the value of the variable I checked it after I toggled the EventHandler, meaning the variable was false. Expecting the waitUntil to wait till the variable was false, but I had the incorrect syntax so it was waiting for the variable to be true, hence why it wouldn't work
I mean its all solved now, but thats why i specifically asked you to log the value from the script itself
Im not mad but let that be a lesson that doing that is good practice
That's besides the point, the only issue here is the lack of communication seeming I asked if the waitUntil waits till the variable was true, thinking it waits till it was false. I didn't clarify what I wanted. That is why you are confused
Overall thanks for the assistance, and I will try to be clear with my questions next time ๐
Okay, I am stuct on another task. Is there anyway I could teleport the player directly infront of him, in the direction that he is looking?
I've tried using modelToWorld but that only works based off of axis
and not direction
the alternative getPos syntax or indeed modeltoworld
player getPos [10, getDir player] or player modelToWorld [10,0,0]
I also thought to create a marker directly infront of the player, and just set the players position to the marker, but don't know how to get the position which is infront of him
I'll try that
thanks
_pos = player getPos [10, getDir player];
player setPos _pos;
``` Works like a charm, thanks!
Strange, it works but also throws me into the sky 200+ meters.... lol
Any ideas?
Don't worry, managed to fix it by playing around with timing
getPos / setPos are wierd if youre standing on objects
player setPosWorld (player modelToWorldWorld [10,0,0])
I'll try that!
That also makes me fly, strange
I managed to get it working so I'll keep with it. Thank you again for your assistance ๐
player setPosATL (getPosATL player vectorAdd (vectorDir player vectorMultiply 10))
theres probably a way to make it even more complicated
omg hahahaha
I'm just using getPos / setPos with a sleep time of 0.001 just before the players position is set so it stops the random act of shooting the player into the sky and essentially looks instant.
@indigo snow @modern sand you could also pick modelToWorld position as it takes into accord all the directions of the model.
i already did that above
i also did modeltoworldworld, got the unicorn out of the stable
@astral tendon what are those?
animations?
yes
[delet1,LEAN_ON_TABLE,"ASIS"] call BIS_fnc_ambientAnim;
you need quotes around LEAN_ON_TABLE
its supposed to be a string, not a variable
check the examples
your keyboard might be in the wrong language mode for some wierd reason
try pressing CTRL + SHIFT a few times and trying in between
its the hotkey to switch keyboard language mode iirc
otherwise dive into your windows settings i guess
might have two input languages set
well, my windows is set in english were originaly was brazilian portuguese
of couse, im using a south american like keyboard
Sure but that wont be meaningfully different from the other versions, right?
Saves you a command for direction, tho
actually it does not.
How on earth do I check if player was run over by vehicle?
Nvm
I guess manual if work
maybe with epeContact EH
What epeContactStart doesn't work with ACE?
@astral tendon its 2:1 so 1024x512
@subtle ore it should, but I can just use lastdmgsource and do a couple of if and it'll be ok
Only issue is grenades
I'm trying to get a globalChat message to be sent to all clients whenever a member of a group is killed. This is my code (in init.sqf):
if (group _x == church) then {
_x addMPEventHandler ["MPKilled", {
[_x, format ["This is %1 at the church, does anyone hear this? Please, stop shooting us!"], (name _x)] remoteExec ["globalChat", -2];
}];
};
} forEach allUnits;```
The above works (with some modifications) with `hint` and even `systemChat` but I can't get `globalChat` to work. I've tried replacing the `_x` with `_this select 0` just before the `format` but to no avail. Where am I going wrong?
@peak plover meehhh, hardcoded stuff feels safer to use imo
19:13:29 Script command setOwner cannot be used for object 'LOP_ChDKZ_BMP1'. Use setGroupOwner instead.
Hmm ๐ค
In theory setGroupOwner should not be used on vehicles
I do a check for isKindOf "CAManBase"
๐
The point of that message is to tell you that you should use setGroupOwner on grouped units.
is there some hidden animation for BobCat crane ?
lowering crane to de-mine minefields
@real tartan look at the animationSources entry in the bobcat config. You will find it all there
Yep, you can do any value between 0 and 1. Ive made it go to 0.25 before and it works quite well. It's a phase
I'm really bashing my head against the wall, I cannot seem to get this exceptionally common command to work on my weapons shop; " [player, "Weapon_arifle_MX_F", 3] call BIS_fnc_addWeapon; " I really have no clue, I have used the old school addweapon individually etc any ideas?
yea that looks correct, but Id just use the normal commands personally
player addWeapon "Weapon_arifle_MX_F";
If that doesnt work theres a mistake somewhere else
that certainly looks like a better classname
I actually thought that but there classnames in 3den were listed as weapon_ ..will verify now.
the name in 3den isnt the actual weapon classname
(the one where you place it from the right hand menu)
thats actually a weapon holder object, that contains the weapon
player addWeapon "arifle_MX_F";
Oh ok, I wouldn't of known that as usually don't pull them out of 3den. This is why you need another pair of eyes, thanks guys for such a silly error
just cut the prefix, for vests its Vest_V , for backpacks its the same one tho
Noted - Any idea why BI did that in 3den?
because the thing you place in 3den is actually an object / vehicle
and actual weapons live in cfgWeapons and are only ever really strings
its to do with how the inventory system works
Cool, once again thanks for the help and quick response
seeing as I helped solve a problem, anyone have an idea why I'm stuggling with my thing ๐ ? (See 17:23 today)
_x doesnt exist within the {} of the event handler
^^
just realised it won't be the same timestamp for everyone else... wish you could link to chat messages like in slack ๐คฆ
Just had the same issue when creating Kill Currency not 2 hours ago
yeah i've tried them with the this select 0 as well:
format ["This is %1 at the church, does anyone hear this? Please, stop shooting us!", (name (_this select 0))] remoteExec ["systemChat", 0];
[(_this select 0), format ["This is %1 at the church, does anyone hear this? Please, stop shooting us!"], (name (_this select 0))] remoteExec ["sideChat", 0];
format ["This is %1 at the church, does anyone hear this? Please, stop shooting us!", (name (_this select 0))] remoteExec ["hint", 0];```
Of these, hint and systemchat work
probably the issue with the binary format for remoteExec, then
yea thats it
check the array of the first line
it has 3 elements
the format isnt parsed correctly
[
(_this select 0),
format ["This is %1 at the church, does anyone hear this? Please, stop shooting us!", (name (_this select 0))]
] remoteExec ["globalChat", 0];```
^should work
(although you should properly aim it at -2 instead of 0, the server doesnt need chat)
testing now
proper indentation management my dude
yeah i started with -2 but switched to 0 in desparation
You'll kill the server by asking it to display a chat message. /s
My server hates me so much it'd probably embrace the sweet release of death
You probably waste more energy by putting either the 0 or the -2 there.
@indigo snow works thanks for the help!
in the vein of modeltoworldworld we need a globalGlobalSay
What for? You have remoteExec to do it.
That was the point.
Ah, fuck. Tired. Should be globalSayGlobal.
Server does not die on chat message
D-did you just try that or what?
Shows up on display
No, I've got a debug message on there
*not display
The tiny window the server has (console) or whatever
Atleast on the hc.... My ai script has a constant systemChat
I don't understand why people are so careful about putting the -2 in remoteExec for systemChat etc.
Don't wanna put more pressure on the server ๐
100 broken scripts running on amd athlon 64 server, Don't wanna make it run any slower than it is
/jk
That's the thing though. You probably create more work by specifying the -2
Instead of letting the systemChat or whatever just fail.
It's so little that it doesn't matter. Yet people go with the more complicated thing. It's really weird.
well -2 would exclude a listen (player) server, so it shouldn't be done anyway. at least here
Ohh, okay. So -client means chat works. https://i.imgur.com/CVFfJZG.jpg
[] spawn {
if (!hasInterface) then {
while {isNil "stop_loop"} do {
systemChat "SPAM";
};
};
if (hasInterface) then {
sleep 1;
missionNamespace setVariable ["stop_loop",true,true];
};
};```
not the point
point is, systemchat kills server FPS
๐
a while loop with systemchat turn server fps from 300 to 170
The loop alone does, because it has no sleep. You could put any command there...
๐คฆ
I'm sorry, having a bit of fun ๐
300 server fps tho ๐
Yoiu know it ๐
This also confirms that using systemChat on the server makes you lose 130 server FPS!
That's almost 3 servers per server.
Is that one dude on the bif thread still mad at dedmen for releasing this?
Yeah I don't get that guy
would side or side group _unit work with onKilled?
or does onkilled mean that it's already a civilian and not in the group anymore?
Or sideemtpy or sth
side group should work
it doesn't work for killed or mpkill event handlers
w-wha?
What do I do now?
I know. I will set side on unit as a variable
on postInit
This way I will always have a side
what I did since that wasn't possible because of locality was just get the side from the unit's configuration
only works if the unit is on it's original faction's side though
_unit setVariable ["unit_score_side", (side group _unit),true];```
Ohh I got an issue...
Vehicles
Hard to keep a track of their side....
use the config
that is the only solution I can think of
yeah, I guess fuck vehicles ๐
vehicles would have to stay on their own sides
Only scalps
I am pretty sure the dead unit stays in it's group for a short while and you can use side group _unit just fine in a killed eventhandler.
hmm, that might be true because, EH is unscheduled
okay, good, this way I won't have to! Thanks!
hmm, I'm having a brainfart
["CAManBase", "initPost", {_this call score_fnc_unitInit}] call CBA_fnc_addClassEventHandler;
global?
only on server?
local?
From What I read, "It's kinda like init box"
So global?
The event will fire on every machine that the function was executed on.
So If I run that on the server... it will run my function on all the clients as well?
For*
No, because you only ran the function on the server, the event will only be executed on the server.
I ment to say for. So when a player connects, and his unit is created, the initPost fires on the server and runs the function on the server?
If AI is disabled then the unit is created on the server when the player picks that slot.
Yes, agreed
So as long as this function was executed on the server, the initPost event will be executed when the player picks that slot.
on the server.
Gotcha, I'll put that line on the server,
- addClassEH
- unit/player object is created
- initPost EH runs on the code on the server
this way I'll just use MPKilled on server for keeping score
EH will still trigger globally only once.
I don't believe that
Run it before the first objects are created.
I've got the cba addClass in preinit
Good.
I've got 2 paths now.
- add a
killedeh using remoteExec from server - add a
mpKilled(means it's added to everyone)
This feels so stupid ๐
What are you trying to do?
keep score
Deaths or also who killed them?
Considered to use this?
addMissionEventHandler ["EntityKilled", {
params ["_killed", "_killer", "_instigator"];
}];
๐ค
That looks perfect
Still need to initpost the side... but that one will solve the killed eh
Thanks!
I still don't believe that is necessary, but w/e.
1 setVariable is the least of my worries...
can someone explain to me the main advantages for defining classes inside SQF? i find interaction with them still a bit awkward especially if they're extremely simple?
There are no classes in SQF.
.cpp?
looks at commy2, looking for the "elaborate" button
You asked for classes in SQF, but there are none. There are people who would like to have them though for whatever reason.
You can probably just use classes in your description.ext if mission making...
well i see missions where people define lots of classes in hpp files
i kinda get what they're doing
but not why
What's the difference of cpp and hpp
one has a c, the other an h
so... same?
who knows.
.hpp is used as #include'd file for .cpp (or description.ext).
H for "header" I think.
#define PLUGIN ace3
#include "..\..\..\engine\macros.cpp"
#include "..\settings.cpp"
oops
It really doesn't matter how you name them.
#include "settings.sqf"
lmao ๐ฆ
And people split their configs in multiple files so they don't get large and are easier to edit.
I like using include for doing settings separately. So I only edit settings, everything else is static
According to Github, the official โข header file extension for sqf is .hqf
That's because Flummi and I made it up 3 years ago.
https://github.com/github/linguist/blob/master/lib/linguist/languages.yml#L4025
๐๐ฟ
https://github.com/github/linguist/blob/master/samples/SQF/fn_remoteExecFnc.sqf
This brings back memories.
is there a way to allow the player to keep map control while a custom dialog is open?
Not opening another dialog.
cutRsc or createDisplay
Yep.
That works, thanks
@peak plover wtf, they have skin tones for different thumbs up? Lol.
That's why discord is so populard
when I open another display dialog from the original, is there a way to make it hide the previous dialog like it does when it's created with createDialog?
with createDisplay they simply stack on top of one another
๐ ๐ฟ
santa skintone 5 is exactly what I was looking for thanks
yw
thought it was skinetone 3 but I appear to have been incorrect
My understanding for config files in mission are .h (stem from C language) and .hpp (stems from C++). Both could be used from the viewpoint of C++ since C headers are viewable through c++ so game must have C++ engine. Both are header files used to define classes. .cpp are config class definition files for mods wich have not yet been finalized-editable/still in developmant to bin format(binerized) .bin.
nvm I forgot to change the actions for the dialogs in my new mission file
so .h or .hpp is okay in mission (function the same way). Anyone ever use or tried .cpp in mission? I don't kow if that works.
Missions use description.ext for their config and you can include everything you want. File extensions are just part of a filename.
so you could do
#include config.cpp in description.ext with what is normally in description.ext and have an extra file for absolutely no reason?
"Missions use description.ext" much like header files can include libraries in c++ , but can you define classes in any file type extention?
Yes you could, Rylan. But you probably make things confusing by using this unrelated name in the "wrong" place.
but can you define classes in any file type extention?
You can include anything you want. Extensions are just part of a name...
I'd suggest using something that your favorite text editor understands as c++ and the code highlighting works properly. So .hpp
Hi, does anyone know any server addon or mission file script that will warn players of incoming missles? All I found was this from someone's mission file with a initplayerlocal call https://pastebin.com/eZvrMQZH although seems like he has some serveside addon that has all the defines in it..
This script works out of the box.
this addEventHandler ["IncomingMissile", {hint "Incoming Missle"}];
would copying and modifying the entire high command system to give more options for modification be a good idea?
I would say only if you make good progress and added features, give it back to community and makeit better then any already outthere. Oh and don't get Diabetes i n the process because of it, then yes.
I am not making it to release to the community as an alternative, but as a specialized version for a gamemode I am making
RTS functionality
so private?
No, just not to be used as a replacement
private would be lame
if it's public, people could make missions with it
which would be nice
k best luck to you. stay healthy.
also once this is done I will create a modified zeus that integrates with it as well
if I get that far
anything already done or just conceptual atm?
The basic mission framework is done.
You can collect resources, buy units or groups, supply drops, vehicle drops, manned vehicles, and command them around with high command. You can also remote control friendly units
Multiplayer compatible
but having modified high command for more direct and polished integration would make things much better
less confusing for players
my biggest issue right now is coming up with a mod name
ArmA-Time-Strategy?
ArTS for short
knida sounds like warfare? how much to buy an AI person?
varies depending on class
high class then
right now for vanilla NATO units, lowest is 50 and highest is 200
50 is for pilots and crew members, stuff like that, highest cost is for AT and AA specialists
I'm totally gonna start writing .hqf scripts ๐
Number cannot accurately represent integers above 16777216 (2^24)
Does this mean distanceSqr is inaccurate AF?
if you go that high.. yes..
distance has the same issue. as it's just the sqrt of distanceSqr
taking the sqrt of a inaccurate number doesn't make it more accurate
distanceSqr will be 100% accurate for distances <4km... and being inaccurate doesn't mean it will be out by several hundred meters
Yeah... I guess it's fine
btw @still forum does sqf [player, true] call TFAR_fnc_forceSpectator;
have to run in non-sched?
Either that or there's some other issue on my end
I remember.. I wanted to look by "Atom" crappy editor didn't want to open any file
Answer is. It doesn't matter.
All that function does is set 2 variables via setVariable
Okay, so it's something on my end
https://community.bistudio.com/wiki/setFriend and getFriend
might be buggy in arma
Anyone ever use?
Hmm, awesome
It works
Last time I used it was like 2 months ago though
But it didn't cause me any problems
Setting the civilian side to be the enemy of any other side will result in the other side attacking inanimate mission editor placed objects such as empty vehicles and static objects, since these objects belong to the civilian side.
I though that's what sideEmtpy is for
civilianUnit setFriend [west, 0];
Some kind of undocumented alternate syntax?
I kinda feel like the documentation for side stuff is outdated
Oh yeah.. it sounds like setFriend takes side or object as left argument
It doesn't though
https://github.com/intercept/intercept/blob/cd971f2e027c9f8bd106fbcdd38a54882c4c5a3d/src/client/headers/client/sqf_pointers_definitions.hpp#L1963
only takes side on left and array on right
maybe the game can automatically convert unit to side? That would be new to me
Hi, for some reason the line below does not work in my init.sqf, any help? :
if (isEngineOn _OK_F_35C) then {hint "on";};
What are you trying to accomplish with that?
where is _OK_F_35C defined?
@still forum above that I put _OK_F_35C = _this select 0;
init.sqf doesn't have _this
so how does it work with any other scripts in that file? O.o
do
systemChat str _OK_F_35C;
Oh boy.
it is init.sqf for a vehicle
There is no such thing as "init.sqf for a vehicle" there is only one init.sqf and it is for a mission
init.sqf is for a mission.
ok, I know nothing now.
If I don't know what to do, I usually think about:
What am I trying to accomplish with that?
Or set a variable name to your plane and
_plane = myplanevar;
I am trying to make a simple line that will activate when the engine of jet is on, then make a simple timer counting to 5 (using sleep or uisleep) after which MFDs will enable.
And return a value to config using setUserMFDValue
Is this for a mod?
as for the init.sqf itself, it is weird becouse this part of script work flawlesly :
_OK_F_35C = _this select 0;
i=1;
_OK_F_35C setUserMFDValue [0,1];
switch (toLower worldName) do {
case "stratis": {_OK_F_35C setUserMFDValue [1,1];};
case "altis": {_OK_F_35C setUserMFDValue [2,1];};
case "malden": {_OK_F_35C setUserMFDValue [3,1] };
case "tanoa": {_OK_F_35C setUserMFDValue [4,1] };
case "chernarus": {_OK_F_35C setUserMFDValue [5,1] };
case "takistan": {_OK_F_35C setUserMFDValue [6,1] };
case "utes": {_OK_F_35C setUserMFDValue [7,1];};
default {_OK_F_35C setUserMFDValue [49,1] };
};
Is this for a mod??
yes it is, doing it for F35E mod creator
If you don't want to completely confuse everybody, then don't name the script init.sqf.
Also you need an engineOn eventhandler like dedmen posted.
well, I didn't . This mod is based on the FC37 mod for arma, and it was named ike that from the begining.
It's time to improve!
Ok, so testing now. Thank you and sorry for misleading
Your script doesn't work, because it's executed when the vehicle is spawned (presumably) and then the engine is always off.
hmm that's why. Makes sense now
Using publicVariable too frequently in a given period of time can cause other parts of the game to experience bandwidth problems.
How much is too much?
Using publicvariable onKilled might be bad, because if a car full of people blows up, it's probably gonna cause a lot of lag... right?
if the variable is small
then there isn't that much traffic
public variable was used for remotexec ;)
It contains UID of every client + 5 integers
thing is.. why make it a public variable?
maybe someone wants to know...you are probably correct
when someone is killed
no one will need to know
score list
Probably I'll do a ended EH and just publish it then
Save some perf.
makes more sense
I don't think public variable is such a stresser as the wiki says.. same thing would then apply to JIP remoteexecs and setvariable
Hmm
TFAR uses publicvariables every time the settings update IIRC
I imagine a plane/heli with 10+ passengers crashing. I don't wanna cause extra stress ti the network, because that's already gonna cause a lot of stress on it
imagine people on an coop adjusting the radio settings.
and the array is large for it
ย "tf_rf7800str_21_settings" = [0,7,["211.3","191.3","323","371.3","165.6","254.5","471.3","67.7","445.5"],0,"",-1,0,"",false]
that's an example public variable
from tfar
It's not thaaat bad
main problem is JIP.. as when you join into the game you need to receive all variables that are set
STRING =
๐ค
and when you start getting into the thousands that takes some time
yes
you can "fix" that by setting unused pvar's to nil and then pvar'ing that nil
that essentially removes it from the queue
unless you are sending functions with publicVar (some do) the amount of data for objects will probably be bigger
what aboud, inventory, health, pos, group, side?
what is "inventory"?
items/weapons/clothes
health is a float.. 4 byte. pos is 3 floats. group is also a netID. side is one byte
how do you put items into a public variable?
pos is a long ass float...
Well I assume the game transmits all the items when joining, I'm just saying, the amount of data the game has to transfer to clients joining, is probably bigger than the publicVars I have
probably
Also all buildings that are changed.... there's so much
You don't need to care about that. until you get into the hundreds
I wonder what happens if you create like 5k PVAR's and then a JIP joins in
5k is probably not enough.. more like 50k
I wonder, how much does traffic increase when publicvar a sentence in string every ms
Find out next time... on SCRIPTBUSTAS
I also wonder, if setting a numerial value to functions would give me any performance gains.
instead of my_fnc_longassname f1
or just 1
@peak plover Have you already checked the "code opitmization" from BI ?
the names of the functions must have the smallest possible name
Please keep it readable...
reliability vs. performance
mission_fnc_checkFile >> mission_fnc_1
I guess the function library should be off the table then
mission_fnc_checkFile >> f1
Maybe i'll put in 2nd number for folder
same with variables
unit_score_side>>u61
Dude like Commy said before, this change is not going to do a double performance, and keep your code readable
and will don't keep your code readable *
Optimisation is everything when running lots of instances, with low delays. However, there is such thing as premature optimisation. Also, avoid excessive cleverness.
i always overtag my global vars :
SP_fnc_brush_init
SP_fnc_surfacePainter_paint
Z_var_areaRadius
Z_obj_vip
When you look at xcam code
zgmrvn
Just look at xcam code, and you will se what happens when you don't do any comments or other things in your code xD
To be more clean
Idk, how he can edit his code
Genius like mozard
^^
I am very grateful for the work that Silola did for xCam, but when you want to look at its code, it is impossible to read it
For me,When you creating some code for community, you need to keep your code readable, if you create code for yourself, you can make it unreadable if you want.
I wis I could do something cool like that
xcam on github?
since xcam code isn't public it's very much possible that they have comments and what not stripped from the builds
to save space I guess
yes
(which probably doesn't save much but whatever ^^)
you guys know a way to forbide weapons to have certain sights in arsenal?
it would be nice if Silola posts its code to the public after 1 year has been inactive the community could fix the problems by making a pull request on the github
But I heard that he was going to resume service by posting a fix, which is not bad
@astral tendon BIS_fnc_addVirtualItemCargo look for these functions
those just add the weapon to the virtual box, nothing about forbide a weapon to have a especific modification
for example, in the same box there is a sniper and a normal rifle
i dont wanna the rifle to be able to have sniper sights
You have to add all that you want. There is no way to remove ones.
i think you'll have to check for the dialog to be closed then check for player's gear
nevermind
since arsenal doesn't trigger take event
Arsenal has a scriptedEvent "ArsenalClosed"
wow, nice
didn't know about that one
why does the BRIEFING_POINT_RIGHT does not point at anything?
the full command is [this,"BRIEFING_POINT_RIGHT","ASIS"] call BIS_fnc_ambientAnim;
@astral tendon scope filter according to rifle https://gist.github.com/zgmrvn/57a3034eb5131e8d27e0a96421d22620
maybe there is a weapon property in the config that'd let you know what kind of primary weapon it is
groups are not consider units?
No, groups are groups and units are units.
i wanna put enableSimulation false as a temporary server boost perfomacy
becasue there is some situations in my scenario that there is allot of enemys
does disabaling the simulation increse the perfomacy?
performance* disabling*
yes.
thats good to know
there is some situations were the enemy still far and there will be no combat
so i think is not nessesary they be enabled
@astral tendon why do you spawn the enemies in the first place? you have to trigger their simulation to be enabled when players are close enough for contact, then you can spawn them with the same exact trigger, too
because they are in especific places
were the convoy will try to escape under fire
is there a script where in game you press like ctrl + b and it opens up some kind of gui that you can select like f 18s to spawn every 5 minutes
like how MCC you can spawn vehicles and a.i vehicles in but only one every 30 seconds manually
There could be.
@astral tendon why not simply put them in 3DEN and enable dynamic simulation in the group options ? to many locations ?
YES
and many of they are doing especific stuff
that require they to not be in the same group or their AI will fart
i'd still give a try to dynamic simulation
with dynamic spawn comes micro-freezes when unit's gears are read on disc
wrong...
dynamic simulation has no stuttering
[] spawn {
{
if (!isPlayer _x) then {
_x enableSimulationGlobal false;
};
true
} count allUnits;
sleep 5;
{
if (!isPlayer _x) then {
_x enableSimulationGlobal true;
};
true
} count allUnits;
Just freeze everything
https://i.imgur.com/KnszwEb.jpg
// before
// after disable simulation
// after re-enable
no stutter drop with ~180 units fighting
yep, i was talking about scripted ia spawn for suttering
what about enableDynamicSimulation ?
aa dynamic spawn not simulation
yes
createVehicle / createUnit can cause stuttering
but
I feel like performance gains are worth stuttering on clients without SSDs
Is there a simple way or method to check / waitUntil a player is in the game like no loading screen, no briefing screen, just when he is able to see the world?
yeah
And would I do that?
no... I dont want to sleep the script.
findDisplay
I want to check if the player is able to see the world aka no loading screen and no briefing screen
People keep asking for this and idk why.
findDisplay. Search for loading/briefing screen. If not there then he is probably in mission
Thanks
@little eagle mmh maybe because of intro stuff? Or Ares Custom Module Inits?
Why not use sleep then? The mission is frozen until the briefing is ended by the host.
waitUntil {time > 0}
if you really really want, although there is no diff.
oh okay...
waitUntil also requires suspensions
for loop with exitwith if you want to avoid suspensions... But that would acuse even more issues...
As in it would not load, because it's busy looping
private ["_westScores","_eastScores","_guerScores","_civScores"];
{
(call compile format ["_%1Scores",toLower(str _x)]) = _scores select {(_x param [2,""]) isEqualTo _x};
}count [west,east,resistance,civilian];
yeah I already had a problem with a never ending briefing screen.
Goddamn, this feels so wrong
wtf is that?
I have no idea what that is.
_x = west;
(call compile format ["_%1Scores",toLower(str _x)])
// _westScores```
you have to private the variables outside of the loop.. If you do that it should work
No, assignment doesn't work like this.
Ok, I've got a new idea. I can scratch that one I guess...
_unitScore = [_uid,_name,_side,[
(_kills + _newKills),
(_teamKills + _newTeamKills),
(_civKills + _newCivKills),
(_deaths + _newDeaths)
]];
// Update the scoreList
_scoreList pushBack _unitScore;
_scoreList == _scores
Instead of old approach
I will just _totalScores + _x
Context: persistant custom score. Making the ending screen right now
well commy2, your time > 0 works, but apparently the game thinks I already am in the game while I still get a second loading screen...
Time is synced from server before the loading screen ends
...
why is there so simple BIS_fnc_finishedLoading or BIS_fnc_canSeeWorld function...
Make one.
well when I use sleep, it sleeps for the time I supply it with.
but the time the second / third loading screen takes it always a little different
Use my solution
detect if loading screen is open.
That way you can know if loading screen is open..
yeah... just gotta find out which display the loading screen is
actually, I have also another question, why does my map change its name to UNAMED MISSION in the second and third loading screen?
101
Because that's the default. And no one is telling the loading screen to do that
102, 103,105
thanks nigel
@still forum anyway to solve that? I saw that BI Maps dont have that issue
There is probably a way
@peak plover I'd avoid call compile and rather use getVariable, the only bad thing about is that you would need to make the variable public
global not public
I've altered my whole script to remvove that now
It seems to be a bad way
What's with the need to correct me if you know what I mean
Sorry, didn't mean to come off like that...
Like some people casually drop stuff like this in
I know some people mean well so people that don't necessarily know what it means understand it or don't get wrong terms into their mouth, but jesus it happens so often
It's like I say public instead of global and 20 people get triggered over it ๐
Yeah, I get you ๐ It's like OCD ๐
it's quite a big difference so depending on context it's pretty important ๐
@delicate lotus there is an issue with displayed mission name when "too heavy" sqm are not binarzed
ah okay
Hmm, figuring out when the loading screen is gone is pretty annoying. The display is created before preInit, at least in the editor, and that means that no loop or mission namespace variable survives into the mission.
BIS_fnc_recompile is a lie
@slender halo you need to enable it in the init or description.ext (forgot which one) it says how in the biki page to the fnc
allowFunctionsRecompile ? @waxen tide
actually BIS_fnc_recompile is ok...
I mean. Really not all that safe whilst running a game
Alrigth Math folks ๐ I ve got myself a new vector challenge, but I am failing again... I want to create a sphere.
if !(isNil "objs")then{
{deleteVehicle _x}forEach objs;
};
objs = [];
_radius = 50;
_tiles = 20;
_pos = getposasl player vectoradd [0,0,200];
for "_j" from 1 to 360 step 360/_tiles do
{
for "_i" from 1 to 360 step 360/_tiles do
{
_t = "Land_VR_Block_02_F" createVehicle [0,0,0];
_npos = (_pos vectoradd [(sin _i)*_radius*(sin _j),(cos _i)*_radius*(sin _j),(cos _j)*_radius]);
_t setposasl _npos;
_up = vectorNormalized (_pos vectorDiff _npos);
_t setVectorUp _up;
_dir = _up vectorCrossProduct [0,0,1];
_t setVectorDir _dir;
objs pushBack _t;
};
};
As you can see one half looks wrong.
Didn't we do this already?
not exactly
_obj setVectordir (_n vectorCrossProduct [0,0,1])vectorCrossProduct _n;
isn't that just [0,0,1] again?
no
๐ค
It's missing a pair of parenthesis. Or the closing one has to be moved.
_obj setVectordir (_n vectorCrossProduct [0,0,1])
nil
nil vectorCrossProduct _n; <<<< does nothing
_obj setVectordir (_n vectorCrossProduct [0,0,1] vectorCrossProduct _n);
This is what you might've meant.
But again, this is just [0,0,1]
why do you use vectors instead of setPitchBank ?
BIS_fnc_setPitchBank is relative to the object and not relative to the world axis.
how do you disable sat texture on a map control? i saw the answer somewhere the other day but couldn't find it again
Didn't AGM do this? I think lot's of config.
damn. i could swear i saw a two liner somewhere that did it. might've been a wet dream though
hmm, idk
follow up. can you fade out the whole map control with some hack? or is it too hardcoded for that with all the special icons and shit
?
i mean fade though
Idk, the command is ctrlSetFade, ctrlCommit
yea not working. but thx
class RscMapControl;
class RscDisplayMainMap
{
class controlsBackground
{
class CA_Map: RscMapControl
{
maxSatelliteAlpha=0;
sizeExLevel=0.029999999;
};
};
};
```?
yea might've been config only. damn
basically i have a respawn menu for a aas pvp mode and i have a satellite camera i have teh map overlayed on. would be cool to fade from map to 3d smoothly. but i guess not in this engine lol
how do you mean? i was thinking maybe one could make the map control child to another and fade the parent but i haven't looked deep into the config part anymore since ctrlCreate got added. so liberating to not have to use configs for ui
yeah a map control, but as a resource, so it's like a hud element
fade it
Ohh yeah
that's still a class 'tho
But does not have to be a mod
oh dude. that's a good idea
do you happen to have a config example so my lazy ass only has to change stuff to my liking?
You can create your own control base classes that you use with ctrlCreate. No reason to limit yourself to script only. Many things can only be done with config.
map cfg https://pastebin.com/bk5yR0XP
I find the best to make a couple of template configs and then a few functions to work with those. So if need comes, extra functions/classes can be added, but it's also fast after it's setup
i know commy but i try to avoid it when i can. i've done it with configs in the past. just prefer it on the fly
@peak plover what is sizeExLevel=0.029999999; for?
ah found the answer in your pastebin, thanks ๐
Too stingy for 0.03.
I don't know how to explain this, Can I add two Scripts In the same trigger example.
!alive "name" && !alive "name"] {alive _x} count (units "name"1 + units "name"2) == 0
Something like that
you can separate lines of code with a semicolon ;
So like !alive "name" && !alive "name"; {alive _x} count (units "name"1 + units "name"2) == 0
yes but it kinda depends on the field you're testing
I guess it's the condition field?
yes
You want to check if the first AND the second condition are true?
I'm having it so you have to kill all the enemies but I don't want all the enemies to be in groups
!alive "name" && !alive "name" && ({alive _x} count (units "name"1 + units "name"2) == 0)
that's what && is for.
something like that
Okay I'll test it out thanks
alive STRING ๐ค
๐ค
๐ค
good thinking folks, well solve the case soon
๐
๐
Oh, i know. I've got this crazy idea guys
Whatif
We
Put a unit
Instead of a string?
Right because I was about to put a noodle string in the game instead of an unit
Noodle strings are good too
๐ฏ
How do I get the number of "House" within given distance at nameCity Location? for example, "La Pessagne" on Malden map.
_nearestCity = nearestLocation [ getPos player, "nameCity"]; //e.g. "La Pessagne" on Malden map
_centerPos = locationPosition _nearestCity; //[3115.53,6330.82,-224.34]
_nearbuilds = _centerPos nearObjects ["House", 100]; // count _nearbuilds get zero
count _nearbuilds get 0 value. because "La Pessagne" is located at high altitute.(224m)
you need to convert from the locationPosition, which is apperently underground?, to AGL coordinates
try to do a _centerPos resize 2; before the nearObjects check?
the negative Z value is really confusing though
might also need a nearestTerrainObjects vs nearObjects
thx @indigo snow ๐
๐๐๐ฟ
Dumb discord doesn't update messages after you resume from standby mode. Great that using the ๐ค emoji the way I do caught on though.
Yes
it was a homage
Is it an homage? The "h" is silent, no?
well that entirely depends on how you pronounce homage
i did debate it for a bit, to be honest
honest ๐ฌ
pinches his nose with two fingers, and says " 'omage "
Lease top alking ike his
Erm... Error publicvariable: Type Array, expected String
I thought publicVariable supported arrays?
No, what made you think that?
From its page on the wiki: https://puu.sh/xJDY6/9c6f70197e.png
Ahh, makes sense
myVar_aSide = west;
publicVariable "myVar_aSide";
^ This for example fails.
best use setVariable instead @rose hatch
missionNamespace setVariable ["myVar_anArray", [1, 2, 3], true]
Yeah, it saves a line. And ink is expensive.
Better use as in vast optimization benefit?
vast
Neato, thanks for the tip
lol
Final result (more or less):
waitUntil {time > 1};
specialAccessUIDs = ServersideAdmins; //defined on init by server mod
missionNamespace setVariable ["specialAccessUIDs", specialAccessUIDs, true]; //defined in mission script(s)
This way I can define specialAccessUIDs in the script should I ever want to disable the servermod.
You need to set that public flag to emulate publicVariable.
oh yeah, missed that
That does nothing ๐คฆ
You accomplish nothing with this. Setting the final flag achieves nothing.
please explain your reasoning behind this?
an antivirus doesnt stop all potention threats, i still use one lol
compilefinal wont stop all hackers but id prefer to use it than not
If someone finds away to inject sqf code via editor before joining a server (which has happened before afew times).
CompileFinal functions / important variables, will limit what they can mess with.
Its just a tiny extra layer of security, not much but better than nothing.
The only downside to compileFinal that array, it will prevent you changing the array on the fly.
Great. By now putting the uids into a function you made it possible to have a script that runs before this variable is synched that itself uses compileFinal.
If your paranoid you can get the client to check if variable isnil before it compilefinals..
Or get the client to sent the variable to server etc
Or you could randomize the variable name etc
There are afew different methods to be annoying
All better than just assuming client will override the admin variable.
Nothing is foolproof, its all about just making it slightly harder
Plus its minimal work to use compileFinal vs compile vs an array
There was no compile before.
I didn't even know this was about admin rights, but I guess it makes sense looking at the variable name.
A function is even easier to fake, thanks to compileFinal ironically.
If you don't mind the RPT spam, you could just try to overwrite it and have it backuped in another variable.
guys
i maded a scenario with this
the server also needs to be subbed to it?
to work right?
Because in the serve that i was testing, the AI were doing randown stuff
No @astral tendon
becasue, when i was tring to play, the AI were being soo random
the mods and the ai aren't related at all
if the AI were dependent on something you wouldn't be able to play the mission without it
what else it could be?
they have verry especific setups
Okay? I'm not concerned as to how you set your AI up.
the concern is if they are acting like dumbasses then you likely either don't have them tasked to do anything
or you haven't set up their skill range high enough
Come on dude ๐คฆ
if i play in SP they run just fine
but when i play in the server, they are acting strange
Configure your server skills settings!
Especially if you are hosting on a listen server
in MP they dont move
Can you please post the trigger condt, act, and deact here?
i cant because i am not in my computer right now
Well, there isn't much you can do then. Because explaining that they "just don't move" or that they "work fine in sp" doesn't mean a whole lot. I recommend once again, you go and configure your skills settings in your game options
what level i have to put they?
if so, how can i lock those dificuty sethings and override any server setings?
are you having a stroke
My english machine broke
In a multiplayer match, If I want each team leader to have a variable passed to the server and have the server add them together. What is the most efficient way for the server to only get the variable from team leaders and not every player?
teamLeader_1 setVariable ["my_variable",2600,true]; on the client, getVariable on the server
Basically, if a player is a group leader they are defined a variable. Simple
"returns -1 if difficulty is not forced and it's used one from player's options"
How do you actually force it on your mission?
using server.cfg
so i just make a server.cfg inside my mission?
No. server.cfg as in server cfg. as in server config. as in not-mission
crazy
So there is no way to force a Difficulty to my mission?
Yes there is.
But you will have to iteratively search every single unit and their vehicles to do it.
There is?
Midnight said above about set the skill seting
basicly, the AI farts and start to do wathever
when i test the mission on the editor it all works fine, but when my friend set a server to we play the AI became randon
and my mission is heavly AI dependent
they drive and also activate triggers
and i and my friend have diferent dificulty setings that maybe is causing the problem
all the commands related to this like difficulty, missionDifficulty, difficultyOption and difficultyEnabled do only return values and there is no way to change it.
Yes, there is no way to change the difficulty with script commands.
i tink o got other way around
maybe i can make the mission fail with the difficulty
and give a erro message
I thought you could use
setSkill
``` ?
does it get reset by the server?
Not as far as I know
as long as you spawned them?
@little eagle Can CBA block diag_log from working?
diag_log _undefined
never printed anything
Because every command with nil on either side as argument fails.
diag_log [_undefined]
is the work around (in unscheduled environment)
The script being run is the simple IED script.
The RPT just stops displaying.
Even executed from console...
Post it?
The wiki even kinda says that https://community.bistudio.com/wiki/diag_log takes "anything" if you give it "nothing" it won't work
Is nothing some kind of thing? ๐ค
I bet there's a script error somewhere.
Odd, stuff in this mission must be playing catchup.
I reloaded the mission a few times but this script is running scheduled
I should get some kind of error.
he
Yep
I managed to solve my sphere question from yesterday:
if !(isNil "objs")then{
{deleteVehicle _x}forEach objs;
};
objs = [];
_radius = 50;
_tiles = 20;
_pos = getposasl player vectoradd [0,0,200];
for "_j" from 1 to 360 step 360/_tiles do
{
for "_i" from 1 to 360 step 360/_tiles do
{
_t = "Land_VR_Block_02_F" createVehicle [0,0,0];
_npos = (_pos vectoradd [(sin _i)*_radius*(sin _j),(cos _i)*_radius*(sin _j),(cos _j)*_radius]);
_t setposasl _npos;
_dir = (_pos vectorDiff _npos);
_t setVectorDirAndUp [(_dir vectorCrossProduct [0,0,-1]) vectorCrossProduct _dir,[0,0,1]];
objs pushBack _t;
};
};
nice
@little eagle Is it a bad idea to add a lot of commands within a forEach loop?
No?
It is equally as bad as putting a lot of commands in a script
*as bad as putting "a lot of commands" times the looping count in a script
_ieds = [];
_iedArea = (getMarkerSize _x) select 0;
_iedRoadsPos = (getMarkerPos _x);
_iedRoads = _iedRoadsPos nearRoads _iedArea;
waitUntil {_iedRoads isEqualType []};
Along with a bunch of other code.
The post is too big.
That's nothing.
But nearRoads keeps returning nothing.
Throws an assignment error
when iedRoads = nearRoads.
At mission start it throws an error
Still not sure why tried waiting till it actually equals to []
_iedRoads = _iedRoadsPos nearRoads _iedArea;
waitUntil {_iedRoads isEqualType []};
That code doesn't make sense (the waitUntil part)
Either _ieRoads is of type array and the waitUntil won't wait at all or it isn't and waitUntil will wait forever
iedRoads returns an array
iedArea refers to the area in that pos.
The area is derived from a marker.
This is someone elses script. There was a number of errors and bugs that needed fixing.
your waitUntil {_iedRoads isEqualType []}; doesn't do anything (Which was already said.. But I wrote this before reading the other messages ^^)
Yeah, that will forever be the same. Either wait forever or just pass through.
So what can I do?
To verify the array actually exists?
So it doesn't spam 20 entries of RPT spam
if(_ieRoads isEqualTo []) then{
hint "failed"
} else {
//perform code
}```
What is going on with that indentation ๐ฎ
Should have seen it before.
Yep just noticed myself xD
It was all concatenated on one line.
Ewww
I've recieved a nearly lethal dose of eyecancer ๐ฆ
sounds like something a certain youtuber would do to "improve performance"
pls elaborate
But that script is probably not from him. the variable names are too long
There is a quite popular youtuber that has videos on SQF optimization..
Stuff like "make variable names as short as possible. Less than 5 characters atleast!" and "remove all whitespace"
"remove all whitespaces" what is he racist?
That sounds more like him
Well in theory you reduce the amount of characters the lexer has to go through...