#arma3_scripting
1 messages · Page 469 of 1
check #community_wiki
So, I need to check the distance of a group from any unit that isn't in their faction that they know about. Anyone know of a good way to do that?
wat
I don’t understand this.
it's magic
what would be the most straight forward way to have an AI unit say "Fuck!" using its voice set defined in its identity or where ever?
@shadow sapphire how often and how fast do you need the info? could potential cause some hick ups with lots of units
@polar folio, doesn't need to be often. It just needs to check the distance between a certain group leader and any "unauthorized" unit.
what's the scenario though? what for? and do you need one positive or do you need the distances for all of them to do stuff with? also what do you have so far?
@polar folio f-word hasn't been recorded in "needed radio voices" for units afaik
@winter rose it was just an example. there is some cursing for sure. i need simple reactions. and i was hoping i wouldn't have to extract from configs myself
@polar folio, I just need the one guy's distance. It's for an AI sniper team, where if players, hostile factions, or civilians get too close, the AI sniper team will dip out. I've actually been picking away at it all morning, and I've gotten super close at this point to what I need. The final think I need is just to stack a variable to mean "any unit." Somewhere. Here is what I've got so far:
//Greek Sniper Team
if (!isServer) exitwith {};
params ["_trigger"];
_trigger spawn {
_G1 = [(_this getpos [600,(_this getdir (getmarkerpos "Origin")) -60 + round random 120]), INDEPENDENT, ["I_Spotter_F","I_Spotter_F","I_Sniper_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
{
{
// _x execVM "Gear\AAF.sqf";
} foreach units _x;
} foreach [_G1];
_G1 setcombatmode "GREEN";
Sleep 5;
_G1 addwaypoint [_this getpos [-400, (getpos leader (_G1) getdir _this)], 0];
[_G1, 1] setwaypointformation "VEE";
[_G1, 1] setwaypointspeed "FULL";
_G1 addwaypoint [_this getpos [-300, (getpos leader (_G1) getdir _this)], 0];
[_G1, 2] setwaypointspeed "NORMAL";
Waituntil {((leader _G1) distance _this) < 350};
{
{
_x setunitpos "Down";
} foreach units _x;
} foreach [_G1];
Waituntil {((leader _G1) distance Scott) < 250};
_wp = _G1 addwaypoint [(getmarkerpos "Origin"), 0];
[_G1, 3] setwaypointbehaviour "SAFE";
[_G1, 3] setwaypointspeed "FULL";
{
{
_x setunitpos "Up";
} foreach units _x;
} foreach [_G1];
};
Where "Scott" is a named unit in the editor what a waypoint that moves him close enough to get the sniper team to run away.
Also, one thing I need to do is replace (getmarkerpos "Origin") with a single variable. I don't quite understand why putting _base = (getmarkerpos "Origin") isn't working, but the reason seems to be two fold as base nor _base work, and throw different errors.
@winter rose, @polar folio, how are you guys calling vanilla voice lines at all?
will the behaviour only be triggerd by players coming close or also other units?
Any unit that's not in their same faction.
@shadow sapphire @polar folio check CfgSounds for all "normal" words usable with say, else I think you need to define a sentence to use with kbTell (see wiki Conversations page)
do you not care, if the sniper team knows about the units?
@winter rose, word. That's friggin awesome. I was asking around about that and had gotten no answers. That's super useful.
@tough abyss, I do, yes. Sorry, I had posted a version on here earlier that included knowsabout, but then I moved on without realizing that I'd taken that down or that it's too far back on the chat.
@shadow sapphire tbh i'm not sure what would be the best way performance wise. i think, if it's just that one group and also a lot of units to check, if they are close, maybe just do nearX periodically
i think nearEntities is cheapest
@winter rose, where might I find CfgSounds? I'm trying to find all of the default voice lines in the game, like numbers and such.
@polar folio, thanks for the guidance. I'll look into it. Could you to me one more favor and explain to me the variable situation?
I want to create a private variable in this script that replaces (getmarkerpos "Origin") with _base. How might I do that? I've tried just adding _base = (getmarkerpos "Origin"), but that didn't work, nor did Base = (getmarkerpos "Origin"). They threw different errors, though, so my problem is two fold, apparently.
what errors though?
If I used _base, it says it's undefined, despite being defined. If I use Base, it says it expects something different than what it is. Wait one.
pretty sure it's undefined, if it says it is 😉
you have to be aware of scopes when using global variables
7:43:41 Error in expression <pawn {
_G1 = [(_this getpos [600,(_this getdir Base) -60 + round random 120]), I>
7:43:41 Error position: <getdir Base) -60 + round random 120]), I>
7:43:41 Error getdir: Type Number, expected Array,Object
7:43:41 File C:\Users\Donald\Documents\Arma 3 - Other Profiles\Deljay\missions\VRAITesting.VR\GST1.sqf, line 6
Yeah, I know it's undefined, the question is why is that variable undefined? I imagine since you said scopes, it essentially just means it's outside of some brackets that it should be inside, maybe?
just from guessing i'd say using a global variable fixes the first error which then leads to the next one. it's pretty clear about what's wrong
Base use tags for all your global variables.
DEL_Base
If I used _base, it says it's undefined, despite being defined Nope. It's undefined. Local variables carry over to lower scopes yes.
But spawn spawns a completly new script instance. That's not a lower scope
@winter rose can't find CfgWords in the config viewer. any other ideas? might be some synonym
it references folders. then i guess it uses premade folders structures to pull the right sound per voice https://community.bistudio.com/wiki/Arma_3_Radio_Protocol
CfgSentences maybe, I can't remember right now
@winter rose. Wow. Bro. That's super legit! Yes! CfgWords, indeed.
@still forum, why is it so important to tag global variables?
Because if someone else uses the same name
your script goes boom
And Base sounds like a variable someone might use
pass it to spawn via parameters
Looking at your script above.
{
{
_x setunitpos "Up";
} foreach units _x;
} foreach [_G1];
That forEach is useless as it has only one element. You are literally just doing
_x = _G1;
{
_x setunitpos "Up";
} foreach units _x;
That's because future versions of the script may have multiple groups.
Thank you for looking it over. All input is appreciated!
@still forum, it's working perfectly with local variable _base now. Thank you so much. This tremendously furthers my project. It tremendously improves several scripts and prepares them to be plugged into my community's sandbox.
The final remaining thing is that I need to change the variable Scott which is a variable name of a specific unit in the editor to be _threat and I need threat to literally be any character that isn't in the same faction as the group. I know there must be a relatively simple way to do that... Working it up now. Something like !EAST or something...
Finding some unit not in the same faction is easy
but putting every unit that is not in the faction into a variable that previously only had 1 unit is not
Well, how do we find some unit not in the faction? That's essentially all I need.
_threat = allUnits select (allUnits findIf {side _x != side _G1})
That should do it I think. Finds the first unit that is not on the same side/faction as _G1
Interesting. When you say first, you mean the nearest at the time, first spawned, first relevant, or what? Excuse my ignorance...
I don't know how that's ordered. I guess first spawned
This is very cool. Will it work to make my sniper team flea regardless of which faction first approaches them? The sandbox for which this is intended has civilians, blufor, and opfor, so the sniper team must flea regardless of which faction approaches, if that makes sense...
Waituntil {((leader _G1) distance Scott) < 250};
->
private _leader = leader _G1;
waitUntil {
//Is there any enemy unit within 250 meters?
allUnits findIf {side _x != side _leader && _leader distance _x < 250} != -1
};
Here is an example that would check if ANY unit of a different side is within 250m of the groups leader
Will it work to make my sniper team flea regardless of which faction first approaches them No. That will only fire if that specific unit that's first in allUnits (Which might also be random) approaches them. But the script I just posted would do what you described
@still forum, amazing. Many, many thanks to you.
What does the != -1 catch do, @still forum?
findIf returns -1 if nothing was found
and 0 or bigger if something was found
we want to wait till it finds something. Thus != -1 means "wait until not nothing found" aka "wait until found something"
could also write >= 0 if you wanted
but that's essentially the same
That seems like an expensive check - other things you should think about are how often are you going to run that? Also, it effectively gives the sniper unit X-ray vision through all walls and terrain nearby.
It is an expensive check
but scheduled script exits after 3ms anyway
Oh yeah. You could also just check through units that the sniper team knows about. So they won't run if they don't know the thread is there
I see. This is good stuff to know. By why must it be included?
knowsAbout, Dedmen? Is that pretty accurate?
Also, yes, we definitely need a check for knowsabout. That was in the prototype version that I had, but I dropped it because I was caught up.
Might aswell use nearTargets then. That'll be much more performant
Oh! That's super great! This will improve several of my scripts in making.
private _leader = leader _G1;
waitUntil {
//Get all known units in 250m distance.
private _potentialThreats = _leader nearTargets 250;
//Are there enemy units near?
_potentialThreats findIf {side (_x select 4) != side _leader} != -1
};
I don't know if it works, but there is also findNearestEnemy and nearestEntities
Just as interesting commands to check out.
That only returns enemies. He also wants civilians and stuff though.
Could use nearEntities but then you'd have to filter for knowsAbout and side.
Why is the sniper retreating from civilians, DEL-J? Preventing discovery?
Yeah, we have a persistent sandbox, players can question civilians, and civilians will tattle, if criteria are met.
But, performance is paramount in this sandbox. There are so many players and so many systems that if we have to drop certain features will have to be nerfed or dropped.
Going back to how often you are going to run it - Dedmen, you say that scheduled scripts drop at 3ms, but if you are spawning it every frame, that's not going to be good, right?
With that running you will probably have 3ms of scheduled scripts every frame.
You can add a sleep into the waitUntil
to make it more perf friendly
I don't really know. I know that our server has GREAT performance consistently, so it's a beast, but I don't know how much it can take, where we can give and take, what effects performance more than what, etc. Completely ignorant on that.
waitUntil checks as often as it can
Well, if you think about it, it's not a decision that the unit needs to be making every frame - that's reserved for things like 'enemy just came around corner and is pulling trigger' - this is something the sniper unit could evaluate as late as every 5 seconds.
you can add a Sleep 5 to check only every 5 seconds for example
Oh? THAT is good to know. Combining a sleep with one of the other performance saving measures here would probably the best course of action for us.
but make sure to have the sleep at the start of the waitUntil
because the last expression in the waitUntil needs to return true/false to exit the loop
waituntil { Sleep 5;
allunits findif {side _x != side _leader && _leader distance _x < 250} != -1
};```
Something like that?
ye
I also tend to leave away the ; on return values. You can leave away the last ; in a piece of code and it won't complain.
But here if you add whatever after the supposed return value. You'll get a compilation error on the script as the ; is missing.
So even if you do it wrong by accident. Keeping that style of no semicolon on return values will show you accidents that might otherwise stay unnoticed
So maybe nearEntities, knowsabout, sleep are the keys here?
Where would you execute that snippet of code from?
I'd personally go for nearTargets. That already contains the knowsAbout and you don't need to do it seperately
And that should also be more performant than nearEntities. Because the unit already has a list of targets and just needs to look into it.
with nearEntities the engine has to look over the whole map for near units. (Not really. Uses a quadtree internally but.. Too hard to explain that)
@dry zephyr, the execution is still a problem I'm solving. It's one of the next things I am going to explore. I've thought about putting in a check in player bases with a twenty hour cool down and a dice roll, but I'm not quite sold on any particular method at present. Players can build bases and that is where they log in, log out, and store gear that persists through server updates and such.
@still forum, That's the one I was looking to find! Yeah, that's what I'll go with, thanks. I was scrolling and couldn't remember the one you'd recommended.
Our AI engages at MUCH further range than vanilla AI through a server mod we made, so these distances are testing distances.
Well, if I read the documentation for waitUntil right ("Suspends execution of function or SQF based script until given condition is satisfied. This command will loop and call the code inside {} mostly every frame (depends on complexity of condition and overall engine load) until the code returns true. The execution of the rest of the script therefore will be suspended until waitUntil completes. "), the code snippet even with sleep would keep executing every framish, so you'd still be running the check constantly, just with a five second delay each time.
"Origin" is also a placeholder. It will be the nearest dynamically placed AI base.
That is an interesting insight...
I think what is in the {} of the waitUntil is meant to be a continuous, framish, low expense check. Whereas if you have an expensive check you want run every 5 seconds, you need a different pattern?
the code part of the waitUntil will also suspend after 3ms
I'd also use waitUntil for expensive checks I only need on intervals.
The alternatives are bad for expensive checks
Oh, so you are saying that if you make one call to waitUntil, it will loop almost every frame or as fast as the check completes, but you have a 5 second sleep in the loop, it is going to take 5 seconds to complete the loop each time, spending most of its time sleeping, so you have an effective every five second check?
or as fast as the check completes it only runs once per frame at most.
so you have an effective every five second check yeah
Gotcha. So the key there then is that when DEL-J starts it off, he's basically waiting for that to return true, indicating the units are nearby, at which point his 'get the hell out of here' code for the sniper unit should run.
But if he wants the sniper unit to start rechecking, maybe when they are at their new position, he has to call the waitUntil code snippet again.
As the checks will stop once it returns.
I'm trying to turn players invisible as part of a script. In the .sqf I have: _guy hideObjectGlobal true . It works when I directly edit someone's init box. The whole script here (https://pastebin.com/GxiMjcFK) works on single player but when I try it on multiplayer it does not work.
note: I'm using Achilles to turn the script into a module
https://community.bistudio.com/wiki/hideObjectGlobal
"Call on the server only."
crap, how would I achieve this if I am making this into a client side mod?
is it possible?
Line 80 is error.
That's not how remoteExec works
your first hideObjectGlobal already runs on server only. But does your module code run on server at all?
no, I turned it into a small mod thingy which is purely client side
so i just load it up in my mods list and I have the module
that looks like you copy pasted a bunch of stuff together. Mixing different code styles...
For one. Line 11/12. Why not use the same private style as line 3-5?
probably should have mentioned I am a bit of a noob when it comes to sqf and have C/P a few things but most of this is me trying to get it to work in the most basic function
if (isServer) then {
_grp = createGroup CIVILIAN;
_rabbit = _grp createUnit ["rabbit_F", getPos player, [], 5, "CAN_COLLIDE"];
_rabbit attachTo [_dog,[0,0,0]];
_rabbit hideObjectGlobal true;
_rabbit setVariable ["BIS_fnc_animalBehaviour_disable", true];
_guy hideObjectGlobal true;
} else {
[[_dog, _guy, player], {
params ["_dog", "_guy", "_player"];
_grp = createGroup CIVILIAN;
_rabbit = _grp createUnit ["rabbit_F", getPos _player, [], 5, "CAN_COLLIDE"];
_rabbit attachTo [_dog,[0,0,0]];
_rabbit hideObjectGlobal true;
_rabbit setVariable ["BIS_fnc_animalBehaviour_disable", true];
_guy hideObjectGlobal true;
}] remoteExec ["spawn", 2];
};
this that should work
currently you already have the top part
is that the whole script for everything or just a portion?
eitherway im very thankful!
currently you already have the top part
Line 14
@still forum, apparently I've done something wrong. No errors, everything works as intended, except for the withdrawal. It isn't triggering now, and I'm sure that I've broken it, but I don't know how.
//Greek Sniper Team
if (!isServer) exitwith {};
params ["_trigger"];
_trigger spawn {
_base = (getmarkerpos "Origin");
_G1 = [(_this getpos [600,(_this getdir _base) -60 + round random 120]), INDEPENDENT, ["I_Spotter_F","I_Spotter_F","I_Sniper_F"],[],[],[],[],[],180] call BIS_fnc_spawnGroup;
_leader = leader _G1;
_threats = _leader nearTargets 250;
{
// _x execVM "Gear\AAF.sqf";
} foreach units _G1;
_G1 setcombatmode "BLUE";
Sleep 5;
_G1 addwaypoint [_this getpos [-400, (getpos leader (_G1) getdir _this)], 0];
[_G1, 1] setwaypointformation "VEE";
[_G1, 1] setwaypointspeed "FULL";
_G1 addwaypoint [_this getpos [-300, (getpos leader (_G1) getdir _this)], 0];
[_G1, 2] setwaypointspeed "NORMAL";
Waituntil {((leader _G1) distance _this) < 350};
{
_x setunitpos "Down";
} foreach units _G1;
waitUntil {
Sleep 5;
_threats findif {side (_x select 4) != side _leader} != -1
};
_wp = _G1 addwaypoint [_base, 0];
[_G1, 3] setwaypointbehaviour "SAFE";
[_G1, 3] setwaypointspeed "FULL";
{
_x setunitpos "Up";
} foreach units _G1;
};```
Ah, I see. Okay, good to know!
Okay, this makes sense. It's creating and dropping that variable every five seconds. Got it.
also please get used to one naming style.
you are mixingcamelCase CamelCase Camelcase alllowercase ALLUPPERCASE all together. Just use camelCase as the BIKI tells you to. Should make the code more readable
also if you get that right you can just do https://community.bistudio.com/wiki/ and copy paste your command behind there to get the wiki page
https://community.bistudio.com/wiki/addwaypoint error
https://community.bistudio.com/wiki/addWaypoint bingo
I think I may just be an idiot but after I changed my script with the thing you sent me, the player turns invisible but everything after line 31 does not work (attaching dog to player). Pastebin here: https://pastebin.com/QFYrcS0X
don't see any error
so what's not working?
the dog should be connected to the player
which is what the second half of the code does
how can I see in that gif that it's not working?
cause I place the module onto the AI/unit/player
and afterwards the dog is not attached to said unit
before it would attach but not make invis
okey.. how about
[[_dog, _guy, player], {
params ["_dog", "_guy", "_player"];
_grp = createGroup CIVILIAN;
_rabbit = _grp createUnit ["rabbit_F", getPos _player, [], 5, "CAN_COLLIDE"];
_rabbit attachTo [_dog,[0,0,0]];
_rabbit hideObjectGlobal true;
_rabbit setVariable ["BIS_fnc_animalBehaviour_disable", true];
_guy hideObjectGlobal true;
}] remoteExec ["spawn", 2];
->
_grp = createGroup CIVILIAN;
_rabbit = _grp createUnit ["rabbit_F", getPos _player, [], 5, "CAN_COLLIDE"];
_rabbit attachTo [_dog,[0,0,0]];
_rabbit setVariable ["BIS_fnc_animalBehaviour_disable", true];
[[_dog, _rabbit], {
params ["_dog", "_rabbit"];
_rabbit hideObjectGlobal true;
_guy hideObjectGlobal true;
}] remoteExec ["spawn", 2];
its still not attaching to player
@still forum, thanks for the help today!
yeah that would explain... Thanks for the help!
[]spawn {
while {true} do {
if (player getVariable "earrape") then {
player switchCamera "INTERNAL";
};
};
};
has crazy performance drops, ~30 fps down.. what am I doing wrong?
Hm. What is the best way to check if a waypoint is complete?
@still forum thanks!
_wp setWaypointStatements ["true", "hint 'This waypoint completed'"];
also (check there description) https://community.bistudio.com/wiki/currentWaypoint
@shadow sapphire
Ah, man... this is something I've needed for a while. Makes perfect sense. The waypoint statements are limited in their use, but you can just throw up a true when complete, and a wait until that watches that.
Thanks, @meager heart.
I have a piece of code that by my understanding should not work but also does exactly what I want it to, so I feel like I've hit a milestone.
if (isNil ([( configfile >> "CfgVehicles" >> _vehClassName >> "AnimationSources" >> _x ), "displayName", nil] call BIS_fnc_returnConfigEntry)) then { ...```
The local and magic variable isn't important, but the way I see it the if statement should be `nil` (and therefore true) if there isn't a "displayName" entry in the relevant vehicle's animation source. Only, it returns true when there **is** a displayName, which is the behavior I want, so...
I checked the function's sqf and it works as the header says (returns third parameter, or in my case nil, if there isn't the config entry it's looking for) so... ¯_(ツ)_/¯
what is more demanding(or recommended course of action). hiding stuff with hide animation, or setObjectTexture ""
?
well #arma3_scripting wise setObjectTexture I'd say. I think the #arma3_model know better which one is more perf friendly.
kk
It's posible to spawn a bullet with tracer effect by script?
I know it's posible to spawn single bullets but, where is defined which bullets are tracers?
Is it possible to make fades executed by a script happen to all players on a mission, for example you can run up to an object and execute a script and it fades to black and then fades back in, however it only does the player who has done the action and not for anyone else, whats the best way around it?
Is it possible to get the player's current difficulty settings?
Jesus is it so hard to make an AI fly to a specific coordinate? I tried sqf HawkeyeLead doMove [999.563,7635.84,5.35433]; tried also with move and tried with addWaypoint
but the chopper does not move from the deck towards the coordinates
so in the addAction do I put remoteExec there? like this this addAction ["Set up Checkpoint", remoteExec "scripts\setup.sqf"];
and @hollow lantern maybe place an empty marker and move it to the marker using getPos
sure I'll try that also
or if its landing you can do it using an invisible Helipad
I think the AI on helicopters will only fly something like within 100m of the waypoint before going to the next one
well the AI does not have any wp. In fact I will create the first via the script ^^
would be something like this in the script then I believe
_wp1 setWaypointType "Move";
_wp1 setWaypointSpeed "FULL"; ```
and this on the pilots ini
HawkeyeLead = group this;
then I use Hawkeye since that's his group ^^
tried that before, maybe I messed something up
I used it recently, naming the group never seemed to work until I actually put it in the ini on the driver in my case then it started to
I have both there but my chopper does not touch off, very weird
ah damnit
I found the issue
{_x disableAI "PATH"} forEach units group Hawkeye; ```
this code I had still in the Pilots init field
thanks for the help @halcyon creek
No worries
@tough abyss Using https://community.bistudio.com/wiki/difficultyOption you can get the difficulty settings for the current user. You can find the list of difficulty options at https://community.bistudio.com/wiki/Arma_3_Difficulty_Menu
Thanks.
As a future FYI to others, the difficultOption cannot return the status on player hints settings. Use https://community.bistudio.com/wiki/isTutHintsEnabled instead
Hi guys, does anyone know how to use the DESTROY waypoint correctly? It seems it is not working at all.... When attached to object, AI refuses to do anything until in COMBAT and when spatial, it's extremely unpredictable.. I am trying to recreate the mouse behaviour from curator, where by pressing RMB on unit creates a (spatial) DESTROY waypoint for every selected units, but in my case it's not working at all
So my server start's a script on each client that connects, the script it starts need to have access to some variables i declared on the server in a cfg, how would i do this?
Except from having the vars in the script that gets run (declaring them there)
Where are the server variables declared?
https://community.bistudio.com/wiki/publicVariable this might be usefull if you declare variables with values on server side.
anybody here havin c/c++ knowledge and too much spare time? could use some helping hands with sqf-vm
That did the trick Veteran 😛 Thanks
Is there a way to check how many eventhandlers a player has?
Not really
but you can guesstimate by adding a empty eventhandler and deleting it again
the handle returned by addEventHandler == the number of total eventhandlers that were added so far
doesn't tell you how many of these handlers were already removed though
Oh no wait.
https://community.bistudio.com/wiki/removeEventHandler
When any handler is removed, all handler indices higher than the deleted one should be decremented.
so the handle probably is the number of currently existent handlers
But I wouldn't trust that
Why not
should 👀
Because that would break tons of mods.
Mod1 add's EH. -> Handle 1
Mod2 add's EH. -> Handle 2
Mod1 remove's it's EH.
Mod2 tries to remove it's EH. But can't. Because the handle should be decremented and is now 1. But Mod 2 doesn't even know that mod1 exists neither can it know that the handle should be decremented
Sigh, they still haven't fixed removeEventHandler? Why they even make it then...
commy says that statement is false. And I think so too. Lots of stuff would be breaking all over the place. It's not though
As of Arma 3 version 1.38 you can safely remove mission event handlers without worrying about decrementing higher indices.
https://community.bistudio.com/wiki/removeMissionEventHandler
That would make more sense. And didn't addAction also suffer this problem long time ago?
*well removeAction
If i compileFinal a var that i use publicvariable on. Do i need to compileFinal it before or after making it public?
if you set the variable after making it public
aka via the = operat... func.. eh... Character!
You essentially delete the old variable and create a new one with the same name
changes that you do after calling publicVariable don't propagate
Ok, thanks!
is it possible to make ingame a "make a report" (on github/gitlab/etc) with htmlLoad?
not really. As it doesn't have cookies to login
And I'm very sure javascript is also not supported
you can however htmlLoad make a Get request on your own server which then generates a report with data passed as parameters
hm wasnt there some way to make stream browser open the url (instead)?
you can just add a link in structured text
not sure if that opens steam browser or desktop browser
it is possible!
but it requires a separate server listening to your request
a simple PHP page would be sufficient
still can't login
you theoretically could even do that, though it should not be done simply because it would be bad practise
actual reporting would work more or less like this: you got some dummy github account that reports the issues for your user
well you could abuse some "anon" account i guess
with a php script you can also just use your own account. Or a bot account
the credentials would be "safe" on the server
problem however would be: you will end up with junk the moment somebody abuses the URL
so some sort of protection needs to be done to prevent abuse
which in the end agian means ... just skip it and send them over to github
it is not worth the hazzle, trust me
i thought about it
just adding a clickable link that opens the webbrowser is much easier.
Biggest hurdle to people would then be needing a github account
you could also just store issue reports on your server and then manually move them to github to have them as a todo list there
either you provide custom login and register service, which again requires webpage access and can be abused too
or you hack around with crap
in the end, all solutions are crap and those who actually will report issues, will also head to your github
Trying to get an addAction to remoteExec a script but cant get it to work, I have the below code on the objected ini field, but I dont believe it works, can anyone tell me where im going wrong?
this addAction ["Set up Checkpoint", remoteExec "scripts\setup.sqf"];
or would it be easier to put it in the first few lines of the script its self?
addAction second parameter is code. aka code wrapped in {} you are giving it the returned value of the remoteExec as argument
could you ELI5? because I dont get what you mean
this addAction ["Set up Checkpoint", remoteExec "scripts\setup.sqf"]; //WRONG
this addAction ["Set up Checkpoint", { remoteExec "scripts\setup.sqf" }]; //CORRECT
addAction second parameter is code. aka code wrapped in {} you are giving it the returned value of the remoteExec as argument
🙃
actually its a lot simpler:
class ButtoDev: Button
{
idc = 1038;
url = "https://forums.bistudio.com/topic/140837-development-branch-changelog/?view=getlastpost";
show = 0;
};```
and there is class RscButtonMenuSteam to open in Steam overlay if active - otherwise standard browser
edit: my bad - only in specific context with hardcoded idc functionality
How would I script detection of incoming artillery round to area.
Lets say I have AI caching and I would like to uncache units when player shoots mortar at the them.
Iirc there was a script which did that. It was used to make defense cannons shoot missiles and the like.
It was called something something ram
it could detector mortars and missiles
or you simulate the damage/effects purely virtually via scripting
How would I go about looping through each vehicle a group is inside?
They may not be in a vehicle or may be in one or more.
{
if !(vehicle _x isEqualTo _x) then {
_vicsArray pushBackUnique (vehicle _x);
}
} forEach units _group;
How would I go about looping through each vehicle a group is inside? Can we get that in proper english?
Each vehicle inside a group? Does vehicle also include units? as units are vehicles too.
Or do you mean loop through each vehicle that has some group inside of it? The all members of a group? Or just some guy in some group? The latter would just be all non-empty vehicles.
Or loop through each vehicle that has a specific group inside it? The whole group? in that case it can only be a single vehicle so why loop? Or any member of that group?
Likely, but questions could always be clearer.
Think it through. What could I mean?
Could I be asking about a truck a unit isn't in?
No.. That's also not on my list
Let's play the optimization game
private _vicsArray = [];
{
if (vehicle _x != _x) then {
_vicsArray pushBackUnique (vehicle _x);
}
} forEach units _group;
private _unitsInVehicles = units _group select {vehicle _x != _x};
private _groupVehicles = _unitsInVehicles apply {vehicle _x};
_groupVehicles = _groupVehicles arrayIntersect _groupVehicles ;
So it's pretty clear what I wanted. Why do you have to always be a complete tool?
No it's not. My list has like.. 6 things on it...
Thanks @digital hollow
So it was the last thing on my list then.
TIL
_arr = [1,2,3,1,2,3,1,2,3,4,5];
hint str (_arr arrayIntersect _arr); // [1,2,3,4,5]
Question about performance about arrays. I want to combine 2 arrays into one. I do not find anything on the code optimizations page about it. So can I just _array3 = _array1 + _array2 or is there a better way?
that is the way yeah. If you need a new array
if you just want to append to an array then.. append
my case is, I need to check on certain situations if my characters primary weapon is in one of the two arrays.
appending is a no go as one of the arrays is being changed by the server via publicvariable
wep in firstArray || {wep in secondArray}
okay
How would you compileFinal a bool? Cause doing this wont work
WhitelistToggle = compileFinal 'true';
But when i try to use it, it says it's not a bool
So i have to call the var?
if (call WhitelistToggle) then {
...
};
Thanks 😛
also you should try to tag your global variables to decrease risk that your variables collide with some addon.
WhitelistToggle => SOV_WhitelistToggle (or whatever prefix you want)
So I'm not sure if this is a scripting thing or a config thing but I was wanting an empty mag to be placed in the player inventory after it is empty. If possible, any guidance in this would be awesome.
Try https://community.bistudio.com/wiki/addMagazineAmmoCargo
If you set ammocount to 0 that could do that.
player addMagazine ["30Rnd_556x45_STANAG", 0];
0 spawn {
private _currentMag = currentMagazine player;
waitUntil {player ammo primaryWeapon player == 0};
player removePrimaryWeaponItem currentMagazine player;
player addMagazine [_currentMag, 0];
};
```also loaded mag will be removed ^
btw what is the easiest way to force ai stop firing without removing ammo ? 🤔
Kill them
yeah... or kick player who was the target...
Kill them
😄
well, he is right 😄
setCombatMode "BLUE" iirc
setskill courage at 0.01 and allowfleeing?
that would be my try without being too notorious about it, they would still do some peashooting but they would also look like a disarranged mess
probably just disableAI the easiest and reliable... 🤔
Is there anything wrong with this code? According to https://community.bistudio.com/wiki/currentMagazineDetail it isn't. I am getting a 18:51:09 Error in expression <_ammo splitString"([ ]/:)"; (This is the handledamage event)
params [
["_unit",objNull,[objNull]],
["_part","",[""]],
["_damage",0,[0]],
["_source",objNull,[objNull]],
["_projectile","",[""]],
["_index",0,[0]],
["_instigator", objNull, [objNull]],
["_point","",[""]]
];
disableSerialization;
private "_ammo";
_ammo = "";
if (!isNull _source) then {
if (_source != _unit) then {
_ammo = currentMagazineDetail _source;
_ammo splitString "([ ]/:)";
_ammo = _ammo select 0;
};
};
@mint kraken yes
_ammo is not a string, it is an array (currentMagazineDetail returns an array)
use str currentMagazineDetail _source
Any ideas how to interpolate playSound frequency to distance: for example the closer the more sounds generated?
@unborn ether something like sleep (1/distance)?
I had the same problem when programming an anomaly detector
https://github.com/diwako/stalker_anomalies/blob/master/stalker_anomalies.vr/scripts/detector/fn_detector.sqf
beeps faster the closer you are to an anomaly
@winter rose yes, but the issue is that sleep will make delays (lol yeah) on the sound, for example 20 meters away will make it happen 20 seconds later (for example). This might be incorrect by the time its sleeping.
@digital jacinth ty will take a look
also circumvents the issue you have with walking closer ot the object and the beep "lags behind"
I got the idea, I will use a bit different way, but that just gave me the idea.
Thanks both.
@winter rose @digital jacinth
👍
maybe "play sound" with playMusic and fadeMusic based on distance 🤔
or simply add sounds to an array and have another thread use it :)
aka fake dolby dts 1.[1.1] 👀
Does playsound even support audio files with multiple channels?
i have never really tried
hi all. little question about GUI
all icons in my GUI are black... how to make them look like in BIS arsenal?
my script^
_pic = getText(configFile >> "CfgWeapons" >> _classname >> "picture");
how do you actually set the image
_list lnbSetPicture [[((lnbSize _list) select 0)-1,0],_pic];
I know someone who definetly knows the answer.. But he got banned because he answered a troll before the troll got banned soooo...
mb someone has the same listNBoxes with colored icons...
Yeah. He does. He made his own arsenal
your code looks correct to me.
does your left column item thingy maybe have a background/foreground color that's black?
it works... the only thing is icons color
OHH
now I see.
didn't see that on the prntscr website as the background is white
yeah. set foreground color on that element
http://prntscr.com/jzizdc
there is a dark background under the list... is this a problem?
hm... i'll try ti play with colors... thank you
Had something similar once. Someone thought this images weren't displaying but they were just black because he set the color of the UI element that's displaying them to black. Which also caused it to manipulate the images color
🕵 pm @elder slate
🕵
Is there any way how i can change the direction of my player looking up and down?
@digital jacinth ```SQF
0 spawn {
while {true} do {
private _beepDistance = (findDisplay 46) getVariable ['detectorBeepDistance',-1];
if !(_beepDistance isEqualTo -1) then {
playSound "beep_target";
uiSleep ((0.25 * _beepDistance) min 0.25);
};
};
};
Where `detectorBeepDistance` is some relative distance to the desired point
To avoid spam that variable has a scripted range limit, so if it goes more than N-meters it just turns -1 to stop beeper.
@lean estuary not at all, sorry
@unborn ether that loop would still go on even if that detector of yours is disabled. You might want to add some handler which starts and stops the loop. Also wouldn't you still have the problem with the sound to "lag behind" the way you are doing it right now?
as in you are 20 meters away, that is a wait time of 5 seconds.
you walk or run up to that object and it is 1 meter. which is 0.25 seconds wiating time. But the other wait of 5 seconds is still in progress.
@digital jacinth I did eliminate that at the point where my actual purpose is 4 meters max distance, otherwise yes, that should be expanded to handle.
It kinda does have "lag" but its too short to mention for my purposes.
Also min 0.25 spans it in my max sleep range.
So even if you go 50 meters, it still will be minimized to 0.25 seconds.
alright
@winter rose It doesn't return an array, it returns a string Return Value: String
@mint kraken
private "_ammo";
_ammo = "";
->
private _ammo = "";
@mint kraken what is the full error that you get?
18:51:09 Error in expression <_ammo splitString"([ ]/:)"; is not the full error
Well the rest was generic expression
Not sure what that ment though
But now I think i know what it means
How would you check if an array is empty
Thanks
Another thing, is there any practical way to check how many controls a certain display has from the vanilla game?
Like i know you can get the current controls of a display with allControls
why can't you use allControls on the vanilla display
@mint kraken true, bad memory. My bad
Cause i want to check the current display against what it's supposed to be
can't test anything right now though, next week =]
I also thought it returns array ^^
To check if it's modded or anything like that
@tough abyss Why would it be different? You can check the config entries. But if a mod changed them that won't help you
You can just run allControls in vanilla. And then hardcode the expected number of controls
Yeah, already doing that 😛 But wondering if there's a "better" way
You can't detect if........ Oh man...
I think you can check who last edited a config entry
and if that mod is not Arma vanilla. Then a mod probably changed something
@lavish ocean what is your opinion on InfiStar, word around the office is that Bohemia Interactive hate them
Is there a way people differentiate heading and course on ArmA? I've got heading using directions (the nose of the vehicle in 0-360), is there a way to get the vehicle model itself or the player's camera direction?) Trying to show two different systems at play; one is course, one is heading. Anyone?
cameraViewDirection
returns player camera view direction as 3d vector
aka you can turn it by pressing ALT and moving camera
hmm, that's good to keep in mind; that'll go in the notes. But what if I wanted the general direction of the vehicle? (i think we already have it sadly, just trying to calculate in the vector path of the vehicle on a single direction)
Question. Is it possible to actually force move a players view location to something, for example lock them to look at a moving plane, player, tank etc?
you can create a seperate camera and move the players view into it
@torpid pike getDir vehicle ?
Hmm thanks
I think that's what we're using currently for heading
bah, oh well lol
:p thanks all
Is there any way to block a player from accesing his mousewheel? I tried the "MouseZchanged" display evh and tried just putting true; or false; in it which is how the keydown evh works but no succes so far.
@tough abyss after a quick benchmark here you go:
0.0013 // count testArray == 0
0.0013 // testArray isEqualTo []
0.0015 // !(testArray params [["_test", []]]); for the lolz
@lean estuary as far as it goes i know you could remove all the actions they could do but i dont know of a way to truely block it
How would i do that then? Im not aware of a way of removing vanilla addactions?
And i know that servers like A3PL have suceeded in disabling it so its def possible.
well as far as i know you could just loop removeallactions on the player or just do it to all the objects nearby
Doesn't work on vanilla actions though but i figured it out now
is what i needed
Thanks anyway
i tryed
anyone know of a way to get all the objects a zeus currently has selected iam working on a script where if the zeus selects objects they can press the user key and line them all up
would it be possible to attach USS Liberty to a dummy ship in order to have it as a drivable ship?
yes if you select all its parts and kinda debug a few gliches you could
using the attachto command with the freedom to a ship with damage dissabled it would work i would think
it may glich around as it is about 10 objects for some reason but it should mostly work
So I found this notification system and tried to add a title to it so instead of _TextCtrl ctrlSetStructuredText _text; I made a _title part in the params and set the default as "Notification" then used _TextCtrl ctrlSetStructuredText parseText ("t size='0.5'>" + _title + "</t><br/>" + _text); But then I got
20:10:48 Error in expression <eText("t size='0.5'>"+_title+"</t><br/>"+_text);_TextCtrl ctrlSetPosition[(_posX>
20:10:48 Error position: <+_text);_TextCtrl ctrlSetPosition[(_posX>
20:10:48 Error +: Type Text, expected Number,Array,String,Not a Number
20:10:48 File core\functions\fn_notification_system.sqf [RLRP_fnc_notification_system], line 2
20:10:48 Error in expression <eText("t size='0.5'>"+_title+"</t><br/>"+_text);_TextCtrl ctrlSetPosition[(_posX>
20:10:48 Error position: <+_text);_TextCtrl ctrlSetPosition[(_posX>
20:10:48 Error Generic error in expression
Not sure why this is happening
_text is Structured Text, needs to be a string
@mint kraken Error +: Type Text, expected Number,Array,String,Not a Number + doesn't work on text
where do you get _title from?
params [
["_text","",[""]],
["_type","default",["",[],{}]],
["_title","Notification",[""]],
["_speed",8,[8]]
];```
can someone tell me how DESTROY waypoint works? Places as spatial it doesn't work at all
And I am running [localize "STR_NOTF_CommanderView", "info"] call Mission_fnc_notification_system; which STR_NOTF_CommanderView is Commander/Tactical View Disabled
you are not telling us the full story
if that would be were _title came from then you wouldn't have that error
But the text isnt ""
- doesn't work on Text
The text is set to Commander/Tactical View Disabled when I call it
parseText is your problem
on line 107 as Gnashes said
you cannot use + after you executed parseText on it
But, when I call the class I set the text to Commander/Tactical View Disabled?
Yeah.. and?
can someone tell me how DESTROY waypoint works? Places as spatial it doesn't work at all
you will need attach it to your object/vehicle withwaypointAttachVehicle< which can/will fail in 9/10 on dedicated, with spawned objects/vehicles... so it kinda works only with "editor placed" objects...
if you doing everything in editor just try attach it with afaik double click over object with waypoint selected (might be wrong)...
@full swan
I keep getting the error missing ] in this code: ```["Body Bag Maker", "Place in Body Bag", {
private _object = [_logic, false] call Ares_fnc_GetUnitUnderCursor;
private _pos = getPos _object;
private _dir = getDir _object;
_active = true;
if (isNull _object) exitWith { [localize "STR_AMAE_NO_OBJECT_SELECTED"] call Achilles_fnc_showZeusErrorMessage; };
rabbit = _grp createUnit ["rabbit_F", getPos player, [], 5, "CAN_COLLIDE"];
_rabbit attachTo [_object,[0,0,0]];
[_rabbit,true] remoteExec ["hideObject",0,true];
if (isNull _object) exitWith { [localize "STR_AMAE_NO_OBJECT_SELECTED"] call Achilles_fnc_showZeusErrorMessage; };
hintSilent "Turned to Body Bag";
_bodyBag = createVehicle getPos player, ACE_bodyBagObject;
[_object, true] remoteExec [call ace_medical_fnc_setUnconscious [0,true];
;}] call Ares_fnc_RegisterCustomModule; ``` even though im 100% sure all the brackets are in the correct place
this is only a chunk of it cause this is what is giving me errors
I also would not be surprised if I did something wrong elsewhere
_bodyBag = createVehicle getPos player, ACE_bodyBagObject;
this is not correct at all.
... //fixed
_bodyBag = createVehicle ["ACE_bodyBagObject", getPos player];
[[_object, true]] remoteExec ["ace_medical_fnc_setUnconscious", 0, true];
...
Thanks!
sorry, its cause im new to some of these and I knew I would screw up somewhere
@surreal peak I've edited fixed code (2nd line)
hi ı change a bank camera positions but not working. I try to copy the position of the object, but it does not work
"bank camera position" ? meaning you want to bank the camera left/right? aka rotate it around it's forward vector?
That was my first guess. But I didn't want to say that because it's so stupid
Can't think of anyone that would be dumb enough to just take someone elses work and the pretend like it's their own
Also we hate such stuff here so much that such people most often just get banned swiftly
@still forum ı change bank position
💸
or maybe he has copied some """Life""" code 🏦 💰
Bingo!
oke
How can I prevent ESC from closing display like it is in Zeus. When you press ESC in zeus it just opens pause menu.
I'm trying to create custom build camera.
Initially I spawn camera via "camcurator" camCreate (eyePos player);
Then later on I'm trying to spawn display to get cursor and it works but can be closed via ESC.
vet_build_display_init = {
private _display = uiNamespace getVariable ["KPLIB_build_display", displayNull];
if (!isNull _display) then {
"KPLIB_build_display" cutText ["", "PLAIN"];
};
"KPLIB_build_display" cutRsc ["RscTitleDisplayEmpty", "PLAIN", 0, false];
private _display = uiNamespace getVariable "RscTitleDisplayEmpty";
uiNamespace setVariable ["KPLIB_build_display", _display];
private _vignette = _display displayCtrl 1202;
_vignette ctrlShow false;
test_display = _display;
// ... more code will be here
};
call vet_build_display_init;
put another display over it that just reopens itself on close event? ^^
_disp displayAddEventHandler
[
"keyDown",
{
if (_this # 1 == 1) then
{
true
};
}
];```
returning true should work, shouldn't it?
I will try this ty.
Yes
As I intend to create something kinda similar to zeus I fear I will have to dig into BI code anyway.
😱
I know someone who already did that 👀
But never finished completly and then out of time
Is he still sane? 😄
Oh nice.
I don't intend to go this big.
We just want nicer build system for liberation 😆
What's intercept, never heard of it
That is a copy of the intercept init code on sqf side from like.. over a year ago
@cosmic lichen not sure if joke
no joke =/
If you love programming in C++ then yeah
I can't programm C
then no
😄
@hollow thistle do you just search for "intercept" on every arma git repo you encounter? 😄
If I start learning C then I'll never see the sunlight again, so I don't touch that stuff
https://github.com/marseditor/mars/commit/2853a7a63c7870f0bf4b5b81b6985cabb36cbe77 Here was his plugin. Just some drawing stuff
but back when he did that intercept was still half broken and unmaintained
@cosmic lichen you don't need sunlight. Get yourself a nice cellar.
wine cellar?
if you like the smell then yeah
who doesn't like wine smell... 🍷
how do you even do SQF without a bunch of wine
🤔
I was looking for ui code and found some intercept calls ;P
@cosmic lichen you'll learn c-like language anyway for Arma 4
Ha, was smoking cig a minute ago, and was thinking exactly the same
🍺 is fine too for some sqf coding.
how do you even do SQF without a bunch of wine Wiskey
I tend to 🍊 🍹
orange juice? Nothing wrong with that 😄
The sugar and co2 filled variant
Gn8
i would love to see people use my stuff too 😦
☝️ wrong on so many levels of desperation!
but true 🤷
stuff like my arma.studio, sqf-vm, ... all to help the community
nobody bothers to help out etc.
sexual innuendo missed its target
feel free to start contributing at any point in time 🙈
workload did not got less, more ... in the opposite direction
SQF VM seems like a dangerous thing for my arma addiction...
why would SQF-VM be dangerous for that?
I'll be sripting all the time, even away from home 😆
well ... bad news for you, you already can use it
on discord
and from home
though ... current standalone release version is not really up-to-date as it still is the c variant which is outdated for month right now
What if, you could simulate the result somehow? Like, let's say it's a cube you're setting the velocity for, and alongside compiling the code "simulates" the result and spits back the velocity after execution
will not happen
no actual game is running, but you could write code in a spawn to actually do that
Hmm. Interesting.
_obj spawn {
while {true} do {
private _vel = velocity _obj;
private _pos = position _obj;
_obj setPosition [(_vel select 0) + (_pos select 0), (_vel select 1) + (_pos select 1), (_vel select 2) + (_pos select 2)];
}
}``` for example
Eeeeeee. No params? Lol
mhh ?
also use vectors maybe 😀
why should i have used params for that code @gleaming oyster ?
could not be bothered to lookup the commands right now @meager heart 🙈
_obj isn't defined
LOL
just was some example code to "emulate" actual game running
X39 we just trolling a bit sorry dude 😄
:)
🤷
i mean... like every code posted here should be optimized asap... 😀
not even sure tbh if i implemented the vector commands yet in the sqf-vm c++ variant
nope, not yet in the c++ version
only in the c variant
i have... i think that is 0.1.4 version
no vectors there
yeah this one https://github.com/X39/sqf-vm/releases/tag/0.1.4-alpha
but Changelog there 🤔
there is my bad https://gyazo.com/4e345c3588c131022714a898927e1554
🙈🙉🙊
So. If I wanted to place a boat inside a vehicle in vehicle Boat Launcher from Encore, what would I need to do?
I'd like to have it start off placed in ViV when the mission starts, instead of having to have players load the boat manually.
Edit: Managed to answer my own question. you can just place a boat on the launcher and it will attach itself. Then you can launch the boat after you crew it.
@meager heart 👌
But that released one is still the c version
Cpp variant is a full rewrite which is more accurate of reality but no Release yet Simply because it lacks Features
@queen cargo your code from 00:25.. There is vectorAdd...
I still see many people writing that old crap that was how you did it in Arma 2. But no one should be doing that anymore
@still forum there may be vectorAdd in the arma world
but not yet in the c++ version of sqf-vm which is what the example related to
Anyone know why
_unit = _this select 0;
is giving me crap when I try to use it with removeallweapons _unit;?
did you checked the value of _this?
maybe because you gave crap to whereever that code is
that line tells us literally nothing
Iirc it complains about the way _unit is being used I'd have to save / execute it again using _this select 0;. it's being used to empty inventory of a unit, but swapping _unit = player; resolves the error.
_this select 0; breaks it
if you don't pass anything to the script sure, selecting 0 from an empty _this will throw you an error
[blahUnit] call compile preProcessFileLineNumbers "blahScript.sqf";
//blahscript.sqf
params[["_unit",objnull,[objnull]]];
removeAllWeapons _unit;
Ideally you should be using params instead
private ["_unit"];
_unit = _this select 0;
removeallweapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;
here's a snippet how it's being used, does objnull select any unit?
No, the first parameter after the string identifying the name of the variable dicatates the default value
the array following indicates the allowed types to be passed for that variable
and no need to private it beforehand, params will do this automatically
ah
params[["_unit",objNull,[objNull]]];
removeallweapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;
so doing that using params will make it detect any unit that it's casted on?
well executed on?
No, params filters already passed parameters to the scritp
just as I have used above
@tough abyss how are you calling that script exactly. The problem lies there.
[thisIsYourParamsArrayPassShietToScriptHere] call compile preProcessFileLineNumbers "blahScript.sqf";
[thisIsYourParamsArrayPassShietToScriptHere] execVM "blahScript.sqf";
execvm on a group of units and or a player on start, I was trying to make it dual purpose so it worked on both ai and players so I didn't need two scripts lol
Show the code snippet of how you are calling it
[thisISYourParamsArrayPassShietToScriptHere] spawn mud_fnc_blahScript;
while {true} do {
//hint"Waypoint updated";
{
deleteWaypoint [_x, 0];
_waypoint1 = _x addWaypoint [(_MOVE_TO_Cargo_position),0];
_waypoint1 setWaypointType "SAD";//SAD MOVE
_x execvm "scripts\GERORGE FLOROS\randomequipment.sqf"
_x setCombatMode "RED";
_x setSpeedMode "FULL";
_x setBehaviour "CARELESS";
_x setSkill ["general", 0.1];
_x setSkill ["reloadSpeed", 0.8];
_x setSkill ["aimingSpeed", 0.2];
_x setSkill ["commanding", 0.2];
_x allowFleeing 0;
}foreach [_Recon_Teams];
sleep 50;
};
};
_x execvm "scripts\GERORGE FLOROS\randomequipment.sqf" There
_x is the unit
But inside your script you expect [_x]
_x != [_x]
params will fix that for you automatically too
you really shouldn't be using _this select anywhere anymore
that's just outdated
thankfully sqf wipes messes up for me a tiny bit unlike java
I'll be honest I'm kind of already skirting by with limited sqf knowledge snagging bits from working stuff to get things working lol I seen people using _this select 0; and figured it was good
Nope
So to be clear it will automatically detect _unit if I don't define it in the script?
wish it could 😦
Are you talking about params[["_unit",objNull,[objNull]]]; with that?
ye will it be wise enough if I replaced my current _unit to know that _x from the other file is the _unit?
replace with what?
Don't see any reason to change anything besides that params thing
params[["_unit",objNull,[objNull]]]; with my _unit = _unit select 0;
you asked replace what with what, should params[["_unit",objNull,[objNull]]]; be in place of my current busted _units = _this select 0;
and that would make it recognize _x is the intended target?
that would execute your code on whatever unit you pass to the function
currently tested unit is passed to script -> Params -> _unit is defined from passed parameters
in your case _x execvm "scripts\GERORGE FLOROS\randomequipment.sqf" _x is the parameter. So the unit will be _x
neat i'ma go give it a try ty
And you said private is basically useless?
What would that even be used for?
i doubt that dedmen would have said that using private is useless
well he said its not needed
if you're ever going to be using private use it like so:
private _var = "var";
//not
private["_var"];
_var = "var";
Sets a variable to the innermost scope
in a function, this is not needed, but in a basic script, private is usefull, right ?
it's not needed when using params
It's not needed because params already does it
ah
Already said that above
private ["_var"] is dumb and useless
private "_var" is dumb and useless
private _var = value; is how it should be used
using private in general makes your script faster and safer
i'm assuming the intention of private is to make something specific to a script?
but not if you use the variants that I just called dumb. Because they make your script slower
yes.
If you'd use the same variable name as a script that called your script. You would overwrite their variable
If you use private that doesn't happen
makes sense, I may have to go make some things private in other files, I have a few reused things in areas.
But I tend to use it everywhere even if there likely won't be any collisions. Because of those precious microseconds that my script will be faster
ty for the advice i won't scrap it but i'll make it work i guess lol
also function will be better option... i mean execVM in a loop is bad idea 😃
😬
wow. didn't even notice that.
Also didn't notice that }foreach [_Recon_Teams]; is dumb, useless and probably not what he wanted to do
Copy paste from guys who didn't know better back in Arma 2.
Hmm.
also probably from YT tutorials "how to do stuff"
Oh. That for sure will stick
@A3_Stickie#1337 not wanna bother him with mentions ;)
Is working on a new/fresh/up-to-date SQF beginners guide for the Arma blog. When that's done we can just link it to people.
Maybe also add a section about common mistakes ^^
Definitely.
would be listed using Life?
I think I can arrange that 😄
:p
got a quick question about the private
private _lol = 10;
_lol = _lol + 5;
It is still private on the second line ?
yeah
okay thanks
make sense xD
//Variable contianing client-requests
Promise_Requests = [];
//Callback for Promise methods
Promise_Callback = {
params ["_id", "_sender", "_data"];
private _request = Promise_Requests select _id;
if ((_request select 0) == _sender) then {
Promise_Requests set [_id, 0];
_data call (_request select 1);
}
};
Promise_Create = {
params ["_rcv", "_mthd", "_args", "_cb"];
private _index = Promise_Requests find 0;
if (_index == -1) then { _index = Promise_Requests pushBack [_rcv, _cb]; } else { Promise_Requests set [_index, [_rcv, _cb]]; }
[_args] remoteExec [_mthd, _rcv, false];
};```
gimme dem crits
Whats that?
promise 😄
[some_random_player, "PromiseCallbackOnClient", "randomarg", { /* executed on server whenever the client is done and send a remoteExec back */ params ["_arg1"]; diag_log _arg1; }] call Promise_Create;```
theoretically, there is a client-side missing though ..
but that was not required
it is just so that you can actually do Request-Response systems in ArmA
Just curious what chain are you trying to create: client-client, client-server, client-server-client?
client#1-(client#N|server)-client#1
if (_index == -1) then { _index = Promise_Requests pushBack [_rcv, _cb]; } else { Promise_Requests set [_index, [_rcv, _cb]]; }
[_args] remoteExec [_mthd, _rcv, false];
Why set the index if you don't use it afterwards
good question @still forum
I would rather do it this way (server variant);
// Server
DT_fnc_someResponse = {
params ['_code','_arguments'];
private _owner = remoteExecutedOwner;
private _result = _arguments call _code;
[_result] remoteExec ['DT_fnc_someRequestCallback',_owner];
};
also the index is always 0?
the empty stuff is set to 0
Client side does what you need. No need to store something somewhere, just make it ping-pong variant
Promise_Requests set [_id, 0];```
request respons what do u mean?
This is basically just async call with callback
you tell someone else to execute something. And he tells you when it's done
@unborn ether goal is to have a full Promise system in place
the idea being that you can call a clientside method from the server and just be done with it
when the client then is finished, execution on server continues
but as i said, client-side is yet missing
but it was just hacked together in a minute
I've always just done that using CBA events. And then just let the function on the server send a event back
Same here (tho with publicVarEh because I forgot cba had events). Normally use it for JIPs
promise-system https://gist.github.com/X39/709ecbf88c5fda594586c9b995c8c6a0 now feature complete
feel free to test it
//Variable contianing client-requests
funny what one can hack together in a matter of minutes just because somebody asked one something
//Mehtod to create a promise
typos
_promise select 2 != _stamp when can that happen? Don't see anything that sets that
if (_index == -1) then { _index = Promise_Requests pushBack [_args, _cb, _stamp]; } else { Promise_Requests set [_index, [_args, _cb, _stamp]]; }
when some index is reused
fixed and fixed
https://gist.github.com/X39/709ecbf88c5fda594586c9b995c8c6a0#file-promise-sqf-L8 how does that ever work? first element is args. not sender
yyy
as i said
hacked together
gimme a second
now
works
unless i overlooked something .. got no highlighting editor in university
gist highlights for you
only after updating
Someone should build a web based online linter
could be done with eg. sqf-vm
though ... problem will always be that undefined variables cannot be errors as it might be intended
in a small code snippet you can see the whole code. And can see if that function is called with a local variable that could carry over
https://gist.github.com/X39/709ecbf88c5fda594586c9b995c8c6a0 now the promise system is even spawn-save
What the point of the stamp?
Also doesn't remoteExec run functions in a scheduled environment, so you have a race condition between Promise_Callback and the "free list" with _index = Promise_Requests find 0; in _Create.
https://gist.github.com/X39/709ecbf88c5fda594586c9b995c8c6a0#file-promise-sqf-L7-L8 shouldn't that also be wrapped in isNil then?
yes remoteExec runs in scheduled by default
@errant jasper no. Not there. Because that part of the code runs unscheduled it makes sure nothing else can run at the same time
Ah yeah, my bad. Worst thing to happen here is a new index is used instead, but hardly a problem.
Personally, I would ensure all these functions ran in unscheduled. None of them are expensive to run, and you would sleep better.
Promise_Callback does not needs to be run in non-scheduled
the id is freed AFTER the value is received
obviously ...
kinda 🤦
regardless of that, if it is not free (0) it will never be accessed by normal code
need*
anybody willed to test that lil system?
cannot do it myself as i am at university https://gist.github.com/X39/709ecbf88c5fda594586c9b995c8c6a0 (Promise-System)
yay now we can have js like callback hell in sqf too :)))))
@tough abyss only if the code works
besides ... @still forum do you know if CBA has such a system in place?
@errant jasper that is exactly what the code emulates
I know, that's my point. We always had "callback hell" in sqf - except worse.
CBA has systems to make it very easy to build such a system on your own
but no actual system like that yet?
guess not
@errant jasper if you could test the system, i would be able to actually create a PR for CBA
https://github.com/X39/CBA_A3/tree/master/addons/promise
though ... probably will be rejected for reasons in first attempt
If you want it in CBA. You should use already established CBA event system
I mean if you are going to use CBA, then use the built-in events system. If not for the fact you want to pass arguments directly to the on-result-callback it would be like 5 lines total.
^what Dedmen says
never worked with CBA
not really planning on doing so
the system as designed is as performant as it can ever get
proposing that PR, commiting it if i or somebody else says the system works as it is right now
if it gets rejected for formal issues, i correct them
if for usage issues, i just leave it closed *and ref to the gist
@queen cargo about to test. Two typos, Promise_Done needs 'then'. And 'select 0' should have been 'select _index'.
It works.
@still forum Could you explain how "true call {}" and "false call {}" works ?
I get that True and False are the arguments of call but how are they caught on the other side ...
in the scope of the script _this will be either true or false in the examples you have provided.
the argument is copied into the _this variable
true call {} is the same as
_this = true;
call {}
can i use https://community.bistudio.com/wiki/sort for sorting strings alphabetic
yes.
how would i sort a array of objects by name
_sortedObjects = ((_objects apply {[_x, name _x]}) sort true) apply {_x select 1}
however i can't loop through it now
it returns an array of the objects in sorted form
{ ...code }forEach _sortedObjects; undefined variable in expression _sortedObjects
show full code
{
_sortedObjects = ((allUnits apply {[_x, name _x]}) sort true) apply {_x select 1};
{
hint name _x;
sleep 1;
}forEach _sortedObjects;
}
];```
still same error
_sortedObjects = ((allUnits apply {[name _x, _x]}) sort true) apply {_x select 1};
I don't see it.. No typos in there
Maybe someone else can see the error.. I'm probably too tired
Sort modifies the array, no return @still forum @tough abyss
🤦
_sortedObjects = (allUnits apply {[name _x, _x]}) sort true;
_sortedObjects = _sortedObjects apply {_x select 1};
😃
No.. still wrong
_sortedObjects = allUnits apply {[name _x, _x]};
_sortedObjects = _sortedObjects sort true;
_sortedObjects = _sortedObjects apply {_x select 1};
``` (╯°□°)╯︵ ┻━┻
┬─┬ ノ( ゜-゜ノ)
True, no ref
which will be deleted after the ;
_sortedObjects sort true; // shouldnt it be enough?
┬─┬ ノ( ゜-゜ノ)
CRAP
_sortedObjects = allUnits apply {[name _x, _x]};
_sortedObjects sort true;
_sortedObjects = _sortedObjects apply {_x select 1};
:>
leaves the room
anyone know a way to make the ai move ontop a waypoint as the ai keep moving near the waypoint my not on top of it
_Area is a VR ground object i have for the purposes of judging how close they get
_WP setWPPos position _Area;
_WP setWaypointCompletionRadius 0.1;
_Group setBehaviour "CARELESS";
_Group setSpeedMode "LIMITED"; ```
side note when i did not force the VR object to a position with setpos the ai moved right to it ie just using create vehicle and leaving it there
{
_x setBehaviour "CARELESS";
_x setSpeedMode "LIMITED";
_x move (_Area modelToWorld [0,0,0]);
} forEach units _Group;
_Area is a VR ground object
kinda strange name for the object...
my whole code is just a giant mess
in order to test it fully i need to write giant chunks at a time and then test each section out so
😃
they still refuse to go to it why
wait
now they just dont move
here we go again
yeah no thats not working they still want to go around wherever i tell them to go and path in the most open area they find rather than the shorter path which is wide open
Hi, I have a problem, hope that you can help me.
My code:
addMissionEventHandler ["Draw3D", {
drawIcon3D [
"\a3\ui_f\data\map\Markers\System\dummy_ca.paa",
[1,1,1, (60 - (player distance cursorTarget)) / 50],
[((getPos cursorTarget) select 0), ((getPos cursorTarget) select 1), 0.5+(1.8/(60/(player distance cursorTarget)))],
1, 1, 0,
cursorTarget getvariable "licenseplate",
1.8,
(0.037-(0.030*((player distance cursorTarget)/60))),
"TahomaB"
];
}];
Error:
20:51:18 Error in expression <
drawIcon3D [
"\a3\ui_f\data\map\Markers\>
20:51:18 Error position: <drawIcon3D [
"\a3\ui_f\data\map\Markers\>
20:51:18 Error Type Any, expected String
If I change cursorTarget getvariable "licenseplate", to "1250 ADC", It's working...
Do you know whats wrong?
Use cursorObject
also if you look at the world or anything with a valid "licenseplate" it wont work
addMissionEventHandler ["Draw3D", {
_Plate = cursorObject getvariable "licenseplate";
if (isNil "_Plate") then {} else {
drawIcon3D [
"\a3\ui_f\data\map\Markers\System\dummy_ca.paa",
[1,1,1, (60 - (player distance cursorObject)) / 50],
[((getPos cursorObject) select 0), ((getPos cursorObject) select 1), 0.5+(1.8/(60/(player distance cursorObject)))],
1, 1, 0,
_Plate
1.8,
(0.037-(0.030*((player distance cursorObject)/60))),
"TahomaB"
]};
}];
that in theory should work
^ you're still missing one =p
only group leader will be at that point/position and the group members will be according to "formation and formation spread" somewhere around it anyway, CR1M30N
@digital hollow missing what?
wont let me post 😦
CR1M30N still has a cursorTarget in the code xD
I have to change all cursorTarget to cursorObject ?
no i did not =p
@kasper Yes. @steady egret >_>
Still this error:
21:19:49 Error in expression <censeplate";
if (isNil "_Plate") then {
drawIcon3D [
"\a3\ui_f\data\map\Markers\>
21:19:49 Error position: <drawIcon3D [
"\a3\ui_f\data\map\Markers\>
21:19:49 Error Type Any, expected String
Code:
addMissionEventHandler ["Draw3D", {
_Plate = cursorObject getvariable "licenseplate";
if (isNil "_Plate") then {
drawIcon3D [
"\a3\ui_f\data\map\Markers\System\dummy_ca.paa",
[1,1,1, (60 - (player distance cursorObject)) / 50],
[((getPos cursorObject) select 0), ((getPos cursorObject) select 1), 0.5+(1.8/(60/(player distance cursorObject)))],
1, 1, 0,
_Plate,
1.8,
(0.037-(0.030*((player distance cursorObject)/60))),
"TahomaB"
];
};
}];
try str _Plate,
Thanks guys 😄
https://community.bistudio.com/wiki/Ambient_Combat_Manager_-_Group_types -> is there any config file for helicopters?
https://github.com/DUWS-R-Team/DUWS-R/blob/master/source/WARCOM/WARCOM_opf_assault.sqf -> I would like to add a wave spawning attack helicopters 😃
anyone know how to force the ai to move untop a location as i cannot script the ai to move to a specific location i posted it above the script is
_WP = _Group addWayPoint [_Area modelToWorld [0,0,1],0];
_WP setWPPos (_Area modelToWorld [0,0,1]);
_WP setWaypointCompletionRadius 0.01;
_WP setWaypointLoiterRadius 0;
player setpos getWPPos _WP;
_Group setBehaviour "AWARE";
_Group setSpeedMode "LIMITED";
_WP setWaypointStatements ["true", "this setVariable ['WSR',1]"];
problem is the ai never move to the wp and the tp is 1-2 m away from where the wp is suppose to be the area is a obj 1 m under the ground and should not be causing path finding errors as its a vr ground entity any help? the move command does basicly the same thing
the group is a one man squad
group and object https://gyazo.com/c115a69b86321333b809df3eac553c96
group at position https://gyazo.com/d8338685879b91c0952e9ce7a2402c9d
ungrouped units at position https://gyazo.com/a8de4b2a3a8fdeb71f7b192c80ea90ce
😀
let me show you what happens with mine
i cant post stuff here ok let me try to post it
imgur it
can we open "pause menu" via script?
@meager heart when i do your test it works but if i create the waypoint with scripts it does not idk anymore
object and unit https://gyazo.com/5486dfa7366f4b9f5bff24f4d6c0a2e8
unit at position https://gyazo.com/d54469d8dfae079bece6599b1e583611
code >
var_unitName move (var_objectName modelToWorld [0,0,0]);
¯_(ツ)_/¯
then i guess its the objs or my game is ruined ok
Are there any default CfgSounds you can call?
If not what is a good place to find .ogg sound files?
has anyone made a library for quaternions in sqf by chance? I'm feeling lazy 😄
@hollow thistle check Karel Moricky's post there > https://forums.bohemia.net/forums/topic/177542-displaying-the-escapepause-menu/ afaik atm the same 🤷
@meager heart found the error know of anyway to make a ai go close to objs as the problem is the ai wants to walk around it and stay 1 m away from it at all times
I was asking cuz recently I was asking how I can stop display from being closed on ESC. And display event handler works but I can't open pause menu with it on (obviously).
input action and close display
I will have to dig into zeus code I think. My goal is to have floating camera (this i have already working), but also i want to have cursor and ui elements.
but also i want to have cursor and ui elements.
maybe justcameraEffectEnableHUDandshowHUD [<params>]
Where can I find the BIS_fnc_holdKey? Checked functions_f.pbo couldnt find it there... I need to modify it so it executes a script when they start holding it
Thanks!! ❤
Arma 3\Mark\Addons < that one lol
Question, so I know you can script a live feed of various PIPs into screens and such
but could you make them freeze in a screenshot format/
Like is it possible to make a literal photograph within the game itself?
@meager heart Thats the not the one xD I was looking for BIS_fnc_holdKey you found keyHold
@outer fjord I tried that before using RT textures, but the engine always clears the texture to black each render frame, so if you stop rendering the view you only get black
damn
I was looking for BIS_fnc_holdKey you found keyHold
shoots himself in the head
I have a feeling it got added in Tac Ops
and I dont have it rip
Well that was a waste of 1 & 1/2 hours
I have creation rights to a mod on the workshop, but the Publisher tool isn't giving me an option to update it.
@mint kraken You don't need the DLC to use the fnc
Hello everyone, if i want to use setVariable on a player, and if i want that value to never be modify, should i use compileFinal, or something else ?
compileFinal should do just fine
good tnx
pretty sure compileFinal doesnt work on objects.
He's compileFinal'ing the variable
It depends if he compile finals a global variable in that players mission name space of a variable on an object iirc. I think it is possible to just overwrite it from another machine as well with going _unit setVariable ["myVar", _newvalue, true];
it will be
player setVariable [format ["id_pl_%1", getPlayerUID player], _id_pl, true];
@gleaming oyster I want to modify it
if (isNil "_Plate") then {} else {
<code> };
What have I done that you all must punish me like that?
@tough abyss Would you maybe someday finally stop cross-posting? #rules
@mint kraken you definetly have it.
And no it wasn't added in TacOps
Well I cant find it...
where are you searching for it?
Last night I searched in the functions PBO in Every folder.
Then you would've found it.
@meager heart sent you a screenshot showing you where and in which PBO it is
Oooooh
And in #arma3_tools Ampersand replied with Tac ops
Ah yeah.
Which makes me even more believe it got added in Tac ops...
Guys anyone know how I can do this: If damage is 0,9 then allow damage false on helicopter
I want a helicopter to be attacked but not destroyed
Everyone has it but those who dont have it as ebo. And as I know you cant open EBO’s
But Thanks ❤
You could also use the ingame function viewer and just copy paste
Or like.. You literally just write BIS_fnc_holdKey into the debug console.. And it returns you the code
so yeah, i was thinking about keyHold not the holdKey, those names... 🤷
it's like after some update pictureColor was changed to colorPicture for the ui configs 😭
worldvisualworldworld ©
Can Arma into space?
Why isn't there any reliable method for monitoring the action context menu? inGameUISetEventHandler doesn't monitor several changes in state, such as closeContext, navigateMenu and when the engine automatically changes the selected action because it's no longer returning a true condition.
It's quite frustrating that there isn't simply a "selectedAction" command that returns the current selected action ID and object or if the inGameUISetEventHandler events actually monitored the menu properly.
{_x addEventHandler["Dammaged",{_this spawn{sleep 0.1;heli1 = _this select 0;if (damage heli1 >= 0.9) then{heli1 allowDamage false;};};}];} foreach thislist
Why is this not working
{
_x addEventHandler["Dammaged",{
_this spawn {
sleep 0.1;
heli1 = _this select 0;
if (damage heli1 >= 0.9) then { heli1 allowDamage false; };
};
}];
} foreach thislist
if damage is bigger than 0.9 then it's proooobably already dead
Hmm try
You probably want to return 0.9 in the EH to prevent it from being destroyed before allowDamage is disabled.
allowDamage false is being executed after the damage has been applied. You want to override the damage and then disable future damage.
Use "HandleDamage" so you can override it.
Depends what you're trying to do.