#arma3_scripting
1 messages ยท Page 271 of 1
@halcyon crypt
Not exactly using SQF to deliver lightning fast computations.
For larger systems, of course you'll want to get the most bang for your buck though -- and this boils down to the programmer's own judgement on what he should do.
I use scheduled single function spawn
then call inside it the rest of the way.
This way the spawn is only a single thread.
and it has wthin it, everything else staying within a single thread.
[] call myTag_fnc_myFunc1;
[] call myTag_fnc_myFunc2;
[] call myTag_fnc_myFunc3;
};
This way @wispy cosmos it keeps it all within the same thread.
and if the functions are just proceedures doing something
I still get them to return a value
Yep, same here @tough abyss
With my game mode I'm working on, I have one thread running per machine which handles everything within its gameloop
You seen BMR insurgency?
I haven't
1200 VM threads
๐
Just wanting to point out that
It's going to give you the results the fastest (since it executes as fast as your CPU allows, and isn't tied to your framerate IIRC). Sometimes you may want that, sometimes you won't.
is completely wrong
๐ฑ
@little eagle I thought we already covered that earlier?
No need to revive it
I already admitted that I was wrong
Fun fact. If AI spawning is called within the unscheduled environment
The game hitches.
Very badly.
makes sense
in an unscheduled env, it's waiting for the createUnit command to finish executing
no need to make things less "readable" for a 0.00001ms (obviously don't know the number.. ^^) improvement
It would be irrelevant if it were that small. But it isn't. The exact figures depend on what you're doing.
It's also not a simple matter of replacing while with for or eachframe
It's deeper design decissions that actually make a difference.
This is why I verify the AI has complete it's initialisation.
@little eagle yea. my argument was that it's not some simple one-size fits all solution. It's all about one's judgement
Gear saving scripts should run completely async from anything else.
But, got to be careful about that as well.
Pseudo-code Quiksilver.
My new best friend.
There is no problem with you having your scheduled poll loop in your mission
But now imagine every addon uses these.
Or one of these in every component of the addon.
It would suck and break everything else.
Queue DS's are not hard to implement I went over-kill and wrote functions for them.
The queue DS works though.
There. The goal is to explicitly not break missions or addons.
like with my mission, it's small scale, very little computation occurring
mission-design you need to live a lot of the time in scheduled.
and likely not to be used with lots of script heavy mods
Also unscheduled.
From what I've noticed doesn't throw errors.
When there is an error.
so I can get away with not worrying so much about using cutting-edge scripting techniques
unscheduled does not throw errors for referencing undefined variables, which can make for simpler code, but also harder to find certain bugs.
^
Been there done that.
I realized that recently
The real pain for someone that makes API functions is, to test them in either environment
E.g
params [
["_object",objNull],
["_variableName","", [""] ],
["_state",false],
["_isPublic",false]
];
missionNamespace setVariable [ _variableName, _state, _isPublic ];
diag_log format [ "_object: %1", _object ];
_HandlerID = _object addEventHandler [ "killed", format ["
diag_log 'EH Fired';
missionNamespace setVariable [ '%1', %2, %3 ];
'Main Mission complete, give us 60 seconds and we will start the next' remoteExec ['hint',0,false];
",_variableName,true,_isPublic]];
Without qoutes around the '%1'
It complained.
"undefined" no errors...
Can you actually have a variable named %1?
It did..
it only works, because it's in another format
It works perfectly.,
Wouldn't %____ be an invalid var name?
Fires perfectly too.
No more while loop for any blow up objective I want.
Just invoke that function.
On ANY destroyable object.
I have a system thats completely EH driven.
It is I've noticed EH's execute differently to other things.
This is flexible though...
I can give any Global variable.
race conditions are the worst
So I can invoke it for many objectives.
-2 doesn't work for local hosted MP
anyone good at scripting AI?
fast excerpt from recent DEV branch builds Added: A new terrainIntersectAtASL script command Added: A new enableWeaponDisassembly script command Added: New setFlagAnimationPhase and getFlagAnimationPhase script commands Fixed: the TurnIn / TurnOut Event Handlers would return [] for the driver turret (instead of [-1]) Added: A new isSimpleObject script command Added: Support for randomly generated values based on a seed (random command) Added: A new "BuildingChanged" mission Event Handler ...
is that to detect if windows break in buildings, etc?
btw, I love it when new commands come out! ๐
never know what people come up with using those
^^
@tough abyss it's to detect model replacement (sections collapse, ruins etc.)
perfect! @lavish ocean
I actually needed that for my BloodLust mod
I realized that the Killed EH didn't do the job for detecting when a building was destroyed, because some buildings had partial destruction.
That'd be very useful ^
@wispy cosmos But, the kill'd EH did detect, my objects destroyed?
@tough abyss I think there are some buildings that don't trigger it if they have partial destruction.
Could also just be an issue with some logic in my code
Everytime I try enabling DynamicSimulation i get thrown expression errors
"Group" enableDynamicSimulation true;
"Vehicle" enableDynamicSimulation true;
"EmptyVehicle" enableDynamicSimulation true;
"Prop" enableDynamicSimulation true;
"Group" setDynamicSimulationDistance 2300;
"Vehicle" setDynamicSimulationDistance 2300;
"EmptyVehicle" setDynamicSimulationDistance 300;
"Prop" setDynamicSimulationDistance 100;```
was what i tried
Danke
the joy of finding a function that does everything you need
โค BIS_fnc_invAdd
oh oh oh, it's magic!!!!
[unit, "H_MilCap_blue"] call BIS_fnc_invAdd;
^ returns false, even though it put the hat on my character
works for weapons and mags just fine though
seems headgear isn't being checked properly
welp, I guess I better leave our hats and shit from my mission >.<
for now at least
It also replaced my weapon and returned false
time to work around this :C
Wonder if Dynamic Simulation will improve FPS in non-ai missions as well
@everyone With zeus, how do I only make the soldiers in the helicopter get out when landing, and not the pilots?
What
Should I just do
A land
Unload transport
And then the helicopter and soldiers go their ways?
It's not landing
It's hovering above the ground
Actually landed now
The troops wont get out
;-;
Set an unload then away from it set a "Wait time"
For where the helicopter flies away.
damn that @ everyone usage.
@tough abyss from what i read it should also improve non-ai missions
Thats good to know.
@tough abyss from a technical point of view,it should improve any mission with a high amount of AI,vehicles and or objects,
One of those there or any combination results in low FPS at high counts so yeah.. I think the dynamic sim will help, but let's not freak out. I guess it won't give you an amazing frame boost and it could cause a lot of trouble when set up wrongly
Good thing "everyone" is disabled for normal users. It's Very poor form to use it.
Its been available for a while in many mission frameworks. This might be a bit more efficient but its got the same trade offs and its not going to solve the issues with client side performance from what I have seen, it barely has an impact on the problem we have.
Try the EH EpeContactStart
I was wondering if it was possible for the Swivelling Target to stay down just like the regular popup targets, until i call for their anim to pop back up.
For anyone using BI's new revive implementation, is there a way to control how much health a revived player receives? It's defaulting to set damage = 0.
onPlayerRespawn.sqf @kindred kayak
It fires when a player respawns so I assume that because Revive template is a respawn template
it means that it should be firing onPlayerRespawn.sqf when you revive someone
Interesting. So something like MPKilled won't fire, but it still calls the respawn event post-revive.
Now to find where they configure the text that displays as you approach an injured person. Doesn't seem to be RscRevive.
Test if it does.
I am assuming it might.
Untested.
feedback.fsm might be what your looking for?
Yes, it fires the respawn event
That solves the health part, however it's not clear which controls are being used to display information like "Hold Space to revive"
And can't find them in the localized strings.
Seems like they're in the engine.
I'm guessing it wouldn't have the 'space' in the localized strings
it would probably get that from control settings
using something like https://community.bistudio.com/wiki/actionKeysNames
is there any way to effectively disable gravity on a player?
to be able to suspend a unit in mid-air without falling
setmass?
can't make an object invisible, and units still fall with setmass
Reverse mass?
and disablesimulation means no animations are played
you can try to create a sphere (used in training missions) hide it, and then attach player or other unit to it
anyway
I am back :)
ah that's not a bad idea, nice one
i don't need to be able to control the player, but if i did, that'd probably be impossible right?
like hiding one of the quay pieces in mid-air that you could run around on
i do that in the gear selector i made.. but i had trouble attaching the player to most objects
for some reason it works properly with a flag though
i just attach the player 30m above the flag so you cant see it
there also an invisible wall object in vanilla, you can also play around and build a transparent box and place player inside
When respawn is enabled, is it possible for a player to be able to select spawning location from both preset locations AND his location of death? What i mean is that in the spawn location map, you can select the usual locations, but you can also select your previous location before dying.
you may add an event handler to his death, and add additional respawn point using position of a dead body
anyone do experimenting with nearEntities/nearestObjects/etc, regarding Z? wondering if it checks around a given position with infinite height, or if it checks in a sphere (with given radius and position). if the latter, is the input position in ASLW?
Sphere-like
ty
Does anyone know what the creatorId is ? https://community.bistudio.com/wiki/weaponAccessoriesCargo
(in the params)
@vital onyx @opaque topaz Am i in the right track?
player addEventHandler ["killed", {_this exec "addrespawn.sqf"}]
//addrespawn.sqf
_bodypos = getpos player;
[player,_bodypos] call BIS_fnc_addRespawnPosition;
@tender root a number (in MP) that can be acquired by https://community.bistudio.com/wiki/getPlayerUID
that can be documented somewhat better on the biki
@torn jungle use execVM for .sqf. The "respawn" event handler has the corpse object, which you may want to be able to know the death position.
@torn jungle or you could use "Instant" as the respawn template in the description.ext
You spawn where you died I believe
Haven't used it in ages, but I think that is right.
@tough abyss But "respawn" is when youve clicked respawn on the location selection screen right? I need to create the respawnposition (so that you can select it) before that.
So i thought id create the spawn position using "killed" then remove that spawn position on "respawn"
I don't think there is a respawn dialog, but that may have come after I last used it.
I would test that though, might get the result you want.
@tough abyss yep instant does that ๐ but i want the player to be able to SELECT respawn locations INCLUDING where he dies. So it cant be the instant respawn mode. It really has to be "base".
In that case I don't think that is what you want lol
Does the "respawn" event handler trigger AFTER you've spawned or is it already called while you are selecting a respawn position?
I'm guessing it doesn
because "killed" event handler doesnt have a corpse argument ๐ฆ
t happen until you hit respawn
Just make a file in the root of the mission called "onPlayerRespawn.sqf"
It is triggered on respawn
in the "killed" event handler, it's possible that the unit (_this select 0) still refers to the corpse, BEFORE you click respawn on the dialog.
will test ๐
yes
hopefully
before i do that, does this make sense?
_bodypos = getpos player;
[player,_bodypos] call BIS_fnc_addRespawnPosition;
Just put 2 units in the editor, load it up, add an event handler to them that does systemChat format [%1, getpos this]; and then kill the unit.
editor doesn't do respawn
You were worried about the event handler "Killed" not returning the proper position of the corpse
Zaf was.
That is a way to check. controlled environment
"killed" will have the position of the corpse in the editor regardless, since it's not gonna do any respawn functions
player addEventHandler ["killed", {_this call compile preprocessFilelineNumbers "addrespawn.sqf"}]
params ["_unit", "_killer"];
_bodypos = getPos _unit;
[_unit, _bodypos] call BIS_fnc_addRespawnPosition;
looks good
problem now is those respawn positions will be added and will acrue and not automatically be removed
the plan was to use https://community.bistudio.com/wiki/BIS_fnc_removeRespawnPosition on the "respawn" eventhandler
yes use a respawn EH and remove the respawn position
just use myLastDeathRespawn = [_unit, _bodypos] call BIS_fnc_addRespawnPosition;
Then use myLastDeathRespawn call BIS_fnc_removeRespawnPosition;
In onPlayerRespawn.sqf
sorry @opaque topaz can you give quick explanation on why call compile preprocessFilelineNumbers INSTEAD of execVM?
I think (?) execVM reads the file each time. the preprocessFilelineNumbers helps to optimize.
Well that method is calling it every time.
If you want to save time on that, call compile it once in the init and call it differently.
so in mission root folder...
onPlayerKilled.sqf
player addEventHandler ["killed", {
params ["_unit", "_killer"];
_bodypos = getPos _unit;
_respawnInfo = [_unit, _bodypos] call BIS_fnc_addRespawnPosition;
_unit setVariable ["respawnInfo", _respawnInfo];
}];
onPlayerRespawn.sqf
params ["_newUnit", "_oldUnit"];
_respawnInfo = _oldUnit getVariable ["respawnInfo", []];
_respawnInfo call BIS_fnc_removeRespawnPosition;
refer to this page for more event scripts https://community.bistudio.com/wiki/Event_Scripts
I don't see the need to use set and get variable, just use a local variable.
the execVM command has delay depending on how many other scripts are in the queue and how busy VM is. execVM compiles and adds the script to the scheduler queue
setVariable is there to make sure the scripts get the right parameters
And it wouldn't in a regular local variable?
also using setVariable because the code is separated into different files
Local variables are known across all scripts.
Well, sorry, local to the machine.
local vars are local the file and machine
Anyone got an idea why the debug console doesn't work in my mission? I've ran in to this problem before and can't remember how I fixed it.... It opens fine and I can watch variables but I can't execute anything. Anyone know the problem?
using setVariable and getVariable makes his event handler durable as well so nothing should really happen or break
Script 1: myVariable = 1;
Script 2: finalVariable = 2 + myVariable;
Script 3: diag_log format [%1, finalVariable];
This should work just fine...
in case the event scripts are executing on different machiens for some reason
dude.... he wants to get/set variable so it is local to that objet
and scripts
if he uses a public variable it is just a pain
In this instance, it is all local data
he is doing it the right way
He isnt setting a respawn for other units.
He wants it for that unit alone...
Exactly.
there is such minimum overhead as well for setVariable and getVariable I don't understand why it's such a big issue. I use setVariable and getVariable to make sure event scripts are using the correct objects
@opaque topaz Is doing it the right way....
I wasn't saying it was an issue, I was simply saying for conciseness, it is not needed.
Anyone know about this?; Anyone got an idea why the debug console doesn't work in my mission? I've ran in to this problem before and can't remember how I fixed it.... It opens fine and I can watch variables but I can't execute anything. Anyone know the problem?
Even the documentation, they use it like I am mentioning: https://community.bistudio.com/wiki/BIS_fnc_addRespawnPosition
Never had that issue before ben.
What are you trying to execute?
even something simple like skipTime 10 doesn't work?
Editor? Server? Description.ext debug set correctly?
ye. description.ext does have enableDebugConsole = 1; it's kinda weird
And It's server
so you're in MP environment on a dedicated server and debug console isn't working?
Are you trying to execute unpacked scripts?
@opaque topaz ye. @tough abyss Nothing works.... testVariable = 1; doesn't even work
Interesting, never had that happen before.
so the console UI is up and in front of you but when you execute something in the console it doesn't work?
@cerulean whale
ye
what exactly are you inputing into the console and where are you executing? Server, local client, global?
nothing works and all 3 of them dont work
e.g. thisVariable =1;.... doesn't write... player setDamage 1; - doesn't work
etc
I guess I'll just make a custom console dialog lol
try restarting your game and your server. Other than that idk
what mods are you using?
that could possibly contribute to your issue
@cerulean whale Let me guess, you are working with remoteExec(call)?
+having the FilterList active?
as in... nothing in debugConsole works
Thats not an answers
emphasis on the 'nothing' part
I execute a command
it doesnt work
that's the bottomline
Are you work with/use RemoteExec(call)?? Yes or No?
@opaque topaz no mids
mods*
No.... There are remoteExec's in my mission but I'm not executing them
Disable that.
Then the Console will work again
Make it to non-Whitelist thingy (no restrictions)
@jade abyss Sorry that I took ages to reply, I was justing testing a new script. Thanks man, that worked.
Just functions in general
@cerulean whale To be able to use the debug console while having your RE whitelists
whitelist call under commands
@dusk sage The last thing worked but thanks for the help, I'll remember that if I do it again in future. thanks
Guys, who knows the id of display for displaying chat messages
?
I would like to disable it completely, like one enabled Stream friendly UI
remoteExec is more efficient in terms of the amount of data sent over the network
@tough abyss
It also has a much more intuitive, system for issuing code to clients
You can even use setVariable with remoteExec
Now you're probably wondering why would I do that?
You can point setVariable to CLIENTS only.
Rather than executing globally
PVEH ๐
Thanks
Yeah but if you want to.
You can use direct message passing.
Instead of single functions
such as instead of remoteExec'ing an entire function you can simply
use [60,1] remoteExec ["setRain",0,false];
@dusk sage How exactly does the JIP flag behave?
If the code is executes isn't it the JIP call runs everytime a client connects?
From the JIP queue.
Still subject to whitelisting with commands though, if you want
It's no different
Yeh
It runs on JIPs
So if you run 5 different functions
They'll be stuck into a queue like this?
[func1,func2,func3,func4,func4]
then run in sequence?
So basically be careful with the JIP flag ๐
How big can the JIP queue actually be?
Ofcourse it is
So if I had say some kind of whether function that requires simple variable synchronisation
I could simply
[] remoteExec ["simulWeatherSync,player,true];
I thought PVAR is obsolete as of remoteExec ?
Of course not
You can use setVariable instead?
Which is effectively the same as PVAR.
it?
setVariable
Why would you RE it
Because you can target explicitly where clients are local among other things?
I'd imagine higher than PVAR
But if you're using setVariable
You're probably on objects etc
Not name spaces
I actually prefer setVariable etc to publicVariable
They both have different uses
Doing what ACE3 does made it easy.
It's like comparing lemons to potatoes
SVAR and GVAR
Macro'ing them.
@tough abyss Do you know how much AI arma 3 can handle on both dedicated clients and server?
I've noticed no real performance improvement with moving AI to the HC's in terms of running more AI.
Without tanking everyones FPS below 30
The safe limit for ArmA 3's framerate appears to be around 60
You're noticed no perf gain from moving AI to the HC
Are you positive they actually moved?
This was 150 AI.
That's alot of AI
Depends on the mission though
If you're in editor, isn't going to affect you too much
Well one current mission I have from soemone else.
Runs 144 AI
And I said it's an abuse of the engine.
The engine just isn't designed to take that much punishment.
Yeah I noticed.
Yeah.
I use debugView
to actually see the traffic / msgps
You can't because only part of the brain is offloaded to the HCs.
๐ฆ
PVEH are sent as priority messages, setVar is not
Yeah. As I said the mission I've been evaluating from one of our community.
Is I counted 100 active units
ALiVE does cache them but his caching clearly wasn't working correctly.
And owner won't return anything useful on a client
There was way too many AI to run.
ALiVE is wierd.
The way it creates the AI, is it creates virtual agents
then switches those agents to actual AI
Thats what I am assuming
because of the raw amount of, agents I saw spawn'd
Those agents are bunnies that are hidden.
moving AI to HC means it does the calculations and sever fps is kept higher to process updates and messages
Yeah
clients still have to consume the AI updates not to mention draw them
but I agree 144 is way too many in the same area
Isn't a single soldier like 15000 polys?
no idea but it's different depending on range due to LODs
Yeah and the LOD transistions are less poppy because of Stochastic rendering
and AI on the other side of the map won't be drawn nor processed as heavily as someone close
so keeping them spread out and cached certainly works
this will help as well https://community.bistudio.com/wiki/Arma_3_Dynamic_Simulation
@opaque topaz but when is it coming to stable branch?
and the 64bit clients / servers?
I hope it's before christmas...
hopefully or else we will have to wait until afterwards and usually BI goes on a 2-3 week winter break
during late december
You will have to wait, there is no way it's going to be on stable. I'm fairly certain Friday is the last day BI is working before their winter break
would be a huge risk.
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers/addMissionEventHandler
added some interesting facts about PlayerConnected EH
The alternative syntax of createSimpleObject is placing as position world and not position ASL as stated in the WIKI?
how on earth are the LOD transitions less choppy cos of stochastic rendering
Can anybody tell me if there is a way to check the type of a variable?
I want to find out if an argument to ym script contains a curator or an array of curators
typeName
okay thanks a lot
nah actually i think isEqualType is the 2016 way to do it
_array isEqualType [] will be true
yeah apparently it's a "much faster alternative to typeName" https://community.bistudio.com/wiki/isEqualType
if (not isNil "_curator") then {
if (typeName _curator == "ARRAY") then {
{_x addCuratorEditableObjects [[_spawned], false];} forEach _curator;
} else {
_curator addCuratorEditableObjects [[_spawned], false];
}
} else {};
that's the code
don't ask why there's an else there
also I don't really care about speed as the script is not executed in a loop
well, it is, but this branch is only executed at most once every 3 or so seconds
but now I feel bad, so I guess I will change it to the faster way
ah, it works, thanks a lot ๐
Why is there an else {}; there? ๐
Let it be, let it bee, let it bee oohh let it beeee sing
whisper words of wisdom
Not in here sing
I like aliterations
can anybody tell me why if not isNil {_this select 5} has an error while if not isNil {_this select 4} doesn't?
because the array "_this" has 4 elements
select complains when you pick an element that is 2 out of bounds
it's really dumb. if it's only one out of bounds it reports nil without error.
isNil {[1, 2, 3] select 20} runs without problem
it shouldn't
param[5,"bla"] <-- Or seomthing like that
(or what was the syntax?)
[5,"",[[]]] <- ?
Dscha, put me off your block list before you embaras youself even more
Don't have you on my blocklist turtle
Haven't touched .sqf for a while now + memory is bad
๐
just read about param
if only I had known this existed...
still
in lua this would have been much easier =/
But its not. So you have to life with this madness ๐
select is bugged shit and has been for years. be gratefull param exists and is fixed now
it's bugged? how?
errors for out of bounds in weird ways
that doesn't sound like arma
๐
fixed it
_new = param [0];
_distance = param [1, 10];
_delay = param [2, 0];
_curator = param [3, []];
_onRespawn = param [4, {}, Code];
looks much nicer now
Or use params
(with s in the end)
it will solve everything in one line
Damn, the description is awful
"similar to BIS_fnc_param"
yeah right
apparently code is not a data type
it is
String it
no
param [4, {}, [{}]];
oh, okay
iirc "Code" should also work
you have to provide an array with examples of that type
that is what the wiki says
*should say
It's the same principle of how you should replace
typeName _curator == "ARRAY"
with
_curator isEqualType []
not that you asked for it
๐
the thing is, won't that allocate an array just to use it for comparison?
still faster
this is SQF
massive overhead for each command use
all the type checks
Of course it works
Then you made mistakes.
Forget every other Language, when you work with SQF
I have no idea why or how
fn_arsenal.sqf line 920
Error Undefined variable in expression: _display
I have learned to just accept it
there MIGHT be a reason for that error, but it is most likely beyond human comprehension
there MIGHT be a reason for that error, but it is most likely beyond human comprehension
Nah, such errors can be found easily if you're experienced.
being experienced == making a pact with the devil?
I don't understand arma 3 and I never will
It's like everything in life. You sink enough time into it and you'll learn.
anyway, here's the finished script
no need to point out that I never check if the curator is actually a curator
If somebody manages to pass some other object into the script (maybe a tank?) then that's just their fault #itsafeature
you need a spawn for that sleep
I mean, you can put into the function header that the function should be spawned
can I?
function header is just a comment, sure
oh, that's what you mean
you can write your groceries list in there if you want
I mean, not only the sleep... it's an endless loop, so if you don't spawn it that might lead to some problems
it's not really a function if it's spawned, which makes it weird
Arguments:
- butter
- milk
- eggs
if (!cansuspend) exitwith {_this spawn _thisScript;};
What quicksilver wrote
that's a nice way to fix it
but
that would still cause problems if you call the function from a scheduled script
I like that line
don't do that
it solves the problem without just saying "nope" and quitting
you can still halt a scheduled script
no it doesnt
you can still halt a scheduled script
_this spawn {
in the first line
and
};
in the last
that would fix it
It doesn't really made if only you intend to use it
But if it's meant to be API, then might as well make it as safe as possible
SQF isn't a nice language to code safely =/
I mean, I want to add the _this spawn {
but whenever I think about a script being spawned and then spawning another script...
so much overhead...
I will know it is there
it will haunt me in my dreams
If you really wanted to avoid overhead then you wouldn't use spawn to begin with, but that's a different story.
Better stay ignorant then. ยฏ_(ใ)_/ยฏ
haha ^
I've spent so much time learning all the nice tricks to avoid overhead in lua
and now this language forces me to do this kind of thing
how tragic...
my life is like a work of shakespeare
But at least you're still alive
Shakespeare is everyone dies at the end
As opposed to vulgar upperclass art?
you guys should refactor shakespeare to use the new commands
oh oh oh
arma 3 should drop SQF
And use shakespeare instead
and if you think I am bullshitting you right now:
you guys should refactor shakespeare to use the new commands
๐
beauty is objective though
it's not really worth doing "to be or not to be" as a switch case, should just put it in an if/else imo
I can see beauty in lines like this:
magazinesDetail _unit select {_x find _displayName == 0} apply {_x = _x splitString "[:]"; _x select (count _x - 1)};
Treatable too?
I meant subjective btw.
And isEqualTo faster than ==
good point, but it needs parenthesis then
beauty is objective though ha ha ha have you tried Java2k?
I meant subjective btw.
@tough abyss not sure, but how exactly is it faster?
I guess :/
(it's the type checking overhead)
So for ints it would be better to use isEqualTo correct?
quick question: does apply create a copy of the first array or just modify it?
yes, cloud
๐
keep in mind that == is a very low priority command, while isEqualTo is a normal binary command, so you might need additional parenthesis
() isEqualTo (_var1 binaryCommand _var2)
vs
() == _var1 binaryCommand _var2
shouldn't matter for left hand side
@loud python It creates new array without touching old one
that's interesting
He gave you a Boolean statement that goes True when a player is close enuff.
i assume thats beeing executed on every Client, checking the area around the player for vehicles ~150m
Well just check if player's position is close
I wish there was way for server to get player's camera position, server actually tracks it
Just enable them locally on client and ask server to enable them globally through pvar
Does enableSimulation overrides enableSimulationGlobal ?
Give it a try
btw did you use server-side getIn?
try with client then
so that you have simulation enabled instantly to avoid black screen\interface problems of getting into disabled simulation vehicle
and then later global simulation arrives from server for everyone else
actually you don't even need pvar, just have events on client and server
server for global simulation, client for local
Is there a way to determine which item you have selected on inventory screen's list box? How do mods like Breaking Point do it where you can double click items to view details and do something with them?
I've checked list items, they have no lbData set (expected lbData having item classname), lbValue is just item index
Getting control or current selection is not the issue, issue is how to determine which item is selected
๐
Nevermind
(This wasn't the question how to get index of selected list item, but how to determine class or any other relevant info on selected list item)
So mystery solved, inventory screens USED to have item classnames in lbData long time ago
Not anymore
Also bonus of ancient TRG sights
http://i.imgur.com/BH5XrA7.jpg
Nope, they still have the Classname in it.
At least, some items
Just started arma for the first time in month's for it ๐
Thats what i meant before, some Items do have the Classname, some don't.
In Editor:
http://pastebin.com/9PUtEe0B
Executed by DblClick in the Inventory.
hm, interesting
Thats why i wrote you that stuff with localization :/ Its... erm... "interesting"
haven't found any clue what the reason for it is
So apparently it only stores magazine classnames in lbData
Nope, no medkit or other items like uniforms, vests, attachments
Nothing, just magazines
No, they're items
thats... stupid
I guess Breaking Point items were magazines too
Well, we should file a ticket requesting inventory containers to have class names in lbData for all kinds of items ๐
I just watched through some files: I also made all Items "magazines" for 2017.
Would be a benefit, if i would still do something for Arma ๐
I needed that for attachments so I'm out of luck for now (or will have to use name comparisons for now)
But yeah, should be in it.
Yeah + don't forget to localize, when its used. Made me suffer for a few days.
Anyway, thanks for help, seeing Breaking Point items start with "Item" I assumed these indeed were items and not magazines and thought this feature was available before and removed since.
your welcome o7
I just associate the displayName with a classname
I know the limitations, but it was close enough for me
oh. displayName+picture apparently
probably for reskinned stuff
new (array)
b:OBJECT setdamage SCALAR,ARRAY
now imagine this
it now triggers handle damage
the optional parameters are stuff like killer, gunner, projectile
maybe it's just for this though:
Added: Support for destroying object without effects (e.g. explosion, fire, etc.)
What happens when you do that?
Quick question guys, anybody got a clue how I spawn on object on a bridge? It keeps going far above it or under.
who was asking for the 'setDead' command
I was
june huh. time flies
the revive system... ha... ha... ha...
has arma 3 found the "revive" respawn template yet?
or is it still searching?
What do you mean?
try adding the "revive" respawn template in a mission from description.ext
as described in the wiki
(looking up link)
typo?
idk
reviveDelay [...] The time it takes to revive an incapacitated unit (default: 6 seconds). Having a Medikit will halve this time. Must have "Revive" Respawn template enabled.
โhttps://community.bistudio.com/wiki/Description.ext
The "Revive" respawn template doesn't exist though
@tough abyss https://www.youtube.com/watch?v=J8D1jV50W5s
Helicopters have some damage that does not get into HandleDamage (though it checks for allowDamage flag)
Namely huge collision damage (which results in insta death) and when your main rotor touches solid objects, it justs sets main rotor damage to 1 and instantly turns off engine with special sound
@loud python the revive settings over Description.ext were deprecated, revive settings moved to mission attributes in 3den
switchLight function don't work with Arma 3?
on street lamp?
@vital onyx yes!
@tough abyss afair the light on street lamp can be enabled with animate or animateSource - so you can try your search this way, or even setDamage to lamp 0 for on, or 1 for off. Anyway you can gopogle for scripts which simulate disabling electric stations and disable light in village/town
When creating static map edits around the map, do anyone know what performence boost you get when you use CreateSimpleObject instead of the original method?
@vital onyx i'm using setDamage right now (0.95 for lamp off), but animate function seens a lot better (at least lamps off will not have 5% health).
@steel mantle simple objects help a lot in performance, but you will probably don't want to have some objects as simple objects, like houses with functional doors and street lamps, because animation and lights don't work for simple objects.
Also storage don't work with simple objects (a box for example).
@steel mantle Safes will also not work and same goes for vehicles
storage can be easily added, by
_box attachTo [_my_simple_object];
Also simple object's namespace I bet is coming for 1.68, which adds new possibilities.
@rancid ruin it means you will be able to setVariable for simple object, like:
_simple setVariable ["myvar","some_value"];
where _simple is a simple object
@tough abyss they already are, are not they?
"Also simple object's namespace I bet is coming for 1.68, which adds new possibilities." This is sad, the most expensive objects can't be simple object because they became useless (like houses with doors), so you need to compare the performance gain from changing more simple objects, like walls, to simple objects... this decrease the performance gain. @vital onyx you believe this simple objects namespace will decrease the gain in using simple objects?
I created a custom way to store vars in simple objects, and since they are mostly static objects you really don't need that for more than one or two ocasions.
Hope they are doing that without decrease of the performance gain.
"Let me store those 10 vars on this chair"
come on, adding a couple of vars to a simple object costs virtually nothing...
simple object namespace is a must have for me, to complete total conversion of inventory system
@normal stump
@vital onyx you believe this simple objects namespace will decrease the gain in using simple objects?
I never said that
@vital onyx Why are they deprecating description.ext stuff?
in many cases it's much simpler to just copy something into a text file than to search through the interface in the editor
Revive still works from description.ext. Its just no longer a template. https://community.bistudio.com/wiki?title=Arma_3_Revive#Config_settings
That makes way more sense
they should update the wiki though
because there it still mentions the template =/
The engine will have a bigger nameSpace list everytime it searchs for a specific nameSpace.
20K + nameSpaces.
Thinking with a "MySql brain".
Hope they are indexed lol ๐
I have seen Jhon Carmack (Id software) says more than one time that one big problem to 3D engines is when the list of "primitives" (?) became so big that is hard to found a specific one, and the engine needs to do that many many times everytime.
So some problems on games engines are becaming "database search" problems.
But those problems arent in the user level.
primitives are simple shapes, like cubes, pyramids, cones, spheres... etc
playableUnits is broken at clients?
because its an array with players only
not AI units
@meager granite it can duplicate units or return AI?
Some really strange things happening.
@tough abyss ah man, thanks... just now noticed you sayd allPlayers and not allUnits.
@tough abyss playable units is working fine since the hotfix
What's wrong with this?
{
if (!isNil _x) then {
weps2 pushBack _x;
};
} foreach weps;
Is weps and weps2 initialized like so: weps = ["Weapon_Classname_1", "Weapon_Classname_2"]; weps2 = [];
weps is [_Wep,_Wep2]... definded from _wep = PrimaryWeapon player; so yeah, it is...
the issue is
And weps2 is initialized? Have you checked the value of the variables being passed through? By logging the value of _x?
if there is nothing there it is passing "" and then messing up later inthe script
I have
essentailly
later inthe script I am using addWeaponCargoGlobal
So nothing is being passed through?
and if it is like this ["","","Rook_9mm_F"] it adds a NULL object
I think you want isNull, not isNil
I was thinking the same thing but it spits out an error
nothing is being passed with isNull
something is passed with isNil
but doesn't go past the '!isNil' part of it
lol, no problem.
If I have a variable returning this: [] , How do I tell if it is like that? (empty array) isNil / isNull doesn't work and != "" or !="[]" doesn't work
any ideas?
I have an idea, thanks for help anyway though. ๐
No problem
@cerulean whale
Don't over think it
If your array is just []
Then check if it isEqualTo []
๐
why are you asking everywhere but #zeus_discussion ?
๐คฆ
I think the fact you posted in so many channels deserves a beheading though.. @yoyr mom pose smel#9030
General = General(obviously), it may be a scripting issue, and you make missions with Zeus
My mindset
Although I am retarded
Why not just try one channel at a time ๐
Rip lol
allPlayers is a function
I want to remove local player and dead players from allPlayers
When you want to make an array of allPlayers which you can modify (delete/add Elements) you have to make a copy of the array allPlayers returns
_array = +allPlayers;
Thanks
np
But if i modify allPlayers, it get "broken forever"?
or eventually get updated when players change?
Thanks, just in case i will use _array = + allPlayers;
np ๐
Is there a way to change accessories of any weapon, which is in a cargospace ?
i tried addWeaponItem but it doesn't work ๐
@tender root there is some time since i messed up with that, but i can't remember a solution to modify accessories of a weapon in a cargo.
Also, the classname of the weapon don't change when you change its accessories.
Those functions: weaponsItems and weaponsItemsCargo
Are the only way to get detailed weapon info.
But they just get info about the weapons, they don't modify it.
You can however write an algorithm to alter it's output
But you can not physically edit allPlayers
@tender root the arguments for addPrimaryWeaponItem is a unit and the item, so I am not sure if you can add the item to something that is in an ammobox.
However, a way to get around this I suppose is to use some of the preset weapon classnames that have sights on it already, as shown in this list: https://community.bistudio.com/wiki/Arma_3_CfgWeapons_Weapons
You know what I would do though, is in the editor, get an ammobox, name it, put a player unit down with a custom weapon config and when loaded in, place the item in the crate
After that, check the value of itemCargo ammobox and see what it spits out.
May give some insight as to how you should store it ๐
It just returns the normal classname. ๐ฆ
without any attachments
the problem is not to get the accessories of the weapon, that just works fine with weaponsItems
i actually am convinced, that there is no command / function which allowes you to change a weapon accessory. I just searched the whole internet ๐
I made a little "work around" and placed the base weapon (without attachments) alongside the attachments seperatly in the box
Thanks for the help tho ๐
Anyone got an idea why my remoteExecCall works in the debug console but not in a function?
It runs fine in debug console but when I put it into the function it doesn't do anything
I believe certain functions need to be whitelisted @cerulean whale but I have not worked with it much. Look up on Google: "CfgRemoteExec"
I was told to remove my CfgRemoteExec and all my other functions work fine..... It is the exact same as an already working function except it runs with getplayerUID from a setVariable instead of just getplayerUID player
I just changed _uid getPlayerUID _player to an already defined UID
It's like a copy+paste with two added / removed lines of code
It was an impounding to garage script that I made about a week ago and I just changed it so a player can impound it if it is left outside for too long
Now I edited something, forgot what it was and the whole script doesn't work
nice
Finally got it working.... sigh
Anyone got an idea why my extDB is fine writing one line to a database but it won't do a second row?
it runs the first row fine, can remove and then do again but it won't do a second row
it have a unique primary key?
It only had a unique key... I added a primary key but it's the same as the unique key....
Does it need a unique key OR a primary key. or a unique key AND a primary key?
@vapid frigate
I did this ALTER TABLE garage
ADD UNIQUE KEY id (id);
I added my unique key but it still doesn't work
In theory if I INSERT a new row it will make the unique key one more right
e,g. first one 0, next 1, next 2, etc
?
i think a primary key is meant to be unique anyway, but if you try and insert the same key twice it won't accept the 2nd
I got rid of them and only have a unique key now
but it still won't write into SQL
i dunno, i haven't used extdb
you tried doing the statements in the mysql designer or equivelent?
might give you a better error
the issue is... the exact same system works with my users table
just not my garage table
@dusk sage I've found the problem, It is trying to write the unique ID to 0...... How would I make it so the second row writes the ID as a 1?
well if you have a primary key
It'll auto increment (can adjust that too)
no need to specify it
It's automatic
It's using a UNIQUE KEY. Should I delete that and change it to Primary?
yep
and i think it should be a primary key, not unique
and PRIMARY KEY (ID)
(which is unique anyway)
by definition yeh
CREATE TABLE garage( idINT(11) NOT NULL AUTO_INCREMENT, classVARCHAR(100) NOT NULL, userVARCHAR(50) NOT NULL, hit VARCHAR(1000) NOT NULL, PRIMARY KEY (id) ) COLLATE='latin1_swedish_ci' ENGINE=InnoDB ;
well the code messed the formatting up lol
CREATE TABLE garage (
id INT(11) NOT NULL AUTO_INCREMENT,
class VARCHAR(100) NOT NULL,
user VARCHAR(50) NOT NULL,
hit VARCHAR(1000) NOT NULL,
PRIMARY KEY (id)
)
COLLATE='latin1_swedish_ci'
ENGINE=InnoDB
;
is that good?
use
```sql
//code
```
looks right
It worked! Thanks for the help guys, I've never messed with SQL code in my life before so thanks for the help. xD
โค
Is there a proper way to check weather the AI is disabled on the server ? Sure u can use getMissionConfigValue ["disabledAI",0] for the description.ext value but this doesn't take the button in the slot list into a count
I hate that copyToClipboard stops working after few Alt+Tab's
Anybody else notices this?
Yep. Thats why i gave up with it. Used diag_log after a while only
Might work with WindowMode
Is there a singular command for replacing a variable in an array
Is the best way to just write a function to find the variable, delete it and add the new one ?
Arrays contain values. You can set them
Yep.
_YourArray set[IndexNumber,NewEntry];
The problem is that diag_log is limited to 1024 characters
while copyToClipboard isn't
When you need to get some massive data for quick inspection copyToClipboard is best way
(not counting callExtension solutions)
Yep, but at least a simple diag_log is enough, most of the time.
Have you tried Arma in WindowMode? Can't remember if it occured there also.
does anybody here have any experience with the setrainbow command?
it doesn't seem to work for me
In this code:
{...} forEach GLOBAL_listOfAI;
What happens if i change the array GLOBAL_listOfAI, in another thread, while this forEach is running?
I have a problem, we have some custom licenses on our server, but poeple are loosing the license everytime they log out, how do i fix this issue
@loud python When you set raimbow to 1, the rainbow can only appear after rainfall and opposite of the sun when it is low on the horizon.
okay, thanks
is it possible to do nearestObject and search for the nearestVehicle?
_car = getpos carSpawn nearestObject isKindOf 'Car' ??
nearestObject [_pos, "LandVehicle"]
thx
_car = nearestObject [getMarkerPos HRP_vehicleSpawn, "LandVehicle"];
That's what I did
hello, im trying to make a little script to restrict players to first person.
{
if ((cameraview == "External") && (vehicle _x == _x) ) then {
_x switchCamera "Internal";
};
} forEach allPlayers;
sleep 0.1;
} ```
i have just added the cameraview == "External" part because i realised that the game is not fun if you cant use sights ^^
but how does cameraview work?
i would have thought that there should be something like cameraview player so that the thing knows which cameraview it is about ... ?
but cameraview has no arguments?
yes i saw that, but a) it diesnt seem to work for some reason and b) id does also restrict 3rd person from vehicles
and i only want to restrict for infantry
MCC (i think) has a module that allows it only for the drivers even
just had to kick MCC
but really i like the 3rd person mainly when im passenger and have nothing to look at
so anyway, i want to exclude it for infantry
i found this :
so i think in principle my cpode should work... just unsure about the cameraview...
maybe i have to run it on th eclient?
You need to run it locally
you're trying to execute it on other clients in the forEach, that won't work
while {true} do
if (cameraview == "External" && {isNull objectParent player}) then {
player switchCamera "Internal";
};
sleep 0.1;
}
Ok will try that. Thanks
@dusk sage How did you get that code to be syntax highlighted? Does discord understand sqf? or did you use some other language with a similar highlighting scheme?
should i put it in the hasinterface part or would it be good to start it also from the initplayerserver.sqf?
interesting, so discord really does understand sqf...
hm crap didnt even know that existed....
I didn't expect that, considering it's a very specific thing
hint "It's amazing, isn't it?"
oรณ
```sqf
hint "stuff" //code
```
hint "code"
hint "code"
i give up...
How do you get the highlighting?
just trying to find that out+
hint "code";
hint "code";