#arma3_scripting
1 messages · Page 531 of 1
i.e. putting it in a trigger in mission would be silly
but might work
wanted to see if there were alternatives that were file based
i.e. init.sqf
idk im learning arma 3 scripting at the moment, as far as i know init is Executed when mission is started (before briefing screen)
How can I temporarily hide the listbox at the top-left of the map display (the one with briefing and such things)???
I have found their IDC, but if I try to ctrlShow false they appear back at the next frame?
😮
Did you ctrlCommit as well?
yeah
Hmm
@coarse plover Don't do that. Use ```
if (isServer) then {setTimeMultiplier 0.1;}; //In init.sqf !!!Stopping time entirely isn't possible with this command!!!
The loop is wrong with the loop
well it works
I thought you'd say something like it being taxing performance or something but no issues are apparent. I prefer your method though as it's more graceful
+You just have to execute that command once. Not constantly
Don't do that. Use
check up the wiki, the minimum multiplier is 0.1
I don't understand you. setTimeMultiplier script command is capped. You suggested to use script command.
Nevermind.
@coarse plover M242 is right. setTimeMultiplier can only slow it down to 1/10 of the original speed. Stopping isn't possible.
then I'll do as I was! thanks!
Just make sure setDate is executed on every client because its effect is local.
https://community.bistudio.com/wiki/setDate Here's an example with remoteExec
ahhh fantastic ty
If I wanted to start my mission a certain way. Would I place a script inside the init.sqf or ?
Looking to start a mission so the screen is black and fades to the player few.
@cosmic lichen I'm fine to use the loop, the command is fine to execute server wide as long as you're not changing the year
just a heads up
I did some tests and it works for me and 3 others
@tribal stump https://community.bistudio.com/wiki/Initialization_Order this may help
init.sqf would work for you
ok thank you!
what happens if you change year?
if you modify the year the effect is only server side
clients continue to see the same year
are you remoteexecuting it?
That's what I'm talking about, there's no need to if you don't change the year
and I'm not changing the year
so remoteexec is not required
so, nadda
the effect of setDate command is local. The fact that it syncs for clients is not intended behaviour
it is the result of some other syncs
thus not guaranteed to work
@coarse plover Not sure what that link tells me. I think I should give more info.... Im trying to make a mission where both players were in a helo crash. And have the screen fade from black(Maybe with a blur, if possible.) Or fade in and out of black a couple of times until the player is given control.
Nevermind. I got. The init.sqf only fires when the mission is started right. It wont fire every time a player dies?
Still can't this script to work right. Just fiddling around with the numbers. This is what I'm working with.
0 = [] spawn
{
[1,"BLACK",3,1] call BIS_fnc_fadeEffect;
sleep 15;
[0,"BLACK",3,1] call BIS_fnc_fadeEffect;
sleep 5;
[1,"BLACK",3,1] call BIS_fnc_fadeEffect;
sleep 5;
};
I would like the screen to remain black for a good 20 seconds, then have the black fade away for a few seconds. And then repeat a couple times. Until the player is "conscious"
hey, i'm pretty new to making missions in arma 3 but i was wondering if there was a way to only have the ai enabled when the player is inside a certain area? (is this the right channel btw?)
When you say enabled, do you mean spawned?
@kind marsh Check this thread out. https://steamcommunity.com/app/107410/discussions/17/558747288128397180/
i have placed ai around the map but i assume that's pretty heavy on the game to have a ton of ai active all the time so i wanted to have them spawned but do nothing until the player is nearby.
i'll check it out thanks
From my experience in MP. I'd say yes. If you've ever played on servers that are like an insurgency based. A lot of people don't like to have multiple AO's active at the same time. It bogs the server/game down.
You could do a wave type system. Just like Nazi Zombies.
So when you kill X amount of players, more AI spawn/move into towards the player(s)
it will probably just be single player or co op with 1 friend. the thread you linked helps a lot thanks!
I need to change the texture of an object that returns [] when I call getObjectTexture object. I know there is no way to use setObjectTexture so now I'm looking for an alternative solution
Make a mod, inherit from the object and apply own texture
if the object is configured for changeable textures to begin with
Presumably
sounds like its not
if getObjectTexture returns nothing
@zinc rapids what object is it
Not all objects that have config textures can be tweaked with scripts
It's a concrete peir
@dire star The reason time is synced between players with setDate is most likely due to the reason that the time was set on the server. From there it's automatically synced with all clients by the engine. At least that's how I remember it. I am not sure how often it's synced though.
You could get the layerID by comparing existing layers before and after the new one is created https://community.bistudio.com/wiki/all3DENEntities
Not sure if that solves the issue.
getMissionLayerEntities did the trick
@cosmic lichen Not long ago setDate was not getting synced. And then it did. Nothing was done specifically to it. My guess it happened after weather attempted sync, but in any case it is a byproduct and there are no guarantees
I thought the sync issue was just with the year?
that was never synced and is still not synced. At least now it is JIP compatible
So JIP clients will have a different date?
do you understand what JIP compatible means?
Yes I misread sorry
no worries
Is it possible to check for two event handlers simultaneously?
I want to check for a listbox change as well as an ALT + Left mouse click
so a combination of LBSelChanged and MouseButtonDown
Possibly I could record the time that the listbox selection occurs and check the time difference in the mouse event?
Maybe there is a better way though?
How can i load a website on a button click?
Open your browser. Type a website. Press enter
Where do you wanna open a website? Give some informations what do you want to do
I assume he wants to open a web site with MS Edge when a player clicks a button in arma
function called via [this, 0.2] spawn ...functionName...
I have a Btn Called "Go To Website" so i want the function of it to open a browser and open the website
I don't think you can open websites via button for security reasons.
You can open YouTube videos via the command however.
Alternatively, you can have text be clickable via the parseText command
@tiny wadi if you add (on)MouseButtonDown EH to the same control, regardless of the order it should fire before the selection EH so you can capture Alt key status from there
@dim kernel https://community.bistudio.com/wiki/Structured_Text there is an example there as well
Or you could use an extension, but that is more complicated
the URL fetch by KK right?
No, it doesn't open browser
has to be custom extension launching browser instance with given URL, could be quite simple but the whitelisting will make it complicated
Ahhh
disableSimulation I think?
i try it, can i have action too
I… don't get it?
i have the action and i can pick it
well then I don't know, why would you need that?
i am doing a csgo case on arma 3
and, the animation include an weaponholdersimulated with a rotating weapon
why not spawn the p3d with simpleObject? I would believe it is possible with the p3d path
because rotating is so weird
like jumping rotating
and its look weird
i use weaponholder rotating weapon from kk
ah yes, simple object's simulation cycles are more spaced
well, then I don't know
😦
someone else here may have the answer though
Gentlemen i'm a complete newb in regards of scripting, but i'm running a small aliens inspired op, and i would like to have a little thing to simulate what is seen in the movies. I'm trying to add an action so that a specific role can move up to a terminal, execute a script that shows the hacking in progress bit, and then unlocks the door.
The door i'm using is an OPtre door, which doesn't have door animations that i can just activate, so i was just thinking of spawning it in with simulation disabled and having it enabled by the end of the action.
The script i'm trying to use to show the hacking is https://www.reddit.com/r/armadev/comments/7gubtp/customisable_keypad_cracker_script/
Any help or pointers on how to do this?
fixed @winter rose
i created an Land_Can_V3_F and attach it the local vehicle, and rotate local vehicle 😃
thanks u turn on my light bulb
and what do u want to do the script @crisp turtle
Hey, guys, im trying to get why exactly my hotkey blocking do not work fine with shift+key combo. May be you get an idea?
As i see in the keydown handler output when you press the shift +key it returns two keydown events - one for shift and one for key with shift combo bool
[[Display #46,42,true,false,false],[Display #46,58,true,false,false],
so, i wonder why doesent it block any key among them?
kka3_reload_handler = {
disableSerialization;
_display = (findDisplay 46);
private _handler = _display displayAddEventHandler ["KeyDown",{
hintsilent str _this;
justsee pushback _this;
[_this select 1,[_this select 2,_this select 3,_this select 4]] in pzn_radiokeybinds;
// (_this select 1) in pzn_firstradiokeybinds;
}];
pzn_transmit_handlers pushback _handler;
};```
@knotty arrow From what i gather the script itself doesn't do anything other than just show a hackign in progress thing and the string getting filled, but at the end of that script exec i'd like to have the door switch to disable simulation to enable simulation, so that they can actually go and open it
maybe u are not using the correct params @calm bloom
with shift or ctrl
@crisp turtle try with a simple hint to try to work, why u want enable enablesimulation or disable it?
holy cow, you are right
😃
probably the cba keybinds and keydown event have different order
maybe
@knotty arrow The door i'm using is from OPTRE, and i don't see or know what the animation is to have the door open. But if i disable simulation the player cannot open the door, so if i enable it after they've done the "hacking" they can open it.
try this
{
_building setVariable[format["bis_disabled_Door_%1",_x] ,0 ,true];
} forEach [1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20];
uuh, how? I'm sorry, i'm really don't know how to use this 😛
The door is an object itself
That has an action "open door", that when used lowers the door
ajam
I sorry for being this dumb kek
no problem
look up the doors config in config viewer to see the user actions script
replace _building for ur _Doorvariable
it shows what part you can animate
its new goat, i don't think that he know how to do it
good time to learn 😄
😃
type utils 2 in debug console
Thanks, worked
statement = "this animate [""Door_rot"",1];";
Apparently this is what "open door" does
try using animateSource
Some buildings (e.g. CUP Hangar) use the "source" to animate the whole gate segments as one action.
Oh good lord that worked
On the subject of animating doors, I'm currently using sqf fish animateDoor ["Door_1_source", 1];
Which successfully opens the ramp of a blackfish fully. However I want to level out the ramp instead of opening it, is this possible?
what do you think 1 does?
then you did it wrong
because it is the animation phase and it should animate up to it and stop
Tried a few more things, values equal to and lower than 0.5 close the ramp fully, values equal to and greater than 0.6 open it fully
I apologise, it seems the command is broken and the phase is rounded
Memlegen, i managed to do the thing i wanted to do with
hacker init
this setVariable ["allowhack",true];```
keypad init
```sqf
this addAction
[
"Hack Keypad",
{ execVM "keypad.sqf"; sleep 15; blastdoor animatesource ["source_door_1",1]},
nil,
6,
true,
true,
"",
"(_target distance _this) < 4 && _this getVariable ['allowhack',false]"
];```
And it works in SP.
Put it on my Server, doesn't work anymore. The keypad bit shows up, but when the timer hits 15 the animation doesn't start. Anyone has any idea how to fix this?
@crisp turtle please use ```sqf ``` around your code
Was trying to fix that yeah
as in
```sqf
hint "hello world";
```
↓
hint "hello world"; ```
Fixed it, thanks
(_target distance _this) < 4 you can set it in action params
Hello all.
Question :
if I set public as true in varspace setVariable [name, value, public] will all varspaces be updated with the same value or will the value still only be related to the varspace but all varspaces will know that this particulare varspace has a variable holding this particular value ?
In what is it different from a simple
name = value; publicVariable "name"; ?
one varspace
your second code will be the same if varspace is currentNamespace
"but all varspaces will know that this particulare varspace has a variable holding this particular value" varspaces don't know anything about eachother
I meant clients
so...
if playerA has : player setVariable ["MyVAR", true, true];
It don't necessarily mean that playerB has MyVAR = true right ?
corrrect
ah great
if you set a variable on objectA it won't suddenly appear on objectB
okay be ojectB will still know that objectA has that var holding that value right ?
that's why it's made public
if varspace is currentNamespace
currentNamespace can be not missionNamespace and so it will fail
objects can't "Know" anything
"currentNamespace can be not missionNamespace and so it will fail" what?
default namespace is mission.
so currentNamespace will be missionNamespace
currentNamespace is currentNamespace
No it's not
yes it is
Hold on, you can argue on that later.
Don't loose me in my learning
there is no "current" namespace
currentNamespace is a command, that returns the, current, namespace
currentNamespace is whatever namespace your script is running in
and could be uinamespace which is not broadcastable
except in UI eventhandlers or config scripts
Well in that case what I said is still true
publicVariable won't work in uiNamespace either
@quartz coyote all "machines" will see that variable on that object
machine can be a player or server or headless client
that's what I meant with my non-expert language.
Thanks for understanding me 😉
Many people miss the difference between player and a player and machine
all are different things, kinda
how to get the vehicle actual name, not it class or variable?
what do you consider a "name" ?
Dedmen
Like the gorgon?
Tell me what you mean by name
a variable name and a classname are both names
but if that's not what you want, what do you want instead
The name displayed in editor? when you try to place the vehicle
Im looking at a gorgon, hes variable is IFV so im using CursorObject and returns IFV, but I want hes name that he is called as "Gorgon", so how do I get that?
I think you might be talking about the displayName?
the name displayed in 3DEN on the right side in the unit panel
but how do I get that in game and in a script?
from the vehicles config
and you get the config using the vehicles classname
which you get via typeOf
getText (configFile >> "CfgVehicles" >> _classname >> "displayName")
So it will look like this
_classname = typeOf cursorObject;
getText (configFile >> "CfgVehicles" >> _classname >> "displayName");
Returns "Pandur II" (because of ACE)
yeah
Thats what I need, tanks.
Guys. I have a horizontal scroll bar. how to make the mouse wheel turn this strip?
the side of thep player can differ from the side of the group the player is in. You are probably setting the player captive.
so instead of side player use side group player
isn't there a playerSide somewhere?
playerSide will not show correct side if player joins a group that was not his original side.
something like this normally does not happen, but eh.
side group _unit works for AI as well, so i recommend it over the other command
Would anyone be willing to Talk to me about options available to prevent client side hacking. We are planning to start a server with a server side addon that is not required for down load on the client. We have been told that this will prevent us from enabling validation of signatures and file patching which will make us vulnerable to client side hacking and script bunnies.
We really need some positive advice/direction on things we can do the minimize this, because as it stands I may not host the server at all if we cant find anything. Please private message if your willing to talk about it or tag me here with your thoughts.
Thanks
You should either remove this msg or one in #arma3_config , crossposting is not allowed here. @exotic tinsel
@hollow thistle done
Truth be told you can’t prevent it @exotic tinsel
Well you can attempt to prevent it but you can’t stop it...
Also you can enable signature validations with server only addons, not sure where you got information that you can't do that.
Also, to help you have a little bit of a better understanding, when you use client side saves, this means, somehow, somewhere the users save will be stored on their own computer. Which of course means at any moment they can find it, edit/modify it to their liking, and do as they wish. That’s why you should have server sided saves instead, this enables the save to be saved to their computer, however when they connect to your server there is a server check between the save they have and the save your server has and it autocorrect whatever variables to the ones that were saved upon previous logouts/server restarts
anyone knows the displayname for the settings?
because i reworked the Escape Menu but i dont know the settings name
Is there some SQF command that provides good resolution timer? diag_tickTime provides only 1ms resolution 😢
or is it Intercept time again 😄
anyone knows where i can find them?
@dim kernel you mean the display's class name?
ye
@shut torrent is it possible for players to modify mission files once they join the server for example the onRespawn file?
for example this is the escape menu RscDisplayMovieInterrupt
but i want the video settings and audio etc
As long as you continuously run server checks upon login/logout no
Not that I know of at least
@shut torrent where do i enable that? do you got a link or something?
You have to create the server checks yourself as far as I’m aware
And usually you have to be running your own server
@hollow thistle thanks for the info that reassures me, ill set it up. thanks
And run checks through a “link”
I’d help you if I could but unfortunately that’s way above my pay grade which is why I don’t run dedicated servers of my own lol
@shut torrent we have a dedicated server. ok, any other things we can do? ill have to do some research on what you mean by creating server checks
not sure another guy deals with that. i just write the code for the server.
Server checks would go through your serverinit I believe
is it some kind of process for checking their files or something?
we dont have saves enabled.
Assuming they save when they exit and it remains the same when they log back in
Ahhh okay
So as they log out you wipe the character
we dont do anything on our part, but we dont have saves enabled on the server. when they connect they spawn at a default location with a kit and go do missions then disconnect and repeat next time they log on. sever restarts every 24 hours we dont use DB. its not progressive server just quick access to combat action
Oh, then your main focus will be script bunnies
yes! def
any suggestions on measures we can take when using server side only addons
Well what are you trying to prevent? Start up “hacking” or in progress “hacking”
both, we are not knowledgeable of this side of arma configuration and research is limiting on the topic.
Well, usually if you’re looking to prevent that kinda stuff you’re running a dedicated “life” server so to speak which progresses as time goes on. In terms of a quick mission, I mean besides reiterating the checks I was talking about earlier there’s really no quick fixes... Even with the checks it’s not always guaranteed to prevent. Hence why you have programs like battleeye anticheat software etc
Besides if people wanted to hack a quick mission then that’s on them. I personally don’t think it’s worth putting all that time and effort into that when they can still technically bypass these things. Besides who would wanna hack anyways, it destroys the fun in missions that were created with the intent of providing it.
Just my two cents
much appreciated
No problem, best of luck to you!
Hey, sorry to butt in, I'm experimenting around with scripting and the editor a bit and have been trying to use documentation to the best of my abilities and could figure a few problems out myself, but this has me stumped.
What I'm basically trying to make an AI do is
- wait until player enters their vehicle (a helicopter, in this case)
- then navigate to a waypoint and drop them off
My code 'til now looks like this:sqf [] spawn { _group = group (_this select 0); _pos = getMarkerPos ["Marker1", true]; waitUntil {sleep 1; player in (crew heli1)}; _wp = _group addWaypoint [_pos, 0]; _wp setWaypointType "TR UNLOAD"; }However, I seem to not quite grasp scopes well? I found out that I would need this[] spawn { }structure to use waitUntil and sleep in the unit's Init, but I can't figure out why the variables I define seem to not stay that way. The error in specific I'm getting isUndefined variable in expression: _group. If anyone could help me out with this or point me in the right direction, I'd gladly appreciate it!
There’s multiple YouTube videos on insertion/extraction
Give me a sec and I’ll link you one
That I found most helpful starting off
@tough abyss
Thanks, I'll check it out and report back
The method in the video does seem easier, though I'd like it to choose randomly from a group of markers, once I get to that point, can I incorporate that into the method shown in the video somehow? Perhaps by moving the existing waypoint?
So essentially you want it to randomly choose a path and then have it insert upon waypoint of the chosen path?
@tough abyss
well, basically I have, say, five markers, so five potential places for landing/insertion
I don't really care much for the path as they're all around the same general area, placed around a town
Okay
That is a topic that I created a while back
Take a look and use what you’re after
Will do, thanks
No problem
@exotic tinsel
We are planning to start a server with a server side addon that is not required for down load on the client. good idea.
We have been told that this will prevent us from enabling validation of signatures and file patching First one is bullcrap, second one.. Well yeah, filepatching is disabled by default, and should be left disabled (though you can enable it only on server and still stay save)
which will make us vulnerable to client side hacking and script bunnies if you really disable signature verification then yes, sure.
@astral dawn diag_tickTime provides only 1ms resolution where did you get that from? It provides time since game start in seconds, with the max resolution a float can do, which is about 7 decimal places I think? That's more than microsecond precision, not millisecond.
Might be intercept time yes, depends on what you are actually trying to do
@carmine oak with a script command no
@astral dawn if you need better time make extension
@still forum I got it from wiki and confirmed myself that its resolution is 1ms at game start and degrades over time https://community.bistudio.com/wiki/diag_tickTime
Does your profiler has a timer lying around maybe?
profiler has no script command to report time
how have you confirmed it?
you know that converting numbers to string without toFixed will truncate them?
Well we have a function wrapper that measures execution time and logs it. So I hit the 'measure performance' button in the console, and it reports that my function is taking like 200 microseconds. I check my logs, they report 1ms time difference (from the wrapper).
But i didnt convert seconds to milliseconds, I will try that maybe
again, logging numbers truncates and rounds them, unless you use toFixed
Wiki is written by the community
toFixed script command is newer than that note on the diag_tickTime page
Ok I will see if my issue is a conversion problem
The wiki is usually right, but not always
You might also check time. I don't think there is a command to get uiTime?
Nah I couldnt find uitime
Time gets accelerated unfortunately, but might divide it by acc factor
I remember some time command that directly takes system clock 🤔
Anyway, floating point is only like 6 decimal places? After 1hr it will be 1ms anyway
I've added a command to my profiler todo list
will return
[seconds, microseconds, nanoseconds] since game start.
With a 3 element array you can nicely use vectorDiff too
Yeah it would be cool. I have thought of something like 2 commands to start and stop measurements, and return the results. But it would need to work with scopes 🤔 probably would need to be wrapped in variables somehow
If tickTime is really only 1ms then SQF-VM is broke 😄
Well you can just grab time at start and end, and then vectorDiff them
Will only use rounded whole numbers. Which means precise up till 16777216 seconds. 4660 hours. Should be enough
Biggest microsecond value would be 999999 which is still well within the precision.
And nanoseconds only go up till 999.
@astral dawn ^ derp
Please tell me when you tested diag_tickTime. If the 1ms precision is correct, SQF-VM needs to be fixed
oh wow, I just got up and you have already done it and built it :D
Yes I will test diag_ticktime now!
I thought I couldn't build because I don't have the certificate at work, but turns out I have 🤔
_dummyLoad = {
_size = 60;
_a = []; _a resize _size;
_b = []; _b resize _size;
_a = _a apply {666};
_b = _b apply {666};
private _i = 0;
while {_i < _size} do {
_b set [_i, (_b select _i) + _i*(_a select _i)];
_i = _i + 1;
};
};
private _diffs = [];
private _nExp = 10;
for "_i" from 0 to _nExp do {
private _tStart = diag_tickTime;
call _dummyLoad;
private _tEnd = diag_tickTime;
private _tDiff = (_tEnd-_tStart)*1000000; // Convert to us
_diffs pushBack _tDiff;
};
_diffs
On my computer it gives: [0,976.563,0,0,0,0,0,1007.08,0,0,0]
So yes it is 1ms
Why would sqf-vm need to be fixed though?
because sqfvm is not limited to 1ms precision
And again, you are not printing with toFixed
so the numbers get truncated :U
But converting to µs fixes it? But the numbers you printed don't look like µs
1000us is 1ms and we get roughly 1ms 🤷
I could do round and it would be ok for this case
If it were 1ms precision, you would get exactly 1ms.
🤔
Maybe it's artificially limited to 1ms? I don't know
Ah now I see, it flips between 0 and roughly 1ms.
It should be exaclty 1ms tho 🤔 wtf
Unless your precision is already so far off... But it should be exact for atleast a couple hours
I ran the game for a few minutes 🤷
Indexes are messed up I think? https://github.com/dedmen/ArmaScriptProfiler/blob/cb5d59f244207f6e107bdece6c1f247ff88a2021/src/scriptProfiler.cpp#L278
And it returns something like [281,0,0] in game
so last two elements are 0 always, first one seems to be nanoseconds
Hello all. i'm having trouble with the select command. I'm obviously miss understanding something.
I'm trying to return true if the nearest man within 25m of my marker is of type b_soldier_f and false if not
nearestObjects [getMarkerPos "spawnLoc5", ["Man"], 25] select {typeOf vehicle _x isEqualTo "b_soldier_f"}```
Can't understand what i'm not doing wrong
why not use nearestObject ?
🤦 crap, brain no worky
because there might be more than one
and the end objective is to count the number of them
count (nearestObjects [getMarkerPos "spawnLoc5", ["Man"], 25] select {typeOf vehicle _x isEqualTo "b_soldier_f"}
)```
Then use count?
if the nearest man within 25m of my marker is of type b_soldier_f
^ it's a one man request?
Your isEqualTo will never return true, as isEqualTo is case sensitive and your classname is wrong.
use
{condition} count (nearestObjects [...])
Also nearestObjects takes classnames, if you want to filter by classnames, why don't you just do that in there?
nearestObjects [getMarkerPos "spawnLoc5", ["b_soldier_f"], 25]
done?
The description on wiki page says "Classname"
i'm not gonna argue on the pedagogic level of the wiki...
Is there a way to delete the "" around a value ?
for example :
I have an array in which I have values like "value"
is there some sort of !str
select
oh ?
"myString" select [1, 4] = "yStr" ```
I defined the value
are you sure there are " around the value? Or just around where you display the value? strings get quoted in debug console, but contain no quotes
wait. lemme be a bit more clear
array = ["value1", "value2", "value3", "value4"]
in this array, my _x is going to be "value1" and so on.
But in some specific cases I want my _x to be value1 and not "value1"
it's a marker name
marker names are strings
and i'm trying to use it as namespace
markers have no namespaces
fak
So if I want to be able to use my var in any namespace i'd use missionNamespace ?
yes. I already knew the answer here.
sorry
profilerTime
Returns the time since gamestart as [seconds, microseconds, nanoseconds]
As said you can just use vectorDiff to find elapsed time. endTime - startTime.
Tried to make the command as precise as possible
https://github.com/dedmen/ArmaScriptProfiler/commit/34364cdde460d781337f11dcd944948ffd741d10
@astral dawn ^
My mistake never happened 🙊
Will try that!
I have multiple vars format [string, number].
Is it possible to sort all those vars (in an array maybe?) only on index 1 of each var ?
if you can convert it into [number, string] then sort command can sort it
@still forum It's alive!!
private _tStart = profilerTime;
_a = atan 90 + cos 90 + sin 0 + 1 atan2 1;
private _tEnd = profilerTime;
private _tDiff = _tEnd vectorDiff _tStart;
// Convert to microseconds
private _us = 0.000001*(_tDiff#0) + (_tDiff#1) + 0.001*(_tDiff#2);
_us
If you add them all back together you're loosing precision :u
well if I aim for microseconds then I'm good but yes
Well seconds will mooooooooost likely always be 0, so it won't matter
I just hope you don't disable it in scheduled >_>
1000 nanoseconds is 1 microsecond
so if I get 999... then I must convert it to 1 microsecond.... by dividing it by 1000
Okey, the seconds things is wrong then
Didn't know which, just knew one must be wrong
when I first made this I had both wrong 🤦
I'm struggling with my arrays :
I have arrayA = [var0,var1,var2,...] in which each var is format [number, string].
I'd like to create an arrayB only holding the vars from arrayA that have a matching string in index 1.
How would I do that ?
arrayA select {_x select 1 == "string you wanna have"}
select all values where condition is true
Hello i have ran into an issue: I spawn crates and fill them with material from an array, always checking if theres enough space in the crate befor ethe next item gets added. Now, with rocket launchers, if i take one out of the crate by hand, and place it back in, it suddenly takes up 3 times the amout of "space". any idea why that is?
if (_crate canAdd [_SanMatActual,_numberAdd]) then
{_crate addItemCargoGlobal [_SanMatActual,_numberAdd];};
it only seems to affect the rocket launchers
I remember some mass problem with rocket launchers, also from normal inventory
Something about mass of ammo being counted twice
is there a way to fill the crate using the same "sized" launchers that the player will experience?
so if i take one out, im able to put it back in
is there a nameSpace for a "Side" ? west / East ...
you mean if I do WEST setVariable ["myVar", true] it'll be available only for Blufor sided ?
um
no
no, afaik declaring a variable west doesnt do anything.
it'll be available only for Blufor sided that is in general not at all how namespaces work
flashranger are you trying to unlock something for one side only?
i'm just trying to make a variable available and defined only on one side
please @still forum you know I can't put the correct words on what I mean.
make 2 variables, one for east one for west?
right ... but how would I do that 😄
You can call setVariable via remoteExec and give it a side as target
and just set in missionNamespace
@still forum but I thought missionNamespace was a namespace available to all "machines"
I don't think you understood namespaces
probably not
All namespaces (Except local only locations or local only vehicles) are available everywhere
so ... when I do player setVariable ... don't I define a variable only for player ?
You do
on the object that the player script command returns
But everyone can access that objects namespace
But if you don't make the variable "public" the others won't know that it exists
It's just a pre-defined namespace that everyone has
just like uiNamespace and profileNamespace
but missionNamespace get's cleared at mission end
so when I do myVar = true, what namespace is it sent to ?
I think you can imagine it like emails.
On your computer you store emails in multiple folders, the namespaces.
missionNamespace setVariable ["test", "value"]
You store a E-Mail named "test" in the folder "missionNamespace" and with the content "value"
Now your friend in another country has the same folders. But if you didn't send the E-Mail to him, he can't see the email that you stored in your folder.
If you do
missionNamespace setVariable ["test", "value", true]
You create a E-Mail, and send it to all (true) your friends. So all your friends will now also have a "test" email in their "missionNamespace" folder.
what namespace is it sent to currentNamespace, which is generally missionNamespace.
I understand
more or less
still syfy but it'll blur out eventually
so, back to my first issue : if I want send a variable only to blufor side i'd remoteExec it.
remoteExec [myVar, WEST]``` ???
Read again what i wrote
I didn't say to remoteExec a variable.
Which btw makes no sense if you read the wiki page
ooooh
lemme try again
[missionNamespace, ["myVar", value]] remoteExec ["setVariable", WEST];```
cool
if I have arayA = [var0, var1, var2] (values would be [1, 6, 5])
and I do a array sort false it'll return [6, 5, 1].
Is there a way for it to return [var1, var2, var0] instead ?
yes but i'd like it to return the name of the variable and not it's value
That doesn't work
shit
You can't put variables into an array
it resolves th variables, and then puts the value into the array
and the value doesn't know which variable it came from
I see
okay i'm stalling. I'm trying to do something which is probably very simple but not thinking it the right way and trying stupid things like this.
I'm trying to create a respawn system that would take into account, the number of friendlies, the number of enemies of each locations, and select the safest one.
so for now i've done this but don't know how to exploit it ...
tdmSpawnLocations = ["spawnLoc0", "spawnLoc1", "spawnLoc2", "spawnLoc3", "spawnLoc4", "spawnLoc5", "spawnLoc6", "spawnLoc7"];
{
if (count nearestObjects [getMarkerPos _x, ["b_soldier_f"], 25] > count nearestObjects [getMarkerPos _x, ["o_soldier_f"], 25]) then
{
missionNamespace setVariable ["spawnLoc"+ str _forEachIndex, [count nearestObjects [getMarkerPos _x, ["b_soldier_f"], 25],"blufor"], true];
};
if (count nearestObjects [getMarkerPos _x, ["o_soldier_f"], 25] > count nearestObjects [getMarkerPos _x, ["b_soldier_f"], 25]) then
{
missionNamespace setVariable ["spawnLoc"+ str _forEachIndex, [count nearestObjects [getMarkerPos _x, ["o_soldier_f"], 25],"opfor"], true];
};
if (count nearestObjects [getMarkerPos _x, ["b_soldier_f"], 25] isEqualTo count nearestObjects [getMarkerPos _x, ["o_soldier_f"], 25]) then
{
missionNamespace setVariable ["spawnLoc"+ str _forEachIndex, [count nearestObjects [getMarkerPos _x, ["b_soldier_f"], 25] + count nearestObjects [getMarkerPos _x, ["o_soldier_f"], 25],"allOrNone"], true];
};
} forEach tdmSpawnLocations;```
in a loop it'll update every variable (corresponding to every marker) with the amount of friendly and the side that dominating
Why are you executing the same code 4 times, instead of just doing it once and storing it in a variable?
probably because I don't know how to do it, or if I do, I can't think of a way to write it down ?
tdmSpawnLocations = ["spawnLoc0", "spawnLoc1", "spawnLoc2", "spawnLoc3", "spawnLoc4", "spawnLoc5", "spawnLoc6", "spawnLoc7"];
{
_nearBlufor = count nearestObjects [getMarkerPos _x, ["b_soldier_f"], 25];
_nearOpfor = count nearestObjects [getMarkerPos _x, ["o_soldier_f"], 25];
if (_nearBlufor > _nearOpfor) then
{
missionNamespace setVariable ["spawnLoc"+ str _forEachIndex, [_nearBlufor,"blufor"], true];
};
if (_nearOpfor > _nearBlufor) then
{
missionNamespace setVariable ["spawnLoc"+ str _forEachIndex, [_nearOpfor,"opfor"], true];
};
if (_nearBlufor isEqualTo _nearOpfor) then
{
missionNamespace setVariable ["spawnLoc"+ str _forEachIndex, [_nearBlufor + _nearOpfor,"allOrNone"], true];
};
} forEach tdmSpawnLocations;
oooh
where do you have variables in there who'se names you need to get?
"spawnLoc"+ str _forEachIndex
will correspond to all the markers in tdmSpawnLocations
Just use _x
you are iterating through marker names
the name will be in _x
just use the name instead of building it with forEachIndex 🤔
mmmh, wait one. brain processing.
true.
but that's just righting my script correctly. I'm still not getting how to move forwards from there
You want to find the marker which has the least enemy units?
Why even set variable to missionNamespace, that just makes it more complicated
Can the player be blufor and opfor?
I understand that. That's probably why I'm lost
does it need to automatically choose the right side?
this code is executed server-side. i'd like it to do all the calculation and publish the two markers (one for blufor and one for opfor) that are the safest
so that the client can simple do a teleportation on his side's safest location (marker)
Can just sort to have the most blufor marker at one end, and the most opfor marker at other end
how ?
If there are more blufor than opfor.
Take the blufor number but make it negative (so it will always be at the low end)
if more opfor, take opfor number at keep it positive (so it will always be at high end)
Then if you sort, you'll have the biggest blufor numbers at the start, and biggest opfor numbers at the end
right but how do I link the numbers I have to the name of my marker
that's what I don't get
Put the marker name into the array
You already have array with number and "blufor" string, just add the marker name to the end of it
I'll show you
oh ... smart
hadn't thought about it
missionNamespace setVariable [_x, [_nearBlufor,"blufor", str _x], true];```
like this ?
No that makes it still hard, as you have to check all the marker variables and then filter it somehow
tdmSpawnLocations = ["spawnLoc0", "spawnLoc1", "spawnLoc2", "spawnLoc3", "spawnLoc4", "spawnLoc5", "spawnLoc6", "spawnLoc7"];
_sortedSpawnLocations = tdmSpawnLocations apply {
_nearBlufor = count nearestObjects [getMarkerPos _x, ["b_soldier_f"], 25];
_nearOpfor = count nearestObjects [getMarkerPos _x, ["o_soldier_f"], 25];
switch true do {
case (_nearBlufor > _nearOpfor): {[-_nearBlufor, _x]};
case (_nearOpfor > _nearBlufor): {[_nearOpfor, _x]};
case (_nearBlufor isEqualTo _nearOpfor): {[0, _x]};
}
};
//Array contains [unit count, markername] where unitcount is negative for blufor, and positive for opfor.
_sortedSpawnLocations sort true; //Sort ascending, negative blufor values will be at front, high opfor values will be at back, 0 values for equal or empty will be in middle.
_bluforMarker = _sortedSpawnLocations select 0; //Select first element, highest number of blufor units
_opforMarker = _sortedSpawnLocations select (count _sortedSpawnLocations - 1); //Select last element, highest number of opfor units
okay
Btw you don't need nearestObjects I think. nearestObjects sorts by distance, but you don't care about sorting.
nearObjects is probably cheaper
ah yes
true
_nearBlufor = count (getMarkerPos _x nearObjects [["b_soldier_f"], 25]);
_nearOpfor = count (getMarkerPos _x nearObjects [["o_soldier_f"], 25]);``` ?
Yeah. Looks correct
I've got a question that has no connection with the previous :
for local variable, often I see that they are declared with private _myVar but it works the same with a simple _myVar so what's the point of the private ?
makes sure you are not overwriting anything
_myVar = 5;
call {
_myVar = 6; //Overwrites _myVar from above
}
oops. one ] too many
Hello! I am encountering an issue with dialogs. The issue is that the eventhandler im adding is running, but not executing the function im giving it. I can verify this by adding diag_log _this; to the event handler. it will log the control and the index (when using LBSelChanged with ctrlSetEventHandler). but wont execute the function.
disableSerialization;
createDialog "RscMUGKit";
waitUntil { !isNull (uiNamespace getVariable ["RscMUGKit", displayNull])};
_display = (uiNamespace getVariable ["RscMUGKit", displayNull]);
_listCombo = _display displayCtrl 99350;
_listCombo ctrlSetEventHandler ["LBSelChanged", "diag_log _this; _this call MUG_Kit_onLCSelChanged"];
The dialog gets created and will add stuff to the ListComboBox but when I click on something thats inside the ListComboBox, it will not execute MUG_Kit_onLCSelChanged, but WILL execute diag_log _this;.
Any help would be appricated!
And you are sure that MUG_Kit_onLCSelChanged is correct?
Dude, thats scary
I am using missionNamespace setVariable with the function name and code
And when you call the function via console, it works?
uiEventhandlers might run in uiNamespace
Cause sometimes a missing } can bork up everything, without giving you an ErrorMsg
not missionNamespace
Use CfgFunctions :U (not sure if description.ext CfgFunctions puts into uiNamespace, but mod CfgFunctions does)
Found a missing " inside MUG_Kit_onLCSelChanged
😉
Had a few other mistakes, thankfully they got reported in the RPTs , seem to be running now
i made a cfgSounds.hpp and included it in my description.ext. But, since i cant see some forum entrys? hm... but what do i write in the .hpp file now to get my test.ogg sound and test1.ogg sound working?
Any clue why createVehicleCrew _veh; isn't returning the Group of the crew, as it claims to in the documentation?
_veh = _type createVehicle _spawnPointBLUFOR;
_group = createVehicleCrew _veh;
_wp = _group addWaypoint [_waypointPosition, -1];```
`Undefined variable _group`
`_wp = |#|_group addWaypoint [_waypointPosition, -1];`
Is there a delay perhaps?
You gotta read the whole documentation
Since Arma 3 v1.93.145652 this command will
Return Value: Group - the group of the created crew (since Arma 3 v1.93.145652)
I suppose I can get 1.93 through a beta?
dev branch yes
What would be the easiest way to transform [1,1,1] to {1,1,1} ?
inside a string you mean?
Do the Arma 3 dev team want to add setObjectTexture for Vests and Headgear too?
How do i approach a while-loop with an addaction to wait that you used an action to determine an effect. Like changing a variable so an ied would explode or anything?
I cant return something with an addAction.
So how could i approach it that an ied waits (we say that it doesnt explode because the guy knows what he is doing) until someone starts to cut wires.
Use while {someGlobalVar} do [] and in the addaction set that var to false
mh, cant do. Its a general function. Currently i call a function that spawns, after creating an object, a check if a player runs too fast and so on. I would know how to do it complex but i try currently to do it all in one.
Use setVariable on the object the action is assigned to and have the condition in that while check for that var with getvariable
_myIed setVariable ["whateveriwant", thisisinit, false];
In the addAction i can then getVariable that data, change it again with setVariable and with an if-statement i can say then "Yup, i got the new stuff. Done"?
And it wont be a public global variable so i can do this for 100 ieds spawned in with the function? (just for understanding)
It's possible yes, don't know how you're doing stuff so I can't say if you will be able to
I start the function, and do
_iedObject setVariable ["bombDefusal", "Neutral", false];
Then i spawn the check if a player is near the ied and yadda yadda. Within the spawn i have the addaction that runs through once (to be added) and within the code-part in the addaction i do
_iedObject setVariable ["bombDefusal", "Red", false];
And within the while i hafe
_getInformation = _iedObject getVariable "bombDefusal";
With if (bombDefusal == "Red") go full boom. ? Would that be kind of correct?
I guess so, also I typically use getVariable ["name", "defaultValue"] just to be safe
thought so, yes. I will try around with the basic 'hello world' thing haha ^^ Lets see if i get it running. Thanks for the info! That helped me
Does anyone know if its possible to loop a function inside a SQF until a condition is met without leaving it? EG Create an explosion every 5 seconds until a variable is changed?
How to add/ remove itemes from uniform? I want remove and add money ( GM DLC) but it didnt do nothing, only the hint works! Its useing as "addAction" from a box!
´´´´´´´´´
player removeItemFromUniform "gm_placeableItem_gc_money_71_100_bill";
player addItemToUniform "gm_placeableItem_gc_money_61_20_bill";
hint "Works";
´´´´´´´´
@wispy cave
[_ied] spawn
{
_object = _this select 0;
_script = _this select 1;
_done = true;
_object setVariable ["bombDefuse", ["Neutral",], false];
while {true} do
{
if (_done) then
{
[_object,
[
"Remote Wire",
{
params ["_target", "_caller", "_actionId", "_arguments"];
_object setVariable ["bombDefuse", "Red", false];
},
[],
1.5,
true,
true,
"",
"true", // _target, _this, _originalTarget
2,
false,
"",
""
]] remoteExec ["addAction", 0, true];
_done = false;
};
_info = _object getVariable ["bombDefuse", "Nothing"];
"I just wait for Action." remoteExec ["systemChat", 0];
if (_info == "Red") then
{
systemChat "IED: May i go boom? I go boom!";
};
sleep 2;
};
};
Sadly i seem to do something wrong. I get an error that the variable is undefined.
probably because _object isn't known inside the addaction
I believe _target is the object the action is assigned to but you better check the documentation
AH! yeah!
The Box, has the name "box1" and in the init. field i have this
´´´´´´´´´
box1 addAction [Pay 20, "scripts\addAction\pay.sqf"]
´´´´´´´´´´
And the class names are correctly!
_target was what i needed. Sweet.
@winter rose How can i do this?
box1 init
box1 addAction [Pay 20, "scripts\addAction\pay.sqf"]
´´´´´´´´
pay.sqf
player removeItemFromUniform "gm_placeableItem_gc_money_71_100_bill";
player addItemToUniform "gm_placeableItem_gc_money_61_20_bill";
hint "Works";
´´´´´´´´
Can someone help me out with script that would activate animation on demand
@tough abyss "Pay 20", not Pay 20
@winter rose Sorry, i forget it here, but in game its in! The "Pay 20" is selectable and the hint works, but it did´nt get and remove the money!
animations dont like me, so i dont try to use them <chuckles>
there is this one from global mob.
if i call for it at start it works
but if i want to bring it out with addaction yeah it fails
@tough abyss it can that its works only for looping animation, like this
player1 switchMove "Acts_ExecutionVictim_Loop";
if i do addAction with remoteExec like
_id = addAction with remoteExec
I get back like _id = "2_1234"; and if i parse it to a number i only get 2". Am i missing something?
I get the JIP ID and if i turn off JIP i get the real id.
Workaround: On an Object, the IDs are in chronological order. Can be worked with. First action is 0, second is 1 and so on. So i know how to work with it in my functions.
Please, can i increase the lift capacity of a helicopter without using a mod?
@still forum thanks. Decreasing the mass of a tank can make it behave erroneous?
Hi again !
is there a way to execute code via control ? I know how to add a link to a button with ctrlSetStructuredText parseText but what about executing code ?
triggering a script for example
I tried controlName ctrlSetEventHandler ["onButtonClick", "[] execVM 'myScript.sqf"]; but didn't work
"[] execVM 'myScript.sqf"
something is missing?
"onButtonClick"
there is like big red writing on UI EH page about this
can't see no red writing ...
👍
Executed locally on a client, will this hide the player from all other players or am I wrong ?
thisPlayerInMenu = player;
thisClientID = clientOwner;
[thisPlayerInMenu] remoteExec ["hideObject", -thisClientID, true];```
@still forum i had set the mass of a tank to 200 kg and tried to lift it with a Taru. Not worked. I believe tanks are denied to lift, right?
setting mass has limits
you cant just make a tank 200kg. It would fuck up physix. Game stops you from doing it
@austere hawk no problem, i want to lift the tank with a heli. After that i recover the mass.
But it's not working, tank can't be lifted even with 200 kg. Any way to do that?
i will make the lift system with attachTo like in Arma 2.
Lemme guess: The Rope selection doesn't appear?
iirc, it was a config Entry, that allowed the Vehicle to be slingloaded.
@quartz coyote no, hideObject is binary command not unary
@tough abyss it is both
Ah yeah, true, but from that code it looks like it is only temp hiding
Unary cannot unhide
Yep
just wanted to know if it worked.
[thisPlayerInMenu, true] remoteExec ["hideObject", - thisClientID, true];```
the player executing code will not see him self hidden but all other player will see him disappear.
hi does someone have a script or tip for the wasteland modus ( for starter money ?) so what i mean is when someone is joining the server only the first time he must have atleast some amount of money on the bank. Too gear up
Pls help.
For the command buttonSetAction, I need to set the action of a button I created with a script but the wiki says it only allows SQS and not SQF. What should I do to be able to call the function I need?
Can I just call it regularly?
Just do a call to a function
okay cool, thank you
Also one final question, if I create a GroundWeaponHolder at the position of the player and put an item in it. How can I make it so it shows up as a container in the players inventory automatically?
It is created while the inventory is already open
When you open your inventory, you specify the container to open at the start. Cannot change in the middle
need to close and reopen, but you can do that with script
@quartz coyote it should
Ivan now has IED. Ivan has Vodka to Spawn under IED as a Test. Ivan not happy, because Vodka lets fall big chest filled with Vodka! Not acceptable! Help Ivan. Tell Ivan how spawning Vodka does not throw big Chest around where Vodka is spawned under.
Bleh... The object is quite nice behaving. But when i spawn in, for the training version, a smoke-effect/grenade, it spawns only right under sigh I think i try it with 'attachTo' but if someone has another solution, please tell me.
How does one make addaction to work with animations and only can be used by player that options is given. i am hitting the wall here.
Execute addAction on the computer of player that needs to have it
Also I am not sure what you mean about the animations part
I am trying to give Lmg users hipfire option
GM offers it so i am smashing my head on trying to make the roles have that option to toggle on and off at awill
So far managed to make it toggle on and off but its broken and other player if they walk up to gents with this script they can actiavet of the mg dude
Could it be, that inPolygon is not rly accurate?
Hi.
BIS_fnc_saveInventory : delete: Boolean - (Optional, default false) Whether or not to delete the loadout
What does that mean ?
Delete when ?
I guess it means delete rightnow
where is the logic in this ?
oh maybe delete is from the player. not delete the save
Example 1 shows it
if you set delete to true, then it will delete instead of save
https://community.bistudio.com/wiki/BIS_fnc_deleteInventory see. deleteInventory also calls saveInventory
Okay, serously... i have an IED-Object and when i spawn a grenade (live grenade) the object is catapulted into the air in worst case and wobbles in best case.
attachTo does not work and i dont know any command that would help me. Except, is there one that only spawnes the actual effect instead of the object that causes the effect?
How do I pass my local argument in the executed code ?
_websiteButton ctrlSetEventHandler ["MouseEnter", "_websiteButton ctrlSetBackgroundColor [1,1,1,1];"];```
you don't
setVariable on the control
But you don't need to
read the wiki page and see what arguments you are getting
Does triggerAmmo work for mines and satchel charges, or only flying ordinance?
supposed to work for all
Nifty.
[_object] remoteExec ["ied_fnc_iedActionRemoveAll", 0, true];
_beep = [_object] spawn ied_fnc_iedBeep;
waitUntil {_beep == "Yes"};
Does not work and i dont quite understand why it is. It says now it expect bool/number and before it says too but _beep should return True. Now it returns "Yes" ...
<sighs> going crazy. Dont want to use sleep -.-
spawn returns a handle to script
you are waiting until _beep is "Yes"
maybe you expected whatever the spawned script returns to be put into the variable you assign from a spawn command call? no it doesn't work like that
waitUntil {_beep == "Yes"}; that will never work
You are never updating _beep, so it can never change it's value
You can only get a return value from a function with using call
What you need to do is to forget beep and use:
__
WaitUntil {[object] call function}_
Ok
I posted it here because I thought the other was the wrong place
but nevermind 😛
why if in this code
box1 AddAction [localize "STR_Talk",{
hint "ok";
}, [], 6, false, true, "", "", 3];
parameter on hideOnUse is true - it must hide the action menu after selecting that action
but i can using all the time. didnt work for me
Also command "box1 removeAction 6;" - doesn't help.
6 is priority value of the action
"hide the action menu" not "hide the action"
aaaa ok
If you want to remove action after you selected it, you can add _this select 0 removeAction (_this select 2), to your action code
thanks a lot 🙂
<scripts a "simple" ied script>
<after 3 days>
"Well, my 'simple' ied script has now 4 different difficulty-ratings, training mode, shit-ton of objects to choose from, placed facing in random directions, complete random wiring-mechanism with timed set-ups and instant-setups as well as some other stuff."
"Hmm. Well. How can i make this from a simple to an more advanced script"
And now i am thinking of pictures, recogniton where you have clicked on it and do "real" ied-stuff XD Come on, cant my brain stop on just the simple thing ^^ And with that the Question: Is it possible to use a picture and reckognize where on the picture a user has clicked?
If you know the picture coordinates on screen (relative to a set point of the picture), and the mouse coordinates at time of click, wouldn't it just be an arithmetic problem?
Kind of, plus, technically you could to it with dialog-buttons spawned on the picture itself - and the buttons are cable-pictures. That, i think, should work too and would be probably a lot easier to do i think
i swear, if that scripted monstrosity of an epic sandbox is in alpha and anybody put stuff in patroen i freaking hire someone that can take some workload off of me ... soooo freaking much to script.
i still dont understand dialoges at all, and the "dialog editor" of arma never loads the freaking dialog i saved... its totally hillarious.
Hello everyone, is there any framework to create a random task that will be generated in-game like in Antistasi/DUWS?
Tried to find some by myself, but they all generating all mission, not tasks
Good evening, im working on a script thats gonna make a AI surrender if they have more than two wounds with ace.
example arm and leg is wounded then he will surrender with a call function.
problem is that I cant find anyway of getting the damage into a if statement.
basicly what I need help with in the script is to define _wounded so it explaines that a _unit have more than two ace wounds. either two arms, two legs or a leg and a arm etc...
ex..
_wounded = ????????
"have more than two ace wounds"
if (_wounded ) exitwith { _unit call my_fnc_surrenderfunction;};
Thanks in advance 😃
Edit, gave it a try like this to simply check the pain level of the AI:
_acelowHealth = _unit getVariable [QEGVAR(medical,pain), 0] > 0.1;
But im getting a error message, and it doesnot work.. any suggestions?
@tawny geyser I am not aware of a task-generator. The demand for 'just tasks' is, i guess so, not high enough so you find plenty of mission-generators but not task-generators.
Blergh... i am going crazy why the freaking add-actions arent not working on the server. I remoteExec the function which contains all the effing actions globally and with JIP!... they no show
Found out why... gosh, ARMA! you ... f.... grah... It did not export to multiplayer anymore and i uploaded the same pbo file over and over again on my server...
how do i make it so the syndicate vehicles count as positive vehicle kill? with out adding event handlers to all of them.
and independent side is friendly in the mission
Hello and good morning.
I have
myVar = [object1, object2, object3];
myVar = selectRandom myVar; publicVarible "myVar";```
I want to ``player setDir myVar`` (which is not working, obviously) how can I do it another way ?
publicVarible "myVar" typo and space at end
setDir takes direction
not object
What are you trying to do
You cannot look "car-wards"
you look north-wards or east-wards
oh... sorry player setDir (direction myVar) ?
what are you trying to do
randomly selecting an object server-side, publishing it to everyone, setting the direction of the player same as the one of the selected object.
player setDir (getDir myVar) then I guess
oups. okay I mistaken direction from getDir
Can isNil be used to check if function is existing?
isNil can be used to check if a variable is undefined
functions are variables
if a variable is undefined it doesn't exist
if (isnil "myVar") then
{
myVar = "Hello";
};```
Don't see much to make better
Not much would imply there's still something to make better 😄
@cosmic lichen about my script ? i'm open to suggestions
I have no idea. Looks fine to me.
then I didn't understand Not much would imply there's still something to make better :smile:
Dedmen said he doesn't see much to improve. Not much != nothing.
Sorry for the confusion.
can return array from switch case, instead of always assigning two variables
thank you i'll see how i can adapt it
@keen bough Okay, thank you for that.
if (!(isNil "VALUE") && {!(_defaultValue isEqualTo VALUE)}) then
{
_attributeValues pushBack [_section,_attributeName,VALUE];
};
How can I make sure to only check the second condition when VALUE is not nil?
Currently the second condition is not checked if value is nil.
() && (() && {})
Alright, thanks.
i came across https://community.bistudio.com/wiki/setTrafficSpeed while in editor, does this actually work in arma?
also, does the volume parameter for sounds in CfgSounds even work? it doesn't feel like it's having much effect
@quartz coyote
https://community.bistudio.com/wiki/ctrlMapWorldToScreen
https://community.bistudio.com/wiki/ctrlMapScreenToWorld
must give it (finddisplay 12 displayctrl 51) or the map control you are using
amazing thanks !
im looking for a way to create random spawn/respawns for a pvp style gamemode is this possible?
so player doesn't choose where he respawns? Or he has a set of 'random' spawn points with the BIS spawn selection dialog?
anyway, answer is yes to both
no choice on respawn and the markers are picked on random
well, you just setPos player that has respawned
from the server
can also do it on client
where would the best place to find the commands etc as i am still pretty new to this ?
depending on how much server cares where the player respawns, probably you want to do such calculation on server
so...
here are the event scripts:
https://community.bistudio.com/wiki/Event_Scripts
you probably want to create an onPlayerRespawn.sqf in the root of your mission folder
and do something there
it will be called each time player respawns
also you need to setup proper parameters in description.ext, must set the proper respawn type, otherwise the game will end with 'mission failed' screen by default, or maybe not, I am not sure
see everything related to respawn there
ive set the respawn type already and set a load of markers it was purely just getting a respawn set randomly, thanks i will have a browse
I am not sure if arma 3 respawn configurations in description.ext allow you to make it select one of the random markers instantly, without the menu
But I didn't read it for very long time
I would probably just setPos player somewhere :/
so i can use setpos to select a random respawn marker? it doesnt have to be instant respawns but just has to be random
do you specify in your mission.sqm file the markers where you want the player to respawn? or does the position depend on some complex calculation?
in other words, are these positions fixed at mission start and are fixed for all players, or do you need to compute a new position every time?
anyway, setPos command sets player's position: https://community.bistudio.com/wiki/setPos
the markers will are fixed
Ok I would approach it this way:
set name of the markers in such a way that you can filter them with a script (for instance, "respawn_west_0", "respawn_west_1", etc)
inside onPlayerRespawn.sqf iterate through all markers, find the markers where player can possibly respawn, select a random marker from them, get pos of that marker, set pos of player
you mightn eed commands like
https://community.bistudio.com/wiki/allMapMarkers
https://community.bistudio.com/wiki/selectRandom
https://community.bistudio.com/wiki/find - to check if current marker's name contains a certain string
Is there a way to turn off the siren for the ambulance while the beacons are on?
@compact solar this is how it works by default already, respawn markers are chosen at random and if marker is a rectangle or ellipse respawn position is randomly selected within marker in addition
Thanks for the help everyone @quartz coyote talked me through it over teamspeak
Guys, how should I know when to disableSerialization ? i'm new to displays and controls
When you are working with displays and controls in mission namespace
And by this I mean when you assign them to a variable
All variables in mission namespace are serialised when you save game
I see
But controls and displays cannot be serialized hence the warning if you do not disable it explicitly
okay
I did not see it or i am unsure. Is this on global scale or do i have to run it globally?
https://community.bistudio.com/wiki/clearAllItemsFromBackpack
I imagine it would need to be executed in the backpacks locality.
Player backpack, local. Backpack on the ground, server.
Player client I should say.
Yeah, thats the question. Since arma is so nice to spawn backpacks prefilled, that i like so much that i clear the backpacks via script ^^
we found viper backpacks from units in our merc-scenario, and, of course, we stole em and put them into our system. Now they get filled everytime with the respective soldier-loadout that we looted the backpack from.
last i remembered whoever had it last has control over it and the code would have to execute on their client

The one where the "Vehicle" is local to
the backpacks are spawned on the server and are in a box. So, their locallity is on the server. Should work and, if not, i can of course make it work. Just thought maybe someone could say where the command should be executed ^^ its not... too clear (for me)
Check the *Classname of the Backpack, i bet it has some _tag at the end
if it's in a box then yeah it's owned by the server till someone yoinks it.
dont wanna start arma now, but i guess it will have that. I guess i can avoid it with getting the base-class of the backpack?
Yeah
wasn't there a command to check locality ownership
the backpacks are created with addBackpackCargoGlobal on the server, so yeah, server ^^
where was the "look into the config for basename" thing on arma wiki again?
owner, that's the one i was thinking of
There is also clientOwner now, Ton

Yeah 😄
oh clientowner just returns the players own ID
On Clients also
Yeah, alot of stuff was added since you borked us all with Life :angrypepe:
only been 4 and a half years, no big deal.
Yeah, not much changed *cough*
<whisper> we will have a command to add weapons... and configure the attachments on it VIA SCRIPT!
dw im coming back to grace you with more life stuff but with aliens @jade abyss
trap in trap or trap?
Yes.
"Which one of the effects you want to have?"
"Yes."
exactly
okay, i can go back to my function and look for the base name, or write a new function to delete all items in backpacks. The lazy version is second since i dont have to do any much else... first one would be neat and clean.
ah, perfect! Thanks Dscha. This one i always forget because i dont use it often.
@quartz coyote split this into many smaller variables or your head will explode
I have a weird script issue I'm probably just not seeing something on
if (isServer) then {
GVAR(loadouts) = true call CBA_fnc_createNamespace;
publicVariable QGVAR(loadouts);
addMissionEventHandler ["HandleDisconnect", {
params ["_unit", "_id", "_uid", "_name"];
GVAR(loadouts) setVariable [QGVAR(_uid), getUnitLoadout _unit, true];
}];
};
if (!hasInterface || {!isMultiplayer}) exitWith {0};
player setUnitLoadout [GVAR(loadouts) getVariable [QGVAR(getPlayerUID player), getUnitLoadout player], true];
This is supposed to save someones loadout when they disconnect, then load it back when they rejoin
Instead when someone rejoins they got someone else's gear, but it was always the same specific person who's gear they got
that script is in postInit
QGVAR and GVAR are used to define constants. You are search for the key "getPlayerUID player" instead of what the command getPlayerUID returns.
if (isServer) then {
GVAR(loadouts) = true call CBA_fnc_createNamespace;
publicVariable QGVAR(loadouts);
addMissionEventHandler ["HandleDisconnect", {
params ["_unit", "_id", "_uid", "_name"];
GVAR(loadouts) setVariable [_uid, getUnitLoadout _unit, true];
}];
};
if (!hasInterface || {!isMultiplayer}) exitWith {0};
player setUnitLoadout [GVAR(loadouts) getVariable [getPlayerUID player, getUnitLoadout player], true];
Yeah that's what I am using now
Just completely forgot about GVAR for a second
I don't know why I had put it there to begin with
Hi all
If I understand the wiki : addAction in a forEach can take _x in the condition argument because it's string and not code ?
_x can be anything. so yeah as long _x is a string it can be used as a condition in an addAction
thx
Does anyone know if it is possible to save weapon and magazine info from a crate. I know about getMagazineCargo and getWeaponCargo but that will cause magazines to be refilled and everything from weapons (optics, acc, magazine) to be lost
Not possible, I tried something similar in a persistent mission. You are either forced to make your own implementation or tell players so detach attachments
Is there a way to have an action (addAction) from inside a Camera scene (camCreate) ?
Hello ... I m looking for help to make my small Mod Zeus compatible so that can be played online
I tried following tutorials but failed
Can you be more specific?
I want my mod to be used with Zeus like in the zues unit list
@tough abyss @quartz coyote disableSerialization is for local variables, because spawned scripts are saved. Not for missionNamespace stuff. So you basically want disableSerialization everywhere where you work with displays in scheduled scripts. Don't need it in unscheduled. And if you are storing display/controls in missionNamespace, you'll get warnings and you have to think about the fact that they may become null at any point in the script.
QGVAR and GVAR are used to define constants. No, normal missionnamespace variables are not constants @digital jacinth
@fringe yoke @digital jacinth
Does anyone know if it is possible to save weapon and magazine info from a crate.
https://community.bistudio.com/wiki/weaponsItemsCargo
@still forum you don’t need it in uiNamespace and it is not limited to local vars
weaponsItemsCargo works, just missing addWeaponsItemsCargo :p
still better than losing it
We have that
there is?
Yep. I came up with that beautiful name and am proud of my baby
It's still a bit broken tho. But I already submitted the fixes
It looks like it works with weaponsItemsCargo, is that correct?
So I could just do { _container addWeaponWithAttachmentsCargoGlobal _x} forEach _oldItems once it is out
Any help
I don't think the syntax is the same. Might be. Haven't checked
@fading dust you have already been asked to be more specific.
In what way is your mod #arma3_scripting replated
U know Zeus is used to spawn units in match
You are not providing ANY helpful information at all.
Yes I know zeus can spawn units. How is that related to #arma3_scripting ?
Just tell us what your actual problem is
Right now it is
weapon, muzzle, side, top, bipod, [mag1, mag1count, mag2, mag2count], count
if it isn't finalized it would be nice to switch it to
weapon, muzzle, side, top, bipod, [mag1, mag1count], count
weapon, muzzle, size, top, bipod, [mag1, mag1count], [mag2, mag2count], count
that would make it directly compatible with weaponsItems format
"if it isn't finalized" that part of it is finalized
damn
I need a script that can make my mod Zeus compatible
But it's not alot of work to convert that
No, it still would've been nice if it just used the same format though
@fading dust that cannot be scripted. That's config stuff
Someone tell me ask here
{
_x params ["_weapon","_muzzle", "_side", "_top", "_bipod", "_mag1", "_mag2", "_count"];
_mag1 append _mag2;
_container addWeaponWithAttachmentsCargoGlobal [_weapon, _muzzle, _side, _top, _bipod, _mag1, _count];
} forEach _oldItems
So I have to ask again in config
@fading dust you were not told to post here. You were told to post here if you need scripting help, which you don't
Maybe I understand him wrong
Is there a command/way to lower the amount of space that the game objects/items take in inventory?
no
Dang
You can maybe use some commands to force items in inventory, even if there is no space
Such as...?
dunno
Some of the commands to add items to inventory
I know you can overfill boxes with script
@still forum do you know if there a way to have an action (addAction) from inside a Camera scene (camCreate) ?
okay thx
Ok
@tender fossil Use player setUnitTrait ["loadCoef",0.1];
That will increase the amount of weight a unit can carry.
Side effect is that I also increases stamina.
We have stamina disabled anyway
weight, but not space in uniform/vest/backpack?
Yeah no. Only affects fatigure/stamina
affects weight, not volume
Ah yeah, he could carry more but would still be limited by the volume of the vest/backpack/uniform.
I see, thanks anyways 😃
Is there a way to do addMagazine on a crate? addMagazineCargo works but I can't add half a mag
ah thanks, missed that
So much work put into that screenshot 😄
Not enough arrows
There should be an arrow pointing to the arrows just to make sure.
hm, doesn't look like there is a getMagazineAmmoCargo then
unless I'm missing something obvious again
Anyway to increase a specific units health?
setDammage ?
#define setHealth(h) setDemmage(1-h) 😄
just setDammage health to zero
ah wait, you mean that character can get more damage before he dies?
I guess you would need to use handleDamage event handler
I can just disable damage for the unit
I tried, this addEventHandler ["HandleDamage", {(_this select 2)*0.25)}];
but it works well with vehicles
not so much with infantry, but I suspect thats to do with ACE
Is there a way to get an the object name of a unit with a specific Player ID? (Basically I want to attach an action to a unit with a specific Player ID)
This link should be pinned @still forum
@spring stone
https://community.bistudio.com/wiki/getPlayerUID
Can't pin
@lavish ocean ? ☝
@spring stone iterate through allPlayers
Makes sence sometimes my brain is a bit to slow 👍 (Since I already look that code up but was unsure how to iterate it @.@)
Oh wait no I rember why I asked. The thing is, with this I can get the PlayerID of a specific Object. But what I want is the other way around. I want the object name of a specifc player ID (when in game).
or can the player ID possibly be used as an object in e.g. an addaction?
Player ID? Which player ID do you mean? Maybe you mean clientOwner?
@astral dawn I'll test it without, cheers for the help
Sorry, should have clarified: I mean a steamID64
as Dedmen said, you must iterate through allPlayers to find the one which has the required uid
Or you can create a namespace and use it as a hashmap to map the string to player object / clientOwner
