#arma3_scripting
1 messages ยท Page 424 of 1
the context is cfgSounds definitions for sounds outside the mission to be called by scripting commands
Ah...
And why does that mean config related stuff is irrelevant
while you are writing a config?
You asked for help. I told you two things that could be wrong with that. You don't care.
So what do you want if you don't want help?
i already shared the differnet problems in here and solutions for ppl who care
I blame the newline { and the macro ending with ;
As I said @ is a special operator. So it will also function as such. You need to quote the string if you want a string. Like all the examples on biki do it.
It's not a macro thing it's a #arma3_config thing
How the heck are you supposed to disable radio channels these days? It was super simple back in the day.
disablechannels [0,1,4];
DONE!
Then it was:
disablechannels[] = {
{0, false, false},
{1, false, false},
{4, false, false}
};
Now what is it?
Same thing
0 not false? ๐ค
Yes, in config there are no booleans, so you write 0.
boolean constants don't exist in arma
Only bad tools automatically convert it, because they're written by people that think they're smarter than you and therefore cause problems because it turns out... oh well.
Eh... maybe I got some syntax wrong, but the disablechannels the first way certainly worked in the past.
The second way worked more recently, too. Like definitively.
But, I believe you that it doesn't work right now.
@little eagle, swapped for zeroes, still isn't working.
What do you mean 'it's still not working'
The channels are not disabled.
if you are the server then it won't be disabled for you
same goes if you are logged as admin on dedicated
I'll upload to another server and give it another shot.
Got this as result:
name = "speech_##I";
sound[] = {"@ww2\missions_s\campaigns\ForTheMotherland_s\EN\mission_7\Rus_m7_1.ogg",1,1,100};
titles[] = {0,""};
with this properly written macro config:
#define QUOTE(var) #var
#define DOUBLES(var1,var2) var1##_##var2
#define SPEECH(I) \
class lib_m7_speech_##I { \
name = "speech_##I";\
sound[] = {QUOTE(DOUBLES(@ww2\missions_s\campaigns\ForTheMotherland_s\EN\mission_7\Rus_m7,I.ogg)),1,1,100};\
titles[] = {0,$STR_LIB_missions_lib_campaign_missions_LIB_07_SA_CAMP_Staszow_LIB_m7_ph##I};\
}
SPEECH(1);
SPEECH(2);
Ofc. the other entries are still wrong, but the sound path is now working correctly.
The name thing is still broken. Because of incorrect stringification
Yep, don't care.
@subtle ore, uploaded to dedicated. channels still not disabled, even using @little eagle's syntax.
Been saying how to deal with this for years, yet every other month the same dumb questions come up. I'm getting tired of it.
You'd think people would learn eventually, but no.
They're too pridefull.
Are you logged in as admjn DEL-J...?
So you still have access to all the channels?
Indeed.
DEL-J have you tried abandoning the config method in favor of the SQF command? It seems people have more luck with that method.
is the rest of your info from description.ext loading?
I have not. How do I do that?
https://community.bistudio.com/wiki/enableChannel
init.sqf or some script instance like that.
Should change my avatar to this: https://klausbaum.files.wordpress.com/2013/11/481_sisyphus-klein-1.jpg?w=712
Sweet! Will try it immediately. It might fix a barely related problem.
thonking harder
Say, how did you rid of your blue name commy?
Bad and unfunny trolling.
@little eagle ๐ฉ
Heh.
I can't just stick that in the init, right? I have to do like, onplayer join or some crazy shit, yeah?
๐
That looks kinda good.
Heh
That's fine.
It's also all greyscale. Just how I like my world.
Iden-what?
tifyicate
Just use your nose and smell the ๐ฉ.
@shadow sapphire If you're trying to disable radio channels your false's need to be true's
For the description.ext?
disableChannels[]={ // {channelID<number>, disableChat<bool>, disableVoice<bool>}
{0,false,true}, //Global - Allows chat, disallows voice
};
Yes
Also worth noting you need the following in your client init files somewhere
/*
https://feedback.bistudio.com/T117205 - disableChannels settings cease to work when leaving/rejoining mission
Universal workaround for usage in a preInit function. - AgentRev
Remove if Bohemia actually fixes the issue.
*/
{
_x params [["_chan",-1,[0]], ["_noText","false",[""]], ["_noVoice","false",[""]]];
_noText = [false,true] select ((["false","true"] find toLower _noText) max 0);
_noVoice = [false,true] select ((["false","true"] find toLower _noVoice) max 0);
_chan enableChannel [!_noText, !_noVoice];
} forEach getArray (missionConfigFile >> "disableChannels");
Holy shit. Dammit, that's a bizarre thing that we ALL missed. I guess they just assumed I wasn't that stupid.
So should I throw what you posted into the onplayerjoin or playerinit? What's that called?
Would be player init (clientside). I assume it's still a thing as the bug report is still open anyway. It doesn't hurt even if it is fixed
Err...
onPlayerKilled.sqf and the killed event handle do about the same?
@shadow sapphire Insight on?
Anything, whatever you were saying "Err..." about.
should've known to disable 1 and to enable 0 (true, false)
W H A T?
Well the wiki kinda said that. I also overlooked it. But I wasn't the one who had the problem soo... ยฏ_(ใ)_/ยฏ
The guy having the problem should be the one doing the most research
Of course.
There is an epidemic learned helplessness on here and I suffer from it the most.
Cool
@ruby breach, switching everything to true worked with no other input.
Right; that second bit was suggested due to a bug that may have been fixed by now. (i.e, if you return to the lobby and then return to the mission without fully disconnecting, the disableChannel[] settings are ignored)
I haven't tested that in an environment without that init code running to know if it's fixed or not
Oh! I see. Interesting.
@little eagle thanks for the macro
still for sounds defined outside missions you have to use @path + playSound as say[3D] is bugged
Im trying to create an addaction that runs a script on a server. I have the addaction portion down, but the script isn't running on the server. putting the script into the execute box runs the script however. I'm having trouble understanding the "guides" on the wiki. Can y'all point me in the right direction?
Post the code.
this addaction ["Detonate","detonate.sqf"]
nul = [nuke_me,200,true,true,true,true] execvm "AlNuke\alias_nuke.sqf"
line 1 is on the item
line 2 is "detonate.sqf"
misspelled null on top of using it for no reasons.
Oh, so the problem is that the script is executed on the client, but has to run on the server?
Yes
sec
//detonate.sqf
{
[nuke_me, 200, true, true, true, true] execVM "AlNuke\alias_nuke.sqf";
} remoteExec ["call", 2];
Change detonate.sqf to this.
It sends the code inside the curly brackets to the server and executes it there.
The misspelled "nul" is pointless, so might as well delete it.
alright
now... since its sending this to the server to execute, the results will happen across all clients right?
Well, depends on what alias_nuke does.
it sets off a nuke effect
the goal is for 1 person to press detonate, and then everyone sees the nuke go off
Yeah, but does it create the nuke effect in a way that is MP compatible?
Can't tell without knowing what the script does.
SERVER EXEC?
Yes
SERVER EXEC does essentially do what I posted.
{...} remoteExec ["call", 2]
Transfering some CODE to the server to execute it there.
Therefore I'd say it should work.
alright! i appreciate it!
The only potential issue you may have is if execVM isn't allowed in cfgRemoteExec
You mean "call".
Yeah, that. (what I get for not really reading past execVM)
First line of that script is:
if (!isServer) exitWith {};
Therefore I think it was scripted with MP in mind and does indeed require remoteExec if executed from the action menu.
could somebody check what will happen when executing theese:
if true then [1, 2];
if true then ["3", "4"];
if true then ["5", {6}];
if true then [{7}, "8"];
if true then [{9}, 10];
if true then [{11}];
if false then [{12}];
also, what is returned when
if false then {}```
also, what happens when doing
1 else 2;```
@queen cargo Exactly what you'd expect
Number, expected Code, 1 element, expected 2, etc.
if false then {} would return Nothing
1 else 1 Generic error in expression
is there a way to trigger an event when a player connects to a uav? i cant find anything obvious in here https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#GetIn
does not answers my question for specific errors for each line
I just told you
Any argument that has the right number of elements but wrong type, will report wrong type. The ones that has incorrect number of elements will report wrong number of elements. 1 else 1 would report Generic error in expression
if true then ["5", {6}]; Error Type String, expected Code
kk
could someone point me in the direction of how to go about allowing specific player to access specific UAV.
str for "_i"
output?
also, what about:
for "_i" isEqualTo (for "_i" from 0)
...```
also ... because it just comes up: what happens when doing this:
for "_i" from 0 to 10 do { _i = nil; };```
does anyone know of an event handler i can use that fires when connected to a uav?
@queen cargo "ForType <invisible>"
false
Infinite loop
what about for "_i" isEqualTo for "_i"
@queen cargo false
@queen cargo I don't think it can compare them
_a = for "_i"; _a isEqualTo _a; is also false
is for "_i" from 0 to 0 do {...} really getting executed once?
and what about for "_i" from 1 to 1 do {...} if it is?
@queen cargo Of course
Weird
[1] select 1 returns nothing, and doesn't error [1] select 2errors
Seems one index too far will return nil without erroring
thats known behaviour
question howerver is what happens with the true false stuff
also:
"test" select [0, 10]```
will this evaluate to "test" or error out
true false is treated the same as 1 0
kk
""
and what if [-1, 10]
Both return ""
and i guess no error outputted?
No
negative length?
Nothing outputs any errors
negative length will output ""?
Yes
yes
how do i find out via script what squad name player is in?
eh. squad name player is in?
awesome, thanks mate
<ARRAY> select <CODE> and <CONFIG> select <SCALAR> are now missing
and the config thing is lacking an essential datatype right now
soooo .... just the array code variant is missing
ty @compact galleon
https://github.com/X39/sqf-vm/blob/cpp/sqfvm-cpp/genericcmds.cpp#L299 this is what i did with those infos
is there a way to set a player to a channel. this doesnt seem to be player drivin. https://community.bistudio.com/wiki/setCurrentChannel
5 remoteExec ["setCurrentChannel", _unit];
Obviously.
doesnt work, but found the solution else where
Yes it does, you can't just use "_unit" withought defining it as it's not a command like player is
ok, how do i define it, all thats being passed to the function is player. total noob here
i tried this from with in the function, i am passing player to function
5 remoteExec ["setCurrentChannel", _player];
Read https://community.bistudio.com/wiki/Variables if you don't know what variables are.
i have read that. im doing this at the top of function
params ["_player"];
Yes, I should've known.
ok nvm ill find help else where tonight. thx
Thanks.
How are your programmer muscles hanging out Commy? ๐ช
insert witty response
heh
@LifeSnatcher#6222
params[["_unit",objNull,[objNull],1]];
if(currentChannel == 0) then
{
5 remoteExec["setCurrentChannel",_unit];
};
ยฏ_(ใ)_/ยฏ
wats remoteExec do?
There's a wiki explaining it.
so its like running a script locally?
Asks server to execute given scripted function or script command on given target PC. The environment chosen for the execution is as follows:
It's the opposite of running a script locally.
Hey everyone, does anyone know why this ```sqf
[jetno,jets,player,_checked] remoteExec ["mld_fnc_jetNotification",0];
Also i do have a CfgRemoteExec whitelist file like this ```sqf
class CfgRemoteExec
{
class Functions
{
mode = 1;
// Ability to send jip messages: 0-disabled, 1-enabled (default)
jip = 1;
/*your functions here*/
class jetSpawnInit
{
allowedTargets=0; // can target anyone (default)
jip = 0; // sending jip messages is disabled for this function (overrides settings in the Functions class)
};
class jetNotification
{
allowedTargets = 0;
jip = 0;
};
};
};
Thanks.
@Moldisocks#2334 I can't read it from smartphone properly, but I think you've missed the functions tags in CfgRemoteExec
@Moldisocks#2334 And yes, server doesn't respect these rules
@Demellion Dismal#4736 What so like this ```sqf
class mld_fnc_jetSpawnInit {
};
//Or this
class fnc_jetSpawnInit {
};
First one.
ok thanks. it's weird though, i have a similar cfg in another mission with the same syntax as my original post and it worked fine.
No, it didn't. You made a mistake.
ok ๐
Hello guys, do you know how i can hint someting at the end of an animation ? I use playmove like this
player playMove "AinvPknlMstpsnonWnonDnon_medic_1";
maybe a
waitUntil {(animationState player != "AinvPknlMstpsnonWnonDnon_medic_1")};
``` ?
That'd work, but just remember that it'll also delay the execution of anything else in that function until after the animation completes
it doesn't work, when i diag_log animationState player in the loop i only get this : "amovpercmstpsraswpstdnon"
Ahh, right, also worth mentioning that animationState is forced lowercase in A3
I have seen setskill and used values of 0,1,2. Does going any higher have any effect? The wiki is not very clear. For example, 3-10. Moslty interested in pilots and drivers at this time.
From wiki: Value of skill may vary from 0 to 1.
I know, however I have seen AI Skill scitps use other values.
me too, but they was all in between 0 and 1
I have only ever used 0-1 values. IIRC correctly when I tested it that attempts to set above 1.0 resulted in getSkill producing 1.0 so was clamped to the range, but it was nearly 2 years ago I am far from 100% on it. I don't recall it crashing.
@Joker#2362 use AnimDone EVH
I was thinking if it's more optimized to use animate instead publicvariable, I have a customObject and i want to know if someone already using action on it, so thinking if i create an animation on it, and put this animation to 1, will be more optimized instead set a publicvariable on it ?
is there a command that gives uavs ability to turn on nvg in third person?
.... press N or whatever your nvg button is....
doesnt work ofc why else would i ask
what's the point?
:/ go figure
what nobody wants to use uavs at night?
im talking about players controlling them
first person doesnt get nvg either
because they don't have NVs
the greyhawk might
eeeeeeeh you may be right
only when in optic view
ofc
let me change the question then, can you force the players view to turn nvg on while he is in control of a uav?
or any vehicle for that matter
that's not how cameras work
it's possible but it's a lot more work than a single command
one could try giving the UAV driving/piloting AI entity NV/TI goggels
u mean the B_UAV_AI things?
in the cfgs?
ive already checked the items they have nvggoggles already
maybe setCamUseTi
ok ill add that to the vehicles useractions see if it works thanks
Need some tweaks here and probably film grain... @lusty canyon
//--- Night vision
0 spawn {
private _color = ppEffectCreate ["ColorCorrections", 1999];
_color ppEffectEnable true;
_color ppEffectAdjust [1, 1, 0, [0.4, 1, 0.4, 0], [0.4, 1, 0.4, 0.0], [0.4, 1, 0.4, 1.0]];
_color ppEffectCommit 0;
private _blur = ppEffectCreate ["dynamicBlur", 505];
_blur ppEffectEnable true;
_blur ppEffectAdjust [.2];
_blur ppEffectCommit 0;
setAperture 0.1; //--- brightness
};
So I'm currently having a problem with "hitpart" EH that colors the part hit.. In singleplayer it works fine but in multiplayer it has one particulary annoying problem..
//[this] execVM "target.sqf";
params [
["_target", objNull, [objNull]]
];
private _EH = (_target addEventHandler ["HitPart", {
private _colorBlack = "#(argb,8,8,3)color(0,0,0,0,CO)";
private _colorWhite = "#(argb,8,8,3)color(1,1,1,1,CO)";
private _target = ((_this select 0) select 0);
private _selHits = _target getVariable "selHits";
private _selectionNames = (selectionNames _target);
private _selectionArr = ((_this select 0) select 5);
private _selection = if ((count _selectionArr) < 1) then {
(_selectionArr select 0);
}else{
private _segment = "";
{
if (_x in _selectionNames) exitWith {_segment = _x};
} forEach _selectionArr;
_segment
};
if (_selection isEqualTo "") exitWith {};
private _selectionIndex = (_selectionNames find _selection) + 1;
private _color = if ((_selHits select _selectionIndex) isEqualTo 0) then {
_selHits set [_selectionIndex, 1];
_colorBlack
}else{
_selHits set [_selectionIndex, 0];
_colorWhite
};
_target setVariable ["selHits", _selHits];
_target setObjectTextureGlobal [_selectionIndex, _color];
if (_selectionIndex == 17) then {
_target hideObject true;
format ["Kill confirmed.\nTarget: %1", _target] remoteExec ["hint", 0];
for "_x" from 0 to 17 do {
_target setObjectTextureGlobal [_x, _colorWhite];
};
_target setVariable ["selHits", [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
}else{
format ["Target still up.\nTarget: %1\nImpact zone: %2", _target, _selection] remoteExec ["hint", 0];
};
}]);
_target setVariable ["myEH", _EH];
_target setVariable ["selHits", [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]];
The selHits variable seems to be individual on each player and I need it to be shared..
Bacause I need it to change color depending on what color it was last time, not by which player shot it to which color last time.
Any advice?
setVariable public. It's documented on the wiki. You add the third arg on the right side array true. Look under "alternative syntax".
Also wrap the last line in if isServer, then it all should work.
You mean like : if isServer then { _target setVariable ["myEH", _EH]; _target setVariable ["selHits", [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]; }
I said the last line. Not the last two.
And selHits there should also use the public flag.
selHits should always use the public flag.
Sorry, didn't read properly..
So what is flag? The wiki doesn't explain as much as I would like it to..
It means that the changed variable will be broadcast to all connected machines, including those that JIP later.
Which should pretty much solve your desynchronization issue, aside from edge cases where two people hit the same target at about the same time, but who cares.
Can you give me an example how to do that with the code above?
๐
...
//[this] execVM "target.sqf";
params [
["_target", objNull, [objNull]]
];
private _EH = (_target addEventHandler ["HitPart", {
private _colorBlack = "#(argb,8,8,3)color(0,0,0,0,CO)";
private _colorWhite = "#(argb,8,8,3)color(1,1,1,1,CO)";
private _target = ((_this select 0) select 0);
private _selHits = _target getVariable "selHits";
private _selectionNames = (selectionNames _target);
private _selectionArr = ((_this select 0) select 5);
private _selection = if ((count _selectionArr) < 1) then {
(_selectionArr select 0);
}else{
private _segment = "";
{
if (_x in _selectionNames) exitWith {_segment = _x};
} forEach _selectionArr;
_segment
};
if (_selection isEqualTo "") exitWith {};
private _selectionIndex = (_selectionNames find _selection) + 1;
private _color = if ((_selHits select _selectionIndex) isEqualTo 0) then {
_selHits set [_selectionIndex, 1];
_colorBlack
}else{
_selHits set [_selectionIndex, 0];
_colorWhite
};
_target setVariable ["selHits", _selHits, true];
_target setObjectTextureGlobal [_selectionIndex, _color];
if (_selectionIndex == 17) then {
_target hideObject true;
format ["Kill confirmed.\nTarget: %1", _target] remoteExec ["hint", 0];
for "_x" from 0 to 17 do {
_target setObjectTextureGlobal [_x, _colorWhite];
};
_target setVariable ["selHits", [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], true];
}else{
format ["Target still up.\nTarget: %1\nImpact zone: %2", _target, _selection] remoteExec ["hint", 0];
};
}]);
_target setVariable ["myEH", _EH];
if (isServer) then {
_target setVariable ["selHits", [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], true];
};
_target setVariable ["selHits", [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],true];
Or what commy put
I meant the flag, those changes I already did.
The flag is the added true
"Chances" ? ๐ค
Changes I think
Commy2: Wrong word, sorry..
Well, those changes are all you have to do.
As far as I can tell. For what it's worth.
So when you were talking about "flag" you didn't mean "setFlagTexture" or other "flag" stuff on the wiki?
Not at all ๐
That explains why I was running around in circle all confused... My mistake.
Nah, flag as in argument you flip from default false to true,
Ok, thanks for your help, now I just need to test it..
in case someone with basic c/c++ knowledge has too much spare time and searches for new headache: sqf-vm still is in need of developers ๐
hello
how to disable or enable Animals (fish,rabbit vs.) how many ways do you have
@strong canopy dafuq man?
dont drink and discord ๐
Yeah... Im sorry lol
@strong canopy You can delete messages
@rancid pecan enableEnvironment script command
@queen cargo Please don't spam.
@still forum yes
i did but don't work
enableEnvironment true;
or enableEnvironment [true,true]; vs..
there are still no fish
if the map doesn't support them they won't be there
Anyone used Patrol Ops 4 (scripting wise) before?
it was released ?
Beta or sth
3 was a goddamn mess
4 seems like it too
so Im trying the static animations
I have the Direone mod installed
than I do
variablename switchMove animationname;
than I do spectate in sp
and nothing
am I doing something wrong
unit switchmove animationname;
case doesn't matter for commands
ah
it's very likely the AI just goes back to idle anim after it's done
alright
nighty night.
gnight
so I name my unit s1
than I use this command
s1 switchMove "combat_9"; s1 disableAI "anim";
and nothing?
you can try add this in unit init
this switchMove "combat_9";
this playMove "combat_9";
both?
yep
alright
and do not disableAI
do I play it in spectate or play scenerio than go splendid cam
will the 2nd way disable the static pose?
you can press prewiev in editor or play it (if debug console enabled, no idea how it looks in sp)
@tough abyss dude check this https://youtu.be/0fQ27k6J7ek
just watch it and you will win the internet...
thanks
yw
doesnt really go over static animations :/
sometimes does nothing sometimes he put his weapons behind his backk
ive searched the nets for something straightforward to show me how to connect a specific uav gunner feed to a monitor. Not looking for a mod just wanted to know how to do it via script. I saw examples that it could be done but no info was provided. Does anyone know how to do this without using a mod, just script?
found this, think im set now. also thanks @young current , that got me started and im going to use that for the rest.
๐
How could I find out the sound a fuel truck plays when you refuel a vehicle with it? Ive tried checking all the config values, and its not in there, so kinda stuck.
It may hard coded. Not everything is configurable.
Check the gas station vehicle class, there may be some user actions t hat play the sound when refeuling
Don't ask to ask. just ask. If it's a #arma3_scripting question then this is the correct place
@still forum I am not English but French sorry, I ask my questions then
I would like to create a name tag with icons on the players' heads but how would I proceed?
You would use drawIcon3D. Assuming you already have lots of knowledge about scripting. Otherwise that might not be the best project to start learn scripting.
Also there are mods that already do that
yes I looked on the bohemia wiki my examples provided does not work
whadd
post code by typing
```sqf
<my code here>
```
it will end up looking like
<my code here>
// comment
baba = (player getVariable ['blabla',true]);
@tough abyss
There are literally hundreds of examples of this on the internet. They're easily found on Google. I think the best tip you can get is to use www.google.com/ncr from now on, so you're not stuck with priority to crappy French search results. "NCR" is for "no country redirection" or something like that.
Idea: What's the unit with least amount of gear for each faction? Is it basic rifleman?
How can I spawn a unit with the least amount of gears
Can I spawn in VR men and give them groups and have them fight for a faction (ai)?
whats the prefered site here for uploading and sharing an image via link?
What is the low level command that makes AI go to cover?
@exotic tinsel imgur. I think it doesn't have ads
What do you mean go to cover? Like the group function "take cover" ?
Im using a modified version of this script to connect my uav feed to monitors.
http://killzonekid.com/arma-scripting-tutorials-uav-r2t-and-pip/
However its not coming in clear on the monitor.
https://ibb.co/n6G6J7
Im new to this part of scripting. Can anyone help me clean up the picture?
im applying texture with this
_displayterminal setObjectTexture [0, "#(argb,8,8,3)r2t(_camera,2.67)"];
tweaked it to this but its still got noise
_displayterminal setObjectTexture [0, "#(argb,512,512,1)r2t(_camera,1.33)"];
@TomAutobahn#3977 there is no low level command, BIS had one, but didn't implement it. You can achieve something like this by playing with 'enableAI' using "COVER" part
How can I go about using one of these templates? https://community.bistudio.com/wiki/ParticleTemplates
@tough abyss eh, createVehicleLocal
@unborn ether I have no knowledge of how to code for Arma 3
@tough abyss well, not the best way to start, but you can try reverse-engineering something existing, to get how to at least create it.
0 spawn
{
private _laptop = "Land_Laptop_unfolded_F" createVehicle (player modelToWorld [0.5,2,0]);
_laptop setObjectTexture [0, "#(argb,512,512,1)r2t(uavrtt,1)"];
private _uav = createVehicle ["B_UAV_01_F", _laptop modelToWorld [0,50,20], [], 0, "FLY"];
createVehicleCrew _uav;
private _wp = group _uav addWaypoint [position _laptop, 0];
_wp setWaypointType "LOITER";
_wp setWaypointLoiterType "CIRCLE_L";
_wp setWaypointLoiterRadius 100;
_uav lockCameraTo [player, [0]];
private _cam = "camera" camCreate (player modelToWorld [0,5,1]);
_cam cameraEffect ["Internal", "Back", "uavrtt"];
_cam camSetFov 0.75;
_cam camCommit 1;
_cam attachTo [_uav, [0,0,0], "PiP0_pos"];
"uavrtt" setPiPEffect [0]; // Normal - [0], Night Vision - [1] Thermal - [2]... check wiki for more
while {!isNull _uav} do
{
private _dir = (_uav selectionPosition "PiP0_pos") vectorFromTo (_uav selectionPosition "PiP0_dir");
_cam setVectorDirAndUp [_dir, _dir vectorCrossProduct [_dir select 1, _dir select 0, 0]];
};
};
@exotic tinsel
holy crap, ill have to spend the next four hours getting in to that. thanks mate
๐
@unborn ether I have general coding experience, but not for games
ive currently got this roughly working, however the view is not the gunner cam. ill post pic in sec
params ["_displayterminal", "_uav","_camera"];
/* create render surface */
_displayterminal setObjectTexture [0, "#(argb,512,512,1)r2t(" + _camera + ",1.33)"];
if (_camera == "mbow_cam_1") then
{
_uav lockCameraTo [MB_Commander, [0]];
};
/* create camera and stream to render surface */
_cam = "camera" camCreate [0,0,0];
_cam cameraEffect ["Internal", "Back", _camera ];
/* attach _cam to gunner _cam position */
_cam attachTo [_uav, [0,0,0], "laserstart"];
/* make it zoom in a little */
//_cam camSetFov 0.1;
/* switch _cam to thermal */
//_camera setPiPEffect [1];
/* adjust cam orientation */
_camtrg = "Sign_Sphere10cm_F" createVehicleLocal position _cam;
hideObject _camtrg;
_camtrg attachTo [_uav, [0,0,0], "commanderview"];
_cam camSetTarget _camtrg;
_cam camCommit 1;
almost there ๐
time to digest ur code
trying to use this with greyhawks, pip pos and dir dont seem to be right. im using laserstart for pippos and commanderview for dir. anythoughts?
better yet, where do i find these pip and dir for vehicles?
afaik they all the same for all uavs...
its just position and direction for the .... camera
well.... i adapted ur code to mine and ill post what im getting on a greyhawk
params ["_displayterminal", "_uav","_camera"];
/* create render surface */
_displayterminal setObjectTexture [0, "#(argb,512,512,1)r2t(" + _camera + ",1.33)"];
if (_camera == "mbow_cam_1") then
{
_uav lockCameraTo [MB_Commander, [0]];
};
/* create camera and stream to render surface */
_cam = "camera" camCreate [0,0,0];
_cam cameraEffect ["Internal", "Back", _camera ];
/* attach _cam to gunner _cam position */
_cam attachTo [_uav, [0,0,0], "PiP0_pos"];
/* make it zoom in a little */
//_cam camSetFov 0.1;
/* switch _cam to thermal */
//_camera setPiPEffect [1];
while {!isNull _uav} do
{
private _dir = (_uav selectionPosition "PiP0_pos") vectorFromTo (_uav selectionPosition "PiP0_dir");
_cam setVectorDirAndUp [_dir, _dir vectorCrossProduct [_dir select 1, _dir select 0, 0]];
};
the gunner is actually pointing at the commander in base
but the view is fixed on the nose
gonna pull my hair out
hang on may have sorted it
uavCameraDriverPos = "PiP0_pos";
uavCameraDriverDir = "PiP0_dir";
uavCameraGunnerPos = "laserstart";
uavCameraGunnerDir = "commanderview";
from the config ^ (B_UAV_02_F)
im still debuggin
0 spawn
{
private _laptop = "Land_Laptop_unfolded_F" createVehicle (player modelToWorld [0.5,2,0]);
_laptop setObjectTexture [0, "#(argb,512,512,1)r2t(uavrtt,1)"];
private _uav = createVehicle ["B_UAV_02_F", _laptop modelToWorld [0,50,20], [], 0, "FLY"];
createVehicleCrew _uav;
private _wp = group _uav addWaypoint [position _laptop, 0];
_wp setWaypointType "LOITER";
_wp setWaypointLoiterType "CIRCLE_L";
_wp setWaypointLoiterRadius 100;
_uav lockCameraTo [player, [0]];
private _cam = "camera" camCreate (player modelToWorld [0,5,1]);
_cam cameraEffect ["Internal", "Back", "uavrtt"];
_cam camSetFov 0.75;
_cam camCommit 1;
_cam attachTo [_uav, [0,0,0], "lasertarget"];
"uavrtt" setPiPEffect [0]; // Normal - [0], Night Vision - [1] Thermal - [2]... check wiki for more
while {!isNull _uav} do
{
private _dir = (_uav selectionPosition "lasertarget") vectorFromTo (_uav selectionPosition "commanderview");
_cam setVectorDirAndUp [_dir, _dir vectorCrossProduct [_dir select 1, _dir select 0, 0]];
};
};
gives me this https://imgur.com/a/jEVz2
crap, see issue with laser
lasertarget ^
running it now with fix
well crap it works your way lol
ive tried to convert what you sent to work in a function for dynamic use. but its not working. are you willing to trouble shoot?
๐
yeah no one wants to hear "will you help me fix the code i butchered that you wrote"
afaik that how it works: you make something, fail, you try it again.. and so on... until it works
here is my call from the init of the monitor
[this, MB_OW_uav_1, "mbow_cam_1"] call TLS_fnc_uavFeed;
here is ur code butchered
params ["_displayterminal", "_uav","_displaytexture"];
_displayterminal setObjectTexture [0, "#(argb,512,512,1)r2t(_displaytexture,1)"];
_uav lockCameraTo [MB_Commander, [0]];
private _cam = "camera" camCreate (_displayterminal modelToWorld [0,5,1]);
_cam cameraEffect ["Internal", "Back", _displaytexture];
_cam camSetFov 0.75;
_cam camCommit 1;
_cam attachTo [_uav, [0,0,0], "laserstart"];
_displaytexture setPiPEffect [0]; // Normal - [0], Night Vision - [1] Thermal - [2]... check wiki for more
while {!isNull _uav} do
{
private _dir = (_uav selectionPosition "laserstart") vectorFromTo (_uav selectionPosition "commanderview");
_cam setVectorDirAndUp [_dir, _dir vectorCrossProduct [_dir select 1, _dir select 0, 0]];
};
The while loop has no suspension.
crap, duh. my bad. back to the drawing board
yep will be less wasted cpu power, but camera focus will be jumpy a bit...
Atm the code is unscheduled, so it will just quit in frame 1 after 10k iterations. And even if you use the scheduler, this would execute ~1200 times a frame, eat all the scheduler time from other scripts and be "jumpy" anyway, because it will be put on the bottom of the stack no matter what.
well... i got this to work but in its current state @little eagle will it still be an issue in the way you described?
this is in the init.sqf
[MB_displayer_lg_ow, MB_OW_uav_1, "mbow_cam_1"] spawn TLS_fnc_uavFeed;
This is the function
params ["_displayterminal", "_uav","_displaytexture"];
/* create render surface */
_displayterminal setObjectTexture [0, "#(argb,512,512,1)r2t(" + _displaytexture + ",1.33)"];
if (_displaytexture == "mbow_cam_1") then
{
_uav lockCameraTo [MB_Commander, [0]];
};
/* create camera and stream to render surface */
private _cam = "camera" camCreate (_displayterminal modelToWorld [0,5,1]);
_cam cameraEffect ["Internal", "Back", _displaytexture ];
/* attach _cam to gunner _cam position */
_cam attachTo [_uav, [0,0,0], "laserstart"];
/* make it zoom in a little */
//_cam camSetFov 0.1;
/* switch _cam to thermal */
//_displaytexture setPiPEffect [1];
/* adjust cam orientation */
while {!isNull _uav} do
{
private _dir = (_uav selectionPosition "laserstart") vectorFromTo (_uav selectionPosition "commanderview");
_cam setVectorDirAndUp [_dir, _dir vectorCrossProduct [_dir select 1, _dir select 0, 0]];
};
Yes, you have to put a sleep there or use waitUntil.
LifeSnatcher, is it for some intro or ?
no its so sqaudleads can review the mission area while the uav pilot surveys.
spectating really from base
if its too big of a lag on the server then i dont need it.
Just use waitUntil and it will be executed once a frame at max. Really not that difficult.
thanks @meager heart for the code, got it working!
nice
can you point me in the direction of where to look on how to get rid of this noise on the screen?
https://imgur.com/a/AZ19N
When that happens ?
uav feed on the rugged large screen at night. uav set to thermal
set to thermal with setPiPEffect ?
yup, on any other monitor its fine.
you can try use setObjectTextureGlobal for that monitor
ill give it a try thanks mate
na, also i misspoke before it also does it on the tv screen too.
looks ok though on billboard
maybe in monitor init already r2t texture and you set one more on top... idk
this is in the texture field on the monitor properties. #(argb,8,8,3)color(0,0,0,0.0,co)
just checked with the same monitor, it works
hmm
yeah laptop is good, billboard is good, tv not good, other monitors not good. wtf
yeah i just used ur org script and spawned in that monitor "Land_TripodScreen_01_large_F", still has the lines for me. no clue
ยฏ_(ใ)_/ยฏ
u didnt get lines on your test? same monitor?
no
blank mission, just put the spawn script in initPlayerLocal. https://imgur.com/a/QDkxl
your video settings maybe ๐
i guess. screw it. its survivable for now.
thanks though for all the help to get it working.
have fun, dude
you too mate
Has anyone gotten boats to work properly with dynamic simulation? Made a spawn script but they seem to float up and down from 2m +/- above and below water when someone gets close to simulate them
@torn juniper have you attempted to change the distances?
Is it possible to enable crosshairs for the pawnee without changing server difficulty ?
@tough abyss I have not, set at default 250m
However they never settle even after spawning, unless a player gets in the driver seat
@torn juniper I've made a note there
@torn juniper Basically what happens is that your boat is simulated too late and it start floating like it should
So they would need a fairly high distance then
Well the distance from which you can really spot it, that's why I mentioned a fog coefficient
Think Ill try messing with the numbers based on view distance then, thanks ๐
Think global distance is only 3k-4k but I will check out your notes
Thanks much!
Nice share Demellion
Why is this having different effects?
Method 1:
myPos = getPos player;
myPad = "Land_HelipadSquare_F" createVehicle [myPos select 0, myPos select 1];
myPad setDir 0;
theWalls = [];
private _walls = [[[-15, 0, 1], 90], ....];
{
_x params ["_vec", "_dir"];
private _wall = "Land_CncWall4_F" createVehicle (position myPad);
_wall attachTo [myPad, [_vec select 0, _vec select 1, 1] .....;
_wall setDir _dir;
private _objPos = getPosATL _wall;
private _objDir = getDir _wall;
detach _wall;
_wall setDir _objDir;
_wall setPosATL _objPos;
} forEach _walls;
Method 2:
myPos = getPos player;
myPad = "Land_HelipadSquare_F" createVehicle [myPos select 0, myPos select 1];
myPad setDir 0;
theWalls = [];
private _walls = [[[-15, 0, 1], 90], ......];
{
_x params ["_vec", "_dir"];
private _wall = "Land_CncWall4_F" createVehicle (position myPad);
_wall attachTo [myPad, [_vec select 0, _vec select 1, 1] ........;
_wall setDir _dir;
theWalls pushBack _wall;
} forEach _walls;
Then run this seperately after:
{
private _objPos = getPosATL _x;
private _objDir = getDir _x;
detach _x;
_x setDir _objDir;
_x setPosATL _objPos;
} forEach theWalls;
@little eagle - The loadscript you provided still left players on the ground :(
if (isServer) then {
skipTime ((23 - daytime) % 24);
private _plane1Cargo = units alpha + units bravo;
private _plane2Cargo = units charlie + units delta;
{
[_x, [plane1, _forEachIndex]] remoteExec ["moveInCargo"];
} forEach _plane1Cargo;
{
[_x, [plane2, _forEachIndex]] remoteExec ["moveInCargo"];
} forEach _plane2Cargo;
};
is there an experienced coder willing to look over my 14 functions and point me in the direction of what i need to do to get them to work for multiplayer on a server. not trying to ask someone to fix them or write code just advise me on how to get each one to work with the best methodes. the issue is i have only been arma scripting for a couple months and i just dont know what is what anymore lol.
PM me if your willing to lend a hand.
Maybe something is wrong with your groups, NyteMyre.
I was wondering if anyone had any pointers on what is the best starting point / place to look for overriding the default revive respawn system? I would like the player to die normally, but then have the option to wait to be revived, or choose to respawn immediately. I would also like the ability to modify the camera when they die. I was thinking of using a 'killed' event handler but I wasn't sure how to respawn them if I have respawn turned off, plus if its turned on it triggers the default method. I basically want to handle death similiar to how it is handled in the KOTH maps I have played.
hi guys. Is it possible to spawn particleeffects using a script?
I would like to add smoke under certain conditions
awesome ty ^^
๐
How do I setup dev. for mission?
Like edit scripts live when mission running?
I dno what it's called so I am unable to google
Recompile you mean ?
Hmm, yes?
Is there a way to be able to edit functions when the mission is running in the editor?
I know I heard about it
can't remember
check at the bottom https://community.bistudio.com/wiki/Functions_Library_(Arma_3)
Ohh, thanks I'll try it
i heard there is some way to do it with cfg... but no clue
live reload configs?
yep
is it dev only ?
dev branch only.
thanks man
I did
allowFunctionsRecompile = 1;
But it does not seem to work :\
Anyway
What's the best way to find a habitable position
for a unit?
"habitable" wat
Not a rock
Not a house
a position where a unit can stand
isFlatEmpty has issues with powerlines
Having a bunch of trouble
getting past powerlines
"House", "Building" with nearestObjects ?
^maybe?
findsafepos is shite
better to write your own solution imo
i wrote one but my c drive died the other day and i lost all my recent arma stuff
Hmm
you're going to have that issue where you get positions inside of rocks, because they're not part of the terrain, there's still flat ground" "inside of them"
What's the best way to find a habitable position for a unit?
Not a rock
Not a house
Having a bunch of trouble getting past powerlines
๐ค
you need then isHabitable /s
yeah
Well
It's fine as I increased check and range
But I kinda wouldn't mind alt.
Hmm
Got recompile to work, but only in single player
only one editor where i am doing something, on local host... and was no troubles with recompile
TIL:
Bad conversion: bool
is a thing
if anyone is able to help me that'd be great, I'm trying to add an action to the Device object, which when triggered will cause an earthquake. I have a tiny amount of experience coding
Okay, I'm trying to figure out this guy's laptop script.
He says
You can check if the download on a laptop/object was finished and/or if someone uses the object by checking the following variables saved to the object: _laptopInUse = _myLaptop getVariable [ "T8L_pvar_inUse", false ]; _downloadComplete = _myLaptop getVariable [ "T8L_pvar_dataDownloaded", false ];
So do I put _myLaptop down in the Trigger Condition?
Or what....
what trigger condition?@
we can't read your mind bro you need to explain what you're on about
Sorry. So the laptops have a script all to themselves. When it's done, it flips that flag aforementioned to true. I'm trying to figure out how to activate a trigger when that flag goes to true. Or even just signal a task to go to completed.
So the _downloadComplete on laptop01 would set the task "Secure Laptop #01" to Complete.
But I'm not sure how to have a trigger check to see if it's true or not.
That's just as good. But I still don't know how to check the "finished" variable
_myLaptop is referring to the laptop object
but it's a local variable (denoted by the fact it starts with _) so you can't access _myLaptop in every script - just the one where it's defined
the easiest way would be to just name your laptop myLaptop in the editor
That's just as good. But I still don't know how to check the "finished" variable
Well:
_downloadComplete = _myLaptop getVariable [ "T8L_pvar_dataDownloaded", false ];
Or do you not know how to access the laptop object?
I think I found how it should work. one Second
Condition == laptop02 getVariable [ "T8L_pvar_dataDownloaded", false ]
I think this should work. I'll report back if it does.
if it returns a bool (true/false) then it'll work
hard to say because we haven't seen this guy's script
Name implies boolean and so does the default value.
you can't take anything for granted in arma or sqf
Bad scripting has nothing to do with Arma or SQF.
At least the globals are tagged. This brings this script into the top 10 percent already.
there's spelling mistakes in the sqf api, this is the perfect place for bad scripts
it's no wonder people write shitty stuff when the whole game is built on shitty stuff
Do you really think the quality of community made scripts would improve if they change the spelling of the dammaged event handler?
Okay, so I've verified with a trigger that that's the right variable. So I put the same thing in a task state module, and synced it to the create-task module. But it doesn't complete the task. Any ideas?
would general script quality go up if the script api itself were better maintained/developed? yes
@molten yacht paste all the relevant code you've written
Okay. Given that (X!) is = true, and the trigger's "Condition" field will respond correctly
It would go up if we got weekly guides by Jay Crowe commy2 on how to save precious ms when writing scripts
I guess the real question is: How do I link a "set task state" module to the target task.
hmm
maybe I'll just use the trigger and.... _tsk1011 setTaskState "Succeeded"; ?
task id = 1011
Hmm. That doesn't work.
Neither does _tsklap1, the variable name. Maybe just _lap1?
these are local variables
none of them will do shit unless you've defined them as something
Okay, so the task id is 13 and the task module's name is "lap1"
The module name is not the same as the laptop's name.
Okay, so what's the task's name?
shouldn't it be 13 or tsk13?
That's the ID it was given.
In the task creation module, the unique ID is 13.
The parent task ID being 10001.
(So all three laptops are grouped up under a master task)
I'll just say SQF is fucking awful compared to C#.... holy shit. There's like zero good documentation...
one was made by microsoft. the other was made by eastern europeans on a budget.
(and documented by a community of gamers)
there's also a culture of just keeping things to yourself once you figure them out, among some people
not many people contribute to the wiki, or are even able to afaik
think it's locked down to a few people effectively
As if those had anything to contribute.
there's also a culture of just keeping things to yourself once you figure them out, among some people
they won't contribute anything anyways
But yeah. Task ID = 13. So I don't know how to tell SetTaskState that that's the one I want.
Unless it's literally just 13 SetTaskState Succeeded.
well nah, like KK (although he was generally good) would straight up ignore 15 questions "how did you do X?"
Doubt you can activate task modules using the SQF command.
like dude just fucking paste the script lol
There's no script. This is the "On Act" part of a trigger.
sorry not you, Killzone Kid
Okay.
have you sync'd everything correctly? modules love syncing shit
The module tasks' state are changed using the Set task state module.
Yes.
8.Now the last part. Create the module "Set task state" set it to succeeded and synchronize it with "Create Task", "Set Task Destination" and the trigger you've placed.
So where's the problem?
Btw, imo this would be way easier without the modules.
Clunky af.
Okay, so the trigger's activation will automatically twig the module. Got it.
I was trying to use the module's condition as if it were the trigger's condition.
This was the first result I found with google. Never used Trigger modules myself. Decided long ago that they didn't offer anything useful that wasn't available otherwise.
i was experimenting with controlling the civilian presence module via script, before my c drive died
the module cancer is probably what killed the drive tbh
Surely.
Okay. So since briefing.html is out, and I hate the task modules, how can I call a briefing SQF? Just put createDiaryRecord; in init.sqf?
Or maybe []execVM "briefing.sqf" ?
Because the Diary Records are ASS.
like holy shit they're so bad if you use the module. Randomly ordered.
question
so i got this little piece of code
_this addMPEventHandler ["MPKilled", {
_victimName = name (_this select 0);
_killerName = name (_this select 1);
_weaponName = getText (configFile >> "cfgWeapons" >> currentWeapon (_this select 1) >> "displayname");
hintSilent format ["%1 was killed by %2 with a %3", _victimName, _killerName, _weaponName];
}];
problem is that
say I put it on a nato ai,named bob right.
it hints out saying
bob was killed by bob with bobs own weapon
even if a opfor unit kills it
any ideas why?
I mean, it's getting the weapon of bob instead of bob's murderer
but there's already a script designed for a killfeed on armaholic, y'know
how would I get the name of bobs murders then? and I guess their weapon too?
It's beyond me, man.
rip
Okay, so description.ext lets you set tasks but not diary entries
Thanks arma
(fuck you, arma)
You can probably cut bits out of it
yea i think thats wat I need the most
damn
I still get it where it hints the same name,aka the unit that dies
_this addEventHandler["Killed",{
hint format["killed : %1 -------- killer : %2",(_this select 0),(_this select 1)];
}];
omg
paraenthesis help
lol
_this addEventHandler["Killed",{
hint format["killed : %1============killer : %2",(name((_this) select 0)),(name((_this) select 1))];
}];
``` tihs works lol
this*
Okay, so, there needs to be a SetTaskParent thing...
_lp3 setSimpleTaskDescription ["Find the third stolen laptop and secure it.", "Secure Laptop", ""];
_lp3 setTaskState "Created";
_lp2 = player createSimpleTask ["Laptop # 2"];
_lp1 setSimpleTaskDescription ["Find the second stolen laptop and secure it.", "Secure Laptop", ""];
_lp2 setTaskState "Created";
_lp1 = player createSimpleTask ["Laptop # 1"];
_lp1 setSimpleTaskDescription ["Find the first stolen laptop and secure it.", "Secure Laptop", ""];
_lp1 setTaskState "Created";
_lpm = player createSimpleTask ["Stolen Data"];
_lpm setSimpleTaskDescription ["Laptops were stolen, filled with classified data. Retrieve them.", "Get them back.", ""];
_lpm setTaskState "Created";```
oh what the hell,the killed eh doesnt work for nonvinilla units
or could be becuase of ace ๐ฆ
It's always ace
God fucking damnit.
Who wanted to participate on that sqf blog again? I just got the arma3 github organization for us. So we have arma3.github.io now
@still forum sqf blog? What about it?
The thing we talked about here a week or two ago
Like KK's blog. But written by multiple people and anyone can contribute via pull request or similar
Link?
๐๐ผ
Is it a big load to the Server that if I set allDamage false to all Map buildings?
not really
Ofcause way more load than if you just set the buildings that you actually need
Thanks.
So what, contributions are markdown?
@Namenai#3053 I'm using the killed EH on CUP units with ACE right now, no issues.
Bux did (โฉ๏ฝ-ยด)โโโ๏พ.*๏ฝฅ๏ฝก๏พ https://arma3.github.io/
Heh.
But what to write about? You'd get an audience by writing (and explaining) code snippets of stuff people want and can copy paste.
Dunno ^^
I know I'll write stuff about SQF internals that I keep repeating in here
E.g. one article about code precedence.
Like the ultimate article explaining everything you can just copy paste the link to every time some asks about it.
Well, you don't have to mention elseType that doesn't exist in the article, but just list else as 5.
It's not that complex.
But do you really think people care about that? They'd rather copy paste a nametag script.
Some probably do ยฏ_(ใ)_/ยฏ
Not everyone always copy pastes someone elses crap
Most do. But not all ๐
Let's be realistic.
But what to write about?
Good examples, bad examples, some sort of tricks, some solutions, anything sqf related will be nice to have... atm we have 0 sqf blogs
Thesis: KK wrote about everything already.
afaik its dead
That is why he quit cuz he had already right written about everything
Yes, but the page is still there.
sqf drama maybe... "Once i tried to align weapon on a weapon holder" ๐
I'd like to see cool improtant stuff like https://gist.github.com/commy2/d0af36ba7b839eb8eb93874b08dcab2e
Or why not to use distance and use inArea
Also KK already stopped 2 years ago. params, private keyword, remoteExec, all Eden stuff.
Kinda weird reading his posts about variables... _var is a private variable private "_var"; is a private variable that is exclusive to this scope (Which is not completly correct)
Then there are private special variables which are... Just normal local variables(_x). He also calls them reserved variables although they are not reserved.
And also Public local variables
var1 = 1;
var2 = 2;
for "_i" from 1 to 2 do {
private "_myvar"; //notice how _myvar needs to be predefined
call compile format ["_myvar = var%1;", _i];
diag_log _myvar;
};
๐คฆ
Then there are Public local special variables such as true false time enemy friendly sideLogic sideUnknown sideFriendly sideEnemy playerSide east west civilian resistance independent opfor blufor nil objNull grpNull netObjNull locationNull taskNull controlNull displayNull teamMemberNull player
Uhuh... Yeah... These are totally variables...
Then there are Public global variables which actually don't exist and are just normal missionNamespace variables that you publicVariabled once or just thought about maybe publicVariabling them at some point somewhere.
After he joined BI and really learned how things work he already stopped writing basic tutorials. So even if he wrote about lots of stuff... Most of it wouldn't hurt to be rewritten properly.
Wiki calls them "magic variables". They're not really reserved, although you have to watch out for them to not be overwritten by accident I guess, e.g. when nesting two forEach.
Public global variables is fine. There is no difference between a global and a public global technically, but in usage there is. And describing a descriptive model of SQF is more important than the boring internals imo.
I guess one difference is, that a public global variables value is synronized from the server for JIP clients. So they are different in a way.
public globals can also belong to an object namespace, and probably also group, but I'm not sure those are synched properly for JIP.
yeah they are synced properly
Don't think there're any reserved variables aside from commands. And no command begins with under score.
You could call every compileFinal'ed script variable a "reserved" variable as you can't write to them
True. Dunno how useful it is to separate functions and variables though.
On the one hand, it makes it easier to categorize different parts you encounter when working on the code, on the other it discourages usage of local functions.
IMO it doesn't make sense. Variables are variables no matter what's inside them.
Same as commands are commands and not variables. Just have to keep in mind that Public local special variables is just another word for commands
You don't think it's benefitial to think of variables and functions as different things, even with the disclaimer that functions are CODE type variables?
Because I do think it's good practice to keep them separate.
Whether or not you want to use Hungarian notation for that is up to debate, but no one should support e.g. redifing functions mid mission.
Hey, does anyone know what could be causing this to spam in my RPTs? 10:42:29 Overflow 10:42:29 Overflow 10:42:30 Overflow I know it's a big vague, but that's near enough all i'm getting besides loading addons & general errors
@little eagle well Dedmen is right at some point, some new things should be explained since KK quit and his web will also go down eventually. Comes up with community needs a stable blog
@quaint turtle #arma3_troubleshooting
Biggest problem with KK's blog is that it's done by one guy. He once wrote down and told people about how he thought things work.
Since then he learned how they actually work and things have changed, but the old entries are left there for noobs to find and get hung up on.
@still forum You wanna make it alike a huge FAQ?
Dunno yet. Most stuff on there won#t be frequently asked ^^
explaining the basics of sqf is a start i'd say
I'll write stuff about the internals of the SQF engine. As to why things are like they are when people think "WTF is dis".
I think other guys planned making a SQF tutorial like many people want. In written form and properly.
Properly aka not written by one Life scripter sitting in his dark conor and imagining how things work instead of actually informing himself.
Good thing is also that through the open-source and PR nature many people look over the entries. Instead of one guy just writing down what he thinks.
or youtube videos....
Nice idea, because there's no resource like this yet, besides KK blog which is not going to be the similar
I need a title for my internals posts. Something cool...
Inside the Engine or behind the sences sounds boring.
The repo is already up so people could start writing things. We are missing layout and.. basically everything else though.
But entries are just markdown so they don't really depend on anything.
I took ACE wiki as example https://github.com/acemod/ACE3/blob/master/docs/_posts/2017-07-14-ace3-version3100.md
-> https://ace3mod.com/2017/07/14/ace3-version3100.html
You do realise that this is the scripting channel? Not the talk about blog channel? However, rather than showing off your e-peen about semantics, you'd be far better off teaching basics that would get more people off the ground.
What?
A blog about scripting is not scripting?
You do realise that this is the scripting channel and not the "rant about something without real reason" channel?
As I already said other people want to make stuff to teach people basics. And no I wouldn't be better of trying to teach people basics, as I don't have the skills to write stuff so that 5 year olds can understand it.
Why don't you do it? It's open-source and everyone is free to contribute.
@still forum I for one think it's a good alternative, even though I'm quite sure KK's site will remain up for quite a while. The only issue I see would be that you'll still have to curate entries.
KK already said it will stay up
Entries will be curated. As someone has to approve the pull request. Granted. Could be done without reading it...
You can't "not" curate using github unless you merge pull requests without checking what you're merging
leading me to my next point; The everyone in "everyone can contribute" specifically means; those that qualify?
No, anyone that has enough of a brain to create an account on github and send a PR
then it's all basesd on the PR content
Ofcause people can still say "we don't want that" or "It doesn't fit the blog".
But they usually just say "Fix this" while pointing to a typo
example:
literally 80% of my PRs for ACE3 ๐
Like. Personally I would want to keep the script snippet spam low.
We don't need someone posting "Hey look at this life car shop script I made"
Thanks for clarifying. I for one would be interested to participate.
as long as it's an example for another "chapter" or topic i'm fine with it tbh
Repo is at https://github.com/arma3/arma3.github.io
We don't have any structure in it yet. But if you want you can already prepare something. As I wrote above it's basically just markdown, you can look at ACE thing I linked above for example.
We can move it into the correct place and stuff later when that correct place exists
@still forum _var is a local variable, not private variable. private _var forces declaration in the current scope, regardless of whether one exists up the call chain
For that I have to agree. That's kinda magic.
But _x and similar are just normal variables that are set by the engine instead of a user.
They all are
They're not protected either
This prints "LOL"
switch 0 do
{
___switch = switch 20;
case 20:
{
hint "LOL";
}
};```
I'd call the switch one magic because it is not documented anywhere and the datatype is special.
It's nothing the user should see. It's purely for implementation
Sure. But it works no different from _x
long time ago in dev build spotrep was fixed: CTD when ___switch is nil... i know people who tried to find anything about it...
and was no sqf blogs back then ๐
but now... maybe...
So
I can disable shooting
via
player addAction ["", {
player sideChat ([
"Nope", "Forget it", "BANG, I guess..."
] select floor random 3);
}, "", 0, false, true, "DefaultAction"];
// KillzoneKid
What's a way to disable throwing?
I saw a PFH option for inputAction and creating and closign a dialog
ohgod
Any other way?
just delete the nade after firedMan
you can't
Alright
unless you refuse the input via a keydown EH
If throw key is pressed setdamage 1
but even then if the dude has shift + G as a shortcut you're fucked
๐คท๐ผ
0 spawn
{
disableSerialization;
waitUntil {!isNull (findDisplay 46)};
var_ehBlockNades = (findDisplay 46) displayAddEventHandler ["KeyDown", "if ((_this select 1) in actionKeys 'Throw') then {true} else {false};"];
};
ez
then true else false
GG
also actionKeys is unreliable because the DIK code for shift + G would be higher than 7 digits
@meager heart Interesting. That event handler persists when you restart missions, unless you quit out of them altogether then start the mission again.
well you can remove it....
duh
and true/false is correct there, alganthe
where what
read that if statement VERY carefully
what
what is inside that condition sldt1ck
@lone glade I know. But you'd think "Restart" and restarting the mission were intended to do the same thing.
the if statement is already a boolean
sorry ๐ฆ
๐
๐
๐ฐ
if ((inputAction "DefaultAction") > 0 || (inputAction "Throw") > 0) then {
``` does not work with shift g
I'll try the @meager heart
yes pls lol
it won't, ever
modifier keys + other key DIK code are 7+ digits
meaning arma chokes on em'
and for remove it
if (!isNil {var_ehBlockNades}) then {
(findDisplay 46) displayRemoveEventHandler ["KeyDown", var_ehBlockNades];
};
๐ฌ
@peak plover , got it working yet ? ๐
can you actualy make it fail and show how you did it ? ๐
will be good lesson for me
Eh? You can disable throwing with keydown
@lone glade so no way.. ?
you can't
like I said maybe 30 minutes ago is still valid
shift + G DIK code is too high, people who rebind their keys or other "high" key combos would end up breaking it
Use input keys command
..... you don't seem to understand what the issue is demellion
floating point precision is the problemoh
Maybe, you mean like 2/3 keys combo DIKs?
any modifier key + another pretty much
Hmm, I'm in 2 days away from my workstation, gonna try peek it remotely
just two
what is the key code for SHIFT+G
hm... good point ded, lemme check
But again. Some people might have 3. Or joystick keys (Which are also very high)
shift+g+ one more maybe ?
So in the end you're only ever gonna be able to make it work for most people but not for all
0x2A + 0x22 for shift + G
If that really breaks it, I should reconsider some of my keydown EVH ๐
hm... lemme check something
nah keydown isn't affected by this afaik
only actionKeys
Well I use actionKeys in it for same reason like default actions, not exactly a buttons
2xG: 290
Shift + G: 7.05888e+008
You can accurately represent from -16777215 to 16777215(0xFFFFFF)
Considering that we only go to positive. Eh.. Thta.
so yeah, actionKeys is still borked
0x2A + 0x22 I didn't mean the seperate dik keys. I meant the combined one.. Which.. you can't read out anyway because.. you can't ๐
yeah, you can't ๐
F*uck
shift + A or shift + F would evaluate the same as shift + G in this case
so you're shit out of luck
That is about 705888000. Which is much bigger than the max 16777215
You might get lucky and it might get rounded to what you expect though
Like good luck with it
But like.. If you try SHIFT+H instead of SHIFT+G that lucky rounding already won't work anymore
At that point the closest float numbers next to each other are actually 64 integer away.
Dare I say, intercept?
Intercept also has to go through the script commands and do the float conversion for that
So nope
You could guesstimate though. Like if the value is close enough to what you expect, still trigger
Precision is the key lol
I have throwing grenades on shift + g, and you definitely can't block that with a keyDown eventhandler, because the double reported as DIK code from actionKeys loses precission and comparing in SQF fails.
16777216 actually
But again that would probably trigger for SHIFT+G same as SHIFT+H
great pun there @unborn ether
I copied my values from Intercept. I knew I took something off just to be extra sure but didn't remember how much ๐
Also, I used to have throwing grenades on Mouse 5 and that can't be blocked either with keyDown.
-16777216 to 16777216. Then 16777217 can't be represented. And 16777218 can
I guess Intercept could Intercept the keypress before the engine get's to see it.. But.. Nah.. Too much work for too little result
What if to try add action to throw same as to DefaultAction?
That used to work, but no longer blocks the input since a few years.
so, long story short is to just delete the nade after throwing?
Well delete the projectile
Or remove the player's grenades from their inventory
Make a loop that resets the throw muzzles reloading time every frame.
It's really not noticable, especially in a safezone outside of firefights.
So yeah @peak plover I would say the problem has been deconstructed ๐๐ฟ there lol
Oh.. That's a neat and tricky way to get the PFH in there
15 lines of code and a map marker.
Yeah, SQF is fun if you know what you're doing. ๐
Even if you don't, less for users though ๐
I guess this one could be an article on that new blog.
but yeah as always whatever the topic, Commy has 10 lines stashed somewhere already doing this ...
Talking about floating point limits now makes me wonder why the game shows integer numbers that can be accurately represented, in scientific notation
That's that kind of small script snippet posting I wanted to avoid. But if you include why all the other ways don't work ๐
Lol
I guess this one could be an article on that new blog.
yes please!
Of course I'd have to asplain how it works.
Weapon reload time affects throw ?
nice thanks @little eagle
Basically the same in repeat as pseudo code / speech.
Grenades have reload times
Yes.
Never seen this before nice
@compact galleon default length for stringified numbers isn't that long. See toFixed
On comma numbers it just rounds to meet the length. I guess on too big integers it uses scientific notation to get length down
Grenades are magazines and each magazine has a reloadTime (1 divided by the rate of fire) and a magazineReloadTime (changing clips).
@still forum Good to know. tofixed 0; hint str 16777216 for useful conversion
Well that should be obvious as Throw is the same weapon muzzle like a Cannon, but never tried that
I think toFixed also changes precision of scopes above your function. So be careful if you do that in a API function somewhere
Any weapon is the same isn't it ?
Throw is a weapon, not a muzzle. The Throw weapon has lots of muzzles. One for each greande type.
Except stuff like different colored chemlights. Those share a muzzle I guess.
But all the smoke grenades with their colors each have their own muzzle.
@still forum Description says "to end of current scope"
I want try seeing a bus throwing a nade
@compact galleon No. It says until the end of script.
it's a grenade launcher inside your arm with an associated anim
toFixed only helps for representing floats. You still don't get double accuracy.
@still forum I'm looking at the in-game description, not the wiki
So string conversion.
Uses fixed-point notation in all number to string conversions until the end of the current scope
But it's wrong
Someone test it.
So who is correct now. Description or wiki ๐
it's nice for cutting decimals too or avoiding engine bugs
@still forum Evidently the wiki
This prints 16777216 twice.
call { tofixed 0; systemChat str 16777216; };
systemChat str 16777216;```
private _num = 11111111;
call {
toFixed 8;
};
hint str _num;
Afaik that command was made by KK. So the ingame description was also written by him. The wiki page though was also written by him.
๐
tofixed -1 returns it to default
call { tofixed 0; systemChat str 16777216; };
tofixed -1;
systemChat str 16777216;```
How much human lives being spent fighting an arma precision?
Does KK even know how we use scope vs script?
english died on this day
Ohh.. Actualy very nice to know. I have a couple dummy variables in Intercept's VMContext.
toFixed state is saved in there if it's global over a script. So that probably is one of them
english died on this day
njet
Da
Lol. end of work in 2 minutes. Almost forgot about it and missed it
"End of work in 2 minutes". Pretty sure you ended work hours ago
lies
End of pay in 2 minutes*
Actually My work ended one hour ago. But I'm making some extra hours for the pesky clock thingy
btw got that keydown fail... right ctrl + left ctrl did the job lol
Kill me
It's not keyDown that fails, it's actionKeys.
more precisely actionKeys returning key combos
*yep ^ corrections
actionKeys is essentially unusable and every script that uses it can be abused.
None
Been like that for years. Hard to get through to people though. They have a hard time accepting the truth.
No workarounds.
Not using them seems the best workaround it seems.
Yep.
I seriously feel like I had that exact same conversation a few years ago
I had this conversation at least 20 times.
Welcome to the A3 #arma3_scripting loop of the day
sank u
you can use "hard coded" key combos that you know work in keydown EHs
since keyDown returns the state of the modifier key instead of the DIK code of the combo
Imo resetting the weaponReloadTime of the Throw and Put muzzles every frame is the best solution.
Does MB5 trigger some EH at all?
mouse button?
MouseButtonDown, but that cannot be blocked like KeyDown.
don't think extra MB keys are handled by it, lemme check