#arma3_scripting
1 messages ยท Page 391 of 1
This script works around 1 camera. It can be moved to different locations but it will be the same on whatever laptops this is run on
@ionic anchor
cheers @warm gorge i will have to look into how to edit it for multiple cameras ๐
I need some help. I am trying to create a custom ask query using extdb3. Anybody know how?
@xAndreei#7190 Probably yes. Copy the code and modify it.
hey, im just finishing up my loadout selection scripts/menus and realised a major flaw. I am trying to allow the player to select the base gun they want, then add attachments using the menu. The menu works great for all attachments except for underbarrel grenade launchers. Using the "arifle_MX_F" as a base weapon, does anyone know how to return an array of compatible grenade launcher and how to attach them to the weapon?
["LMG_Mk200_F", "bipod"] call CBA_fnc_compatibleItems;
Or vanilla...
searching...
["LMG_Mk200_F", 302] call BIS_fnc_compatibleItems;
I believe.
Ok, so that function should return an array of compatible underbarrel grendae launchers for guns that support them?
Well idk. The base game has no underbarrel grenade launchers, but it has bipods.
? the MX3GL has a nade launcher. Or do you mean that you cannot 'attach' such a launcher under the gun
^ that is what I meant.
bugger haha, that's what i feared : (
You have to choose a different base weapon
bummer. Well thanks anyway. Helpful as usual
@still forum where can I take a look at the source code of that BIS function?
ok, thanks
[testguy2_1, "carriedStill"] remoteExec ["switchAction", 0, false];
is there a way to stuck dead unit in this action?
if i put that on a dead unit its plays the animation of being droped
you don't need false at the end btw
That was a copy/paste, any idea how to make this keeping working to dead units?
playMove/switchMove maybe if body is dead?
@astral tendon Check this might be helpful https://forums.bistudio.com/forums/topic/181759-interaction-with-bodies/
thats not really what i want
this is just a scripted section of the mission were a medic carrys a wounded soldier to a black hawk, so its made by a AI.
createAgent and then try what Dedmen suggest?
agents have a bad reputation
๐
is there an arma extension that allows to make http calls? not only get but post, and for 64 bit?
Could someone recommend me a mission with well written scripts., for inspiration/reference purposes?
Yeah! Uhm no.. wait.. Eh Maybe.. no... Eh.... Hm... This is harder than I expected... Does a mission without any scripts count too?
umm you mean like something just hacked together with the editor?
doesn't have to be a masterpiece but i'd like to see some neat .sqf u know
All Missions or Mission Frameworks I know are good examples of 5 year old crappy ducttaped together code.
So looking for missions might not be the best Idea
I'd recommend ACE or CBA. But their code is hard to read unless you understand how Macros work
i've got some code you could use as reference
its far from a masterpeice of SQF work but is simple enough to understand
He didn't ask for code. He asked for well written code
lol snappy today?
:3
Oh.. That too. Didn't even notice
i didn't look through it ๐
Definetly not something for a beginner to look at while searching for how good code looks
i'd send you might stuff, but then dedmen will bully me and well... it's as much a macro-fest as CBA so might as well look at CBA then
there's CLIB.... also macro-fest
there's a correlation here
The only really good code I know is ACE/CBA. The only bad thing is understanding the macros but that doesn't take that long.
Not even the code I write myself would be good enough to show a beginner
A lot of that is just copy/rewrite from CBA tho
i find it a little bit cleaner than CBA. CBA does have a habit in some sections to make crazy functions
i mean the places where that happens is 100% understandable and probably even neccesary
๐ correct
but for someone 'new' it might make it harder to look at
If you copy paste everything 10 times, it looks more impressive afterwards.
Plus. I wouldn't recommend anything that's basically just stolen code from other people but slightly changed up so they can put their own name onto it.
https://github.com/TaktiCool/CLib/blob/master/addons/CLib/PerFrame/fn_addPerframeHandler.sqf
https://github.com/CBATeam/CBA_A3/blob/master/addons/common/fnc_addPerFrameHandler.sqf
And knowing how CLib started... Just no.
@still forum if youโre referring to ArmA3URLFetch that doesnโt look like it dies post requests
It does.
Read the wiki on their github
The huge indentation pushes the code so far to the right that it goes offscreen.. so readability == 0 Because you can't actually see the code ๐
I guess you could ask the author then
Secret code after 30 tabs hoping no one finds it.
Around line 160 it goes offscreen when viewed on github
Commy why do you link to a few empty lines?
^^
I just don't understand why you need to nest half a dozen if statements and then just have
};
};
};
};
};
};
};
at the end.. Instead of just putting everything into a single if statement
Is there a way to select text through scripting command. when someone clicks a ctrlText box i want it to automagically select all the text
maybe i'm retarded (well probably tbh) but i dont see it
set selection in a ctrlText box?
yep
I'd say no. But I'll look
Ctrl a
I looked. no.
lemme do _control ctrlSetTextSelect [0, 10] to select
INTERCEPT-MAN TO THE RESCUEEEEEEEEEEE
No. Intercept won't help you there
Are you talking about the editboxes?
E.g. init box, exec box in debug console etc.?
class Value: ctrlEdit {
idc = 100;
tooltip = "";
text = "0";
font = __MONO;
x = __GUI_SETTING_TEXT_W + __GUI_SETTING_SPACING_X;
w = __GUI_GRIDX(5);
h = __GUI_GRIDY(1.25);
};
ctrlEdit
all
Oh. I still don't know what these ctrl Variants do differently.
uh, they're the same thing as normal ones
same typename
so yes, init, exec, whatever
Ohh God that indenyation
I don't think you can move the cursor with script.
Not even a clever work around from me. Except moving it to place 0 by deleting all text and resetting it a frame later.
that doesn't select the text though does it
And would be useful in many of those ifs
True.
What would you even need that for?
so i select the box and you get all the text selected.... ๐๐ป
Is it for the
Is it for the or
Is it for ts address or sth
nah setting angles
Ohh haw about
If clicked, delete it, if not changed or clicked elsewhere, restore old
I guess it's different
Not possible afaik, too advanced for Arma.
sad
๐ฆ
does moricky still work at bis?
i gotta expand my PM list of "PLEASE ADD THIS UI COMMAND"
One day tops for me with Intercept and no battleye.
One*
That's why you should read messages from bottom up.. You read from top down and then the last message get's deleted before you can read
I need some help. I am trying to create a custom ask query using extdb3. Anybody know how?
Custom query*
Ask the extdb3 guy
I know how to create tanks and how to create missiles blowing up tanks, but wtf is a "query"?
There are soooooooooooo many entrys regarding that topic. It's easier if you take a look at those examples.
OO_EXTDB3 - A driver for extDB3 addon MysqlLastest version : 0.2 by Code34
GitHub : https://github.com/code34/oo_extdb3.altis
OO_extDB3 is a driver...
More OO stuff! Nice!.....
Driver for ExtDB? What does it do?
"I drive"
It calls script functions for you if you call it's script function and tell it what script function it should call for you
*confuzl0rd*
Or in short Encapsulate totaly EXTDB3 commands through an object
that means what?
2 smart 4 me
I rly have 0 idea what means, what you wrote up there Dedgirl
Its really just sqf functions for extDB3, since people get confused by the API trying to code it from scratch
Ah, pre-made functions to call extDB?
Always good to make your frameworks as easy to use as possible.
Yeah. I had my own list of functions/files, that i reused everytime i tried something out
As for the OO part look at the examples, for the variable _extdb3 that is returned
so is it psuedo-namespaces?
Usage seems more like a universal do-it-all function.
https://github.com/code34/oo_extdb3.altis/blob/master/oop.h
This is impressive.
Dscha, you'll like it.
I'm still a little confused but I can probably figure it out ๐.
Oh yeah, i love it
hey all, are there any bycicles available besides http://www.armaholic.com/page.php?id=23493
What's wrong with that one?
nothinโ
I vaguely recall A2 having one, so maybe there's one in CUP.
iโm looking into licenses
iโm building a terrain and want to ask authorโs permission to include it directly, not as a dependency.
he states that it belongs to BI so that makes it more complicated.
This one apparently is the one from A2, so you could just get it from there.
If CUP can release A2 terrains, so can you.
iโll see if itโs in the a2 model pack
As long as it's for Arma I guess.
of course
is there a way to set a specific event handler on a picture, like onButtonClick?
Make a transparent button on top of it with the same dimensions and position.
only that way?
I think so, what's wrong with tha?
meh, i have to write 2 controls instead of 1
Does onMouseButtonClick not work in RscPicture?
It may do, but not sure. I assume they tried and it didn't.
@winter dune Did you try?
no, testing right now
Lul
ยฏ_(ใ)_/ยฏ
didn't know that xD
_ctrl ctrlAddEventHandler ["MouseButtonClick", { diag_log _this; }];
hm I assume it wont work
just saw that it passes "the pressed button" as a parameter
onMouseButtonClick = "whateverfloatsyourgoat";
nope
I think the button overlay thing would still be the best idea
doesn't do
need the button overlay
activeText supports it theoretically, but has other issues that i can't remember of the top of my head
Sqf wud work
there are no EH for pictures
I recall seeing OMBC on a RscText, but I might misremember.
ombc works on ListBox, ComboBox, TextBox, Button, ActiveText
tf is TextBox?
Debug console?
TextBox implies... ctrlText which doedsn't work ๐
@winter dune there are ehs for pictures
You have to re-enable rscimage though as they are disabled by default and thus not raising events
i mean here's another option.... use ctrlPictureButton?
class ButtonAdd : SVAR(ctrlButtonPictureKeepAspect) {
idc = __IDC_BUTTON_1;
x = __GUI_PANE_W - (5 * GRID_W);
y = __GUI_SETTING_LINE_H + (1.5 * GRID_H);
h = (5 * GRID_H);
w = (5 * GRID_W);
text = ICON(content,add);
tooltip = "Add selected entry to list";
};
need more macros btw
I approve.
@queen cargo I'll go with invisible button lol
Enabling the picture and using left mouse button eh is enough @winter dune
ctrlEnable?
But do as you like
onLoad = "(_this select 0) ctrlEnable true";
Would this enable it?
And make the ombc fire?
Yup
Do that then. It's exactly one line.
Took me some time to figure out
That's super hidden, but convenient.
Kinda
n1, didn't know that either
Images are disabled simply by default so that no accident happen
Explains a lot.
As images in background then get moved to foreground etc
X39 you happen to know a way to select all text of a ctrlText control on setFocus? ๐
Thus one have to be kinda careful
Though, there is also a Config switch to enable the image
Uhm... Gimme few minutes
Currently mobile and need to check some docs
Why is it not enable = 1;
ยฏ_(ใ)_/ยฏ
I always wondered why it isnt named like that, is there a reason?
Probably a flag in style =
Right now too much to research on mobile
Search a command that allows you to set the selected text
If there is none, ask bi kindly
was hoping for some magical hdiden trick. nothing in here
Or, just do the ctrlEnable thing.
Best is you use Intercept to enable the RscImage
How do I check if a weapon on the ground?
@tough abyss What do you mean? They're in weapon holders, so just check if it's not a part of the player's holder
I want to find all nearby buildings with interiors from a given location, is there a way to accomplish that?
nearestTerrainObjects [player, ["House"], 200];
@plucky willow Buildings do have defined memory points for things like entrances, and i believe a few scattered positions. But other than that it'll be manuL
Yeah what commy posted will return all your house terrain objects. (Which sometimes returns undesired objects remember that)
So in filtering the returned array you may need to disclude other object types like lamps
so what im planning on doing is checking for a minimum amount of building positions
Minimum amount? What do you mean?
like if theres only 3 building positions and i want to fit a squad of 5 inside the building
there will be overlap
so i would like to avoid that
the buildingPos command will return all positions it you use -1 as your tight param
yeah i already have something written i just couldnt figure out how to gather all available buildings
No, not necessarily. They can't all exist on the same position. They huddle around
I believe the max defined positions was like 9 iirc
I thought there were buildings with like 50 positions. That hotel on Altis.
Ghost hotel? Wasn't that split into different assets though?
Good point. I swear someone talked about buildings with many positions.
Not sure.
Which ones?
Purple? Have a screenshot handy?
Err...sort of. Moving onto cache sites and freeing prisoners
Ooh...really? Why does that have so many positions?
They're identical to the size of the adjoined houses on altis.
Lol
i would have made the numbers with shadow = 2 style or 0
all around the numbers, i personally think 1 looks a bit weird ๐
Still doesn't make sense as to why there would be over 9 positions
Yeah the numbers stand out over the icon
but like the "top is almost solid to almost gone background" fade effect
is that a texture?
oh okay so its a texture
looks good
but still the text could have needed a <t shadow='0'></t> or 2 imo :P
looks very good though nevertheless
yeah defintely blends in
maybe it was an intern who wanted to do more
if i create a variable without assigning it a value does it default to null?
How would you even do that?
private _myvariable;
That just fails silently if _myVar is undefined.
private command expects a string.
In scheduled, it would error.
so if I want it to be null, should i just set it to null?
why nil
don't do the former
Nil is for undefining a variable.
Or for having an empty array element.
Such stuff.
if its nil can i use the variable again? the wiki uses very strong words like destroy
Yes you can use it again. And by using private, you set it's home scope.
And that is not destroyed.
okay, thank you
and just for my curiousity, where does null fall into all of this?
There is not one null. There is one for almost every type.
It's just the empty "thing" of that type.
E.g. objNull is the empty vehicle/object.
i see, thanks again
Sometimes the debug console prints <null>, but that is really just nil.
Inconsistencies.
๐
Hey guys, if I add a weapon to a vehicle using AddWeapon, is t here any way to control where specifically on the vehicle it will be shooting from?
(I'm making motorcycles that shoot gatling guns)
UI fun part #2007. CtrlEdit does detect a mouseEnter event one time, after that it doesn't detect it anymore and obviously mouseExit even doesn't work.
Anyone know a workaround? ๐
ok how about this question, does anyone know how the engine determines the position of the "driver turret", I.E. if I use addweaponturret ["weapon_name",[-1]]; where will it be shooting from? And is there anyway for the driver to adjust the aim of this?
it seems like it's the model origin but I'm not really sure
Ignore my graphics, check the radar https://i.imgur.com/bqnyh6g.png
And you can't do anything with it through scripting, its all in configs and model
Hey #arma3_scripting , Just wanted to ask if there is a way to find out what a unit spawned as? Like 'AA specialist' or 'Light Rifleman'
hmm like the typeOf
?
thats just their class name
im sure there is a displayname in their config somewhere
I understand you can use typeOf like if (typeOf vehicle player == "B_Soldier_lite_F") But i guess im looking for the classname itself
well if you can find a config of a soldier then you can find their name for the variable and refrence it in your script
@UltraNoob#5524 you can find the display name of a unit with this:
private _displayName = getText(configFile >> "cfgVehicles" >> typeOf player >> "displayName");
Which will return the display name like; "Rifleman"
or "Autorifleman"
How can i put icons in the actions? like the ones in the vanila campaing
thanks for the info @meager granite I'll check it out
if you play one of the laws of war showcases the actions have a icon
here
thanks
Hey guys, I'm looking to see how I can have a foreach loop for a variable, which checks any sqf varName_x (_x is 1,2,3,4,5,6,7,8,9,etc...)
Hey guys, i'm looking for a way to have these objects that are created through a foreach loop. Here's the source and foreach at the bottom. How can I add the sqf allowDamage false? https://hastebin.com/nevixopuke.php
Here's a gyazo of what happens. https://gyazo.com/73c19748d7bb18f89a43c8de120f162a
@drowsy axle {_x allowDamage false} forEach _myGroup;
hey guys, just a quick question, i am putting together a AI spawn script that currently spawns a group of AI and a loot box with 1 building randomly across my map but want to change it so it spawns a composition of buildings instead .... anyone got a hint on how i can do this
i am currently just using this:
_cargo = "Land_Cargo_Tower_V2_F" createVehicle _randomPos;
but want to change it so it spawns more buildings to make it look more like small camps
@tough abyss
Put more lines like sqf _cargo = "Land_Cargo_Tower_V2_F" createVehicle _randomPos; one for each new building you want, then have the _randomPos variable change between them like this ```sqf
_randomPos = [(random [min,mid,max]),(random [min,mid,max],(random [min,mid,max]]; // First time
_cargo = "Land_Cargo_Tower_V2_F" createVehicle _randomPos;
_randomPos = [(random [min,mid,max]),(random [min,mid,max],(random [min,mid,max]]; //Second time at a new random position
_cargo = "Land_Cargo_Tower_V2_F" createVehicle _randomPos;
_randomPos = [(random [min,mid,max]),(random [min,mid,max],(random [min,mid,max]]; // Third time and so on
That's what i would do, but it is hard to help you directly without the rest of the code.
I was wondering if anyone else here has ever attempted to or been successful in creating a system using scripting only to allow players to re-bind hard coded key bindings that use DIK-codes; like this ```sqf
menuOpenEH = (findDisplay 46) displayAddEventHandler ["KeyDown", {// Open Menu here}];
With only one or two hard coded bindings it is ok to work around them, but now that my mission has around 10 and more will be needed in the future to activate certain features, i am looking for a way to allow the player to actually change their these bindings with an ingame menu. Searching the Wiki showed that VBS has a simple answer to this, a file called dikCodes.hpp in the bin directory that basically cross-references all the DIK-Codes with their characters, but for Arma 3 this doesn't exist.
Anyone know anything about this?
It does exist for Arma 3.
And the DIK codes (Direct Input key codes) are always the same everywhere
#include "\a3\ui_f\hpp\defineDIKCodes.inc" There
Whhaaaaaaat, coool
@limpid pewter This way ?
[] spawn
{
waitUntil
{
(inputAction "Throw" > 0)
};
hint "Throw Keys Pressed";
};
@meager heart
Yeah but isn't this only for bulit-in actions within arma 3? I meant that i want to be able to let players edit the DIK-codes that i have set using the code ```sqf
menuOpenEH = (findDisplay 46) displayAddEventHandler ["KeyDown", {
if (_this select 1 == 45) then {
//Open Menu here
};
}];
Do you want to add your own keybinds. Or change the Arma ones?
So i have already added my own keybindings, they work great. But there are around 10 of them now, and everyone who has tested my mission has different opinions about whether they like the bindings i have set and so i want them to be able to change them.
@limpid pewter Check this https://community.bistudio.com/wiki/inputAction/actions
Btw, these keybindings are for activati ng functions such as miniMap zoom, menu opening, jumping, etc...
Yeah, that looks like a useful command, but not what i need.
i thought this was going to be hard , i was right haha. Thanks for the help anyway
I will have to manually create an array that relates the DIK codes to the characters.
yeah, that's the problem haha.
Most people are fine with the END key as a cancel button, but one person uses it for opening doors, so i need to allow them to change it
CBA has their keybinding system. Which seems like that's exactly what you are trying to do
yeah allright, i will check that out thanks
Hey guys,
if I for example use "foo" remoteExecCall ["hint", 0 , "jip_test"]; and then at a later time use "bar" remoteExecCall ["hint", 0 , "jip_test"]; will this overwrite the JIP version of my hint? Or can the stringed JIP thing only be used for removal from the JIP queue?
@distant egret From bis wiki: If a non-empty string is given, it is treated a custom ID of the message and the message itself is added to the JIP queue overriding any remoteExecCall message with the same ID.https://community.bistudio.com/wiki/remoteExecCall
Shit lol, I even read that...
Does cba keybinds work mission based as well? Without other mods?
is it retarded to do "variableToDestroy = nil;" at the end of function? Is there not some sort of garbage colletion going on?
If you have CBA then yes @peak plover
@tidal aurora There is no garbage collection no. So it does make some sense to do that
But just use local variables then
You should not need to delete variables if they are named ok
If a few kb of variables shouldn't cause issues
Yeah. Your one variable won't cause problems. Unless it's an array with over 9000 strings inside it
I think at around over 20 mil variables crashed my game back in 32 bit
hmm alright
so if i do call {_var = 420}; 50mil times will it crash my game? :D
call {_var = 420;}; i mean
ok now i get it
How would you disable peripheral dots?
You mean the dots at the screen border that can be disabled in the difficulty settings?
Yea, I disabled group indicators but I still see some dots on people in vehicles
This are my current difficulty settings https://pastebin.com/eHKKH14X
visionAid maybe?
@tidal aurora I used variables with a bunch of random numbers in arrays. The game ran out of memory, everything turned into blocks looked like ofp, then eventually crashed
Is it possible to use gradient in a controls background?
You can use an image of a gradient
Of course I can, but I am still wondering if I can use a colour for a gradient.
no you can not
Hello everyone, what is the most optimized way to trigger a script 5 hours (for exemple) after the server started ?
Yes its acceptable
A server-side only trigger with the time as condition
time > 60*60*5 for 5 hours. Also add up the numbers manually and write the result into there. Don't let SQF multiply the numbers like I wrote it. I'm just too lazy to calculate that now
I think when you place a trigger you can set a checkbox for server only
i mean i know how to create a basic trigger, but not a server-side
Okay, will check it, thanks you, again lol
If you don't have check box, use createtrigger command at serverside, and you can put false parameter, that create only local to the server.
๐
true (Default) - trigger is global Effects of this scripting command are broadcasted over the network and happen on every computer in the network
false - trigger is local Effects of this scripting command are not broadcasted over the network and remain local to the client the command is executed on
yeah forget, it was only in my mind lol
its ok thx :p
and, there is a way to launch a script 5hrs after server started, without a trigger ?
yeah
but you asked about the most optimal way ^^ Trigger is the most optimal for performance
[] spawn {
sleep 60*60*5;
<code>
}
in initServer.sqf
That again is serverside only. So you then have to remoteExec to the client if you want code on clients
Thanks you for theses 2 methods ๐
@still forum What about checking diag_TickTime?
that is from server start and not mission start
Also rechecking is more expensive than sleep
_EndTime = diag_TickTime + (5*60*60);
waitUntil{sleep 5; (diag_TickTime > _EndTime};```
yeah. But.. again rechecking everytime. And you don't get any more precision using that
or using it in sleep, doesn't mater
and it's more code
sleep can delay, when it's under heavy load, remember that ๐
oh boy
uisleep then
damn furry
no uiSleep and sleep don't make a difference on server
and waitUntil delays the same
any scheduled script can delay under load
uiSleep continues running when the game is paused. where sleep doesn't.
But you can't pause a server. So no difference
B-but every scheduled script is.
Depends on what precision you want.. And being a minute off on 5 hours.. well.. I wouldn't care..
yep
If it's like time then it would be over one hour for 5 hours.
but could also be > 5min
Okey okey okey..
The most optimal way with 0 performance overhead and nanosecond precision: Intercept. Solved.
i remember the A2-Epoch times, when sleep fkd up everything and "events" started with a delay of 10-20minutes
lol Ded
registerFunction("execAfter"sv, "Executes code after x seconds"sv,
[](uintptr_t, game_value_parameter left, game_value_parameter right) -> game_value {
float sleepTime = right;
game_value code = left;
std::thread([sleepTime,code]() {
std::this_thread::sleep_for(std::chrono::duration<float>(sleepTime));
client::invoker_lock lock;
sqf::call(code);
}).detach();
return {};
}, GameDataType::NOTHING , GameDataType::CODE, GameDataType::SCALAR);
and SQF:
{<code>} execAfter 60*60*5;
Tadaaa
lol
Though.. That will still execute the code after the mission ended ๐
But I'm too lazy to write the code so that doesn't happen
i remember the A2-Epoch times, when sleep fkd up everything and "events" started with a delay of 10-20minutes
this tbh
spawn / sleep scares me
but no other way possible (inb4: yeah Ded, intercept can do it, damn furry)
๐ never
Awooooo
๐
is Init evh also executed when a object is placed in 3den?
Init is, InitPost isn't.
there is an initpost evh for objects?
ok thanks
RemoteExec without call, will that create a thread on targets computer or self?
True
SimZor only for functions, for commands (setFuel, call) both remoteExec and reCall are the same.
Yes, obviously, however, will it create a thread on target computer or my own computer?
Did not answer my question, will it create a thread for my own computer on or the target computer?
I.e. if I disconnect, will the thread persist on targets computer?
You can't have threads on your machine for other machines. That doesn't work.
I did?
Implicitly?
Okay, thanks @little eagle
yw
You never know what bohemia comes up with...
Would not be surprised if it reated a thread on my computer and which executes on other computer
That idea stumped me, so I couldn't get it at first.
so I applied the xeh init evh to my objects which works fine when placing a object in 3den howevery when starting the scenario in 3den and aborting back to the editor it doesn't work
What are you doing?
basicially I'm dynamicially retexturing objects on init
at least this is what I want to
Current script?
what do u mean?
Paste the current script, so I can try myself or smth.
gimme one sec
Guys, does remoteExecutedOwner work over the network? Like if I check locally (owner _foreignObject)
I remembered something about it always returning 0 or something...
anyone know how to fix the bug with arma 3's respawn template screen "MenuInventory" where sometimes it wont spawn you with the selected loadout? selecting it twice seems to fix it sometimes
Does the Dragged3DEN work?
yes
Does setObjectTextre complain about undefined variable in array?
don't think so, no
The error is, that it does show the default textre when returning from a preview in 3den, right?
[_object, _texture] spawn {
(_this select 0) setObjectTexture [0, _this select 1];
};
Try this for the second setOT.
you mean the one at line 23/24?
24
I think you also have to do this for the third / setOTGlobal, because commands that do network synching, like setVariable public or setObjectTextureGlobal, fail to synch to clients when executed from an init eventhandler.
is cba waitandexecute also fine? like with 0.1 secs delay?
Nah, this spawn is ok. Just need to push it to next frame.
execNextFrame and waitUntilAndExecute don't work in 3den, because time doesn't progress.
I don't know then. Check if _texture is defined. Add some diag_log and see if the eventhandler fires.
kk
@little eagle The fact that OTG fails to sync isn't noted in the wiki? Is this an 3den thing or are you referring to:
Do not put global commands such this one into init field in editor and expect it to work in Multiplayer. See Talk:setObjectTextureGlobal for the explanation.
3den isn't syncing
No, in general, all commands that do synching don't work in MP when executed from the init event. They do from init box however.
so the init evh fires but it seems that the 3den check is false
I think I'll wrap the whole init into a spawn maybe this works
Stupid question probably but had to ask; what is the difference, if any, between:
params ["_var"];
and
params ['_var'];
Oh, yes
there is no difference
is3den reports false for the first few frames when returning from a preview.
That is a known bug. Known to me at least.
It's what I suspected... Thanks Chris
ok, is there a workaround? so is letting it running scheduled enough or do I have to sleep it for 0.1 secs?
if (is3den || !isNull findDisplay 313) then {
Try this condition.
313 is the idd of Display3DEN
The display persists throughout the preview.
But not the first time you open it. So you need both.
I believe.
ยฏ_(ใ)_/ยฏ
Does anyone know how to get the current position of a player?
assume its just getpos player?
jep
getPosWorld/ASL/ATL ?
beside all the other position formats like ASL and so on
getPosAGL
so would _obj = "B_UGV_01_rcws_F" createVehicle getPos player; work?
Would be nice if it existed.
creating the obj at their current position?
createVehicle is normally checking for a empty position
@little eagle no clue what you are talking about
Who wrote that?
You edited it. #
Me? never!
ATL2 / ASL2
getPos
getPosASL
getPosASLVisual
getPosASLW
getPosATL
getPosATLVisual
getPosVisual
getPosWorld```
to be precise
private _dir = [0,0,0] getRelDir player;
private _dist = [0,0,0] distance player;
private _pos = [sin _dir * _dist, -cos _dir * _dist];
_pos
semi colon -_-
commy display check didn't work
Paste it again.
if (is3DEN || !isNull findDisplay 313) exitWith {
_object addEventHandler ["Dragged3DEN", {
params["_object"];
private _texture = [_object] call FUNC(getSurfaceTexturePath);
_object setObjectTexture [0, _texture];
}];
private _texture = [_object] call FUNC(getSurfaceTexturePath);
_object setObjectTexture [0, _texture];
};
if (local _object) then {
// Has to be spawned to ensure MP compatibility
_object spawn {
private _texture = [_this] call FUNC(getSurfaceTexturePath);
_this setObjectTextureGlobal [0, _texture];
};
};
Whats that for, Commy?
Returning your positon.
What's with the || ?
|| = or
It's an OR
because
is3den reports false the first frame after you return from a preview.
๐คฆ
What did you expect?
|| is what I do. There is no diff.
I mean
OR is just horrible to read imo
@subtle ore yeah. || is twice the same character. Thus faster to write. Thus better performance
I always use ||
depends on how fast you type
^
you could expect this answer ๐
Save the trees. Save power by writing fast scripts.
OR is easier to type than || on an american keyboard
Pfff.. Get a german keyboard then
ENGLISH
Then buy a European one
change your keyboard layout
Yeah, Germany Keyboard ftw
Psshhh.....German keyboards are overrated.
รครถรผ <- you will have those
Have two keyboards. One with german layout one with murican
Lol
Have one keyboard with just the | key.
|| is 3 keystrokes here, of which all three are located left hand side, OR also takes three, located on the right side. nevertheless || is faster because of the repetition.
Or one with macro keys. And make a || macro button
every time I have to write something to a console that is just supporting english keyboard layouts it's like testing which button means which special character ^^
So is OR (with shift) @cosmic kettle ๐คฆ
Why would I commit an entire key to |
Pretty sure it's with a modifier.
Well yeah, if I press shift and \ then I get |
Dscha, I said both were lol... never edited ^^
on german ones you have to press alt gr and <
i need more cofeve
so it's quite easier on english keyboards I think
also, side note.
{
if(name _x == "playername")then{
_x moveInAny _obj;
};
No?
Don't care if you use || or OR, but if you use && together with OR, you should be shot.
any idea of a better way of finding a player?
if(cool && swaggy OR cool && stylish) then
{
//fight me commy
};
maybe ;P
shivers
*shiversToo*
whats so bad about that?
Nah, about Midnights post
the word operators
oh
Using OR instead of ||
sort of like not
right
cool
if(not _cool) then
{
//not cool
}:
(wich doesn't work in SQF)
pfft
๐ค
so we actually have to do x = x + y?
x >= y
?
Yep Cort
Oh, yeah
rip
_A = 1; //1
_B = _A + 1; //2
_A = _A + _B; //3
glances at dedmen, change it you must
couldn' a macro do this, or can't we use those chars in them?
I would think so, not sure though.
@jade abyss That's horrible code!
iirc you can't use numbers
Pretty sure i've seen SUBTR(_A,_B); but yeah
what have i started ๐
wat
not using numbers = was related to macros. iirc they can't start with numbers or signs
70% of questions end up in this. I like ๐
Lol
Not possible
@jade abyss ```sqf
private _A = 1;
private _B = call compile format ["%1 + %2", _A, "1"];
private _C = call compileFinal format ["call compileFinal '%1 + %2'", _A, _B];
Superior coding
Uhm
Rip
you forgot OR and && @tame portal
Okey.... Theoretically maybe possible....
Give me a shotgun and a buckshot and I'll do it
Okey.... Theoretically maybe possible....
Thats what i wanna hear!
If I give it to YOU, i will end up dead Optox
He's caving @jade abyss
@jade abyss you gave up to many other things before no shame doing it again
( อกยฐ อส อกยฐ)
ok ill stop
,,,,, <-- There, get them for freee
๐
๐
๐
angeber
waitwut
all those germans
Made it myself.
youre a legend mate
Clearly you have some ps skills.
you know commy you made me like the smiley so much its actually my avatar in rainbow six siege
now ill use the winter version
@jade abyss please stop posting poop all over my messages
๐จ ๐บ ๐ณ ๐น
๐
Okay, enough spamming.
@still forum Is it even possible to add commands, that have +-= etc in it?
Last time I heard he said it's not impossible. He'll do it!
By 2019 Intercept will have replaced the RV engine entirely
hm, i am wondering then, why Numbers can't be used as Vars then
Meanwhile Iโm dying in clr hell
lmao optix
they can @jade abyss
Dedmen's number namespace
In C world variables can't start with numbers. BI just carried that over
kk
127 = "banana";
missionNamespace getVariable str 127 // "banana"
^ ๐
in engine everything is stored as UTF-8 string. Just the compiler is limited. But you can get around that using get/setVar. Emoji variables and stuff
So you can basicly store a function in a number? ^^
Yes.
in a string that only contains a number
Wait
Gotta love that
This is good
thats... pretty much.... bad
You can store numbers inside numbers!
Yes
....
1 = 2 = true
1 = 2 ?
This is perfect for messing with others reading my code
@cosmic kettle syntax error. Can't assign nothing to variable
missionNameSpace setVariable ["0",1];
missionNameSpace setVariable ["1",0];```
^^
#define true (random 2 > 1)
hahaha
Nope
๐
Lol
Will it work? you never know.
#define _TRUE false
I thought everybody is just pasting any code that comes to their mind
What if I tell you, dere is eh app on teh market, for storing text in eh numbers.
true/false are commands. All commands are protected
I wish sqf was Kia or python
The preprocessor doesn't care.
Override protection
I wish sqf was C#
๐
here we go again
C# wrapper for sqf?
From intercept
i wish the scripting engine wouldn't be such a bitch, then i could live with sqf easily
"I wish SQF was X:"
Itโs not hard Iโm just in a predicament where clr isnโt wanting to host with version 4 and only 2 which leads me to believe arma issue
Yes
Iโve done it before for other games but arma wonโt comprehend
@still forum do you know if arma blocks createthread
doesn't
I also started an intercept c# wrapper but it's definitely too much work
But remember you can't create threads in dllmain
Really?
yep
Is that just arma? Iโm able to do it in some of my other projects
nope that's windows
Wtf
@shut flower C# please ๐
@tame portal how are you doing? ๐
Well ct then call the clr host to start
Is how Iโve tried but maybe itโs dllmain thatโs the issue
there is no dllmain equivalent in c# so you won't see such problems there
Itโs c++
I know
This was an answer to Might not be a problem if you load C# from C#
ok @little eagle tried do spawn the whole script hoping this would be enough but it still doesn't work
my last solution is to catch OnMissionPreviewEnd and iterate threw all objects
That might be necessary, yes.
waitUntil {
if ((damage team_1)> 0.50) exitWith {
Team_1 say3D selectRandom ["Team_Hit","Team_Hit2","Team_Hit3","Team_Hit4","Team_Hit5"];
true};
};
};
im using this to play a sound when that unit is wounded but it only works one time, there is a way to i repeat that script once it executed once?
0 spawn
{
while{true} do
{
if(damage team_1 > 0.50) then
{
Team_1 say3D selectRandom["Team_Hit","Team_Hit2","Team_Hit3","Team_Hit4","Team_Hit5"];
};
}:
};
but yeah, Torndeco has a better solution there
you should really look into event handlers and loops
because loops don't always have to exit if it can repeat multiple times. But in this situation, an event handler is a better solution
I used the hit event handle, but i think will do the same problem, he will say it every time he is hit
Damaged -> Write a condition for a certain amount of damage -> Execute say3D
Same thing applies to hit, only it'd be more useful to grab damage of limbs with hit -> Write a condition for a certain amount of damage -> Execute say3D
That damage is the amout of damage received by the shooter or the total amout of damage that the unit have?
Hey guys, quick question, on each frame handlers does not "halt" when you are outside of the game right? Like tabbed out.
but i think that still going to be trigered multiple times if the unit is hit like 2 times
Yep every hit will fire
so the player will have a nice ear rape with 2 sounds at same time
but that will run only once? just like that waituntil i have?
Something like this
0 spawn
{
while{true} do
{
if(damage team_1 > 0.50) then
{
if (random 1 > 0.5) then //--- 50%
{
Team_1 say3D selectRandom["Team_Hit","Team_Hit2","Team_Hit3","Team_Hit4","Team_Hit5"];
};
};
}:
};
well that would change the way the script fires
Well that just an example there a lot of ways how to do it
that one give me error
0 = [] spawn there
my brain hurts stop with the spawn loops
๐
just use eventhandler to fire the code. add some conditions if you only want it to fire when unit is over x amount of damage / random chance etc
Also everyone of those loops has a major implentation issue, that no-one seems to have noticed yet
They just wrong
You will notice when you test it out
@still forum c# from c++ is actually impossible
c++(CLR) --> c# is what you ment ๐
and not that difficult actually
but requires extra work to be done
i actually did not noticed anything
but, there is a limit on how many spawns i can use?
Yes. A couple thousand
before its starts to hit perfomace or is like the amout i can make?
Before the game crashes
Ok...
@astral tendon ```sqf
{
_x addEventHandler ["Hit",
{
private _unit = _this select 0;
private _damage = _this select 2;
private _shoter = _this select 3;
if ((_shoter call bis_fnc_objectSide) isEqualTo SIDE) then //--- Set "SIDE" to right one
{
if ((_damage > 0.5) then
{
_unit say3D selectRandom ["Team_Hit","Team_Hit2","Team_Hit3","Team_Hit4","Team_Hit5"];
};
_unit removeEventHandler ["Hit",_thisEventHadler]; //--- Remove this if you need it fires every hit
};
}];
}
forEach units Team_1;
No ?
btw Team_1 is actually one unit
LOL
yeah, i put like that because is that how they are called in the DF:BHD game
and is easy to i remember
Team_1 addEventHandler ["Hit",
{
private _unit = _this select 0;
private _damage = _this select 2;
private _shoter = _this select 3;
if ((_shoter call bis_fnc_objectSide) isEqualTo SIDE) then //--- Set "SIDE" to right one
{
if ((_damage > 0.5) then
{
_unit say3D selectRandom ["Team_Hit","Team_Hit2","Team_Hit3","Team_Hit4","Team_Hit5"];
};
_unit removeEventHandler ["Hit",_thisEventHadler]; //--- Remove this if you need it fires every hit
};
}];
DF:BHD ?
Delta Force Black Hawk Down
k
With CfgFunctions, is there a way to localize loading of the function to machines ie: server, client and hc?
no
@meager heart
instead of
if (random 1 > 0.3) then {true} else {false};
id just do (random 1 > 0.3) ๐
so lame, no way to reduce memory footprint besides legacy function loading methods..
i mean if you really care, you could make the bit yourself by just setting everything to nil
basically make a postInit function yourself thta goes through cfgFunctions classes checking a certain value, for example getNumber (_someClass >> "serverOnly") > 0 then just set the variables referring to that function in every namespace to nil
@tame portal ๐
@Adanteh#0761 ok, thats something to work with. So the function would get loaded then wiped by overwriting it will nil? i've done something like that before for 1 time use functions..
@cloud thunder use CBA and XEH_PREP stuff ๐
Which is the fastest way of return list of playable units including not yet spawned or dead ?
maybe playableUnits ?
wiki says : This does not include dead players awaiting for respawn
yes playableUnits not return dead
so you want it to return dead?
AllPlayers Returns all players including dead players but it will be reliable at some time after mission start
@cloud thunder yes and not yet spawned
what is the best method to handle catching a player disconnect to save their info into a database. Been looking at several: addMPEventHandler, BIS_fnc_addStackedEventHandler, onPlayerDisconnected, and HandleDisconnect event. This is a multiplayer setting and not sure what the best method to catch the player disconnecting is
@river meteor addMissionEventHandler ['HandleDisconnect',{}]; ?
@meager heart if you name the playable unit then that name will be nil until it has a player.
No i don't name them
no saying you do. just a suggestion as a way.
@cloud thunder ```sqf
//-------------------------
Result:
0.006 ms
_allPlayers = [];
{
_name = name _x;
_allPlayers pushBackUnique _name;
}
forEach allPlayers - entities "HeadlessClient_F";
systemChat str _allPlayers;
//-------------------------
Result:
0.0131 ms
Code:
systemChat str ([] call bis_fnc_listPlayers);
//--------------------------
Needs parenthesis.
In forEach ?
(allPlayers - entities "HeadlessClient_F")
Technically it doesn't since + and - have higher priority than other binary commands.
But this just hurts to look at.
Ok ))
Anybody knows why increasing knowsAbout of a unit doesn't make them fire at the target they know about at a long range?
//-------------------------
Result:
0.0061 ms
Code:
_allPlayers = [];
{
_name = name _x;
_allPlayers pushBackUnique _name;
}
forEach (allPlayers - entities "HeadlessClient_F"); //--- With ()
systemChat str _allPlayers;
//-------------------------
Result:
0.0131 ms
Code:
systemChat str ([] call bis_fnc_listPlayers);
//--------------------------
0.0001 slower ๐
@little eagle >Technically it doesn't since + and - have higher priority than other binary commands. Thanks didn't know that
@meager heart any reason for unique?
Got disconnected rejoin? Swaped slot ?
the var is private
@simple solstice it runs in cycle
then it makes sense
I'm having the weirdest bug right now
My server starts, loads the mission then decides to load the mission again before launching
I'm running exile, but I've seen it happen to our alive servers sometimes as well
there is a config error that appears in the log, but its for an animation
I'm super confused >.>
would anyone know how to return every players uid in a nice list on a server?
RCon -> players ๐
well, what i said will do
what is debug menu ?
it seems like i missed The Right Bundle... no debug menu for me ๐
Is there any documentation on the setPlateNumber yet?
no. It's also not on release branch as people say
Is it not on dev branch?
it is
Do you know what the parameters etc is?
I guess
type it in debug console and press F1
@old glade Same here, players have reported a second 'darker' loading screen.
Ok so i have a function that takes two variables like this sqf ["_objPos","_Dir"] // Variables are like this [Object Name/ID , Object Direction] The function has a while loop that, for demonstrational purposes just hints the vars parse into the function like this ```sqf
systemChat format ["_obj = %1 and _objPos = %2",_obj,_objPos];
So to sum up, my problem is that on the first while loop run, the code works well, then on the second run it doesn't parse in the correct vars, but for some reason _this select 0 now parses the player object. Does anyway have a clue as to why this happens?
wild guess, not privatized vars?
link us to a gist with both funcs, it's easier to help if we can see the code
show full function ๐
kk
params ["_objPos","_Dir"];
mld_fnc_ammoMain = {
};
_count = count ammoPackArray;
if (_count > 14) then {
deleteVehicle (ammoPackArray select 0);
ammoPackArray deleteAt 0;
};
_obj = "Land_MetalCase_01_small_F" createVehicle [0,0,0];
_obj setPosASL _objPos;
_obj setDir (_Dir - 90);
ammoPackArray pushBack _obj;
while {!isNull _obj} do {
_units = nearestObjects [_obj,["man"],3];
{
systemChat format ["_obj = %1 and _objPos = %2",_obj,_objPos];
[_x] call mld_fnc_ammoMain;
} forEach _units;
sleep 0.5;
};
Half-finished by, hence the empy function var
Essentially, the function is executed on the server by the clients, it then uses the placed object as a physical marker to automatically rearm the soldiers around the placed object.
I don't see the systemChat you mentioned
ok, 1 sec
also, if those are functions why the hell is there a sleep in there?
It is edited now
you're not using unscheduled are you?
no, remoteExec spawns the function afaik
hm, can't remember if it's 100% going to run scheduled, lemme check
yeah, but if it weren'y unscheduled, then wouldn't i get an error saying generic sleep expression?
yes. If it was unscheduled it would error
So not the issue then, k
I don't see anything wrong in that code...
ok, can i be possible that arma is buggin out?
nope
Is that really your full code that you are currently using?
The fact that you edited in the systemChat afterwards tells me you didn't CTRL+A CTRL+C CTRL+V it
Saying that an object was given but expected was an array
Please post the complete error message
For that function yes. But this is how the function is spawned within a switch do statement```sqf
case "ammopk": { // ammoPack
[_objSpwnPos,_mrkDir] remoteExec ["mld_fnc_ammoMain",2];
};
ok, will do
wait. you are remoteExec'ing mld_fnc_ammoMain but inside mld_fnc_ammoMain you set mld_fnc_ammoMain to a empty function??
Systemchat output: _obj = 13727d42b00# 17811767: metalcase_01_small_t.p3d and _objPos = [13772,12455.25,23.405] _obj = 13727d42b00# 17811767: metalcase_01_small_t.p3d and _objPos = B Alpha 1-1:1 (Moldisocks) The error message: ```
_obj |#| setPosASL _objPos;
_obj setDir (_dir - p...'
Error setposasl: Type Object, Expected Array
Really need to setup a way to copy error msgs to clipboard haha
_objPos is wrong. The error is not inside the while loop.
Your _objSpwnPos is wrong
typo
for the love of sqf, PASTE THINGS
you can copy the error message from RPT.
unless he uses atom, then he can't open them ๐
do you know what an RPT log is?