#arma3_scripting
1 messages ยท Page 344 of 1
๐คฆ
I was scrolled down too much
I have a function that checks local _target before doing remoteExec
I just do a check if typeName _target isEqualTo "SCALAR"
๐ฎ
Oh god, thanks
it can also be side for remoteExec
whoa
if !(_target isEqualTypeAny [0,west,(allgroups select 0)]) then {
Neat.. Never had a use for isEqualTypeAny myself yet
Tsh, allgroups should be grpNull
ohh, checking for those is stupid. I can just (_target isEqualType objNull)
sick command
implemented that shit into like 5 functions
brining it up to 2015, one command at a time
_unit = _this select 0;
if !(isNil "_unit") then {
if !(isNull _unit) then {
//CODE
};
};
?
{ } is new?
no
2012 new
probably have not seen it much because it's not on wiki...
params [["_unit", objNull]];
if (!isNull _unit) then {
nvm, it's just not on the if page https://community.bistudio.com/wiki/Control_Structures#if-Statement
I like the params version more.
So, potentially silly, but does anyone know how the scoring system works? For example, if an enemy unit was using a friendly vehicle, and PlayerA uses an AT to destroy said vehicle with said enemy in it, would they be rewarded a combination of negative and positive points, or would the game recognize the vehicle as being enemy and reward positive score overall?
If an enemy uses a vehicle, the vehicle is not friendly, it's enemy.
Thank you for the clarification. Does it stay marked as enemy even after they dismount?
'Marked' might not be the best word, but you get what I mean. Is it still classified as an enemy's vehicle.
Empty vehicles are neutral.
Instantly?
Yeah, that's what I'm wondering. I'm doing a sort of TvT, but in my attempt to balance it, I'm giving both teams Prowlers, even though one doesn't normally have access to it. I was just hoping that if Blufor destroy's Independent's Prowler, it doesn't affect them badly, because it's their vehicle.
Add a getout eventhandler that sets a last_used_side variable, then add a onKilled to that vehicle
addRating based on what's what...
Yeah, I'd never really used addRating, but I might have to look at it now. Thank you.
Have fun dude
Thanks!
''implemented that shit into like 5 functions'' @peak plover when you repeat something that many times you should make a function
Follow DRY
functionception
So, despite my mission working fine initially, for some reason whenever I capture a sector, I get two notifications instead of one. I haven't changed anything in that regard, which is rather odd.
MP?
Yes.
It's been purely tested in the MP enviroment since it started.
I've experienced similar things with notifications in the past, though I'm not sure when it occurs or why.
Maybe the function that shows the notification shows the notification on every machine.
And the function that executes the function that shows the notification is executed on every machine.
And the function that executes the function that executes the function that executes the function that executes the function that executes the function that executes the function that executes the function that executes the function that executes the function that executes the function that executes the function ...
Then you would have N duplicate notifications where N is the number of connected machines.
Dedmen, please go back to disproving ________
You might be right. Just odd that it started happening seemingly randomly.
Note that I'm not saying that the function that shows the notification does show the notification on every machine.
But it could be and the same type of error could be the issue, even if it's in another step.
You might be right. Just odd that it started happening seemingly randomly.
Maybe it was always the case and you just noticed it for the first time.
Nah, it hasn't always been the case. I was showing it to my roommate an hour or so ago, and was paying attention to the notifications and such.
I might restart Arma though. It's been open for a while. Maybe something's broken internally.
git checkout <commit-hash>
git diff master-<commit-hash>
Well, sadly that had no effect. Funnily enough, the first testrun after restart had me spawn inside the ceiling of a building. Respawn again, nothing.
Restarted whole mission, also didn't happen. Arma is weird.
Does this use a display/control eventhandler on the mission display (#46) like keyDown?
I'm not sure honestly. You're going to hate me, but I just mostly used the Sector Modules for this one. The group wanted something basic that I could show them at a later point.
The problem with that is, that these modules are essentially black boxes that do something, but you don't know what they do. So if there is an error in one of them, or even a quirk, you have no idea what to look for.
Yeah, I understand that. It's a risk I took for some simplicity.
Also, is there any way to stop the game from overriding the mission.sqm information? I tried using the in-game attributes to set the Scenario Name, however that doesn't seem to do anything, so I've tried leaving that empty and editing the mission.sqm to have OnLoadName = "titlehere";, but it overrides that whenever I try to save or export.
When I do add a name to the in-game 'Title:' section, that doesn't get added to the mission.sqm for some reason. The author part updates in the file, but the title doesn't.
Seems like I've gotten it to update everywhere except for the Create a Game lobby, in which it still shows as savedname.malden :(
Does selectPlayer command still have issues with editor placed units?
where there issues with it?
I just tried and didn't encounter issues at all
But there's clearly stated on the wiki (https://community.bistudio.com/wiki/selectPlayer)
"Also avoid selecting player into editor placed units in multiplayer, as it may, on occasion, lead to some undefined behaviour. If you need to selectPlayer into another unit, consider creatingUnit dynamically."
@jovial nebula Did you try on local multiplayer or dedicated server?
Okay, so I've also tried just creating a new, blank mission. Giving it a name, saving it then exporting it. That worked, that now has a name that shows up in the lobby. That narrows the source of the issue down somewhat.
Trying to verify the game now just incase.
Local actually
Then it makes sense that you didn't encounter issues
the problem is locality. If someone else owns the Unit you wanna switch into -> Problems
....aaand this is why we should delete outdated comments from the wiki
@little eagle The comment is not wrong nor outdated.
Not being wrong is insufficient when it comes to 'should be on the wiki'.
Atleast not Also avoid selecting player into editor placed units in multiplayer, as it may, on occasion, lead to some undefined behaviour. If you need to selectPlayer into another unit, consider creatingUnit dynamically. I guess
Though that seems a bit missplaced in the description of the command
I don't believe it anyway. "On occasion undefined behavior". Maybe he made a race condition and that's it.
No reason to put that on the wiki then.
They could've put it as an example though. Creating a unit locally and then switching to it.
Well weird, I tried on a dedicated server and no problems at all
You're not the first one to ask what the issue actually is. And all because of the wiki.
D:
My conclusion: there is no issue.
๐ Let's hope it is actually as you say
If you find it, put it on the wiki with a better description.
Sure
use it more than once put it into a function
Isn't that too much?
Value more than once, save to variable. Code more than once, consider a function.
So if I use a command more than once, I should put it into a function?
I feel like that's a suggestion not a rule...
I wouldnt make a function for every command, no. I start considering when its ~4-6 lines
Just consider if you use the same 4-6 lines a lot (say draw a debug marker), if you wanted to change it a bit, rather change 1 fnc than 6 code bits
But its hugely subjective
I do get the reasoning 'tho. Because yeah, it does make it easier. I feel like for this I don't need to do to that 'tho
I use getvariblae in multiple places, I don't think it means I should make a function like
fnc_getVariable
Seems reduntant to some extent
If you do fancy stuff beside just getting it, maybe, otherwise yea thats retarded
Now that I think of it
The correct answer is, 2000 lines of macros and includes and then one function call.
I did make a few functions for getVariable, but they are specific to certain variables
^
I'm starting to like macros more and more, now that I tried them out
I feel like a lot of code can be replaced by simple macros
#define Line1 params["_a"]
Line1
#define Line2 ...
Params is very different every time 'tho
Use macros sparingly and consistently or you wont understand what you wrote some time down the line
I think this might be wrong, but something like this would be helpful at times...
#define GETVARSETVAR(var,default,global) missionnamespace getVariable [var,default]; missionNamespace setVariable [var,default,global];
That as well cptnnick
Could do some kind of a macro that adds a comment or sth about macros if enabled...
So it tells you what it is
before using the macro
Then use like functions viewer to read the function...
Would that work?
functions viewer
๐คข
just open the file. Arma is a shitty file browser (understandably)
But that would process macros and add comments...
No, it wouldn't.
I still don't get it..
Double click the file to open.
Jeez
That would mean that I'm underthinking this shit
I consider this a lie now
nigel, take a good look at a function in the functions viewer. It looks exactly the same as when you open it in your favourite text editor. Except that you can actually use a proper text editor and file browser.
I thought the macros would be resolved in there.. my bad
It wouldn't be readable anymore when the macros are resolved.
@peak plover keep in mind macros does not make your codebase smaller, as they are preprocessed.
I would suggest functions and not macros
Since functions are much easier to handle
It means that if I want to change a function or sth, I change it in once place only
Thats what you use a function for.
Function > Good when usage is in more than one place
And this does not mean if you are using a command
But let's say you want to select a player out of an array, instead of doing this in 6 different files
You create a function and pass arguments to it.
Then you go by DRY (Do not repeat yourself)
And you keep your code base smaller
Sure
Where as macros will be preprocessed anyways and be replaced with the code in the macro
Which will make loading the application, loading all whats in that macro as well. (Arma is in this case the application)
Therefor not following DRY
A good example of this is BIS_fnc_getUnitByUID, where you wouldn't repeat that loop all over the place, but you would rather stick it in a function and call that
One pro of this as well is that if something needs changing, you just have to change it in one place.
Hey, I am trying to make my own simple 3DEN script, to make things easier to work with. And I am trying to use set3DENAttribute ["ItemClass", value]; But it's not working, I use the same set function to set Name, and it works just fine, any idea why?
Yes, good example as wel;๐
@storm sierra this takes an entity as a parameter.
I know, I left that out on purpose, because it's the ItemClass I am having issues with
If you want helpful answer I suggest leaving full code snippets ๐
And what is ItemClass?
What are you trying to do?
https://community.bistudio.com/wiki/Eden_Editor:_Object I am trying to randomize Pop-Up Targets in the 3DEN Editor, and name them from T1 to T9 Using the Attributes : ItemClass (Type) and Name (Variable Name)
I am not getting any script errors, there's just no results when I set the Attribute ItemClass
[_T] is never a string
I know that, I was testing around,
but its selected from _types
Also, use params please
which is also arrays
I tried setting it to [_T] because _IC was returning ["TargetP_Inf4_F"]
yes it returns an array containing the return value
have you tried simply executing just the set3denattribute from the debug console?
I just tried
collect3DENHistory {
((get3DENSelected "object") select 0) set3DENAttribute ["Name", "TargetP_Inf4_F"];
};
Which works fine, it changes the name
But when I try
collect3DENHistory {
((get3DENSelected "object") select 0) set3DENAttribute ["ItemClass", "TargetP_Inf4_F"];
};
Nothing happens
does it return the get3denattibute correctly?
Oh shit, I just realized why functions are func = {};.
You assign code to a variable and then call it.
It returns ["TargetP_Inf_F"]
That somehow escaped me until now.
The curly brackets are glorified quote marks.
Are they faster, though?
aight. its blocked by the engine then, @storm sierra
Cool, thanks
@little eagle: but if you call a string you need to compile it first.
And what is the result of compiling a string?
They just replace the " with {
If you use {} you don't need the compile.
Yes.
but then it isnt a string of course
Thus they are better.
numbers are better since you dont need to call them anymore
Can't use format with curly brackets. format always leads to very nice and confusing code.
tipp: use formatText instead to avoid getting truncated code strings
formatText is a worse version of parseText.
formatText is the one variant that has no upper limit
unlike format, strings can be way more lengthy in there
guys is there a built in revive system I can use in online sandbox sorts of games? We're doing small private zeus games.
awesome thanks
Would anyone perhaps know why that upon mission completion (custom zeus objectve) and mission restart that the ablity to use Zeus would be disabled, or simply not work.
Only a server restart seems to allow me to be Zeus again
Hello there guys, i have (what i think may be) a simple question, so, im making a mission in which you're a policemen and there's a shootout so you have to ask the civilians around if they saw where the gunmen fled to, i know i can add the "Interrogate" with the "addaction" command, but how do i make it that after that they show a "Hint" text?
This is what i tried on the init field: this addAction [Interrogate (hint"I didnt see anything")]; but it doesn't work, on the hint i could change it manually but i don't know how to formulate the action ๐ฆ
wouldn't it be addAction["Interrogate", hint parsetext format ["I don't know anything!";];
I mean, you probably wouldn't need parsetext format, but you could potentially make it so they have an array of answers.
addaction["Interrogate","Interrogation.sqf"]; then within that sqf, have an array with different replies, get a variable to choose one of them, and then have the hint display the chosen line.
I also have an odd / interesting issue. So, when you choose my mission from the scenario list, it shows it's title, and below it, it shows the author. That's correct. On the loading screen, it also shows the correct information. However, once you're in the mission and you spawn in, the text down the bottom right show the wrong information, and nowhere can I find why it's using one thing over another.
This is what I'm referring to. I've used the Scenario Name module, which initally only showed the Scenario name, which I didn't mind, but then once I added author information to the description.exe, it started showing the author, which I wouldn't mind if it were correct. http://i.imgur.com/Avt8ThS.png
Okay, I can confirm, that for some reason, the Scenario Name Module uses the onLoadName string as the author text.
Huh.
If I remove onLoadName, the module only shows the scenario name, however my loading screen shows 'Unnamed Mission,' which is not ideal.
just call your mission Unnamed Mission
@spice kayak Thanks man! ๐
Of course the wikipage for the one bit of information I need is down :(
What bit of information
the dynamictext information, for what each of the arguments and such mean.
I'm slowly figuring it out by trial and error though :D
A command? Or a UI element or what is that?
sorry, the BIS_fnc_dynamicText - though it appears to load now.
Hey guys. I am very new to this, so maybe you can give me an answer.
Ask away, someone will help!
Problem: i want to spawn an Ammobox to a Marker (called "ammo_spawn"). the NPC, that should trigger the spawn will be an AI officer. to open a dialogue i get into its init this AddAction["Create Ammobox"]; i KNOW that i have to set a comma after that to add the funktion to spawn that thing. But my syntax seems to be wrong :S
can anyone give me a simple syntax for that?
i tried to work with _veh = createVehicle ["rhsusf_ammo_crate",getMarkerPos "ammo_spawn"] but that doesnt work for me for somehow
this AddAction["Create Ammobox",_veh = createVehicle ["rhsusf_ammo_crate",getMarkerPos "ammo_spawn"]]; <<< that was the syntax i wanted to fill in the NPC-init at the editor
The function needs to be between code brackets {}
The reason is that it needs to be a single variable
how must the code be then?
And {} makes a code-type variable
you mean that stuff after "createVehicle"?
object addaction ["name",{ createVehicle ... }];
So just like a string, wrap everything in those curly brackets
facepalm omg ok is it that simple?
Yes
Now i cant comment yet on if your actual code itself also works correctly but thats the syntax
It looks ok though
this AddAction["Create Ammobox",{_veh = createVehicle ["rhsusf_ammo_crate",getMarkerPos "ammo_spawn"}]; << like that?
i think i missed a "]" somewhere
see ^^
Just a question about ace_slideshow_fnc_createSlideshow; i want to have multiple Slideshows on one object and use the same controller, but with 3.10.2, the interactions of the Slideshow are mixed up for me and overlap in the Submenu (e.G. when i select 1 subcat the entries of the second slideshow will overlap), i load this slideshow via init.sqf, should this maybe the problem?
Why dont you try asking in the ACE3 slack?
It shouldnt matter where you call the function from, though
@indigo snow no errors so far, ill try that now in mp-mode. hope it does what it should do ๐
Its all global, should be fine
nah gives me an error
You might wanna remove the action after spawning the box, though
hangon trying to post the picture
What error do you get in MP that you dont get in SP?
You can open your RPT file, all errors are logged in there
Google "arma 3 rpt file"
hangon
11:11:23 Error in expression <_veh = createVehicle ["rhsusf_ammo_crate",getMa>
11:11:23 Error position: <createVehicle ["rhsusf_ammo_crate",getMa>
11:11:23 Error 2 Elemente angegeben, 5 erwartet
https://community.bistudio.com/wiki/createVehicle As you can see. You have to provide 5 elements in the array
lul ๐
@still forum what does that mean?
You need to add some other values to the array
It means that you have to provide 5 elements in the array. You only have two. Read wiki page
I thought they were optional, my bad
why i am don't ask on ACE3 Slack, beacuse i am not on the ACE3 Slack and i am waiting for the "invite"
what do i need else?
You could also use the first syntax for createVehicle instead
@long hatch You don't need invite
@fallen notch Read wiki page.
[type, position, markers, placement, special] <<< that stuff?
Yes
ok now i need someone that explains me, what i should fill in there ๐ (like i said i am new to this)
"rhsusf_ammo_crate" createVehicle getMarkerPos "ammo_spawn" should work too, to help you along
[type, position, markers, placement, special]: Array
type: String - vehicle/object className
position: PositionATL (PositionAGL if boat or amphibious), Position2D, or Object - Desired placement position
markers: Array - If the markers array contains any markers, the position is randomly picked from array of given markers plus desired placement position. If any of the markers were given z coordinate with setMarkerPos, the vehicle will also be created
at given z coordinate.
placement: Number - The vehicle is placed inside a circle with given position as center and placement as its radius
special: String - "", "NONE", "FLY", "FORM", "CAN_COLLIDE". "CAN_COLLIDE" creates the vehicle exactly where asked, not checking if others objects can cross its 3D model.
"Who can read is clearly in the advantage"
oh dedman its not the "reading" you know its the translation from english to german
Eh hes new to it. Best to show a few working examples to learn from
so i clearly dont have as much advantage
Wanna go through each element seperatly?
type: you have that already
position: you have that already
markers: you don't want that so [] empty array as in example 3
placement: you want it to be on the poistion so 0
special: you don't want that so "" or "NONE"
i have to translate from english to german to scripting language
Skip the German part.
dammage
xD
ok ok wait lemme try to rebuild the code then again
I thought you were Chinese.
Or American.. Riggs sounds american
Just a tip, there should be no differences between SP and MP unless your server doesnt have RHS loaded
(With this specific thing)
(In this specific situation)
(on this specific game version)
The code will run locally, so the box will be created as long as the client has RHS. It will print errors on the server though.
(Standard bisclaimer)
this AddAction["Create Ammobox",{_veh = createVehicle ["rhsusf_ammo_crate",getMarkerPos "ammo_spawn,[],0,"none"]}];
is it like that?
missing a "
"ammo_spawn" corect?
Rest looks good tho
^
Might wanna get a text editor with syntax highlighting
That is storing the vehicle into a variable that you never use.
@indigo snow Or just
this AddAction["Create Ammobox",{_veh = createVehicle ["rhsusf_ammo_crate",getMarkerPos "ammo_spawn,[],0,"none"]}];
Discord is the new IDE
I can tell that he's using CBA just from that line : D
ya i have notepad++ but really i dont use it it doesnt autocomplete for me :S
I can recommend Atom
I'm trying but I can't see the CBA reference
Don't listen, Sublime Text 3 is superior in any way (it's faster).
But not free
Didn't CBA fix that?
Hence...
I can delete it and give you the honors
I made it work, so... : P
now i understand
WORSHIP ME
Now spawn the box another 5 times and watch the physx ๐
i thought if i dont need the variable i leave it lol
Its a negligible loss of time
Aww ._. No physx because createVehicle too "intelligent" :/
"Can_collide"
I wish these parameters in createVehicle were optional. I never use them (aside from CAN_COLLIDE sometimes), and I never can remember them either.
Now make a ui interface for insanity points
i was thinking bout that lol
the more insane you are the more badass items you get haha
(bananas and stuff)
no really @little eagle thank you ๐
you made an old man happy
i got ace
the idea behind spawning items was: there are no containers with unlimited spareparts
and tahts sad
*thats
You could make one ๐
i know it is ^^ now tell me how far would i get? 35 years old and the 5th day on doing this lol
Better use what's already working ^^
Also better for frames, ace cargo items actually exist (or was that only with AGM?), saves on the frames
i am just at the very basics and the language i was using on "programming" was basic lol
maybe you could help me out with something else. I have a container that has the virtual arsenal command when i get closer to it. When i am very close it still has its inventory. how do i deactivate the inventory of that container?
Just the grammar is a bit weird. MyCookie eat now instead of now eat mycookie
Are you sure you don't want the Inventory? I love that to throw away misc items. If you don't have the inventory you either have to search the Item in Arsenal to remove it or you just throw it on the ground
hmm ya you are right maybe i just clear the inventory then
Everytime my group has an Arsenal on an object without inventory there are tons of items laying on the ground after equipping. If they have an inventory to throw stuff into everything is neat and tidy
argh now i have another problem :S when i put that ammobox to the ground it automaticly hase the virtual arsenal on it
but when i spawn it via that command i used befor it just has an empty inventory
And what's the problem? you want arsenal or not?
how do i get that this addaction ["<t color='#FFFF00'>Arsenal</t>",{["Open",true] spawn BIS_fnc_arsenal}];
to that box? ^^
https://community.bistudio.com/wiki/BIS_fnc_arsenal
["AmmoboxInit",[<Your Box variable>,true,{true}]] spawn BIS_fnc_arsenal;
or
<Your Box variable> addaction ["<t color='#FFFF00'>Arsenal</t>",{["Open",true] spawn BIS_fnc_arsenal}];
The variable is returned by your createVehicle call
so
_myBox = createVehicle..;
_myBox addAction...
ok so for my understanding: do i have to place that somewhere to that line with this 5 options?
my guessing was that empty []
in the code block. {code}
Right now in your addAction that spawns your vehicle you have
createVehicle [...] change that to _veh = createVehicle [...]; _veh addAction[<Arsenal action here>]
hangon
this AddAction["Create Ammobox",{_veh = createVehicle ["rhsusf_ammo_crate",getMarkerPos "ammo_spawn",[],0,"none"]; _veh addAction ["<t color='#FFFF00'>Arsenal</t>",{["Open",true] spawn BIS_fnc_arsenal}] }]; like that?
```sqf
<code>
```
this AddAction["Create Ammobox",{
_veh = createVehicle ["rhsusf_ammo_crate",getMarkerPos "ammo_spawn",[],0,"none"];
_veh addAction ["<t color='#FFFF00'>Arsenal</t>",{["Open",true] spawn BIS_fnc_arsenal}]
}];
looks good.
Hi all, im trying to create ambient civs in town with EricJ's Taliban units thats spawns via trigger activated.
How im trying to do it is to place them via zues and copy that data to a sqf that id like to call in the triggers on act field...
```This is the sample data of handfull of civs as a test... how would i go about calling this via sqf.
Ive added the data to a town1.sqf and trying to call it via trigger using ... this execVM "scripts\town1.sqf";
what am im doing wrong?
so that means i can just put "what it is" and "what it does" in 2 commands in it
@tame stream Not using sqf highlighting. Not using newlines. Not using private
im sorry i dont follow
I'll help you...
i've done this before via the zeus method but for the life of me i cant figure out how i did it before
private _newGroup = createGroup civilian;
private _newUnit = _newGroup createUnit ['Afghan_Civilian5', [1505.94,313.088,0.00137329], [], 0, 'CAN_COLLIDE'];
_newUnit setSkill 0.5;
_newUnit setRank 'PRIVATE';
_newUnit setFormDir 296.721;
_newUnit setDir 296.721;
_newUnit setPosWorld [1505.94,313.088,360.481];
_newGroup setFormation 'WEDGE';
_newGroup setCombatMode 'YELLOW';
_newGroup setBehaviour 'SAFE';
_newGroup setSpeedMode 'LIMITED';
private _newWaypoint = _newGroup addWaypoint [[1568.47,221.883,0], 0];
_newWaypoint setWaypointType 'MOVE';
_newWaypoint = _newGroup addWaypoint [[1567.15,301.517,0], 0];
_newWaypoint setWaypointType 'MOVE';
_newWaypoint = _newGroup addWaypoint [[1485.68,311.603,-3.05176e-005], 0];
_newWaypoint setWaypointType 'MOVE';
_newWaypoint = _newGroup addWaypoint [[1489.83,284.029,3.05176e-005], 0];
_newWaypoint setWaypointType 'MOVE';
_newWaypoint = _newGroup addWaypoint [[1538.28,280.469,0.00128174], 0];
_newWaypoint setWaypointType 'CYCLE';
That really is some heap of code..
oo yeah soz
What is not going like you want it?
ill do it like that in future
You say something is wrong but you don't say what's wrong
That's why I told you everything that came to my mind about that script
im trying to use that given data to spawn the civs in the town via a trigger...that does not happen and im trying to find out why
So.. The civs don't spawn?
yup
Script error in RPT maybe?
Disabling logs while coding... Great Idea
๐ฌ
i did activate logs awhile ago dont know why it still off...fml
using this script for spawning enemy 'AI Spawn Script Pack', but its having issues with EricJ civs hance the questions, but for anything else it works great ..have you come across this one before, pretty handy... http://www.armaholic.com/page.php?id=19832
comes with this handy link ..http://kaartomedia.com/ARMA/AISSP.html
just mentioning ๐
@fallen notch the problem is that in MP, people now wont see the Virtual Arsenal action since its local.
You need some more magic for everyone to see it
@indigo snow what do you mean?
Only the person who spawned the crate with the action can access it now
you sure?
Yes.
Since addAction has local effects, it only exists on the computer where it was added
omg
Easy fix
ok how to do it then?
object addAction params
->
[object, params] remoteExec ["addAction"]
You replace the first line with the last.
object and params are placeholders. Replace with what you have.
@still forum not seeing any thing in RPT link if interested ... (https://cdn.discordapp.com/attachments/315295593314648066/349499787999051776/Arma3_x64_2017-08-22_12-18-37.rpt)
12:19:13 [XEH]: Car does not support Extended Event Handlers! Addon: @task_force_radio
12:19:13 [XEH]: Tank does not support Extended Event Handlers! Addon: @task_force_radio
12:19:13 [XEH]: Air does not support Extended Event Handlers! Addon: @task_force_radio
Explain yourself, @still forum
you mean instead of just addaction i should do remoteExec ?
remoteExec ["addAction"]
yes
12:18:54 Updating base class Offroad_01_military_base_F->Offroad_01_base_F, by task_force_radio_items\config.cpp/CfgVehicles/Offroad_01_armed_base_F/ (original a3\soft_f\offroad_01\config.bin)
12:18:54 Updating base class Car->Car_F, by task_force_radio_items\config.cpp/CfgVehicles/HMMWV_Base/ (original (no unload))
^^
this remoteExec["AddAction"]["Create Ammobox",{_veh = createVehicle ["rhsusf_ammo_crate",getMarkerPos "ammo_spawn",[],0,"none"]; _veh addAction ["<t color='#FFFF00'>Arsenal</t>",{["Open",true] spawn BIS_fnc_arsenal}] }];
No
facepalm
object would be the NPC soldier?
No, look at your code.
rhsusf_ammo_crate?
object addAction params
this AddAction ["Create Ammobox",{_veh = createVehicle ["rhsusf_ammo_crate",getMarkerPos "ammo_spawn",[],0,"none"]; _veh addAction ["<t color='#FFFF00'>Arsenal</t>",{["Open",true] spawn BIS_fnc_arsenal}] }];
What is "object" in your case?
i truely have no clue :S
"this" would be then the object
Yes!
so the object is the NSC i give the command
It's a reference to the object's init box you put it in.
Now what is "params" in your case?
yes
this AddAction ["Create Ammobox",{
_veh = createVehicle ["rhsusf_ammo_crate",getMarkerPos "ammo_spawn",[],0,"none"];
[_veh, ["<t color='#FFFF00'>Arsenal</t>",{["Open",true] spawn BIS_fnc_arsenal}]] remoteExec ["addAction"];
}];
: /
nono lemme look
you want to remoteExec the Arsenal action. Not the box spawning
Look at what inside the array to the left of remoteExec
Youd have an action for every connected client + server, commy :P
I better go to sleep again.
lol
But yea dodger look at the arguments for remoteExec, and what they were when it was an addAction
so in my words right now i make a box that everyone can see but they didnt see the commands and now they do
because remote addaction has done it?
Yes. If you create the box, everyone can see it, but if you add an action, only you can.
//before
_veh addAction ["<t color='#FFFF00'>Arsenal</t>",{["Open",true] spawn BIS_fnc_arsenal}];
//after
[_veh, ["<t color='#FFFF00'>Arsenal</t>",{["Open",true] spawn BIS_fnc_arsenal}]] remoteExec ["addAction"];
Local effects and global effects
AH
So you need to remoteExec the addaction so it happens on every client
_veh is the "object", [...] is the "params"
so you just say "and by the way Addaction is remotly done"
remoteExec ["X"]; is "do function X on every machine
Id rather say you need to remoteExec it for everyone to see it
I think this also needs the JIP flag. So people joining later have the action too
omg
remoteExec ["addAction", 0, true];
Welcome to MP scripting :D
I wouldn't have used remoteExec personally ๐
and for make the whole thing easier i put that in an sqf file and just call taht file lol
You could just use Arsenal ammoboxInit.. And done ^^
Obviously youd need a CBA XEH ( :P )
and a PFH and a PEH and a CNS
(btw how can i copy that code with colours in here?
already told you before ^^
```sqf
<code>
```
_veh = createVehicle ["rhsusf_ammo_crate",getMarkerPos "ammo_spawn",[],0,"none"];
[_veh, ["<t color='#FFFF00'>Arsenal</t>",{["Open",true] spawn BIS_fnc_arsenal}]] remoteExec ["addAction"0,true];
}]; ````
No space between ticks and sqf
_veh = createVehicle ["rhsusf_ammo_crate",getMarkerPos "ammo_spawn",[],0,"none"];
[_veh, ["<t color='#FFFF00'>Arsenal</t>",{["Open",true] spawn BIS_fnc_arsenal}]] remoteExec ["addAction"0,true];
}];```
aaaah^^
Wrong space ahah
shift + enter to newline after the "sqf"
You can just enter after three ticks
UMSCHALTTASTE * EINGABETASTE
this AddAction ["Create Ammobox",{
_veh = createVehicle ["rhsusf_ammo_crate",getMarkerPos "ammo_spawn",[],0,"none"];
[_veh, ["<t color='#FFFF00'>Arsenal</t>",{["Open",true] spawn BIS_fnc_arsenal}]] remoteExec ["addAction"0,true];
}];```
tadaa ok
JAWOHL
@still forum SHIZAAA !!! ๐
i figured it out... have to use null=execVM "scripts\town1.sqf"; instead of this execVM "scripts\town1.sqf";
if you are interested this is my method. --> (using Zeus Achilles addon)
-place single player on map with zeus acces
-spawn civs/enemies/structure with waypoint and states of choosing
-in zues use copy SQM command
-copy data to newly created town1.sqf
-use null=execVM "scripts\town1.sqf"; on trigger activated by player
Boom all good, player enter trigger and zeus prebuild item spawn as needed
๐
(omg i think im going insane, need more coffee)
i figured it out... have to use null=execVM "scripts\town1.sqf"; instead of this execVM "scripts\town1.sqf";
ยฏ_(ใ)_/ยฏ
this AddAction ["Create Ammobox",{
_veh = createVehicle ["rhsusf_ammo_crate",getMarkerPos "ammo_spawn",[],0,"none"];
[_veh, ["<t color='#FFFF00'>Arsenal</t>",{["Open",true] spawn BIS_fnc_arsenal}] remoteExec ["addAction"]0,true];``` now it says theres a "]" missing :S
["addAction"0,true];
same error
...string"0,...
isn't right either
ah lol
still missing something
this AddAction ["Create Ammobox",{
_veh = createVehicle ["rhsusf_ammo_crate",getMarkerPos "ammo_spawn",[],0,"none"];
[_veh, ["<t color='#FFFF00'>Arsenal</t>",{["Open",true] spawn BIS_fnc_arsenal}] remoteExec ["addAction",0,true];
}]]; ```
Yes
[_veh, ["<t color='#FFFF00'>Arsenal</t>",{["Open",true] spawn BIS_fnc_arsenal}]
You open 3 [ but only close 2
And the not indented lines open one [ and one {, but close two ] and one }
so i need to get rid of 1 "]" at the end of that line?
Yes. And then also fix line 3
what is wrong in line 3?
4 opening [ and three closing ]
i dont see it ๐ฆ
You should really read what people tell you
Count it one by one then
put it into notepad and set text size to 500
๐
Last time I used big text thingies was in primary school ๐ I don't remember how sizes work n stuff
yes Size 72 helped ๐
had to start to count at line1 ^^
and then it stared into my eyes lol
"And if you gaze long into an abyss, the abyss also gazes into you."
With time your brain will learn to recognize the pattern
its like math
YES
i know that but in all that lines and thinking and focussing i missed the whole picture lol
13:16:07 Error in expression <(_this select 0) addaction (_this select 1)>
13:16:07 Error position: <addaction (_this select 1)>
13:16:07 Error addaction: Typ Zeichenfolge, erwartet Objekt :/
_this select 0 is a string instead of an object
As... The error message already told you
aaah seen it ^^
Haven't been on for a couple days so I might've missed some answers. I was trying to make a square in GUI and someone recommended
w = x * safezoneH;
h = x * safezoneH;
But that gives me something that is clearly rectangular.
So how do I make an actual square?
w = x * safezoneW;
would x work in configs? shouldn't it be safezoneX?
Dude... I don't even
im trying to do a mobile respawn that needs to be activated by players, as soon as the player activate the MHQ via addaction, only then i want them to have the option to spawn there.
So how can i make a respawn module active via addaction, also needs to deactivate via 2ns addaction
any ideas? ive tried hide and disable simulation
Quick question about github and scripts and comments:
// Exit if target unit does not exist or isNull or is not a man
if (isNil "_unit") exitWith {};
if (isNull "_unit") exitWith {};
if !(_unit isKindOf "CAManBase") exitWith { };
Will github filters pick this up and ban me from github?
Because if you are not a man it won't run the script...
Because you are using wrong syntax that will never work? no
"Man" in this case means "Human"
Not Male
isNull check
Ohh, right 'o
Thanks
if (isNil "_unit" || {isNull _unit} || {_unit isKindOf "CAManBase"}) exitWith { }
better?
indeed
Lol.
Any ideas on how to effectively extract code (typeName "CODE") from the debug console? Too long to load it and copy it (crashes game). I would prefer not to print it and keep all the extra quotes out of it.
What function?
Just extract the PBO that function is coming from. And take the sqf file
It's not in a sqf file.
Where then?
Generated in-game.
Custom extension or Intercept to write to file
Never used it before, will have to check it out.
So if you click onto the function in Function viewer it crashes?
Forget that. It's probably not in the function viewer
when exactly does it crash?
It's not in the function viewer. It is a variable.
I put the variable in the watch box, go to CTRL + A or press end and it hangs until I force close it.
Are you sure it's unrecoverable? Did you wait for several weeks? Kappa
๐คฆ
How long is the output you get from copyToClipboard
I've waited for 10 minutes with no joy
so after how many characters exactly does it truncate
I take that back. It didn't truncate it.
So... Everything is fine and you just derped?
I derped... Been working on this for maybe 10 hours and I derped at the end.
Brain is tired I guess.
guys how do i make it so only someone with the Bounty Hunter licenese can spawn here ["bounty_spawn","Bounty Hunter HQ","\a3\ui_f\data\map\MapControl\watertower_ca.paa"] not everyone else (im hosting a lakeside server ik how to do it for altis life but not so sure about lakeside modded(edited)
pls help
Thank you for copy pasting. I wish you a very nice time here.
what was i surpose to write its the same question?
As this is a Life specific question you should go ask in a Life forum or Discord.
wowo rude
It would not be rude to just leave you be without answers?
Just add an if statement before adding the spawn location and just check if they have the license...
ok thx
can someone help me out and get me the right syntax for some ifs in a row with else at the end, seems i can't get it running: ```C
_boing = player getVariable ["boing",0];
if !((vehicle player) isEqualTo player) exitWith {};
if ((_boing < 1) && ("bla" in (magazines player))) then {
publicVariableServer "do_this";
};
if ((_boing > 1) && ("bla" in (magazines player))) then {
publicVariableServer "do_that";
};
else
{
hint "you need bla";
};
do i need to work with else { if { else instead?
if (boolean) then {
// Do something
} else {
// Do something else
};
Can't just put a random else there.
if (boolean) then {
// Do something
} else {
if (boolean) then {
// Do something else
};
};```
if (boolean) then {
// Do something
} else {
if (boolean) then {
// Further checking
};
// Do something else
};
Shame sqf cant implement elseif
call {
if (bool) exitWith {};
if (bool) exitWith {};
if (bool) exitWith {};
{CODE}
};
I just use
in fact: else if is technically in other languages nothing but the if else of arma
but as other languages support non-pharatesis blocks, it works without that ugly crap we do in arma
-->
if(...)
{
}
else
{
if(...)
{
}
else
{
}
}```
is the same as ```c
if(...)
...
else if(...)
...
else
...```
eachFrame is better than waitUntil for code for UI?
I assume eachFrame runs every frame regardless, but waitUntil will suspend until next frame is available and checks for that.
By this theory eachFrame is less performance consuming and I should use that instead...
you barely need the "rendering power" for actual per frame handling
Actually arma doesn't neeeeeed the {} blocks.. It just needs code
_func1 = {};
_func2 = {}
if (something) then
_func1
else
_func2
simple update of UI can be done in a spawn
unless you do heavy rendering stuff, avoid per frame
same for non-live updates
Yes, but in theory using waitUntil will eventually cause more performance usage than eachFrame
"each frame runs every frame regardless"
"waitUntil will suspend until next frame is available"
"Therefore eachFrame is less performance consuming"
wtf?
ui interaction does not cares for performance
eachFrame runs every frame. That's correct.
waitUntil goes into sleep state and does nothing..
I don't understand why eachFrame would be cheaper
It's to update a menu list and check if any texts are in the showtext que
TLDR onEachFrame is NOT cheaper.
_updateLoop = args spawn {`your while loop and update stuff`};```
do that
be happy with it
use waitUntil
and stop trying premature optimization
eachFrame is running 24/7. It's just running empty.
waitUntil would constantly check if it's his time to execute, it does not know if it's the next frame until the diag_tick has changed...
especially if it is based around some phrases some users threw around here
Wrong.
waitUntil checks once every frame ONLY if the game didn't spent too much time on other SQF scripts that frame
eachFrame executes every frame regardless
I could swear I have explained that to you a dozen times already
Yes, but
Dedmen - https://i.imgflip.com/1dxet4.jpg
:3
if there is too much code in scheduled, it would lag the UI... but then again if it's already that bad and I run the code in eachFrame, it will ALWAYS update the UI
True
Yeah, I'm overthinkign again, damn it
#fakenews
#offtopic_fakenews
expected the remix actually to be about that ...
#arma3_scripting_fakenews
Either way, now that I'm doing UI elements I have found this new thing out and yah, it is all logical and makes sense now. Thanks
Now I understand how they do the non-laggy nametags etc.
The question is. Is you UI in the foreground?
Yes, but you made me realize that it's not important for me to get this updated on every frame, so waitUntil will do as the impact will be 0.0004 ms per waitUntil that is running in the mission, which currently total around 5
If it is in the foreground it means your Users focus is on your UI. Meaning it being updated smoothly is more important than the background behind the UI being 30+ fps
As long as your code is only running while your UI is open. It doesn't really matter if you drag fps down to 10-15 which you probably won't be able to do anyway
yeah
I gotta stop premature optimization, because I keep going back on older functions when I remember something that would improve it by a tiny amount
I do a optimization run every now on then. It's quite fun for me
I love optimizing stuffz
๐
Hey guys, Is it possible to pack a mod into a mission?
No
I found a mod that lets you walk around ontop of moving vehicles, but It a performance hog, so we don't want to add to mod pack, but I wanted to use it for 1 missions.
That Mods add's a custom Model afaik. So answer stays No
cool, thanks for the answer.
my tiny SQF vm gets clearer in its shape every hour โค
ohh crap
my_var = [[{player call myFnc1}], myFnc2];
publicVariable "my_var";
Won't this just send the whole function? as in 100 lines of code...
publicVariable "my_var";```
It will send myFnc2 entirely yea
thats 1 thing
It will still send myfnc2
i though you wanted to have it executed
Send it as string
Thing is why are you doing it that way?
then compile
yea
Alright, thanks
myFnc2 = {hint "arma3";};
publicVariable "myFnc2";
or that thing with the string >.>
call myFnc2
yep
this functon is globally available using that var name then
if you only want it on the server send it via publicVariableServer
myFnc2 = {hint "arma3";};
myFnc2 = str myFnc2;
publicvariable "myFnc2";
call compile myFnc2;
publicvariable "myFnc2";
call compile myFnc2;```
arma will handle the serialization for network sending for you
Stepping back a bit, nigel what do you want to do? Have the client call a predefined function or share a new function with them
yep, thats the better question
call |#|compile myFnc;
Type code, expected string
Well yes but answer the question first please :P
Events for custom respawn system
So I can add scripts / code to the Events
Do the clients have the fncs already?
publicvariable "myFnc2";
call myFnc2;```
Yes, but I also want to be able to add code too
no need for the compile anymore
So they have myfnc1 and you add myfnc2?
Yeah
Then your original array was correct
my_var = [[{hint 'lol'}], [myFnc2]];
Except for the array brackets around the code brackets around the fnc1 bit
Yeah
Dont need those for it to work
(Idk the framework behind it tho)
Seems like unnecessary []s
aka overthinking the hole way through, baby
What if I only want to use it once for some ๐
^ that wont send fnc1 but will send fnc2 entirely
Hmm, really?
Idk your architecture but im sure you can design a way
Yes because it wont evaluate whats inside {}
And fnc1 is inside the {}
I think I might just make it so that it stringifies it when it registers the code and then it compiles before it executes
Probably easiest fix
ohh, nice thanks
No need to str it first and then compile it later
Maybe save that array into a var
And look at it in the debug console watch fields
Youll see what gets sent
It helps to understand whats going on
[[{call respawn_fnc_deadHudShow}]]
If {} are glorified strings, this is alright
I'll leave it like this.....
Check it in the watch fields and see
[[{[] spawn respawn_fnc_deadHudClose}],[{call respawn_fnc_timer_onRespawnUnit}]]```
This way I can designate which scripts spawn and which call, so I don't have to spawn them when the Event happens
Don't have to worry about wrong scripts running besides eachother,
Great, thanks ๐
Yeah, I tried vanilla respawn, missing basic functionality like respawn side, a list of dead players, availiability to respawn players when they are not on the server, etc.
easier to make my own thing than use vanilla
is it possible in mission.sqm to pinpoint a path for custom markers? C class Item26 { dataType = "Marker"; position[] = {25695.2, 0, 21367.3}; name = "Marker"; text = "Sofia"; type = "path\to\your\marker.paa"; id = 126; atlOffset = 0; };
or create an own mod and overwrite cfgmarkers i guess?
well, since we'r talkin about an existing mod - wouldn't it be possible to outsource cfgmarkers?
uh im not sure what you mean by that
got this mod running, cfgmarkers defined there in a *.bin - outsourcing it to add my own custommarkers
im not sure what you mean with outsourcing
you can create your own mod and add more, sure
yeh that for sure, hehe but i just wanna outsurce the class cfgmarkers and put it into missionfile
so instead of getting the class from the mod, getting out of the missionfile
you cant do that
missions can only edit the missionconfigfile, not the main configfile
not even overwriting some classes in configfile thru missionfile?
configFile, where cfgMarkers is under, can only be edited by a mod
so not by a mission
dang that
but couldn't i check, where the mod is lookin for cfgmarkers and overwrite that path? Like, mod is lookin in cfgmarkers from config, give the mod a new path to look at my cfgmarker file? (mod allow overwriting)
im not sure in how many ways i have to say you cant edit cfgMarkers with a mission
you cant
you need a mod
a pbo file containing a (possibly binarised) config.cpp file which adds to the cfgPatches and cfgMarkers is needed to edit cfgMakers
thanks for the information! ๐
i know its a bit sad but theyre really separate
yeh, indeed it is - just thought there might be a way around it
well, how do you define "markers" - with drawIcon i should be able to place an image, right?
or is it really drawn?
drawn in the sense the engine draws a picture on your screen
_mapControl drawIcon ["PATH\TO\ICON", _color, _pos,12,12,0];
hm...well basically i just look for an option to place an icon (instead of a marker) somewhere at the map - guess that's the way but that need lot of adjustment i guess
yeh just looked it up - might be the way
the coordinates on the map control correspond with game world coordinates
thanks, will give it a shot
@indigo snow since pressing "M" open map is a standard value, how would i achieve to/where to place the drawIcon statement? stucked here
you need to put it in an onEachFrame handler and excute that somewhere
keep in mind the onEachFrame in the notes is outdated atm
There's a map opened EH
you still need to draw it each from when its opened
Yeah,
phew...seems like i'm gonna cast away that idea
hmmh, the mod got an option to add clanmarkers saved in the database shown for each clanmember - so i might be able to bring them up for everyone instead of clanmembers only...
could be so easy, sad - dang
can anyone help? Im getting an error for this cutText ["<t color='#ffffff' size='10'>3 DAYS LATER</t>", "PLAIN", 0.0001, true, true];
it tells me 2 expected, 5 delivered
oh sorry "5 elements provided, 2 expected"
mhh ... anybody here got an idea how i could sort this correctly?
_arr pushBack ( _arr select count _arr - 1 ) * 2.5
each space separated 'block' being a single token
not directly SQF related, but SQF solutions are accepted too
so ... for simplicity: ["_arr", "pushBack", "(", "_arr", "select", "count", "_arr", "-", "1", ")", "*", "2.5"]
goal is to have a ranking table for each token when it would be executed (ignorable tokens shall be assigned a -1)
for this particular example that would be: [1, 0, -1, 3, 2, 4, 5, 3, 4, -1, 1, 2]
obviously that needs to work for everything else (eg. code, array, ...) too
_var = 12.5; _var = _var + 3; diag_log _var
-------------------------------------
15.500000
-------------------------------------
To Quit, Press any key.```
ok ... kinda solved it
to some extend
just searching the start and then using recursion to solve the left/right part too
anyone here could tell me what typename {} else {} returns?
just noticed steam killed my arma installation again ...
so ... if (true) then [{1}, {2}] should work too?
(typeName {}) else {}
thats why
could you check if the if (true) then [{1}, {2}] works?
np
so i need arrays first ๐
but that basically means else can be used to concat two values into array
Just SQF things.
_arr = 1 else 2;
_arr = [1, 2]```
((the `1 else 2` might not work though..))
now the question to be asked is: what is faster ๐ค
I'd guess the second
probably
but that also would mean: remove all your "else" from code!
it eats performance
the second of course, its a command less
count vs foreach too its a readability thing
you might save a second in about 5 years time
i will save 5 years in time if i stop with my current project right now
[1.000000, 2.000000, 3.000000]
{_test = "foo"}``` stuff starts to shape
https://cdn.discordapp.com/attachments/349557843239632897/349719418390970369/SQF-VM.zip in case anybody is interested in trying my lil vm it out
using "help" you can see the capabilities
please know it is limited
still it is just normal SQF ๐ (syntax errors might cause crashes too, so you wont even notice the difference)
if you call remoteExecCall twice, is it possible for the functions being called to execute concurrently?
ok great
@queen cargo thats pretty cool
Code is online at https://github.com/X39/SQF-VM
I tried using absolute values to make square:
w = 0.5;
h = 0.5;
That's still not a square. I don't get it.
Those translate to display coordinates
They do not correspond to pixels
Use safezone "magic" and you will be fine
Alright thanks for your answers I'll give both of your suggestions a read!
Hey everyone! So I found why the Scenario Name Module (missionnameModule) was drawing my Author text from the onLoadName pool, instead of the author pool.
_author = "";
if (count allcurators > 0) then {
_authors = [];
{
_curatorPlayer = getassignedcuratorunit _x;
if (isplayer _curatorPlayer) then {_authors set [count _authors,name _curatorPlayer];};
} foreach allcurators;
{
_prefix = "";
if (_foreachindex > 0) then {
_prefix = if (_foreachindex == count _authors - 1) then {" & "} else {", "};
};
_author = _author + _prefix + _x;
} foreach _authors;
} else {
_author = gettext (missionconfigfile >> "onLoadName");
};```
For some reason, the default function is to draw from the onLoadName, which is normally used for the Scenario Name you see on the loading screen.
What are you doing ? ๐
Well, I wanted to use the module to have this cool text show up down the bottom right when the mission starts, and it worked really well until I started using the description.ext a little more. When I did, it started saying "[MissionName] by [MissionName]" instead, which I wanted to figure out why :c
Alrighty
A screenshot I took of the issue http://i.imgur.com/Avt8ThS.png
But yeah, so I went digging into the module to find out exactly why it's drawing from onLoadName and not Author, which it should be, all things considered. And I found that code I sent above.
So you want to fix it?
Make a new function based on that... fix issue... use that instead
Well, I don't know if I can fix a module, though I should probably report it for being borked.
Oh, I guess that would work. I was just going to find what they used to display the text, and use that.
Just seems a little silly that they draw both the mission name and the author name from the exact same variable :P
well, turns out they are human after all... ๐ฆ
Aww, now hastebin isn't workring for me :C
consider this code:
player setVariable ["s", [[]], true];
private _a = player getVariable "s";
(_a select 0) pushBack 1;
hint str (player getVariable "s")
the player variable was changed. Does this mean that the line (_a select 0) pushBack 1; uses network?
I think it's same as (_a select 0) = (_a select 0) set [(_a select 0),1];
So no...
uses network?
Local to the client only
setVariable [var,value,TRUE]; only sends it out once
After that the value gets unsyncronized
Created my first issue on the Feedback Tracker :D
I actually quite like how it's laid out. It's nice.
ahh, yeah. forgot about that. Great. Thanks @peak plover and @dusk sage
@tardy yacht Did you try what I told you? You tried to use safeZoneH in width. Which is obviously gonna give wrong results. You need to use Height for Height and Width for Width
If I use the same number in both i.e.:
w = 0.5 * safezoneW; //1.212121
h = 0.5 * safezoneH; //0.9090
It gives me a rectangle. If I use:
w = 0.5 * safezoneW; //1.212121
h = 0.5 * safezoneH; //1.212121
It's still a rectangle.
How about
w = 0.5 * safezoneH;
h = 0.5 * safezoneW;
Oh yeah that might be a square.
If it's not it could at least fool people into thinking it is.
Just take a ruler and hold it up to your screen ๐
I was thinking of doing that but thought that would be stupid.
I'm gonna look pretty dumb doing this
Yeah that's a 4 x 4 (cm) square!
neat
Thank you
safeZoneW get's wider the wider your screen is. And if you measure your screen and just take 0.5*width and 0.5*height ... I lost my thought... Ehh... Congrats...
So i havent done much controls, but arent x and w supposed to be absolute pixels?
Even when using absolute values (no * safezoneX) it's still relative to a 4:3 box.
What is the most reliable way to detect what hitpoint (of a person) got hit? I'm using a HandleDamage eventhandler and the hitpoint that (seems to) get hit is not always the hitpoint that took most damage.
is this what you're after? https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HitPart
i dont think it wouldnt be too much more accurate that handledamage, just shows all points hit with some more info
how would i temp ban someone?
probably over something like this:
https://community.bistudio.com/wiki/serverCommand
Does HitPart work in MP?
@still forum yeah apparently that works only sometimes. I have just tried on an existing thing
w = 0.0575 * safezoneW;
h = ?;
I don't know how to apply the math there. I can't just
w = 0.0575 * safezoneH;
h = 0.0575 * safezoneW;
As this will change my boxes' width.
I can do
w = 0.1 * safezoneW/ safezoneH;
h = 0.1 * safezoneH;
And that'll be a square, but
w = 0.1 * safezoneW;
h = 0.1 * safezoneH / safezoneW; //Or safezoneW / safezoneH
still gives me a rectangle.
The GUI aspect ratio is 4:3 ...so try
w = 0.5;
h = w * 4 / 3;
That should be a square
Wont be on all monitors, tho
Try checking the new panel controls, theyre square for sure
He can also try pixelW/pixelH
But AFAIK the GUI internal aspect ratio is always 4:3
http://killzonekid.com/arma-scripting-tutorials-gui-part-3/
Have a look at the picture below. The blue box in the centre is your anchor. It is exactly the same on every monitor and every screen. It is always 4:3, it is always positioned at 0,0 and its size is always 1ร1.
Cheers, thanks for the link
I have tried the 4:3 thing, it does work but I'm trying to make it fit all screens with the safezone.
what are you trying to do?
make a square in the center of the screen? or in a corner/on a side?
topleft = safezonex, safezoney
bottomright = safezonex + safezonew - w, safezoney + safezoneh - h
center = 0.5 - (w * 0.5), 0.5 - (h * 0.5)
@tardy yacht You should be able to calculate the screen ratio using the safezone commands
For height wouldn't it be safezoneH / safezoneW?
I don't get why it works for width but not for height.
@still forum When you add multiple styles together in a control, how does the game know what specific styles were applied if the game only gets the final sum of the styles?
Like ST center 2 and uppercase 192
binary
The game only reads the sum 194 and knows what styles you specified
Yes
194 & 192 -> true
192 & 2 -> true
192 & 4 -> false
I think it's called "Enum flags" ?
192 in binary is 11000000
2 in binary is 00000010
so
00000010
& 00000010
->00000010
and every number that's not 0 is equal to a boolean true
https://community.bistudio.com/wiki/Dialog_Control#Control_Styles_Defines as you can see each one increments by ... uhm... wait..
Vertical Center is Up+down.. Which.. does somewhat make sense
So 194(10) is 11000010(2), which is what the engine reads, right?
yes
Problem is.. They can't differentiate ST_UPPERCASE and ST_HUD_BACKGROUND
This is like enum flags "BI totally messed up" style
No they actually can because they... Gosh is that crappy code...
Does the engine go through the possible styles then and looks what logical of the binary representation equals the style? As in
11000010
& 00000010 which would be
= 0000010 so it would know that style 2 applies
when checking casing they first & the value with 0xF0 and then check if the value exactly matches ST_UPPERCASE
yes
somewhat
Wait I can give you an example
Oh gawd this is flawed in my head
switch (type & 0x03)
{
case ST_DOWN:
case ST_UP:
case ST_VCENTER:
}
They are first removing everything besides the first 3 bits. And then check which value matches exactly
switch (type & 0xF0)
{
case ST_UPPERCASE:
case ST_LOWERCASE:
}
It is only a little fucked up... Only a tiny winy bit
So I have 1100 0010. First remove everything but the first 3 bits
So I end up with 1100 0000
Nevertheless, is this a common technique?
Will look at it now
@still forum Ahh makes sense now
So each bit represents one flag
๐
So all the game basically does it check for each type that exists and see if the corresponding bit is == 1
In the style number
Make sense
*makes
Silly me
The binary explanation was 100 times better than a decimal
How would i change if (!((headgear player) to be for facewear? like glasses and stuff
addGoggles
if (goggles player) ?
if (goggles player isEqualTo "Glasses") then {};
wtf is that name?
makes me wonder who in unicode consortium had a great idea to include oversized characters
dont know honestly, saw it on maybe the rainbow 6 discord and i just added it to mine lol
@devout niche lul
you used the quick list that pops up ๐
ah it's a fuzzy search nvm then
lol
It is annoying, tempted to block so i don't have to look at it ๐
ill change my name
๐ฎ
shit ill cry on altisliferpg ill do it
yea... i cant change my name. someone want to change it to just "neil" lol
i can't locally change my name for this discord server
it's not the end of the world ๐
ill revoke you from real life ๐
Hello. Does anyone know if there a way to pull information about date/time in real life so I could run scripts based on that?
If you are using extDB2/3 for mariadb/mysql backend it can return localtime/utc time aswell
When a script uses the total runtime of 3ms in a frame, is it placed at the front or end of the queue in the next frame?
in scheduled. all that does not run on this frame will be in the front on the next frame