#arma3_scripting
1 messages · Page 291 of 1
units requires ONE group and not an array of groups
I didn't think that my guess example would be even close to right.
It's not
Oh! Well, you guys jumped on saying I needed just brackets! Haha
Is there a better alternative to find? CONTEXT:
if ((typeOf _unit) find "AR") then {_unit superessFor (random 10)};
Anyway, I see your example @little eagle, I'm going to try to mess with that.
yo
?
Do that.
Okay! Doing it.
yo
@peak plover
if ("_ar_" in toLower typeOf _unit)
I guess.
toLower to make sure it doesn't break when an update or mod changes the capitalization.
(Yeah, that stuff happens)
It does all the time. Ask QS.
@little eagle, it worked like a charm! Much less script on page now, too!
Also find reports a number and not a boolean like if expects.
Yeah, the toLower still has to be split
{
if ((typeOf cursorObject) find "_AR_" > 0) then {
_x suppressFor (ceil random 10);
};
}count units _group;
Looks the cleanest for now
Why find when in already reports a boolean?
value in array
https://community.bistudio.com/wiki/in
Example 2:
And your code only works with upper case AR
I swear there was a STRING in STRING
huh
O_Soldier_AR_F
I just woke up btw.
It will never be lower case
Thats why -> toLower
You don't know what a patch or addon could do, nigel
Is there any concern with overuse of sleep commands?
That's a good point
So it wouldn't matter if its changed to: aR Ar ar or AR (And again: Yes, that happend before)
Sleeping sickness
Not rly @shadow sapphire
Do you guys find that you have less jarring clientside framerate drops if you stagger AI spawning?
_G1 = [(getMarkerPos "M1"), INDEPENDENT, ["I_Soldier_SL_F","I_soldier_F","I_Soldier_GL_F","I_Soldier_AR_F","I_Soldier_TL_F","I_soldier_F","I_Soldier_GL_F","I_Soldier_AR_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
Sleep 1;
_G2 = [(getMarkerPos "M1"), INDEPENDENT, ["I_officer_F","I_officer_F","I_medic_F","I_soldier_UAV_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
Sleep 1;
_G3 = [(getMarkerPos "M1"), INDEPENDENT, ["I_Soldier_SL_F","I_Soldier_M_F","I_Soldier_GL_F","I_Soldier_AR_F","I_Soldier_TL_F","I_soldier_F","I_Soldier_GL_F","I_Soldier_AR_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
Sleep 1;
_G4 = [(getMarkerPos "M1"), INDEPENDENT, ["I_Soldier_SL_F","I_Soldier_F","I_Soldier_GL_F","I_Soldier_AR_F","I_Soldier_TL_F","I_soldier_F","I_Soldier_GL_F","I_Soldier_AR_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
as opposed to:
_G1 = [(getMarkerPos "M1"), INDEPENDENT, ["I_Soldier_SL_F","I_soldier_F","I_Soldier_GL_F","I_Soldier_AR_F","I_Soldier_TL_F","I_soldier_F","I_Soldier_GL_F","I_Soldier_AR_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
_G2 = [(getMarkerPos "M1"), INDEPENDENT, ["I_officer_F","I_officer_F","I_medic_F","I_soldier_UAV_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
_G3 = [(getMarkerPos "M1"), INDEPENDENT, ["I_Soldier_SL_F","I_Soldier_M_F","I_Soldier_GL_F","I_Soldier_AR_F","I_Soldier_TL_F","I_soldier_F","I_Soldier_GL_F","I_Soldier_AR_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
_G4 = [(getMarkerPos "M1"), INDEPENDENT, ["I_Soldier_SL_F","I_Soldier_F","I_Soldier_GL_F","I_Soldier_AR_F","I_Soldier_TL_F","I_soldier_F","I_Soldier_GL_F","I_Soldier_AR_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
Placebo ?
I mean, when I've tried the latter, I hear my guys with weaker machines callout "Platoon just spawned in," and shit like that when we are on missions.
But since I've staggered it to have just one squad spawn in at a time, I've not heard that anymore.
Should be tested with a debugger and not with anecdotal evidence like that.
I think the more gradual frame drop is easier to confuse with normal game performance.
Like moving toward a city, or whatever, everyone's frames drop a bit.
Instead of one big stutter.
Is the first code executed in unscheduled environment or what?
Then it's not. I guess the scheduler just sucks at doing it's job.
Why?
I mean sure. Maybe. But "this guy didn't seem to notice" is pretty weak evidence.
Well, it's not one guy. I have a pretty weak machine, too. It's just way more noticeable, without the sleeps, I drop from 60 to 40 all at once with a major freeze frame for probably a quarter of a second.
Why?
It's supposed to suspend the script when 3ms or something like that are reached, so FPS should stay constant even without sleep commands.
When I add in the sleeps, the drop is more gradual and I don't get any hard freezes.
Suspend the script?
Get some numbers.
How do I get numbers?
Debugger. Idk, be creative with diag_log diag_tickTIme
Suspend the script?
The scheduler already suspends the scripts when the execution is taking too long.
Oh, man... Probably not worth all that. I'm... terrible at this stuff.
Oh, well, the script spawns everyone instantly.
Sorta like virtual sleep commands that an appear everywhere in your script at any time.
I've never had an issue with that.
The script spawns instantly everything on the server. No server slowdown. I just mean my machine and other guys with weak PCs.
umm
This is really wierd,
_unit knowsabout player; //0
_nearestEnemy = _unit findNearestEnemy _unit; //player
_unit knowsAbout _nearestEnemy; //4
Ahhaa! ```sqf
_unit knowsAbout vehicle player; //4
Somehow the unit knows about editor places vehicle, behind a hill 500 M away
Good find!!
Arma ¯_(ツ)_/¯
targetKnowalge also gives false information using findNearestEnemy, however getHideFrom works //[0,0,0]
Well, you can't really call it "false information".
It's just reporting what the game is doing, which might be unintuitive.
My whole life has been a lie up until this point.
Must be a boring life then^^
Eh. There are exciting lies.
Makes them all the more believable.
I'd say the likelihood of some piece of information being false is directly proportional to how exciting it is.
When I use spawnvehicle, what is the easiest way to reference that vehicle to give it waypoints, etc?
?
_array params ["_vehicle","_crew","_group"];
mySpawnedVehicleGroup = _group;
@peak plover, thanks!!
I have looked at that wiki page for a while, but I never understood how to refer to the information!
@peak plover, it's saying _array params is undefined.
wops it says sqf_param
Wait one. That might be wrong.
9sqf_array
It doesn't work with sqf_array or sqf_params.
Well, it throws errors, anyway.
@peak plover, it throws erros with both sqf_array and sqf_params.
o
sqf_params = [getMarkerPos "M1", 180, "I_MRAP_03_F", INDEPENDENT] call bis_fnc_spawnvehicle;
_array params ["_vehicle","_crew","_group"];
mySpawnedVehicleGroup = _group;```
What have I messed up?
_array = [getMarkerPos "M1", 180, "I_MRAP_03_F", INDEPENDENT] call bis_fnc_spawnvehicle;
_array params ["_vehicle","_crew","_group"];
mySpawnedVehicleGroup = _group;
I fucked up defining array before
I defined sqf_array instead
In your case, it's defining sqf_params and then later trying to get the info from _array (undefined
Nice! Okay, it's working now with no errors.
😜
Any idea how I can place more crew in a spawned vehicle or should I go back to using createVehicle (which has been much easier to work with for me)?
[getMarkerPos "M1", 180, "I_MRAP_03_gmg_F", _G1] call bis_fnc_spawnvehicle;```
What is the easiest way to set this to spawn at five meters away from the marker? Anyone know off the top of their head or have a link?
Your position (getMarkerPos "M1") is just an array 😃
((getMarkerPos "M1") getpos [5,(random 360)])
@dusk sage, is just an array?
getMarkerPos "M1" //[x,y,z]
getMarkerPos "M1" is the same as having [420,69,0] <(the actual marker coordinates) instead
Ah, neat!
Is there a way to guarantee a safe position using getpos alternative syntax, @peak plover or @dusk sage?
Anyone have any ideas for detecting the CUPS train track objects? Was able to use the lineIntersectsWith/lineIntersectsObjs/lineIntersectsSurfaces with the tracks on Tanoa. However, that doesn't seem to work with the CUPS tracks.
There are a couple that get detected if the line intersects the metal rail, however, most can't be detected at all with those methods
try terrainObject
http://images.akamai.steamusercontent.com/ugc/92725318258023162/C513C86A39F4E108FC5F16C705648B7540F31BCF/
Yep, works @thick ridge
[] spawn
{
while{abc}do
{
_NTO = nearestTerrainObjects [player, [], 20];
_Txt = "\n";
{
_Txt = format["%1%2\n",_Txt,_x];
}forEach _NTO;
hint _Txt;
};
};```
awesome - thanks for finding that 😃
should also work with the Tanoa Tracks
do you know off hand if that would also detect tracks placed via the editor?
or does it only work for the static objects included in the map?
*does work with the Static Tanoa Tracks
No clue, are they somewhere in the editor available?
that's too bad - guess it would have to be a combination of both nearestTerrainObjects and nearestObjects
Yep. But nearestTerrainObjects -> Should be first, imo
yeah
Thanks - will try switching the train code from lineIntersects to those methods
gl
Mother. Fucker. I'm sick of this shit always being so hard.
_G1 = createGroup INDEPENDENT;
[((getMarkerPos "M1") findEmptyPosition [20,60,"I_MRAP_03_hmg_F"]), 180, "I_MRAP_03_hmg_F", _G1] call bis_fnc_spawnvehicle;
Sleep 1;
[((getMarkerPos "M1") findEmptyPosition [20,60,"I_Truck_02_ammo_F"]), 180, "I_Truck_02_ammo_F", _G1] call bis_fnc_spawnvehicle;
Sleep 1;
[((getMarkerPos "M1") findEmptyPosition [20,60,"I_MRAP_03_gmg_F"]), 180, "I_MRAP_03_gmg_F", _G1] call bis_fnc_spawnvehicle;
Sleep 1;
[((getMarkerPos "M1") findEmptyPosition [20,60,"I_Truck_02_fuel_F"]), 180, "I_Truck_02_fuel_F", _G1] call bis_fnc_spawnvehicle;
Sleep 1;
[((getMarkerPos "M1") findEmptyPosition [20,60,"I_MRAP_03_hmg_F"]), 180, "I_MRAP_03_hmg_F", _G1] call bis_fnc_spawnvehicle;
Sleep 1;
[((getMarkerPos "M1") findEmptyPosition [20,60,"I_Truck_02_box_F"]), 180, "I_Truck_02_box_F", _G1] call bis_fnc_spawnvehicle;
Sleep 1;
[((getMarkerPos "M1") findEmptyPosition [20,60,"I_MRAP_03_gmg_F"]), 180, "I_MRAP_03_gmg_F", _G1] call bis_fnc_spawnvehicle;```
If I use this, then it always spawns two to three vehicles on top of each other. It's always the same exact two or three, based on how I set the size of the spawn radius.
scratch that. I've discovered that by setting the min/max distance to 25/50, I can get five of the seven to self destruct on spawn.
I reckon it's runny too fast to recoqnise the older vehicles or something.
[] spawn {
private ["_G1","_spawnPosition","_spawnedVehicles"];
_spawnedVehicles = [];
_G1 = createGroup INDEPENDENT;
_spawnPosition = {((getMarkerPos "M1") findEmptyPosition [20,60,_this])}
{
_array = [_x call _spawnPosition, 180, _x, _G1] call bis_fnc_spawnvehicle;
_array params ["_vehicle","_crew","_group"];
_spawnedVehicles pushback _array;
_vehicle allowDamage false;
sleep 0.1;
[_vehicle] spawn {sleep 1;_this allowDamage false;};
}count ["I_MRAP_03_hmg_F","I_Truck_02_ammo_F","I_MRAP_03_gmg_F","I_Truck_02_fuel_F","I_MRAP_03_hmg_F","I_Truck_02_box_F","I_MRAP_03_gmg_F"];
};
It's an extremely dirty way of doing it 'tho.
question: Getting the current list of tasks, client side that a unit has assigned to it, assuming the references to the tasks were already lost. any ideas?
nevermind, found it
what's another way I could run a script locally at the beginning of the mission for one unit
init.sqf
if (player == z1) then {
null=execVM "GUI\spawn_menu.sqf";
};
this isn't working, in fact it runs the script all the time no matter the unit in SP testing, and not at all during MP testing
initPlayerLocal.sqf
mmmm I tried that too, but I didn't test it as thoroughly
I honestly can't tell why it's not reliable in the first place
Is that menu for before they spawn in or after?
it waits for interface
That's farther up the sqf
imma try the local thing first
that did the truck thanks
it just wasn't consistent on SP but tested on the dedi and it worked
Did you try adding a wait?
Hey guys, anyone working with the arma 3 revive function? Do you know of any way to check for the "unconscious" state? I'm having a problem with players getting around becoming "unconscious" by relogging. And I want to check for it and put them back at unconscious if they were it before logging off. I suppose using namespace to store it would work?
@plucky beacon
CfgFunctions with preInit or postInit flag set to 1 or CBA preInit / postIni XEH.
I reckon it's runny too fast to recoqnise the older vehicles or something.
The game is fast enough to recognize the vehicles lol
findEmptyPosition just sucks
I'm pretty noobish.
Trying to learn.
Does uiNamespace get cleared in the lobby tho?
Ahh, so they can still avoid it by restarting ARMA.
I guess I could be nasty and kill them if they disconnect while unconscious?
That sounds the easiest tbh.
It would suck if you got disconnected for "reasons"
BI should fix their revive system if it can't even handle relogging. That's embarrassing .
Well, as always we have to work around their issues. xD
Just kill them off when they dc.
If I remember it right, historically the game started as an army tool, which means the machines that would run it would have all been in one room like a lan party, and 'logging off' had real consequences... like a drill seargent in your face for those shenanigans...
So, what do I check for? lifeState? ie. if the player is in a certain lifestate on disconnect, set playerDamage = 1?
considering that the unit dies when they disconnect... depends on the mission you are setting up. If it would happen where they die and the possibility of reinforcements is there, then dying might not be a bad way to go.
addMissionEventHandler ["HandleDisconnect", {
params ["_unit"];
if (lifeState _unit == "INCAPACITATED") then {
_unit setDamage 1;
};
}];
However if you are making a persistent server, i.e. life or a long term tactical simulatur like dynamic wars.. you have to reappraise that and figure out what works best for your mission/gamemode.
could also teleport the unit and turn the simulation off for it.. then when they reconnect, teleport back and reenable simulation? Dunno.. just tossing an idea out there. I don't know about exile.
He said it's Arma 3 Revive. I guess that is not modified by Exile.
Otherwise better ask them for details.
Why not QS?
There is only one way to find out.
Yes, but now you're making up solutions for problems that don't even exist (yet).
How does Exile even handle players relogging? Is AI enabled or does Exile just setPos a new unit to the last position?
Uses extDB and stores player data lastPosition and reloads it
You can save the information about the player on the server and once the client connects, ask for info.
Aye.
No wonder the unconsciousness thing is handled properly then.
Though, my knowledge on the back end is limited. As I said, I'm a noob when it comes to coding.
The lifeState should be serialized by the database extension thing. I just don't know how to manually knock out a unit in BI Revive (Just setUnconscious ???)
Yeah.
Pardon?
So setUnsconscious is sufficient?
To manually knock out a unit and have BI revive work.
?
The wiki page is garbage.
Just kill the unit.
Hey hey, no need to get violent.
But they explain nothing.
file?
#include "defines.inc"
#define DEBUG_LOG bis_fnc_logFormat
This part is cute. It almost looks like a proper script.
SET_STATE(_unit,STATE_INCAPACITATED);
I guess.
It probably does a bit more than that.
I hope at least. Otherwise ...
What is playerVar ?
bis_fnc_objectVar
all this fancy new tech
KK ?
googles neokika
Nelson Duarte
according to my googlefu
we
I never found an application for bis_fnc_objectVar
Does it work on clients?
Yeah, but it seems to be required for bis_fnc_reviveInitRemovePlayer
Why does a getter function like bis_fnc_objectVar add a "local" eventhandler? -_-
discord
There was a wise guy that once said that functions should have no side effects.
Like a getter adding a eventhandler
Is that why they use
private _object = param [0,objnull,[objnull]];
instead of
params [["_object", objNull, [objNull]];
?
// init.sqf
if (/*database says I'm unconscious*/) then {
private _playerVar = player call bis_fnc_objectVar;
[_playerVar] spawn bis_fnc_reviveInitRemovePlayer;
};
something like that.
Thanks for the pointers guys.
I will see if I can make it work.
Probably will do a temporary solution in the short run which checks if the player is unconscious on disconnect, and then kill the player if it was in combat at least.
Just slap it on the server and watch if someone complains.
wow
Thanks discord for adding that "gif" text.
Perfect.
I mean he could work on something to store the state in an object variable or in uinamespace
But the proper way would be to have the database thing serialize the unconsciousness state.
And then use setUnconscious or whatever the way is to trigger BI revive state by script.
On the initPlayerLocal or something.
But the player object is deleted though. The object vars should be gone then.
(((getPosVisual _x) select 2) < (300 / floor((speed _x) / 50)))
parenthesis hell : (
(((getPosVisual _x) select 2) < (300 / (floor((speed _x) max 0.01) / 50)))
I guess
Yeah, right now that's a bit over my head.
thanks Max, is perfect
Don't say that to him though.
But I can do a onPlayerDisconnect check for lifestate.
That won't work. You need HandleDisconnect
OK
Otherwise you don't have access to the unit of the disconnected player.
So I need to add that eventhandler on the initPlayerLocal?
No, it's a eventhandler that only works on the server and handles all disconnecting players.
Define "in combat"
Well, Exile has an "in-combat" system, ie if you fire a weapon, or if a weapon is fired in the vicinity of you, you are set as "in combat"
I don't want to kill players that disconnect to avoid (for example) falling down some stairs, or stumbling on some #arma rocks, or whatever
But definitely kill them if they are in combat
(if they disconnect, that is)
googled "arma exile in combat"
Nothing valueable found
ExileClientPlayerIsInCombat
Check for that
That's the check I do for other things
ie. if !(ExileClientPlayerIsInCombat) then {
It's local to that client huh
Could try to add one yourself that mimics it but uses a broadcasting setVariable
And that's how it's reset.
No need to I think
firedNear already is global iirc. Could everything be handled by the server
diag_tickTime doesn't support saving, but I guess the rest of Exile doesn't anyway, so ...
handleDamage is insert swear word
Maybe, please don't ask me. I have PTSD from that thing and the ace medical system rewrite.
😄
//initPlayerServer.sqf
params ["_unit"];
if !(_unit getVariable ["commy_inCombat_init", false]) then {
_unit setVariable ["commy_inCombat_init", true];
_unit addEventHandler ["FiredNear", {
params ["_unit"];
_unit setVariable ["commy_inCombatTickTime", diag_tickTime];
}];
};
//initServer.sqf
addMissionEventHandler ["HandleDisconnect", {
params ["_unit"];
if (lifeState _unit == "INCAPACITATED" && {_unit call commy_fnc_isInCombat}) then {
_unit setDamage 1;
};
}];
commy_fnc_isInCombat = {
#define COOLDOWN 30
params ["_unit"];
diag_tickTime - (_unit getVariable ["commy_inCombatTickTime", -COOLDOWN]) < COOLDOWN
};
maybe this works
@tough abyss it gets triggered like 15 times per injury for instance.
What's the usefulness of #define COOLDOWN 30 vs _cooldown = 30;
_cooldown = 30; is a variable assignment. Variable assignments cost performance
I do it mainly to trigger Dscha.
I'm sure we'll live
Is the performance difference really that good? I've been using _var = blabla;. I'm trying to cut some MS off a script that has to run 1000s of times withing a few seconds
no
Negligible
perfectionism
words
you are trying to cut MS off? Milliseconds? are you saying me that your script that runs thousands of times needs over 1 millisecond to execute?!
lol, nigel
It's mostly about how many times, I think around 2500 times took me ~1.5 seconds
eyes twitch
I read that as trying to cut Microsoft off
I think this is better than having 2500 seperate scripts for every group 'tho
It's a magic variable
-> belongs in a macro at the top of the function
You're getting < millisecond on your script as is
You have 2500 groups?
If you cut some milliseconds off that, then let me know
Because I'd like infinite performance too
They are cached. So in reality max is still 144
if you have constants. That is variables that never change. You may have a small benefit from putting them into a #define instead of a local variable
I normally use this with ~100 - 200 groups. But I wanted to see what would happen if I had a mission with the whole map covered in enemies
whole map covered in enemies
How many we talking 😄
Not gonna need any optimisations when the whole game 💩s
group limit is 144 if you aren't on dev branch
I can tell you what would happen.
Arma has stopped working ™
I've got a activeGroups limit that I can set different for every group. I try to limit the maximum active to around 30. So 30 active...2470 cached (deleted, only array)
server fps : 45
30 groups is different from 144
No arma session will ever need 2500 cached groups so test your script with realistic values
30 seems reasonable
I would like to think if it were spawn mycachescript forEach groups; I would have less than 45 FPS on the server
I've got an actual mission with the script where I got 147 groups right now. Bear in mind some of the groups are only 2 men patrols
What does it do?
I think the game craps itself when you have like 2000 scripts running.
And 300, one for each fish in the ocean. Thanks BI
Let me get the minigun, brb
Setting one object namespace variable should be fine, but definitely don't make it a public one.
Just set CfgAISkill everything to 1 and use the commands exclusively
It's .39 and not .2, because they practiced in secret!
Developing A3 must be fun
Does it make sense? Nah. Cool.
Hey guys check this out, I just implemented this new command, it doesn't do what it's meant to do, hahaha
AimingAccuracy 0.3-0.4 seems to bee good middleground
you need aimingSpeed 0.3 as well
hahaa
!1!1!!!
Brilliant
Did you know the setSkill "courage" is responsible for the amount of suppression the AI can withstand?
What the fuck?
aimingShake 69%, aimingAccuracy 29%
Your AI are wacked on something man
got the shakes
endurance: 0.959843
Coke confirmed
How does it interploate so much for you?
Is that a modded unit?
"I_soldier_F" "aimingShake" == 0.435 //setSkill 0.8
What are you using to draw the skill value?
What are your difficulty skill settings?
setSkill "aimingAccuracy" 0.5; //skillFinal 0.462362
Yeah, I think the difficulty setting is part of the interpolation.
@little eagle Thanks m8, I'll try your solution.
Do publicvariables initiated on server start stay for those who connect, if so how would I read them?
just read them by using the variables. Public Variables will be received and set when joining the server
Thanks
If using setVectorDirAndUp and setVelocity on every bullet in a fired eventhandler, Does the bullet path get updated/sent over the network twice per shot? Will it cause any performance decrease in MP?
Pretty sure the bullets are local objects and you have to setVector / setVelicity them on every machine.
Will it cause any performance decrease
Yes
Everything does.
Use the profile branch thingy and find out how much.
No issue in single player, but how will it affect performance on a server with 2 players vs 60 players. Kind of hard to test
The only way to find out is the profiler or some other kind of debugging.
This doesn't run for AI
ok. thanks 😃
Bullet locality depends on ammo simulation and how it was shot. Player-fired shotBullet projectiles are local to each client
Only fired message is sent, then each client processes bullet by themself
That is why we have to use our own deterministic random number generator to keep sniper bullets synched for spotters.
So bullets get adjusted "in flight" locally and the new path is not sent to every client with that overheating script?
they're adjusted once when fired and not in flight
is ther any way to control depth of field via script?
should I be running scripts for GUIs in functions?
it says waitUntil is an error in general expression
no. you should read up on scheduled vs non-scheduled environment in sqf
supsend stuff like sleep and waituntil only works in scheduled
preInit are called unscheduled so suspension is not allowed. Parameters passed are [ "preInit" ].
postInit are called scheduled so suspension is allowed but any long term suspension will halt the mission loading until suspension has finished. Parameters passed are [ "postInit", didJIP ].
that's a good starting point
good. you should still read up on it if you don't know what the difference is
They put that count vs forEach shit on the wiki 😦
what about it
is it wrong?
Ya post init didn't work so I guess I have to read up more
why is that bad?
perfection commy perfection!
question: is there any advantage in converting my ui scripts to functions instead of keeping them the way they worked?
nitro. according to that stuff you posted you were somewhat right but it highly depends on what you make waituntil wait for i guess. either way it's very important to understand the difference anyways. so can't hurt to read it
it's waiting for a boolean
clicked = false;
onMapSingleClick "'east_start' setMarkerPos _pos; clicked=true;";
waituntil {clicked};
so what happens?
Why don't you put the rest of the code inside the eventhandler
also use addMissionEventHandler
this is local?
right (@commy not at local)
uhhh
So you don't have to work with a string and have stackable eventhanlers
this isn't for an event handler?
did they keep those for backwards compat? would be cool to habe them remvoed at some point
although mission EH keeps it from breaking right?
It makes using it more convenient and does stop it from breaking too.
so essentially BIS_fncaddstackedEH is kind of pointless, huh? i kind of missed the memo on mission EHs. shoudl probably switch all my BIS_fnc_stacked EHs to those
It is now.
I mean, there is nothing wrong with it, but it's vulnerable of being broken by mods that don't care about compatibility
E.g. Exile.
onMapSingleClick "
'east_start' setMarkerPos _pos;
clicked=true;
'H8erHUD' cutRsc ['default','PLAIN'];
OpforFlag setPos (getMarkerPos 'east_start');
openMap [false, false];
enteredEast = true;
[] call GUI_fnc_SpawnMenu
";
I suppose that works
but it's all ugly and turqoise
:P
do what commy said to decrease ugliness adn also make it better
what did he say to not deal with strings?
yea Exile blocks mission EHs too i think though. or infistar. can't remember
missionEH
You can still remove them all by using removeAllMissionEventHandlers
But if someone does that, why bother with it.
and yea it sucks. but it still makes all the noobs come to my steam page to complain. and i honestly would like them to be able to use stuff without hassle
Write a letter of complaint.
do mission EHs survive save game loading? because then it'd require care to avoid spam
Yes.
k thx
Dear BI
scrtipting is hard, plz nerf
love XxScriptingNoobxX
I'm having lots of trouble understanding keydown event handlers and how to get certain things pushed back appropriately to make a thing happen.
I know that the action keys I need to work with are GetOver and CommandFast (I think that's sprint).
Does anyone know the most efficient way to create an event handler for GetOver+CommandFast keys?
I've got a patchwork of shitty script for this already, but it's... just terrible.
Is there a method of reading systemChat from the server?
you mean ask the server for something and make it spell out in systemchat on the client?
No like if let's say some admin says something in rcon. I want to read the sentence and trigger the script
Nope, sorry
Dang
If you are handy with a different language, you could whip up a small extension
Is there a way to enable the new Revive system conditionally? I would like my missions to fall back on it should ACE medical not be present.
@shadow sapphire Those actions don't work properly. You better forget about them and treat them as if they don't exist.
@old basin
if (isNil "ACE_Medical") then {
// no ace medical
};
No idea how to script start the revive system or if it is even possible.
@little eagle, DRATS!
What might I do for the V key and SHIFT key? Just use DIK?
DIK codes. #include the library to keep your code readable.
#include "\a3\editor_f\Data\Scripts\dikCodes.h"
who's dik?
brother of cok
nice meme
DirectInputKey?
DirectionalInfractionKnowledge
@little eagle Yeah I know how to check for whether the mods are present, it's the BI Revive thing I'm having problems with
Sorry, no idea how to start it by script.
Can't find any commands or functions in the BIki to control it
Was looking at the wiki yesterday and it's nothing on there.
"DirectInput Key " is what i found
It has no SQF commands, it's a scripted solution as far as I can tell.
It was when I last was active like a year+ ago, but I never paid it much mind
Oh hey there are functions in the ingame functions viewer for this thing
The wiki does not seem to be up to date with these
Anyone know how I can do a keydown for when 0x2A and 0x2F are pressed simultaneously?
If I'm not mistaken, you'll have to release a key to detect the other
isn't the problem rather that each single key will trigger the event? i don't think keyDown will block itself like that
It's only going to trigger for the one key
And when they occurs, the other key is already not known, the EVH has finished execution
Hmm...
Okay, well, shit.
Then I'll have to do a fucking velocity check. Irritating!!
So, I need a keydown even handler that checks a whole bunch of shit out and then does it's thing based on that. Ugh.
What are you trying to do?
Because if you want to stop people from vaulting, then give up.
So, I need a keydown even handler that checks a whole bunch of shit out and then does it's thing based on that. Ugh.
Elaborate 😃 ?
could have keypress down "v" set a variable to true and keypress up "v" set to false and keypress "x" checks if variable is true then both keys are down
@little eagle, @dusk sage, I'm trying to make the movement in my sandbox more versatile. I don't want to remove vaulting, but I want to make it where if you are sprinting and hit the vault key, you will jump, if you press vault key when there is a window or wall, based on height, you'll climb through or over it.
@plush cargo, that's not a bad idea, but I've seen something similar to what I need done with a velocity check and that seems to work fine. Thank you, though!
np 😃
Just be careful, if you hold a key down, it'll fire many times
You can simulate a little parabola, but it looks odd
Same as what life does, just via setVelocity
Same anim as you just linked
animchanged EH could work too. would need switchmove though without transitions. might get ugly when used with any otehr than a rifle in hands since i think there is only a rifle version fo the jump anim in game
yep, it holsters mid flight
Hello,i settet up a wasteland server on chernarus summer.I put the MOD vehicles from CUP in the store to buy,took me many hours bcs im a noob.When i press buy there pop up a messege in the top right "The purchase has been cancelled". I realy dont no what to do can any one help me maybe :/?
hm i guess you could do some fast selectWeapon stuff. auto select rifle while jumping and select back to what you had right after. shouldn't be noticable with anim EHs. except you will always jump with rifle in hand xD
does anyone know the path to the default NVG overlay?
I can look it up.
You know I never even thought about it, you could use the NVG overlay without the green effect to simulate a mask of some kind
It actually uses a model and not a texture
modelOptics="\A3\weapons_f\reticle\optics_night";
\a3\weapons_f\Reticle\data\optics_bg_blurred_round_CA.paa
Four of these
It's only a fourth that is mirrored.
thx!
k. so how do i rotate a picture? possible?
basically need to make a copy of that overlay
actually i could just create teh ctrl as an object/model one. derp
should do the trick
Never tried that, but sounds interesting.
although since i'm doing stuff to nvg i might aswell remove that default overlay all together. should be possible, right?
By editing the config, sure.
btw. i was thinking. it would be so damn useful to be able to use that addaction hack using the shortcut parameter without having that ghost entry in th scroll menu list. what are the chances of them adding a parameter to addaction to avoid that, if we ask for that?
so one could easily create EHs for any mapped action or whatever you call those
About 0?
Don't be optimistic commy
You're right. If we ask, they'll probably take away the DefaultAction hack we use atm altogether.
thx
so if i do test = 100; publicVariable "test"; on server side and for every client that connects can i just do hint str test?
nvm tested and it worked
It's great, isn't it?
alright ill do missionnamespace
@tough abyss inside remoteExec though, right?
oh wait. nvm. you use global bool
nice
What was the alternative to publicVariable? mission namespace or soemthing?
I had a long convo with Dscha and someone else and ultimately found out they do the same thing
minus some parameters
missionNamespace setVariable public is essentially the same as publicVariable
missionNamespace setVariable ["Test", 127, true];
Test = 127;
publicVariable "Test";
The first one is very slightly faster and a one liner.
yush, thans commy
I remember that there was a max execution time for scripts, but I can't seem to find it anywhere.
Thanks
thanks Dscha for the code optimisation page. never read it.
It should be pinned!
True, best way to do it is, achieve what you want to. Once it's done rewrite or improve.
Every time I go back on a old script, I feel like I've been so bad and the new one is 2x better
recursive loop and you return to it
therfore it's never perfect
therfore you write it 2x better every single time
dah dah dahhhh
End result is better 'tho. Even
even 'tho it might never be perfect, it's always better
What gamemodes did you design?
Is there any way to script how hexagons show and on what players they show on?
Like is there any commands for setting shit like that? I've been looking like crazy but haven't been able to find anything.
Ah alright, but can I use the default hexagons then? I assume no. I've seen it done I think. What I want to do is, remove a hexagon from the group when the target doesnt have a gps. so when he doesnt have a gps, no one in his group can see him
ah alright
Ye that seems like a good way i guess
It's like a slightly cleaner version of handleDamage minus the damage processing
@tough abyss so its like hitPart in a way?
Hello. Need help with ejecting players from vehicle in INCAPACITATED lifeState. Example from wiki (moveout) don't work. Any ideas?
hmm, can you temporarily disable the unconsciousness, do moveOut, and then reenable it?
yes, this method is best atm, but may be someone know more simple and clean 😃
Delete the vehicle. Jk
with those new damage handlers you could therietically award players who have done the most damage and give other players asissts like most games
What has changed that you think would make that so much easier? @plucky beacon
Read quicksilver's comment up above, you can measure how much damage is caused by a unit and it's projectile
This was already possible with handleDamage tho
That could be used to add the dink sound games like battlefield,counter strike and cod are using when you headshot someone with a helmet, to appeal to the mainstream audiences
Also hitmarkers and hit indicators.
Have a square one for vehicles
imma start with people first
Make them only show when a certain amount of damage is done, that way when you shoot a pistol at a tank, you won't get it, but if you shoot a .50 at a car you do.
I was thinkin' that actually
ho boy I could even do it for getting hits on parts of vehicles like rotors
on another note, I could do a script that spawns a marker when you fire a weapon without a suppresor
that then fades
Genius. This will improve arma immensly.
I found it's best to do the scripts right the first time. I don't get back to improve stuff like 90% of the time. Only the really big features get overhauls and it's mainly stuff like new SQF commands or eventhandlers.
well at least in my head including vehicles now or later is negligible since it won't be reusing much code. the damage to parts on vehicles is diffrent.
I've rewritten things several times because I've been told it's wrong here
I prefer thorogh testing with a reliable group
Yeah, I try to think of all of that before.
I still think the safe zone object in helpers is way more effective
I prefer iterative design
I learn more
and I'm also not good enough to know the best way
so basically becuz nub
I can't plan for time spent
because I don't know how complicated it will get
i.e. hit markers
I'm pretty sure I know how I'm going to do it
but then, i dunno fucking sound files will be trouble suddenly
hitPart EH description actually recommends usage for hitmarkers iirc
haha lol
Because of this, this event handler is most suitable for when the shooter needs feedback on his shooting, such as target practicing or hitmarker creation.
I've modified atlas' hitmarkers mod which also uses hitPart
but what about dem headshots
selection: Array - Array of Strings with named selection of the object that were hit.
why not use the dammaged handler?
Wouldn't you have to use MpHit anyway?
eww
I guess remotExec would work as well
prevent network stuff wherever possible
for local feedback like hitmarkers i wouldnt recommend mphit
Copy that. remotExec has object available as target, the function will be executed only where unit is local
So it's perfect
on a side note - im hardly experienced with networking but doesnt remoteExec with a local 'target' still send a msg to the server and then the server checks locality and sends the msg on through to the selected client
I somewhat doubt its p2p
I think the only P2P in arma is local and nondedicated hosted servers and VOIP
in Atlas' mod he makes it an extension of the hitPart event handler, can you do that in a script solution? description maybe?
what u mean is that he's using the CBA hitPart extended eventhandler, for ease and stability.
there are several ways u can do the same without CBA tho
Is p2p even possible in arma ?
Is information sharing p2p possible, as in only sending a variable to a certain client?
There is no p2p. Arma is server-client.
So the best solution is still having the remoteExec
For what?
solution to what problem?
Why though? remoteExec already handles objects. And labeling it p2p is misleading.
clientOwner still reports something different in loaded save games : (
p2p has a definition
Otherwise everything MP is p2p
i get both povs but yeah i agree with commy here. p2p has a definition
remoteExec can give you the illusion of p2p
They're fine, but you have to do stuff correctly to not break them.
CBA didn't work at all in loaded savegames until I fixed all the problems.
uiNamespace
And none of the displays survive
So all keyhandlers are gone for example
CBA_fnc_addDisplayHandler handles all this. Including restarting a mission in editor, where the RscDisplayMission is carried over, which leads to duplicate keyhandlers if done wrong.
benefits of MP dedicated scripting...dont ever have to deal with this shit ^-^
locality is funnyjummy
Dude. You can just remove comment and leave the strings inbetween the code.
That would make it faster too.
But it's true. The command is useless.
file search in the debug console
rght
syntax highlighter in the debug console : O
if you wanna file search for comment's just search for //
leaving random strings in the code would perhaps make me think it's unfinished code. Putting comment before it though makes it abundantly clear it's a comment
Personal preference I guess XD
true. use /**/ then
do textures used in UI stuff need proper size and ratio too like textures? having trouble loading a texture
#careForComment
Using the debug console for writing code is retarded in the first place.
Quick question: Is it possible that when I enable respawn on custom position on a user selected position that the mission doesn't start with everyone having to wait until the respawn timer runs out after joining in?
I mean, ofc it is possible somehow but how
What?
Basically, I have a mission with respawn on custom location
- the respawn menu to select where you spawn
BUT, that means that everytime you join in the mission, you basically have to respawn right away and wait until the respawn timer runs out. So assume I have a 60 second respawn timer and above settings set in the mission, the moment I launch the mission everyone needs to wait 60 seconds before being able to spawn in
uhhm
And its one of the go to mistakes mission makers do in the arma 3 unit I used to be in. Respawn on custom location + spawn selection = lets wait additional 30 seconds before we can spawn in after the mission started
respawnOnStart = 0; in description.Ext? this?
RespawnOnStart 0 will run the respawn script, but not to actually respawn. 1 will run respawn script and actually respawn. That was the biki explanation, i guess if you set it to 0 it wont count as a respawn i suppose
Yeah, basically setting it to 0 means that you won't see the respawn menu until you actually die which is exactly what I needed
Another issue though: Special characters like Miller loose their face whenever I do anything with their attributes (Because said attributes contain the identity and millers face isnt selectable there, thus resetting it) any workaround for that?
1 = true
0 = false
1 = 0 0 = 1
@jade abyss I know but that wasnt my point :S
Yeah? And?
Nothing
erm, okay? ^^
Still wondering how I fix that Miller looses his face
Or, how to make him still appear as miller
Well, now I just need to figure out the identity name of miller. Can't test it right now but, I'm just gonna assume its not "Miller" is it?
Using the debug console for writing code is retarded in the first place.
Right in the feels
I think it's used for debugging scripts that have been written earlier. That's why he uses comment '';. So he can simply copy the script straight into the debug console and make small edits without reloading the mission.
@polar folio did you figure out the ui texture?
Added: New modelToWorldWorld and modelToWorldVisualWorld script commands (transforming model coordinates to world coordinates with absolute height without any adjustments)
modelToWorldWorld
modelToWorldVisualWorld
Rly? 😄
I'm amazed that people actually defend using comment when they also argue for count over forEach.
I mean, sure, Quiksilver is just trolling as always, but everyone else should be ashamed.
Pretty sure it's a typo and the command is named modelToWorldVisual
Oh, wait. That already exists. modelToWorldWorld oh wow.
Makes sense if you plan to use the debug console a lot
Sometimes I forget about comments, spend 20 seconds or so deleting them
Gets annoying
Does anyone know a good way of adding "categories" to a listbox?
Like
- Category 1
-- Item
-- Item
the performance impact of the comment command may change if BI incorporates it into https://feedback.bistudio.com/T123419 basically removing at compile time :3
imo comment should only be used for debugging scripts in the console, making small adjustments. When final tweak is done and nomore debug console is needed, I replace em with // (or i remove the preprocessor comments b4 testing in console)
Why would anyone use comment?
if one is sure one tweaks a script in the debug console where regular preprocessor comments are not allowed and one must absolutely preserve those comments for some reason, one may use comment
so, basically never?
Every solar eclipse
that often?
when all the planets in the solar system align
use the diaglog
and spam the rpt? lol
: ^)
one should always put diag_logs in perFrame handlers
gotta love dem 100 MB+ log files
I can do one better
for maximum performance
while {true} do {
0 = [] spawn {
while {true} do {
diag_log "spamming log until your computer dies";
};
};
};
OH GOD
virus activated
does this qualify as malicious code?
you all be good boys and not use that
@plucky beacon
ABC =
{
while {true} do
{
diag_log "spamming log until your computer dies";
[] spawn ABC;
};
};
[] spawn ABC;
GG
LOL
missing brace for while {true}?
Fkn spawn{ ppl instead of
spawn {
you a newline bracketeer?
Braces on same line master race
Yes, much cleaner and you can see on the first look, where it opens and where it closes.
Sameline brackets is for noobs! all hail the Newliners!
😦
newliners have neater code
a happy newline is a happy coder
Newliners = bestliners!
halp im being oppressed
a bracket a line, keeps your faults in line
can we all agree on that we can't rhyme?
They can't
Okay, back to scripting stuff again. Getting outta hand again 😄
a bracket a line, your script's all fine - my final attempt
oh ffs, rly Nitro? 😄
if(_x isKindOf "SmartAss")then{bitchslap _x};
}forEach (units Channel);```
((units Channel) select { _x isKindOf "SmartAss"}) apply { bitchslap _x; _x };
{
if(name _x == "MrSanchez")exitWith{closeDialog 0;};
}forEach (units Channel);
if (local _sanchez) then { createDialog "Discord"; };
the way you don't put a space between the last bracket and forEach hurts my eyes
I can live with both, tbh. The NonSpace Version looks more professional since (I HAVE NO TIME TO PRESS SPACE!)
😄
if (_uid == _Sanchezuid) then
{
player setAnimSpeedCoef 0.1;
};
you will play arma at 1/10 speed
pffft ill adjust the moves config, set everything to 10x
not if I'm checking addons
in that case, more time for coffee while playing
if (_uid == _Sanchezuid) then
{
player setVelocity [100000000,0,0];
};```
input is an array with xyz
it is whistle
while (gay) do
{
hint "you are gay";
playSound "LoudScreeching";
};
pffffff
why hintSilent. Let the noise be heard.
I love the old arma 2 hint sound
on a loop ofc
now i think of it, is there autorun in arma?
quality discussion while I was gone I see
always 😃
ofc
We're solving the real issues here commy
none of those bugs or errors
just the problem of not enough shitcode
I can't save every chat.
*-l
What kinda smiley is that, Dscha?
\Okay, again: * -L / *remove L
Gesundheit.
Danke.
I can't wait to make some ambigious code with these new commands
_1, _11, _111, _11111, _111111, _1111111
Think of the bytes commy
_I vs _l
They are going extinct
You can start local vars with numbers, as it's denoted by the _
Eh, am I going crazy
lol i noticed my mistake lol
Comment was deleted.
your mistake was looking at anything we been writing 1 hour ago
missionNamespace setVariable ["0var", 127];
Does it work?
idk
does sqf support Unicode as variable names?
ASCII
aww
And without setVariable it's only letters and numbers
That will not work, BoGuu as "5" is a "reserved variable"
missionNamespace setVariable ["0var", 127];
missionNamespace getVariable "0var"
->
127
works
Deam?? It would be a nightmare if numbers where Vars!
See the picture
Just doesn't work when parsing because it's not expected to be a another type
Yeah Commy, but a simple 0var check resulst in error ("Error missing ;" )
missionNamespace setVariable ["äöüß", 12];
missionNamespace getVariable "äöüß"
->
12
really?
yep
Shit it's real
Oh my
inb4 security hole by being able to end anticheat threads that are started via
0 = 0 spawn {
fml -.-
The BoGuu namespace
0 = "hi";
0 = 0 spawn{systemchat "test"};
missionNamespace getVariable "0"; //<NULL-script>
Oh my
yup.
0 = 1;
missionNamespace getVariable "0"
-> 1
At least
0 = 1; with missionNamespace do {0}
Is still 0
No, its okay. I don't wanna hear anymore, it could affect my reality.
Yeah, thats normal.
yes
this is it
There must be a way to break it all from here
Keep writing shit code, we've got this
As long as it only reacts to getVariable -> No Prob, tbh
Google numbers
Did you mean 'ARMA numbers?'
True. It's just funny.
numbers are parsed into special instructions at compile time.
just like strings. but unlike true/false which are still function calls
shh
wait a sec
_null = 0;
_null2 = -0;
[_null == _null2, _null isEqualTo _null2]
->
[true, true]
So isEqualTo makes no difference between them
0 and -0
puh, at least this doesn't work :D
missionNameSpace setVariable ["true",false];//reserved Variable
_null = 0;
_null2 = -0;
[_null == _null2, str _null == str _null2]
-> [true, false]
str can detect 0 vs -0.
Is that how you use params?
_null = 0;
_null2 = -0;
[_null] isEqualTo [_null2]
->
true
@peak plover The string can be a variable too, but it's unusual.
Yes @peak plover Makes my code more readable
less*
🍿
missionNameSpace setVariable ["null",player];
missionNamespace getVariable "null"; // O Alpha 1-1:1 (Khairullah Sabet)
isNull null; // false
^^
null is used by so many people (and for no reason most of the time), that that code isn't really safe.
Some stuff that you can irritate some ppl with 😄
Mind isEqualTo 'blown'
if null == null
objNull == objNull // false
controlNull == controlNull // false
displayNull == displayNull // false
grpNull == grpNull // false
locationNull == locationNull // false
taskNull == taskNull // false
scriptNull == scriptNull // ERROR
configNull == configNull // true
Yey consistency
To be fair
inheritsFrom configFile == configNull // true
You could achieve configNull by using inheritsFrom configFile and they probably didn't want to break stuff.
It's more annoying that str configNull is "", so it's basically invisible in the debug console
also
isNull teamMemberNull // ERROR
tbf: Who would use that.
I don't even know if it's implemented correctly.
Don't think so. Can't even think of a usefull thing to do with it
It has some weird "control structures" associated with it:
{} forEachMember _team;
{} forEachMemberTeam _team;
{} forEachMemberAgent _team;
It's just all sorta fucked and circular though:
Syntax:
team addTeamMember member
Parameters:
team: Team Member
member: Team Member
Return Value:
Nothing
TEAM_MEMBER was another candidate used as variable container for pseudo namespaces, but LOCATION was faster.
So, it's useless.
hm
This is a reserved Type for future implementations. In Armed Assault it is not implemented yet.
Well. That means never then.
I wonder if you can hack something together with this though.
Those not forEach'es look interesting.
I think I figured it out:
modelToWorld // reports AGL, simulation thread
modelToWorldVisual // reports AGL, render thread
modelToWorldWorld // reports PosWorld, simulation thread
modelToWorldVisualWorld // reports PosWorld, render thread
PosWorld is the same as ASL, but with the model center being z=0 instead of the lowest point in the LandContact LOD.
They fucked up when naming PosWorld. It doesn't really describe what it is all that well.
One "world" refers to model space vs map ("world") space and the other "world" refers to PosWorld.
There, chat saved. Suck gas, evildoers.
Because they didn't anticipate having a PosWorld variant for modelToWorld.
I have no idea why they named it PosWorld. It doesn't even have to do anything with the world. The actual difference in the z coordinate is zero being model center instead of the lowest point in LandContact.
Should've been ASLCenter
getPosASLCenter instead of getPosWorld
ASL, cause it's ASL, Center cause it uses the models center.
logic ¯_(ツ)_/¯
modelToWorldVisualASLCenter
Still shit, but at least the words all make sense on their own.
Actually they already have a command named getPosASLVisual
So the visual comes after the "z type"
modelToWorldVisualWorld should be named
modelToWorldWorldVisual for consistency
It's not possible to raise the water, Dscha.
Of course