#arma3_scripting
1 messages ยท Page 374 of 1
cool, what is the event handle for distance?
i'm sorry but there is more to scripting than EHs and triggers
there may be a completely different solution for it
i need to detect if a player puts a "m112 x4 charge pack" inside a especific area
yes ive read that
but WHY
do you want him to blow something up ?
or why do you need to detect the placement
its need to be played a sound when the charge is in the area
like this one
https://youtu.be/KyF0B0d3vgg?t=6m13s
ah
a fired eventhandler might work
last time i used that with "put" was in A2 i think
if (nearestObjects [player, ["m112x4.p3d"], 200];)
i cant use that, gives generic error
m112x4.p3d is not an object
๐
why the coma at the end?
player addEventHandler ["Fired", {
params ["_unit", "", "", "", "_ammo"];
if (_ammo isEqualTo "rhsusf_m112x4_ammo") then {
if ((_unit distance2D yourbombtarget) < 10) then { // withing 10m radius
// shit is happening
};
};
}];
params pls
params ["_unit", "", "", "", "", "_magazine"]
now if my keyboard was properly placed in front of me i'd type faster, but my hotas is blocking it ๐
My editor has the params as template for all* addEventHandler as auto complete.
hmm
@astral tendon Look at your object and do this in the console _obj = cursorObject; copytoclipboard str(_obj);
i think u'll get the classname
got this: ```2771264: m112x4.p3d````
Looks like an OBJECT.
Go to virtual arsenal, found your item, place your mouse on it and wait, the classname will appear @astral tendon
rofl
Or just use typeOf cursorObject via debug console.
think this is it rhsusf_m112x4_ammo_mag
ah right
That's a magazine if the classname doesn't lie. He's looking for CfgVehicles/CfgAmmo/CfgNonAiVehicle
nop he need the classname to use it with nearestobjects
to check if a bomb has been planted near the player
but the EH will work just fine
(if i understand him correctly)
nearestObjects etc. only works with those 3 I mentioned.
yea, but rhsusf_m112x4_ammo_mag is the most logic classname i found x)
typeOf cursorObject is guaranteed to work though.
though personally I wouldnt limit it to a single kind of explosive
_magazine isKindOf "PipeBombBase"
Depends on the mission I guess.
sure
typeOf cursorObject give this
"rhsusf_m112x4_ammo"
or ammo in that case
Well there you go, Roque. That's your classname.
thanks commy
Problem solved. ๐บ
I should just add typeOf cursorObject as a default field somewhere to the debug console.
Could someone who has succesfully returned currentweapon picture/display name in a dialog give me some advice?
I have typeOf cursorTarget as expression in the config viewer, which can be done by modifying some profile namespace variables ๐
getText ?
yup, all working
params ["_unit", "", "", "", "_ammo"];
if (_ammo isEqualTo "rhsusf_m112x4_ammo") then {
if ((_unit distance2D test) < 10) then { hint "yes" };
};
}];```
private _weapon = currentWeapon _unit;
private _config = configFile >> "CfgWeapons" >> _weapon;
private _displayName = getText (_config >> "displayName");
private _picture = getText (_config >> "picture");
Something like this?
thanks everyone
Yea Commy - I've got that info and I understand that process. I can put that into a CutRsc but I'm failing to make a dynamic dialog to be called using the above info
Well, dialog implies buttons to press, something a cutRsc thingy cannot do. You'd need createDialog instead.
Do you know how ctrlCreate operates? If so, this is how you create a display you can interact with:
private _display = allDisplays;
createDialog "RscDisplayEmpty";
_display = (allDisplays - _display) select 0;
And then just add clickable controls to _display via ctrlCreate. E.g. RscText for displayName, RscPicture for picture, RscButton etc. etc.
can you add an eventhandler for all displays, which will be open?
onLoad? Not in vanilla. With CBA you can for most displays.
No.
I don't but I have started to work with this area of scripting - that really does help Commy thanks // just clarify I have made a functional GUI - just not dymanically yet ๐
Good luck, lol!
wow i now got to an point where i need a precise number to find the object....
any idea why it still finds it? https://puu.sh/y0vjN.jpg
I may think that the object id loses the same precision? Could that be because it is the same nuber and would have the same inaccuracy?
The problem is it changes with every new server start
Yes, that is how it works.
You can't use these stringified object ids anyway, even without restart. They are double internally, but SQF only supports single float. You cannot differentiate between two big ids potentially.
Well this... bad if i want to check if an editor object (object with id) is already placed to get the data of my DB instead of create to do a reinitialation
set a variable to every editor placed object
Or give them a name.
That's what I meant
hm can i find an object over a variable in their namespace since i want to keep the normal Variable (Name) Field open
Why?
For mission makers later on :/
Thats more a kind of a frame instead of an actual mission
framework*
Make a script that iterates through all mission placed objects on game start?
And give them all names by using BIS_fnc_netId on them.
i was not sure if this is the perfect word but yeah at least it seemed to be the right one ๐
//postInit
{
_x call BIS_fnc_netId;
} forEach vehicles;
There. That should be the same every restart as long as you don't edit the mission I guess.
Well the edit. Sadly an also important part i put my targets high
i could probably check for each vehicle if it has the ID and if it has it select it
Then there's no way to say which object is which. If the mission editor is allowed to move them around, they lose all relation to the previous mission object-
this is where the DB comes in handy
but well i need the original id ๐
that was the goal "^^
in that case you could be create vehicles yourself from the DB information and setting their ID manually
No, there's no relationship between the objects. Therefore you have no hook for your database to say which object is which.
not have them in a mission, because then there's no way to know which vehicle belong to which DB entry (if you also allow removing vehicles in the mission)
Yes. No way to tell, because they are not related.
there is an way but only if the floating point inaccuracy would not be there
... okay
They are unique but you can't predict which ID they will have
Yes.
Especially if you remove one vehicle and then add another
They're lost after the mission ends.
@gray thistle use toFixed to turn the number back to string
I worked with them many days they did not change
you have more precision than the game shows you
also i edited the mission
maybe i did not encounter that and yes they autoincrease but only if a new object is placed
if you move an edited object the number wil not change
This is a terrible idea. : P
also this is only for the mission start not random this is where i have to say you are right
so my _vehs will be created if they are not already gotten from the editor
thi is the point where it gets random
Reminds me of when people used the map ids for objects and then complained after every map update that they were changed.
They complained so much that BI removed the ids from 3den or something like that.
Not entierly
it was 2D editor back then
I don't know what valid use they have actually
how could i make sure that they have their own ids
alganthe
Return the object with ID 123456:
_nObject = [0,0,0] nearestObject 123456;
yeah, no, I said "valid" use
@lone glade It's all internals shining through. Not meant to be used as API.
it really was the lazy way to open for example a certain door
like if there was a gate somewhere that you wanted to open and you went about it the bad (aka not valid) way then that's what people would use
then there would be an arma update and it would break ๐
Hm i could number the object by X/Y axis there would be the problem i would not be able to change the veh pos
Name the object by the Database UniqueID
Then i would not have editor compability
except i could use that in the editor
"Name the object by the Database UniqueID" Also i am doing that already ๐
Then why bother to number the object by X/Y?
Editor compability but this would not help either
Editor compability? As in?
You can change stuff in the editor and the vehicles would be placed right still if they were moved or changed (ammo dmg destroyed)
also they did not remove the 3EDENEntitiyID
https://community.bistudio.com/wiki/get3DENEntityID
No clue what you are stuck on to be honest. But i don't use eden editor really
You assign the database unqiue id to the objects via setVariable (when added or loaded from database)
That way if the object is moved / changed you can getVariable to get the database unqiueID and update it in the database.
I am not sure if i could do everything over something like ares
Btw it's somewhat weird that editor objects don't have their own ID autoincrement diffrenced from the word object id
Question can you get some numbers out of the mission SQM itself which you can exactly order to a unit
no
anyone got any ideas why the init EH of an unit doesn't fire when createUnited from a dialog?
(A3 EH not CBA's XEH)
wrapping it with with uiNamespace do {} works
still looking for a reason though
I'm also guessing that wrapping it in a spawn {} might work
How did you determine that it doesn't fire?
well the side effects of the init don't show
Which are?
I'm not sure about loadout, but certain commands simply fail at unit init. setVariable public for example does not synch when used inside the unit init. It does work when used in the same frame though.
Maybe the same is true for addMPEventHandler.
it works just fine in the editor and through the debug console, it's just this dialog that's breaking it
There is no synchronisation in the editor. Dialog?
trying to troubleshoot some ALiVE ORBAT tool issue
My guess is that setUnitLoadout doesn't work at init, or there is a race condition with a different loadout script.
Now we jumped from unit init to some dialog. I don't see the connection.
you asked Dialog?, so I gave you the dialog config ^^
If I run into this problem, I just change init to initPost and it works 99% of the time : P
So basically the same as you did.
that only applies to the actual mission init right?
we don't want a CBA dependency for all the exported group config collection mod thingies :/
Just keep the spawn then.
It's essentially the same for your purpose.
Just saying that this issue is known (to me at least).
I have the feeling we're not on the same page on what the actual problem is but that's probably just me doing a bad job explaining it ๐
thanks anyway
Hi, I just came across some kind of double call with function? Anyone know about it and why, etc?
Line 27
Was just wondering is all ๐
it uses the return of the first call as the param for the second
Oh
I see... Thanks.
So it's just shorter than something like this: _return = [arguments] call TAG_fnc_something; [_return] call TAG_fnc_blah;
If I understood correctly.
@peak plover I figured out my NPC problem - create a unique Group for every unit, set each one to 'enableDynamicSimulation true'
then run a scheduled script to locally hide/unhide the closest ones per-client
that takes care of both the FPS and the network traffic, and lets me keep the 16k view distance
not sure how it'll fare with a bunch of players spread around the world, but that's a problem for another time
@obtuse cosmos yea thats it
Cheers, good to know, learnt something new ๐
Okay so how do i properly do pitchbankyaw without fucking shit up? I wanna get current [pitch, bank, yaw], adjust one of them by X and then set it
And have it work
Also how do i prevent it from just going up in the sky if I use setPosATL after it (Because that seems completely fucked?
@little eagle you like math right? :3
Anyone know why this happens:
if ((VEHICLE_DAMAGE_PROBABILITY > (ceil (random 100)))) then
{
_vehicle setDamage (VEHICLE_BASE_DAMAGE_MIN + (ceil (random VEHICLE_BASE_DAMAGE_MAX)));
};
Those are macros btw (obviously), in my config:
// Vehicle damage probability (in percentage %)
vehicleDamageProbability = 60;
// Vehicle base damage amount
vehicleBaseDamageMin = 0.15;
// Vehicle random damage amount
vehicleBaseDamageMax = 0.15;
I did a test with hint to see what it is:
if ((VEHICLE_DAMAGE_PROBABILITY > (ceil (random 100)))) then
{
_damage = (VEHICLE_BASE_DAMAGE_MIN + (ceil (random VEHICLE_BASE_DAMAGE_MAX)));
_vehicle setDamage _damage;
hintSilent format ["%1", _damage];
};
It shows 1.5 ??? lol ???
The max it can be is 0.3 - no?
@peak plover sure, https://pastebin.com/zDQKStQa
I've confused myself lol
Ah
Is ceil whole or decimal? Hm
Checking
Wow.
I think I see why.
Gonna try removing ceil, not needed
I guess there is no dynamic way to tell a static MG to only cover specific directions? I got a M2HB (M3 AA) located on a Watchtower (https://i.imgur.com/BwD0kaJ.jpg) but for some reason sometimes if a enemy is upfront the M2 Gunner randomly decides to turn himself + the weapon in the opposite direction and either A) he gets killed then or B) the weapon flips and become damaged
Fixed! I removed the wrong ceil haha - All good now.
I know that doWatch and doTarget exist but I guess these are not that dynamic and apply only to a certain point hmm?
meaning that I would need to manually select a target each time, right?
nice share ~ thanks @ionic orchid , have a more perm author link for attribution if i use some bits?
twitter.com/giragast would do
thanks Quiksilver I will try that
@hollow lantern nice tip from kidkillzone at the bottom of the setformdir wiki page too
uh gonna check that out thanks Burnacus
// I can do it now!!!
hintSilent "I AM A GENIUS! :P";
Took me a while to see I was using the wrong symbol lol ' > `
Hmm
What if when I cache units dynamically I save the variables attached to them via _vars = allVariables _unit;
Ohh crap
That won't work because there's no way of checking if a varaible should be public
And setting public variables for units uncaching is just a bunch of desync
This is a theorycraft question (to ensure I have an understanding of local/global) - If I have an event handler to happen to all East units within the init.sqf that add's a HoldAddAction - will this addAction be Global to use for everyone? If I then set this addaction to not repeat - would it be single use or would it be a global addaction that everyone could use once?
From my CTF project: ```sqf
player addAction ["<t color='#F37C01'>" + (format [(localize "STR_weaponSelection"), objNull]) + "</t>", Haz_fnc_weaponSelection, "", 0, false, false, "", "(_this == _target)"];
// only once in init.sqf (or rather client_init.sqf called from init.sqf) so pretty much the same thing
// They get it everything time, JIP
// the action stays in this case
// (_this == _target) - Only that player can use the action as well as see it
The reason why that has format in was because I copied it from something I did use it for, just didn't remove it yet is all.
Ah... You mean, say Killed EH with addAction? From init.sqf? You are asking who will see the action? Correct?
@waxen cosmos
All should see, depending on condition, etc... But I don't think JIP will see it if action was added before they joined. Not by default anyway. Not that specific unit action at least.
@obtuse cosmos what is this you're trying to create ?
Have you had a look a our CTF version ? Already running in tournaments and public every week...
No need to create anything for CTF lol it's already there ๐
@quartz coyote capture the flag tournaments?
@rancid ruin lol yes haven't you read the SITREP ? We got a shout out for it lol send me a PM I'll give you the information you need
was just curious, i don't really play arma in mp
more wondering from a scripting/mission design perspective cos arma still interests me in that aspect
@rancid ruin let's talk in pm so we don't span this Chan lol
@waxen cosmos What?
And in the end the winners were mods that were already there before. And that would've been made anyway
I did all this for the closed server milsim.
community MP gamemode good luck getting a whole community to agree on the best way to do something
design, scripting, everything...it would take years of work and drama
Description:
Using setFog with fogParams syntax, e.g 0 setFog [0, 0, 0] on the server will cause a fog sync to all clients.
Using setFog with an integer, e.g 0 setFog 1 will not cause a sync to clients.
lol
anyway, big projects have existed since day 1 of arma 3, tacbf was one for example... obviously a lot of it needed serious reworks, however there was always a lot of finger pointiung there
everyone saying they want a big pvp mode, everyone saying they could help improve it.....but the amount of people actually helping was extremellllly slim
even then, arma pvp is extremely fragmented between private events (that usually run some sort of no-respawn ace), versus more PR like gamemodes...
and these there's the competition of games like squad too
Any ideas how i can hide/delete objects a player is aiming at? hideObjectGlobal cursorObject;``````deleteVehicle cursorObject; doesn't seem to work
@waxen jacinth read the wiki!
it must be executed on the server
SE icon
@gusty flume your description is very vague
does the server try to load the mission?
PBO files are not #arma3_scripting
If you have problems with your server #server_admins
You should go to #server_admins
Also I'd suggest stopping to post the same question in multiple channels... People really don't like that
Oh
Scripts can load stuff?
๐ค
@gusty flume No one will help you if you don't say anything specific about what the actual problem is
Uhm..
You mean the mission starts just fine and there is 0 issues with the PBO.
But your scripts don't work?
@simple solstice Cheers. Is it even possible to delete/hide cursorObjects with deleteVehicle or hideObject/Global? Regarding to wiki it only "can be used on all objects with class names"
@h0nkX#7510 "Is it possible to hide Objects with hideObject" What do you think that command does?
that's a weird note about hideObjectGlobal
If the mission can be loaded then the PBO works. @gusty flume
You made that mission?
hidingObjects for sure, i'm just confused by that statement "all objects with class names" - some terrainobjects (HIDE) doesn't even have a classname, do they?!
Every object has a class.
everything has a classname
except simpleObjects spawned by model path
But I think even they can be hidden with hideObject ๐
What I was doing is hiding the object and then setdamage 1 them
@gusty flume I guess your "just some changes" broke the mission then.
And I used nearestobject to select the object
What tool did you use to pack the pbo?
is it a mission or a addon pbo?
did you fully repack using pbo manager or did you just replace some files?
any errors in your or the server RPT?
I would be able to.. Not sure if I want tho
Definetly don't want to as I see how you spam your crap everywhere although you've been told that's not liked here
Question on the A3 datalink system....Is this turned on by default or do mission makers need to script in true to the following variables:
setVehicleReportOwnPosition
setVehicleReportRemoteTargets
setVehicleReceiveRemoteTargets
Please tag me if you know, ty!
@tough abyss afaik its set by the vehicle config BUT can be changed in editor and via scripts
Ty, so if nothing is scripted in, it's on by default?
depends on the vehicle
@tough abyss e.g. some have recieveRemote and reportOwn but not reportRemote; but you can check that via attribute window in editor
Rgr, ty!
I think vehicles have it on by default if they have config flags receiveRemoteTargets reportRemoteTargets and reportOwnPosition set to true
i have this script
this addEventHandler ["killed",{if (player == (_this select 1)) then {hint "dont shoot civlilians!";};}];
i am gonna change to a playsound intead of hint, but i am woried if it may happen that to many sounds will be played at same time
like, a guy trow a granade and then 2 civs die and plays 2 sounds at same time
that would be anoying, i would like to only play one or one afther another
you could track when youve last played a sound, and then only play a new one when its been over (insert amount) seconds
thats another thing, i will use selectrandon to chose one of the 3 messages
or more
thats fine?
killed eventhandler does only fire on the machine where the object the eventhandler is attached to is local. This will not work in MP.
that will work to MP?
aren't all dead units civilian?
the sound still plays if the target is a opfour
i have
that worked
agents?
oh, that is to spawn units
also, that code does not fire when a opfour kills civilians
that is also good.
Hello,
How can I remoteexec a function ?
"ctf_fn_outro" remoteexec ['call', [0,-2] select isDedicated,true]; ?????
is this correct ?
No.
Thanks amaizing help
Have you read the wiki article of the remoteExec command?
Yes but it is a bit complicated
I still need practice and advice
that is why I am asking for help
I you are not incline to help me annother will I am sure
Example 6:
// runs "someFuncWithNoArgs" on each connected client
remoteExec ["someFuncWithNoArgs"];
Can you fill in the blanks here?
remoteexec ["ctf_fn_outro", 'call', [0,-2] select isDedicated,true]; would this be more correct ?
of maybe
remoteexec ["ctf_fn_outro", [0,-2] select isDedicated,true];
That looks better, but what's the JIP flag for? Isn't the mission over after the outro? Why would someone else join?
I think
remoteexec ["ctf_fn_outro", [0,-2] select isDedicated,true];
would be more correct no ?
You re posted the same thing twice if I'm not struck with blindness.
Sorry, I thought I was unclear
my original script was
"outro.sqf" remoteexec ['execvm', [0,-2] select isDedicated,true];
Do you know why you're doing things or are you guessing?
a bit of each.
[0,-2] select isDedicated is pretty poor design, because while you account for a dedicated server having no interface, the function will still be executed on a headless client. Better to add a hasInterface check at the top of the function.
Make the function safe to be executed everywhere.
Oh that sounds good
let me write it again
waitUntil { hasInterface };
remoteexec ["ctf_fn_outro"];
How does that look ?
Pretty bad, because hasInterface never changes, so having it in a waitUntil loop is pointless.
It either passes first try or is stuck as loop forever checking every frame until the mission ends.
but wait ...
hasinterface : Returns true if the computer has an interface (a real player). False for a dedicated server or for a headless client.
My script is executed Server side on a Dedicated server ... how is that going to help me
I meant to add:
if (!hasInterface) exitWith {};
as first line in ctf_fn_outro, so this function is safe to be executed everywhere and simply does nothing on a machine without interface.
And then just use remoteexec ["ctf_fn_outro"]; like you posted.
Maybe ctf_fn_outro already is safe, so you don't need to do anything. Idk, I just assumed you do, because you had that isDedicated check.
to be honest the isDedicated check was added by someone else that said it would be good lol I just followed blindly
would you have some time to vocal chat so I can explain better ?
Typing is annoying
how to you quote script in Discord -_-
```sqf
code here <<<<
```
blabla
ah
nice
InitServer.sqf :
Sleep (TimeP+30);
// Send End Status to allPlayers
TimeEnd=true;
publicVariable "TimeEnd";
hint parseText format ["Mission over<br/>Final Score : <br/><t color='#0000FF'>BLUE</t> %1<br/><t color='#FF0000'>RED</t> %2<br/><br/>Flag Touch : <br/><t color='#0000FF'>BLUE</t> %3<br/><t color='#FF0000'>RED</t> %4", WScore, EScore, westtouch, easttouch];
remoteexec ["ctf_fn_outro"];```
fn_outro.sqf :
scriptName "fn_outro";
// Created By Flash-Ranger - flashrangerarma3@gmail.com (Please respect the time I spent on this system)
// Please do not modify anything in this script without knowing what you are doing.
#define __filename "fn_outro.sqf"
playMusic Music;
waitUntil { !isNull {player} };
Player EnableSimulation False;
["<t color='#FFFFFF' size = '1' shadow='1' align='center' font='PuristaBold'>GAME OVER</t>",-1,-1,8,2,0,3088] spawn bis_fnc_dynamicText;
Sleep 10;
enableRadio false;
If (WScore > EScore) then {[format["<t color='#004399' size = '2' shadow='1' align='center' font='PuristaBold'>BLUE</t> <t color='#FFFFFF' size = '2'>Team Wins<t/><br/><t color='#FFFFFF' size = '1'>Blue : Points %1 - Captures %2<br/>Red : Points %3 - Captures %4</t>",(WScore),(westtouch),(EScore),(easttouch)],-1,-1,15,2,0,4001] spawn bis_fnc_dynamicText;};
If (EScore > WScore) then {[format["<t color='#7F0000' size = '2' shadow='1' align='center' font='PuristaBold'>RED</t> <t color='#FFFFFF' size = '2'>Team Wins<t/><br/><t color='#FFFFFF' size = '1'>Blue : Points %1 - Captures %2<br/>Red : Points %3 - Captures %4</t>",(WScore),(westtouch),(EScore),(easttouch)],-1,-1,15,2,0,4001] spawn bis_fnc_dynamicText;};
If (WScore == EScore and westtouch > easttouch) then {[format["<t color='#004399' size = '2' shadow='1' align='center' font='PuristaBold'>BLUE</t> <t color='#FFFFFF' size = '2'>Team Wins<t/><br/><t color='#FFFFFF' size = '1'>Blue : Points %1 - Captures %2<br/>Red : Points %3 - Captures %4</t>",(WScore),(westtouch),(EScore),(easttouch)],-1,-1,15,2,0,4001] spawn bis_fnc_dynamicText;};
If (WScore == EScore and easttouch > westtouch) then {[format["<t color='#7F0000' size = '2' shadow='1' align='center' font='PuristaBold'>RED</t> <t color='#FFFFFF' size = '2'>Team Wins<t/><br/><t color='#FFFFFF' size = '1'>Blue : Points %1 - Captures %2<br/>Red : Points %3 - Captures %4</t>",(WScore),(westtouch),(EScore),(easttouch)],-1,-1,15,2,0,4001] spawn bis_fnc_dynamicText;};
If (WScore == EScore and easttouch == westtouch) then {[format["<t color='#FFFFFF' size = '2' shadow='1' align='center' font='PuristaBold'>DRAW Game</t><br/><t color='#FFFFFF' size = '1'>Blue : Points %1 - Captures %2<br/>Red : Points %3 - Captures %4</t>",(WScore),(westtouch),(EScore),(easttouch)],-1,-1,15,2,0,4001] spawn bis_fnc_dynamicText;};
What is this unformatted aids
_camera="camera" CamCreate [0,0,0];
_camera cameraeffect ["internal", "back"];
_camera CamSetTarget Centre;
_camera CamSetRelPos [30,30,50];
_camera CamCommit 0;
waitUntil { camCommitted _camera; };
sleep 5;
_camera CamSetRelPos [100,100,500];
_camera CamCommit 10;
waitUntil { camCommitted _camera; };
sleep 5;
"end1" call BIS_fnc_endMission;
sleep 5;
_camera cameraEffect ["terminate","back"];
camDestroy _camera;
@little eagle does this all seem correct to you ?
Still needs that
if (!hasInterface) exitWith {};
in outro.sqf like I suggested, otherwise it loops forever for player to not be null on headless machines.
right
waitUntil { !isNull {player} };
This line is wrong. I think you confused the syntax of isNull with isNil.
isNull CODE will just error.
That's wrong too, because player will never report nil.
but @still forum told me it was inNull lol
Well, it's correct syntax, but bogus code.
Yes, it is isNull, but not with CODE, but with OBJECT.
it should be* is what I mean.
Okay.
player reports an object. The avatar. It reports a null object on headless machines (dedicated server, headless client).
OBJECT
CODE refers to everything wrapped in curly brackets.
{anything} <<< code
Ahhhhhhh
CODE is a glorified string essentially. Instructions that can be executed but by default are just special strings.
Do you know what the problem is now?
I can't eagle eye any other obvious mistakes, but I didn't really look at the wall of text one with the format's, because my eyes are tired.
Your mission was featured in a sitrep?
Who's? Not mine.
just wandering if it was you, gonna try it out
Sweet ! Please send me feedback ๐
we have a pvp server
Oh, I didn't see Music to be defined anywhere. But I assume it's a global variable defined somewhere.
Okay so actually, my original problem was that outro.sqf (wasn't a function before today) and was executed with the remoteexec by a execVM.
Problem was that in outro.sqf... the only thing that was executed was the
"end1" call BIS_fnc_endMission;
@little eagle don't bother about Music, i placed that just to cover a big mistake of mine loool
Well, if Music is undefined, and this runs in >scheduled environment, then it will error and stop executed anything below that.
no, it's playMusic "Music"; lol I just didn't fix my error when I pasted the code
I see. You're testing me.
Lol no, I'm dumb sometimes ^^
Me 2.
Right, would you have any idea why the hole script would be forgotten exept for the "end1" call BIS_fnc_endMission;
scriptName "fn_outro";
// Created By Flash-Ranger - flashrangerarma3@gmail.com (Please respect the time I spent on this system)
// Please do not modify anything in this script without knowing what you are doing.
#define __filename "fn_outro.sqf"
playMusic Music;
waitUntil { !isNull {player} };
Player EnableSimulation False;
["<t color='#FFFFFF' size = '1' shadow='1' align='center' font='PuristaBold'>GAME OVER</t>",-1,-1,8,2,0,3088] spawn bis_fnc_dynamicText;
Sleep 10;
enableRadio false;
This one?
indeed
Wait, there is no "end1" call BIS_fnc_endMission; in there.
does your mission get around the issue of flag drooping in front of your face?
the script was too long i have to cut it into 3 part
look down
@cloud thunder Hu... never saw that bug
Ah. Have you checked the RPT file? There're more undefined things like Centre in there.
intresting
yes Commy, absolutly NO ERROR at all .....
@cloud thunder i'm in constent relation with Jakub from the dev team to improove the flag fps but no other error to be seen on my part
Can you repost with all fixes? Because as of now it errors on like line 2.
Yes sure
// Created By Flash-Ranger - flashrangerarma3@gmail.com (Please respect the time I spent on this system)
// Please do not modify anything in this script without knowing what you are doing.
#define __filename "fn_outro.sqf"
if (!hasInterface) exitWith {};
playMusic "Music";
waitUntil { !isNil {player} };
Player EnableSimulation False;
["<t color='#FFFFFF' size = '1' shadow='1' align='center' font='PuristaBold'>GAME OVER</t>",-1,-1,8,2,0,3088] spawn bis_fnc_dynamicText;
Sleep 10;
enableRadio false;```
If (EScore > WScore) then {[format["<t color='#7F0000' size = '2' shadow='1' align='center' font='PuristaBold'>RED</t> <t color='#FFFFFF' size = '2'>Team Wins<t/><br/><t color='#FFFFFF' size = '1'>Blue : Points %1 - Captures %2<br/>Red : Points %3 - Captures %4</t>",(WScore),(westtouch),(EScore),(easttouch)],-1,-1,15,2,0,4001] spawn bis_fnc_dynamicText;};
If (WScore == EScore and westtouch > easttouch) then {[format["<t color='#004399' size = '2' shadow='1' align='center' font='PuristaBold'>BLUE</t> <t color='#FFFFFF' size = '2'>Team Wins<t/><br/><t color='#FFFFFF' size = '1'>Blue : Points %1 - Captures %2<br/>Red : Points %3 - Captures %4</t>",(WScore),(westtouch),(EScore),(easttouch)],-1,-1,15,2,0,4001] spawn bis_fnc_dynamicText;};
If (WScore == EScore and easttouch > westtouch) then {[format["<t color='#7F0000' size = '2' shadow='1' align='center' font='PuristaBold'>RED</t> <t color='#FFFFFF' size = '2'>Team Wins<t/><br/><t color='#FFFFFF' size = '1'>Blue : Points %1 - Captures %2<br/>Red : Points %3 - Captures %4</t>",(WScore),(westtouch),(EScore),(easttouch)],-1,-1,15,2,0,4001] spawn bis_fnc_dynamicText;};
If (WScore == EScore and easttouch == westtouch) then {[format["<t color='#FFFFFF' size = '2' shadow='1' align='center' font='PuristaBold'>DRAW Game</t><br/><t color='#FFFFFF' size = '1'>Blue : Points %1 - Captures %2<br/>Red : Points %3 - Captures %4</t>",(WScore),(westtouch),(EScore),(easttouch)],-1,-1,15,2,0,4001] spawn bis_fnc_dynamicText;};
_camera="camera" CamCreate [0,0,0];
_camera cameraeffect ["internal", "back"];
_camera CamSetTarget Centre;
_camera CamSetRelPos [30,30,50];
_camera CamCommit 0;
waitUntil { camCommitted _camera; };
sleep 5;
_camera CamSetRelPos [100,100,500];
_camera CamCommit 10;
waitUntil { camCommitted _camera; };
sleep 5;
"end1" call BIS_fnc_endMission;
sleep 5;
_camera cameraEffect ["terminate","back"];
camDestroy _camera;```
o.o
@little eagle done
waitUntil { !isNil {player} };
This does nothing.
player is never nil, so this line can just be removed as the code block always reports true.
Right but I need the outro camera to be executed for all players. because there is 1% chance a player dies when Timer hits zero
So you're waiting for them to respawn?
You have to use isNull, because isNil will always report false for player, even if player is a <null> object (objNull).
waitUntil { !isNull {player} };
then ?
I don't think you understand the difference between {player} and player.
No ... at ... all lol
{player} is never <null> either. It's a piece of CODE.
player can be ยด<null>`.
{player} is code and never null. I guess it can report null, but isNull cannot execute CODE. isNil can, but not isNull.
@quartz coyote The question is.. Why did you put {} around player ?
Without executing the CODE, there's no way to get a return value that could be null
Dedmen, copy pasted from isNil. Because isNull and isNil have the same name, surely they have the same syntax, right?!.
That would make sense
Well...
People are often unable to read wiki.
Dedmen I don't know ... so of what I understand :
!isNull player is correct
!isNil {player} is correct
Right ?
Must be lazyness that get's their guard down. People don't like making mistakes either, but the lazyness seems to be even stronger.
!isNil {player} is correct syntax, but has no meaning.
It's tautologous to true.
Might as well write 1 == 1.
waitUntil {!isNull player};
is what you should use to make sure the player object exists
Yes.
guys, i'm very far from the scripting world. Understanding the basics of scripting is the key. It's not lazzyness friend, it's about not having the base knowledge.
I'm scripting this shit because no one else would do it. I'm not happy with spending half my fucking nights on scripts ! I doo because if not, our legendary gamemode would DIE
๐ก ๐ก
CTF
haha
-_-
yeah football field size or arena
@tough abyss i'd love to discuss how CTF can be played all sort of ways but i'm here to fix my scripts ๐
hahahaha
ok lets stop this here ^^
@little eagle can we go back to scripts ๐
offtopic is not enforced here
What would a channel be like if offtopic was enforced. ๐ค
most here would be banned
@little eagle i'll test the script like this and see if it works and report back ! Thanks a lot for your help
Yes, we infiltrated the moderation...
This channel would be boring if it were all on topic.
You need a lively discussion once in a while or the channel would be dead as the rest.
still BMR Insurgency , always improving, currently trying to replace IDEs with inhouse script and possible way/interface to imhibit op4 AI for opfor slot like in original A2 version..
occational pvp stuff to , mostly just modifying other's missions. Yes play as existing AI.
IDAP mission, just cleaning up UXO from fights between AI sides
Don't add playable units to east for COOP.
doing ai vehicle repairs when theyve broken down on the roadside
big war going on and the players just going "dont mind me just doing my job"
That's why you don't zeus remote control in COOP missions.
You will always get someone to complain, even if it wasn't the zeus.
Just don't do it.
If you want to jump and frag play Battlefield 2
COOP and PvP don't mix. Dunno about AI in PvP. Might work if they only guard a base and are stationary.
With COOP you can plan to have a 2-6 (lol) hour mission. PvP could be over in 30 minutes.
yes its hard to balance. Insurgency is asymetrical so they don't have all the nice stuff as blufor. no arsenal. very very limited vehicles , kits, no scopes, must scavage weapons from bodys and go back to deployable mhq's crate to save loadout. Theres lobby option to dissable playable opfor and respawn with full loadout if server admin wants it. I anly add 2 playable op4 slots because focus quickly changes for blufor who is in coop mode mostly. Most of the hard core pvp players love the op4 role even as its limited and focus on sabatoging , booby trapping objectives and caches. Op4 players are currently medics by class and engineers by trait.
Theres all kinds of roles and special abilites for blu4
A week ago our fallujah server ran for a week with no performance loss and over 4000 AI kills, over 50 objectives completed andsome op4 players had come and gone. server auto restarts weekly unless map is finished.
We do PVP sometimes within our coop public. However only members can be the enemy side with strict rules. Works fine. Also with playercount restriction.
no not by side, thoughit is global lobby option. got a neat code snippet from an old buddy Paxton that hides player objets when a object between their line of sight exists. will probably integrate on next version..
yas its not good for pvp. Our pvp server is always 1st person enforced..
I've got something similar PVPscene_POV = { // Limit 3rd person view to vehicles only [(_this select 0)] spawn { while {alive (_this select 0)} do { if (cameraView isEqualTo "EXTERNAL" || cameraView isEqualTo "GROUP") then { if (isNull objectParent player) then { player switchCamera "INTERNAL"; }; }; uiSleep 0.1; }; }; };
yeah
I noticed your InA was about 9.something mb in size is that all code textures or what?
how many AI max exist at any time?
ok , nice do you integrate any AI behavior modifications?
Very nice, I don't find script count in scheduled typically an issue especially if they are mostly sleeping. I do keep mindfull of it though.
Notice any degredation in performance over long term?
or do you not run mission for days on end?
i only notice degredation after total unique players who have come and gone get close to 100 and thats unmodded, but no degredation on our moded server for example that may only have 50 something unique players..
thats after a week
Triggers and waypoints have ruined many missions I played and that since A2.
yes many way points can have impact ive noticed especially in high sequancial numbers. I've not notice significant impact using many triggers that run on server.
if i wanted to run a hint to the entire west side, would this work? "hello" remoteExec ["hint",west];"
Yes, Neil.
Thanks!
i've got both type of medical system as loby option. Usually prefer allow death type and havn't noticed degredation using it allthough its been tweaked alot.
There used to be but not anymore thats measurable here.
Did you delete the ragdolls?
I mean with the native respawn.
Dead bodies.
Ragdolls are really poor for performance. Never checked if that's true for servers too, but for clients if you're just near them and there are enough of them, you notice the fps plummetin.
Well, dead bodies stay ragdolls forever.
Then not anymore of course.
The only other explanation is lots of setVariable public for killed / respawn events.
Or generally lots of code in those events.
But ragdolls themselves are already really bad.
killed?
respawn isn't as bad as it never happens to AI.
Eh, just with booleans. As long as it's not shitty long arrays as in ace adv medical.
BIS_noCoreConversations must be set again after respawn?
All variables carry over from the corpse.
Well, for soldiers that is. Vehicles completely delete the namespace and don't even trigger init again ...
yeah BIS_noCoreConversations set once on player has worked for me
Vehicle respawn is one of those abandoned features. At least the SQF command version.
Not that I know of.
none that i can remember. I think you have to reconnect after death.
strange as copses would be side civilian and terminal should not work for them.
Post it.
Sure, if it's much longer than what Quiksilver just posted, go for pastebin.
!(player isKindOf "B_Helipilot_F")
its QS's code so i'll let him chime in
So the problem is that the pilots are kicked out too?
Everyone or just the pilots?
Well, the script has 19 opening { and 17 closing }.
That can't be right now can it?
Yeah.. Found atleast one missing one
Why not fix the one he has?
/*/ This is a CAS aircraft /*/
Thanks for the eye cancer.
I'd say you add the missing closing brackers to your code.
just add the missing }
๐ฆ
True.
All you had to do was to add two missing } to your original code.
Dedmen, reading comprehension
Yeah.. I noticed. But I didn't want to delete my message so I choose to redirect the attention elsewhere
๐ช
aaand you posted in anyway?!
No I already posted it before I noticed
arrow up, ctrl+a, del, enter
What were we talking about again? My brain is broken today
We were talking about how you should release TFAR v1.0 already.
Tbh, the original is written pretty shitty. Better off starting over, but with knowledge of SQF, that would probably end up worse and take forever.
It being twice as long than it has to be is broke in my book.
Proven by the fact that it has more { than }.
No one can work with this. It will always end up broken if it's written like that. My thinking...
"ahoy world"
if i wanted to have an action remove itself without removing all other actions on the box how would i do so? i have a laptop that adds an action and over time repeatedly adds more of the same exact action, if one was to be clicked, how would i have that one be removed and not the rest?
Use the condition string of addAction with a global variable instead of removing the action.
do you think you can give me an example?
A one time action that disables itself?
for example, lets say i have intel1, 30 seconds later, a intel1 is once again repeated again and once again added to the laptop
i don't want a player repeatedly clicking one of the intel1's, i would like it to simply delete that one action
yikes scoobs, hastebin is a super neat tool these days ๐
Like a true professional.
/s
/s /s
This is something I should add to my gists I guess.
Seems like a common enough question.
Yep.
seatSwitched?
And probably twenty from CUP and RHS.
Bunch of mediocre A2 ports. ๐ฅ
}
}
This is a great way to do coding.
Google the problem, click the first Stackoverflow link, and then copy paste the top answer.
The original is decently formatted, so the two missing } that are literally the whole issue are easy to find.
Me neither. Don't have it on this machine.
Why not ask the game? You don't have to convince us, just it.
ewww...where is all the syntax highlighting at?
/*/ This is a CAS aircraft /*/
This deserves a ban imo.
You managed to make the closing and the opening comment thingies look the same.
not ass efficient as using event handlers but could use something like AllowedPilotTypes=["B_Helipilot_F"]; if ((count AllowedPilotTypes) != 0) then { [] spawn { if ((typeOf player) in AllowedPilotTypes) exitWith {}; private "_veh"; while {true} do { if (vehicle player != player) then { _veh = vehicle player; if ((_veh isKindOf "Plane") || {((_veh isKindOf "Helicopter") && !(_veh isKindOf "ParachuteBase"))}) then { if (driver _veh == player) then { if (isEngineOn _veh) then {_veh engineOn false}; player action ["GetOut", _veh]; hintSilent "Restricted to Pilots"; }; }; }; sleep 1; }; }; };
it's okay, ass effeciency is not bad Jigsor.
but code is simpler and since it loops it will always check for driver and work with any aircraft.
It's not a one liner yet though.
give us the one liner @little eagle
I don't even have SQF in my editor installed on this machine.
I wish that thing was stackable and could remove actions.
Unusable for mods.
Loved when you could inject code with it on any server.
You reported it? You made me look 30 minutes for another way to do the same.
Probably still some way to compileFinal some ui functions.
How is the mission namespace vulnerable? It gets reset at the start, no way to move something there.
Happens when you have AI as squad leader.
you troll
Who?
quick
But how you'd exploit mission namespace functions not final'd? You have to execute code overwriting them in the first place.
And you can only do that with other means. Like via ui namespace.
There's no point in fighting it anyway. You can google memory editors and find them on page 1.
pretty sure you could "inject" code with BIS_fnc_addStackedEventHandler or at least carry code over with you to the server you join.
Probably at some point.
Or just have fun adding some controls to certain displays that carry over through all menues.
code here still runs in memory even if not in mission
addMissionEventHandler
BIS_fnc_addStackedEventHandler oneachFrame for example
I don't think you can overwrite any variables with this. Maybe I'm overlooking something.
SQF dick measuring contest. Who has the secretest hacks.
in volume girth or length?
Yes.
lets see yours first
Which level are you on?
create a trigger covering the entire map, do a check with getPlayerUID on thislist and see if it matches your own player
and that's your player object
๐
Not bad, Adanteh.
so (player in player) is pinnicle eye?
No, but:
player in entities typeOf player
is.
now add isEqualType in there
will always be true
You're clearly not there yet.
wrong answer
Alternative syntax OBJECT in OBJECT
Reports true when rhs is the vehicle of lhs.
Which also works on foot.
It's the same as 1.) essentially, but somehow never caught on in the eternal copy pasting.
was unaware syntax was updated to support alternative
"updated". It's as old as in.
Arma 3 1.26: I swear sometimes BIS make changes and many do not get posted in spotrep
in is from 2007 or older
OBJECT in OBJECT is in A2.
oh right, wonder in what case SilentSpike comment holds true
Reports true when rhs is the vehicle of lhs.
well since this is documented its not really secret
Secret?
The image is just to remind you that if you understand level 3 and 4, you wasted too much of your life on SQF/Arma scriptin.
well it was your challenge
@gusty flume https://community.bistudio.com/wiki/Arma_3_Vehicle_Loadouts ? Check out that forum link on the wiki there, da12thmonkey has some nice info, jump to the last page and read back
@gusty flume https://forums.bistudio.com/forums/topic/187986-custom-respawn-inventory-menu-per-player-dynamically-load-players-saved-virtual-arsenal-loadouts/ might give you some ideas. Personaly, I almost always, preface my "scripting question web searches" with "arma bistudio" or "arma armaholic" (for google - you can also enter "site:bistudio.com my seach terms here" to only search there - works way better than trying to search the forums and wiki with thier sites seach things imo)
@gusty flume there a bazzillion out there. Try digging though this list http://lmgtfy.com/?q=site%3Aarmaholic.com+dynamic+loadouts+script
A lot of stuff you find may be out of date but will get you on the right path (use the wiki and make sure functions arent depriciated etc, enable displaying script errors, read your rpt log if your crashing)... if you do decide to get your hands into scripting.
its been a while but do the actions work for empty vehicles? (I'm assuming your heli lights are the static searchlight turrets. Try player action["lightOn",this] in the init box of one.
i wasnt aware you could even turn those off
dont they start on?
switchLight might work
GOOD LUCK
Dark sure has a problem with his capslock key. Even the name is all caps.
It adds an element of stress to it. I imagine this is critical to an ongoing situation
He only has time to check back in here when the fight with those lamps calms down for a few seconds
player in player is faster than isnull objectparent player?
Wow, cases can be an array? Cool.
๐ผ Cases?
@simple solstice thereโs a microsecond diff, objectParent being faster
but it had an issue when the object is attached, @little eagle ?
Yes. You're also taking this way to seriously.
Please don't actually use this code. The point af that macro is that the answers become ridiculous towards the end.
guys, I remember we had a discussion on why would SQF require prefixing a private var with an underscore while it should just properly use the private keyword without requiring any hacks for the actual var name.
and I guess @still forum mentioned that internally the lookup for private vars is much faster when they're prefixed with an underscore.
but... isn't that what the private keyword is for in the first place?? I mean... for lookup purposes, private keyword should automatically prefix a var name with some agreed symbol that'll be used later for search... that's my 2ct
@timber ridge private is used to make sure you don't overwrite local variables by accident when your code is called for example
I mean private could do that automatically internally, but I think that would just overall make it inconsistent since they can still be declared with an underscore
You equate local variables with "private variables". "private variables" don't exist in SQF. private is a command and keyword used to set the current scope as the home scope of a local variable.
Well that's not true. You can ruin FPS and achieve nothing by badly designed code.
You too missed the point of the image then.
No one / nothing else brought up objectParent.
Reading a conversation from the beginning is a virtue.
'poorly optimized'
Where's that quote from?
Yes and you used quote marks as if you're quoting someone.
This effect could make people think you're misquoting someone and arguing against things they haven't said which would make you come off as dishonest.
No point in having a conversation with someone dishonest.
really depends where and what you optimize
if you have loops that have to be run for a lot of units, it is well worth it.
But that's wrong.
especially when those loop contain parts that get synced in mp
These so called "edge cases" are omnipresent.
that shit can quickly get nasty if not written well
me neither
Yes, that is what I said.
hmm
what I meant was that badly written, overused loops can cause desync and other problems in mp
that doesnt mean theyre not functional
That's circular.
Anything that tanks fps would be "too crazy" by this arbitrary standard.
uh stop quoting me i just answered him
obv the orig image is meant as a joke
Thanks. I thought it was a widespread enough meme on the interwebs.
You haven't unlocked level 4 then.
It's weird to me that you project something about performance on this image when it's nowhere implied to be about that.
Yes, that is what the conversation is about.
You're obsessed with something about performance to the point that you have to inject it into random conversations.
That's not healthy.
why can't we just ask one of the BIS scripting gurus here about SQF performance? ;DD
Seems like you were triggered tho tbqhfamalam
why?
Yes, you got triggered by this so much that you had to chime in without even reading what it was about.
well you started qs
Never.
i admire your honesty, hell, i like you, you could come over my house and f**k my sister
OK
i sincerely hope people got the Full metal jacket ref
so i'm not 110% misunderstood
No, never watched that.
ZZZZ
Guy seems very unlikeable. I might've missed a bullet in his direction at some point.
@little eagle ```SQF
switch [_source, _priority] do {
case ["client","server"];
case ["mission","server"]: {
_ctrlLocked ctrlSetText QPATHTOF(locked_ca.paa);
_ctrlLocked ctrlSetTooltip localize LSTRING(overwritten_by_server_tooltip);
};
};
Yes?
...
@Inlesco#5178 "internally the lookup for private vars is much faster when they're prefixed with an underscore"
Uhm... Yes... But also if they are not prefixed with an underscore they are not private variables.. so that sentence makes no sense at all...
privatized local variables are faster to lookup than non private ones if your scope level is >1
@cuel#9704 "thereโs a microsecond diff, objectParent being faster"
Did you know that calling ANY binary command takes about 1.6 microseconds? That's the time spent to just reach the internal engine function.
So if you have a binary command that does literally nothing. It will still take 1.6microseconds.
Great Discord.. Just great.
@cedar kindle
@timber ridge
Ah.. Now.. yes.. Makes sense
@still forum i was only implying that, if SQF had a somewhat reasonable design, prefixing a private var with private keyword already defined to it, would not be required as the syntax interpreter, if needed, should be able to detect usage of private and prefix the var name internally as it's needed for lookups.
unless I'm not aware of smth else, forgive my ignorance lol
Listen... SQF has two ... two types of variable tables.
The global one. and local one. Each scope has a table of local variables.
If you are saying "just get rid of the _"
How would it know that a variable is local? Ah yes! It would first search through all local variable tables in all scopes (which might be dozens) and if you don't find it search through the huuuge global table.
If you add the _ prefix though the engine knows exactly where to look for it
and if it's not there it can abort directly
And what happens if you do
myVar = 6;
private myVar = 5;
?
Two variables that are completly different besides the name.. How would you differentiate?
generic error in expression ๐
private makes no sense for global variables and therefore errors.
Yes. One is private. But if one uses myVar.. How would you know that guy wanted the private or the global one?
ok, seems reasonable I guess, i'm not much of a seasoned SQF user lol...
but why do you need private for _localVar then ?
@little eagle You didn't follow the conversion
pushing the var to the innermost scopes
You have the exact same thing in C/C++ and other languages
_var = 5;
call {_var = 6;}
_var is 6 now... But the function you called didn't intent to modify any variables outside of it.
ok, so in this case private prevents any mod of a var outside of its scope?
yes
yep
but why the fuck do you need private for _localVar then ?
To set the home scope of the variable, so the game doesn't have to loop through all other scopes in the current script instance to check where to write the variable.
it's also the biggest pain in the ass to realize ๐
"why is X acting this way" turns out you used the same var not privatized 5 scopes above.
And.. Because each scope has it's local variable table.
If you private a variable it will be present in the first table the engine checks.
otherwise if you just do _var = 5 The engine would have to check all scopes above you to see if the variable already exists and it has to overwrite it
I guess a proper SQF IDE should be able to detect this and mark it for you ๐
just privatize all local vars
There is no negative thing to privatizing variables.
Your scripts run faster. And you don't break stuff you don't know about
... It makes it easier to read, because you immediately see where the variables come from with proper syntax highlighting.
you can also tell your IED to hide the _ from you :d
ArmA.Studio yet lacks a proper AST generator which is why no deeper analysis is done beyond plain syntax checking
for now i am busy with SQF-VM so that it does not relies on the game itself
but as ppl do not rly contribute as much as i hoped, ArmA.Studio is pretty much on hold due to that right now ... can only always focus on a single project
do you guys know, how I call the clock in-game?
ye
a watch
date
yes
Why not use this? : https://community.bistudio.com/wiki/daytime
what is the difference if I wanna see the clock?
you can also tell your IED to hide the _ from you :d
IED... no wonder this is a military game's scripting channel :d
and in this context, I'll assume _ means it's below surface level lol
@modern snow date is a better choice in your situation if you want to display HH:MM format only, it'd make for some cleaner code.
I suggest from now on every single code snippet posted has to have a ms runtime posted with it ๐
Performance is still the number one discussion topic here ^^
game_value nothing(game_value, game_value) {
return nil;
}
0.0016ms
Does literally nothing.. Still takes 0.0016ms
@tame portal there is a semi-relevant relation that can be seen using SQF-VMs instruction count as that is more or less equal to SQFs
aka: when SQF-VM has low instruction count, you also will have less instructions in SQF
or more precise: SQF-VM gives you a proper number instead of just theoretical O(N) algorithm
@queen cargo Do your command calls also take 1.6 microseconds before it get's to the actual function that's being called?
My debugger... Hell even... Wait.....
salt.png
Anyone interested in a instructionCount CODE command? That returns the number of instructions in a piece of code?
@still forum Yes
For testing I made 3 script commands that do absolutly nothing
nothingN 0.0008ms
nothing 1 0.0008ms
1 nothing 1 0.0009ms
@little eagle The difference between unary and binary is not really there. These still pass the arguments to the engine function. But the engine function returns nil immediatly
Each one of these is between 0.0008-0.0011ms
not sure if it also has that delay @still forum
one would have to test (or actually create a performance test function call ๐)
only one way to test
anybody can give me the code for the bis_fnc_perf thingy?
diag_codePerformance
The old one? I doubt anyone is still running that old version
will have to if i want to test right now ... got some linking problem
Here is the current code
//--- allow function to be spawned
if (canSuspend) then {disableSerialization};
params [
["_testCode", "", [""]],
["_params", []],
["_wantedCycles", 10000, [0]],
["_display", [] call BIS_fnc_displayMission, [displayNull]]
];
diag_codePerformance [compile _testCode, _params, _wantedCycles] params ["_result", "_actualCycles"];
instructionCount doesn't work like I expected ๐
๐คฃ
Well... Actually that is like I expected it. .But i hoped I was wrong
Idea scratched I guess... Probably too much work
SQF-VM can take over that need ๐
sqf-vm even has / had a player now ๐
not rly
only a variable
probably will give it a proper command at some point
@little eagle - well today I learned you can do that, it's not on the wiki.
@tough abyss passing arrays?
Using them in case.
That is on wiki
Syntax: case b
Parameters: b: Anything
An Array is Anything. A object is too. And a string or a number.
Oh ๐คฆ
what command should i use to forcibly move one unit from one turret to another when said unit is already inside the vehicle?
if i use action "MoveToTurret" it only works when the unit is the commander of the vehicle
tried moveInTurret too but it only works when the unit is outside the vehicle
Oh my gawd... A semicolon is a script Instruction......
https://image.prntscr.com/image/sLa-wAs-TI_9uN7Hd_vPsg.png
But it wurks
why is the upper 14 and not 7 Oo
he just said it ๐
but the lower is not matching
thats why i ask
cannot be the semicolon
unless the last one gets cut off
and the upper also would not match count with semicolons in mind
the last semicolon is added by the compiler
Adding it doesn't change the instruction count
second one then does not solves correctly
so it does not checks deep?
then it is kinda useless ๐
That last one is a constant containing a variable
Is there a function to add those big X's on ORBAT groups?
Not surprised that it doesn't count the instructions inside a CODE block. Those are essentially strings. This is from intercept, right? Still don't get why it adds another virtual semi colon though.
Just out of curiosity. What happens if you replace all ; with , ?
A while ago I asked here if select passed by reference or value... Was told it was value. Seems like it doesn't. Someone wasted my time. ๐ข I feel hurt
Who told you that?
I can believe no one disagreed with anyone saying it. Maybe you misheard.
Could you elaborate @icy raft ?
I did literally ask "Does select pass by value or by reference?". Got that answer
They started arguing that it did pass by value, and for getting a reference you would have to make use of count and extract the value from _x inside the count condition
Did some test and in fact select does pass as reference
As in, Does select pass by value or by reference?, do you mean for example, an array in arr select x?
Yes
Yes then
Did the following tests with the same result, changing the refered value
this_is_an_array = [
[1, "This is data"],
[2, "not is data"],
[3, "wherever are you"]
];
reference = [];
//Here we extract the array at index 1
_counter = 0;
{
if(_counter == 1) exitWith {
reference = _x;
};
_counter = _counter + 1;
} count this_is_an_array;
_outstr = "";
_outstr = _outstr + "REF:" + (str reference);
_outstr = _outstr + "\nARR: " + (str this_is_an_array);
//Here we modify it
[reference] call BIS_fnc_arrayShift;
[reference, "MODIFIED"] call BIS_fnc_arrayUnShift;
_outstr = _outstr + "\nMOD: " + (str this_is_an_array);
//Modified value shows up
hint str _outstr;
this_is_an_array = [
[1, "This is data"],
[2, "not is data"],
[3, "wherever are you"]
];
//Just a select this time
reference = this_is_an_array select 1;
_outstr = "";
_outstr = _outstr + "REF:" + (str reference);
_outstr = _outstr + "\nARR: " + (str this_is_an_array);
//Here we modify it
reference set [0, "MODIFIED"];
_outstr = _outstr + "\nMOD: " + (str this_is_an_array);
//Show the modified value
hint str _outstr;
If the element you're changing is an array, yep
Effectively:
arr select x
->
SQFArray &arr = LHS; //left hand side
return arr[x]
I'd imagine
Hmm... Some times I just whish I could run intercept without BE crying... (clientside)
I think they whitelisted an earlier version Dedmen was using ๐
Did they? Which one?
It'd be awesome to be able to do some RPC calls clientside
One thing I've been trying is to connect to a NodeJS server from the client and run request from there
Nvm looking back it seems they whitelisted his engine hook (for the IDE thing)
Hello it's the dummy again !
I need someone to explain Varialbles and publicVariables to me. I do not manage to handle the Wiki explainations...
QUESTION 1
I have a var
WScore=0;
most I put a
player setVariable ["WScore", 0, true];
for it to be known by all players in MP game ? And if not why ?
Yeah, it was for local server as it was blocking, he didn't implement any async functionality like extDB3
WScore is global to the client (not public), in the missionNamespace (presumably). It is not a variable on the player object, like player setVariable would be.
player setVariable ["WScore", 0, true];
Would be public, and known to all clients (on the object)
@quartz coyote global variables are stored locally and you can access them at any point in the local machine.
Doing a publicVariable "variableName" would propagate the value through all the clients (with the correspoding traffic (lag if overused) )
Doing myVariable = 1 would set the value 1 to myVariable only in the machine it was executed.
But calling publicVariable "myVariable" would set the value myVariable as 1 in every machine (after a delay because of internet delay)
Not the best thing to do when everyone has different scores (I imagine)
I now get what you mean. select CODE does indeed create a new array, but select NUMBER just picks an element.
my score var is initialised on the InitServer.sqf
I has to be the same to all players at all time even to JIP players
yes I understand that @BoGuu#1044 but do I have to do it just after initing it ?
I guess yes
but i'm not sure
You have to do it every time you change the value of the variable
As every time you do publicVariable it gets the value of the variable and send it to everyone. But only the value it has at that moment.
If it needs to be defined on the clients (to 0) initially, yes @quartz coyote
Okay nice
@little eagle I'll look into it in more detail. I'm currently just looking through BIS code to try to understand some quirks of SQF
and what is the proper way of doing it ?
player setVariable ["WScore", 0, true];
Or
WScore=0;
publicVariable "WScore";
Second one
Or,
missionNamespace setVariable ["WScore", 0, true]
missionNamespace = Returns the global namespace attached to mission.
I don't understand what is that ...
Akryllax, don't try to think of them as references. It only applies to arrays in SQF, nothing else. Think of that as objects/containers. Most commands about arrays copy them / create new arrays that can then be stored in a variable with potentially the same identifier. Only a few edit existing arrays, set, sort, pushBack(Unique), append.
select NUMBER itself just picks an element from an array. And if that element is itself an array, it's not copied.
Said simply, is a region where all the variable you use get stored. There are different namespaces where different stuff is stored. Read this blog post that explains it if you are interested:
http://killzonekid.com/arma-scripting-tutorials-variables-part-2/
I will right now
Local in local variable refers to the variable being only available in the current script instance ...*
Global in global variable refers to the variable being available in every script instance on the local machine.
A public global variable is a global variable available on all machines.
commy2, that just perfect ๐ . I usually work with subarrays to store data so it's incredibly usefull. I used to think that select did in fact copy everything and kinda annoyed me.
Well it's key to consider array references, otherwise this wouldn't make sense
And if that element is itself an array, it's not copied.
Because naturally we work by value
And I just found a few BIS_fnc's that work with key pairs so its just perfect
Maybe you're right. It's not how I got myself to understand this though.
I used to think that select did in fact copy everything and kinda annoyed me.
Copy what though ๐ค ?
Create a new array
@little eagle awesome i like that perspective !
Saying that select copies the array isn't wrong though. It's just that there are multiple commands named select that do different things.
So it's a mixup most likely. Misunderstanding.
๐
Create a new array in the case that you select an array, from an array, that is?
there is a ending that shows ups "Your side lost" when you run out of tickets to spawn, how can i change that?
Also the addMissionEventHandler ["Ended",{hint "check" }]; does not fire with that
select CODE creates a new array filled with the elements the code block returned true for.
The LHS array has nothing to do with the return value array aside from containing some of the same elements.
The array itself is new or "a copy". Strictly only + ARRAY copies it, as in makes an equal duplicate.
actually, that "Ended" MissionEventHandler does not fire by anyting
Do you mean ARRAY select CODE @little eagle ?
Yes, sorry.
Ah
select ARRAY also copies the array for that matter.
If the new array contains arrays, they'll be references to the original array, still
But are not copied, more importantly
The only deep copy command that I know of is + ARRAY.
It copies even the sub arrays for some reason.
Yep, it recursively duplicates
[] + ARRAY doesn't deep copy. It's so weird.
Yeah, explicit case for +ARRAY
I still haven't put that detail on the wiki.
SQF is not consistent at all man...
CAManBase*
were i can find a list of all icons in arma 3? like
iconPicture = "\A3\ui_f\data\map\mapcontrol\taskIconFailed_ca.paa";
open that folder and look?
what folder? there is no A3 folder
PBO manager is not verry happy with huge files
plus, is not inside ui_f.pbo
`sure, it's in ui_data_f
anyway, with arma 3 tools there's an option to unpack all files
that'll just export all PAAs
there is no list of all icons
if you unpack them, they'll be in a folder \a3\ui_f\data etc etc etc
then you can browse through it
seems like that gona take some time.
yes
Anyone that is able to interpret this wiki page ? O_o https://community.bistudio.com/wiki/addTorque
I really can't understand how I can refer to a wheel object as in the example
you cant refer to the wheel of an object
you can refer to an object that is a wheel
also make sure not to refer to the image for the meaning of counter clockwise rotation
or maybe wonder what kind of clock they use over in czechia
Cool
Hey guys, ima kinda new to scripting but if anyone would be able to point me in the direction of where i could find some script that adds a flame and smoke to a moving helicopter after it passes through a trigger, thanks...
_heli setDamage 0.7
unless you want it to irrealistically have flames and smoke but be miraculously undamaged
in which case you need to attach a particle generator to it
thanks
Hey
Can anyone tell me why
if (side player == west) then {car1 addAction ["Impound Vehicle", {deleteVehicle car1}];};
isnt deleting the vehicle?
Yes
Sorry no.
@little eagle With if (side player == west) it doesnt show the action. But without, it does.
I also would like it to do it for all vehicle dynmaically.
๐คฆ
These init boxes are probably executed before your client has an avatar. player is null and side objNull is sideUnknown not west.
There is also, you know. A conidition param for addAction ๐
Eh, try playerSide instead of side player.