#arma3_scripting
1 messages · Page 438 of 1
@unborn ether I thought createVehicle by default doesn't spawn on occupied area (collision NONE)?
position: Position - Desired placement position. If the exact position is occupied, nearest empty position is used.
@fossil yew Well createVehicle tries to find a safe position, but if another vehicle is created before the first one gets its time to init - booom.
I see
depends on your VM business mostly
maybe a simple sleep would help
ok, I'll try with bigger value
Maybe something might be in the way, for example a platform they are created on. You can try adding ~0.25 to your last Z coord.
ok, thanks
How performance intensive are global remoteExec/call executions? Would I benefit much from passing arrays of only nearby players to a required call compared to running it globally? For example, lets say I wanted to play a switchMove animation on a player. Would I benefit much from remoteExec'ing it to only nearby players?
Between 0 and infinite.
Yes ofcause it would benefit. The server having to send less messages out. Means the server has to send less messages out.
Less messages == less traffic == good.
But in most cases I'd say that doesn't matter. Atleast not before you approach a 50+ playercount
Alright thank you
@still forum i tried it now with your code and it works so just specific player can open the paint menu BUT the function to paint wont work anymore
How performance intensive are global remoteExec/call executions?
like this (ツ)_/¯ 😄
@pseudo cypress Is the function to paint also in there? Just remove it. If they can't open the menu they can't paint anyway right?
this is how the script looks ingame
a specific player can open this menu but cant press the change mode to texture button and it shows no colors there
¯_(ツ)_/¯
@pseudo cypress assuming that is exile, you need to make an edit in model box show
I’m not on pc but that is where they modify all the camera stuff
is there a way to quickly see execution time and possibly load a script is having on the server?
load a script on the server..? execVM?
No I’m talking about how resource intensive a script is
oh, load on the server, my bad.
execution time yes, load no afaik
you could log at the beginning and the end of this script and check the time difference in the server logs
load check would require only the script to run, and you monitoring the CPU difference at the same time
resource intensive == runtime.
Except if you spawn vehicles or markers or other stuff. In that case. No. No way.
execution time in scheduled scripts is useless too
@tough abyss the problem isnt the view on the obejct the problem is that i cant change the colors
i have this code
sound[] = {"BEW_Music\sound\music\BEW_Song_01.ogg", db2, 1, 50};
which number do i need to change to increase the volume?
i'm trying to add music to my mod haha
You could tell me what that is. Then I might be able to google for you
i did google it and i couldn't find anything usefull
i need to increase the volume of that song
db2, 1, 50};
iis a config.cpp that i made to play a song in my mod
//sound effects
class CfgSounds {
sounds[] = {};
class BEW_Song_01
{
name = "BEW_Song_01";
sound[] = {"BEW_Music\sound\music\BEW_Song_01.ogg", db2, 1, 50};
titles[] = {};
};
Mh.. When I google I find stuff.
Weird.
And it even tells me what the volume is.. Weird.. Very weird.
My computer must be magical and I probably have access to a special type of internet where google returns magic results
// filename, volume, pitch, distance
sound[] = {"fx\wolf1.ogg", 1, 1, 100}; i'm guessing te distance is 100
and the volume is 1 but theres another 1 haha
🤦
Filename
Volume
PITCH
Distance
Pretty sure it's CfgSounds, however @ornate pawn I suggest you ask in #arma3_config
thanks dude
i got it working
i just figure that out thanks for not being an a hole
Keep Description.ext in your favourites, you can use it frequently
i know that but i'm actually putting the songs in a config.cpp for my own mod
Yes, it's the exact same concept. Just the wiki shows you it in a description.ext file. You use it / set it up the exact same way in your config.cpp file.
@winter rose Btw Description.ext page doesn't show what the CfgMusic parameters do 😉
Well. I just googled Arma CfgSounds
And it gave me that.
Google is amazing, once you obtain a brain cell that knows how to use it. 😋
lol
yeah dude, people learn something and they feel like god i know how it feels when i was in the U.S Army and learn something i felt special i know that feeling..
The MPHit event handle causedBy is not returning the weapon that damaged the unit but the unit that cause the damage, any fix for that or is already know issue?
Not entirely sure, never worked with it. But can't you just simply get the weapon by doing this SQF _killersWeapon = currentWeapon _causedBy;?
If only people would learn how to google :u and then feel like god about it.
@astral tendon It was never supposed to return a weapon. So there won't be a fix. And it's not an issue.
Dedmen my solution would work correct? Seeming currentWeapon returns as a string?
yeah
So, why have the causedBy and instigator if they do the same thing?
unless the causer changes the weapon before the bullet impacts
Because.. Google! Reading! https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#MPHit
Which is a slight chance of that happening.
Says it right there
Unless you shoot from a far distance
But with rockets?
oh true.
Or in case of collision damage there is no weapon at all
Well in that case, you could just put filters in before hand to check.
Simply check if _killersWeapon is either nil or "", make _killersWeapon equal to "Unknown" or something
What if he has a weapon. But didn't kill you with it
That is a problem to detect a granade
I'm reading up on the remoteExec command, and tried playing around with ending a mission (via the server, but executed by the client) so I'm using this but doesn't seem to work SQF ["END1"] remoteExec ["endMission", 2]; That should work, seeming executing this via the client works fine SQF [5] remoteExec ["skipTime", 2]; Anyone know if there is a certain type of syntax needed when using endMission and remoteExec together?
endMission doesn't take array. It takes string @modern sand
I used this on my missions
```["end_unsafe",true,true,false] remoteExec ["BIS_fnc_endMission"]; ````
Cheers, just Dedmen is right. Remove "END1" from an array and should work fine.
Thanks, both of you 😃
😛
Detecting grenades via MPHit is.... Well.. A challenge
If I remember corrently that's hard and over my level. Commy might know
Ahh, removing it from an array doesn't seem to work either.
What do you expect to happen?
You are executing it on the server...
And it has local effects
so.. If at all it will end the mission on the server... I'd say undefined behaviour
https://community.bistudio.com/wiki/endMission Read Additional info at the bottom
Ahh, I guess I should have checked before hand. idk why but I just assumed if it is executed via the server it ends it completely.
Waiting for your classic google one liner Dedmen 😛
Well if the mission ends on the server.. I would also expect that all clients are kicked out of the mission.. ¯_(ツ)_/¯
That's what I expected as well.
@still forum ok, ok, I'll update the Description.ext#CfgMusic ... get the whip away plz 😄
CfgRadio as well
And if you call BIS_fnc_endMissionServer the server does not stop still 😃
lol, well I'm just using this now ```SQF
"END1" remoteExec ["endMission", 0];
Yeah, I send an event from the server to all (including the server), and then handle it locally on each machine. But I also have to handle, two sides, and both win/lose endings, for a total of 4 different possible endings to display.
@still forum done, btw
just in case someone wants to create vehicle on exact spot (like doing some persistent mission), don't use type createVehicle pos. Use private _vehicle = createVehicle [_vehicleType, _vehiclePosition, [], 0, "CAN_COLLIDE"]; instead. First default call likes to move vehicle to new position when Arma thinks something might get in the way even when it results in complete explosion.
@modern sand try this ["End1",false] remoteExec ["BIS_fnc_endMission"]; 😀
Tom, I always just do an explicit setPos* after
afaik endMission < deprecated
I do too @errant jasper
AFAIK endMission is not deprecated. I you to end the mission without the visual effects it is one of the few ways to do it.
i create it on [0,0,0] and setpos after
Yup. But it is, as @fossil yew says, because I don't trust the created position, and even if I did, I can't ever remember what the position is posAGL, posATL, posASWL, or posWTF
endMission is it still working, Muzzleflash ?
Yeah. I use it on the dedicated server since BIS_fnc_endMission* does not terminate the server
@errant jasper It´s the same, just my way is better optimized
hmm
This is my game over event handler for an asymmetric TvT mission: https://pastebin.com/G4WmWqG0
For a dedicated server I force it to end the mission by running the command.
BIS_fnc_endMissionServer?
^ I was about to say
it ends on client and server
BIS_fnc_endMissionServer no it does not https://forums.bohemia.net/forums/topic/208826-bis_fnc_endmissionserver-doesnt-end-mission-with-no-connected-clients-on-a-dedicated-server/
maybe problem is that
"SideScore" - show "YOUR SIDE WON" to side with largest score
and since no players are online, it might be 0-0?
not sure, just guessing
no problems here either
Do the "ropeBreak" eventhandler execute when a rope is shot?
For SideScore what side is dedi on?
Maybe endMissionServer is only broken for SideScore then. I just took him on this word that for his instance the server did not terminate, which lead me to consider this another untrustworthy BIS function.
Sections defines the variables used for score i would imagine?
BIS_fnc_endMissionServer just delegates to fnc_endMission. For SideScore case it does:
[["SideLost",false,nil,nil,true],"bis_fnc_endMission",_sides - _winners] call bis_fnc_mp;
[["SideWon",true,nil,nil,true],"bis_fnc_endMission",_winners] call bis_fnc_mp;
[["",true,nil,nil,true],"bis_fnc_endMission",allcurators] call bis_fnc_mp;
The 3rd argument to bis_fnc_mp is target where for a type side it: Side - function will be executed only on clients where the player is on the specified side
well i use RE 🤷
allCurators return a list of objects, and then bis_fnc_mp only run where those are local. So it does look like SideScore is broken for dedi servrs.
Well if you use endMissionServer then you also use bis_fnc_mp.
@orchid saffron Never mind it does
How does the engine run at the same speed at any framerate?
Or does it?
Does a player with 60 fps run faster than 10 fps
Like in-game run 100 meters
It looks like, SideTickets, GroupScore and PlayerScore end mission types have the same issue.
@peak plover ["id", "onEachFrame", {comment "your code"}] call BIS_fnc_addStackedEventHandler; ?
^^ Now he just needs to ruin his fps to test 😃
shift minus [fps]
can toggle to 60/40/20/unlocked
I mean like engine side
How does the engine make it so the character always moves
At a certain speed
Even if fps is high
@still forum maybe knows
Awoooo
Engine uses deltaT
time doesn't change depending on FPS
time is always time
Anyone know, rather than continuously update variables used for CfgDebriefingSections, can I just listen for "Ended" mission event handler and compose it then?
so delta time
It at least works in SP Eden, just curious if anyone has more experience with it.
Does it mean
Why is: nil call _code treated special compared to _anyThingElseThanNil call _code ?
Also, what is preferred alternative? 0 , [] , or ???
Is there a simple way to set a mission or server where map markings will only be shared if players are very close?
@errant jasper call BIS_fnc_endMission
? I am no longer talking about BIS_fnc_endMission.. Just general calling. If the argument is nil the code inside behaves differently.
you can use call directly, no need for parameters
that's what I meant
https://community.bistudio.com/wiki/call → First syntax
That work too. But since the code will be customizable I would prefer not to, since calling without argument leaks those from higher above.
I... am not sure I understood that
@errant jasper Nil is treated as special because.. It is special. No real reason I guess. It was just coded that way
Typical BIS. It ruins dynamic scoping
just always pass array?
You should use params anyway
and 0 or [0] is the same for params
Yup, that's my workaround so far, to pass []. Just wondering whether it was the best value to pass (in microoptimisation land).
@winter rose See this example where the code runs wrong because the arguments are not default: https://pastebin.com/SJwCfVtf
[] is cheaper than nil
but 0 might be a bit cheaper again
but you are in nanosecond area here.
@errant jasper I still don't get it, nevermind.
so calling with nil or directly call won't use params properly?
wat
.... why the hell would you expect params to work in that situation
and no, params works as intended there
Yes params works as intended. It is calling that does not.
@lone glade How do you call a function without passing arguments?
That passes the arguments of the "parent" function.
Run my example shown above. I call _unknownCode like you say, yet it receives outer arguments.
where is it?
it's an inline func
different case there
the args aren't passed, the args already exist within that scope
Then let me rephrase how do you call an inline function with no arguments?
you don't
if you used params or private the local vars that used them will be defined there
you're not passing _this, _this already exists in that scope
so either pass your args like you would normally do or don't use params inside that inline func
So SQF is terrible with regards to compositionality
oooh... using call _fnc is indeed _this call _fnc? brain just clicked
that's not the issue lou
params default to using _this as left arg
_this already exist in the parent scope
thus it's also present in the inline func in that case
isn't it like _x in forEach, the innermost is used?
yes
but he called it without passing args
so it's not redefined
think of privated local vars, it's the exact same
And the only way to undefined it for the call is to call it with 'nil' except that somehow breaks dynamic scoping completely.
Yeah. I think I am going to stick with [] since it worked for me since way back. And fortunately, nowadays, almost all are passing array even for single arguments.
oh ok, thanks
Mmm i´ve checked the performance in the console and passing nil as an arguments is more optimized
you can't rely on the console for that kind of testing
So what you recommend
dedmen's perf profiler*
hey @still forum did you implement what we talked about a while ago?
😦
and I can't dev at home
it was about swapping the perf profiler for brofiler instead
@orchid saffron Mmm i´ve checked the performance in the console and passing nil as an arguments is more optimized Yes. Ofcause. Because the call will silently fail and never execute
Ah yeah that's on my todo
So yes. Not calling at all is faster than calling
@still forum touché
// is faster than comment huehuehuehuehuehue
breaks his neck
inbound X39
who uses comment really?
stupid people
Hah.. Wanna bet
Wow so bulli dedmen
Damn. Didn't know code could have "Director's Comments"
and both are worse than // or /* */
Just looking through a few vanilla missions. Is it hard, without any mods, to assign spawned AI to a HC?
Well define mods...
HC mods are just scripts
you might aswell place them in your mission
Any way to measure text width, in horizontal space, not number of characters?
@still forum If I add a TFAR event handler to a player, will still work on respawn?
How would I waituntil a file has been "read" to then continue with script?
context?
scriptDone ?
thanks @meager heart
Do this make sense? ArmA keeps throwing errors: sqf b_mrap_01_f = [b_mrap_f,b_mrap_f_1,b_mrap_f_2]; o_mrap_02_f = [o_mrap_f,o_mrap_f_1,o_mrap_f_2]; The variables in the array are markers, which are the same name, and in the variable box.
Is this possible to do: ```sqf
{
#include "fn_aiCreateVehicle.sqf";
} foreach b_mrap_01_f;
{
#include "fn_aiCreateVehicle.sqf";
} foreach o_mrap_02_f;``` Having two or more #include statements of the same file?
i want to know that as well, plus can sqf inject a hpp / cpp / cfg as well in #include?
@cuel so say i have the grumpy loadout script on my server (has multiple hpp cpp and sqf files)
can i remoteexec it to another connected player that doesnt have the script?
@errant jasper No TFAR EH doesn't work after respawn
In TFAR 1.0 you can just use the unitless CBA eventhandler. That will always work
@lusty canyon If you send the script along yes.
@still forum Okay. I'll add a respawn handler for now, still on 0.9.12
Do you guys know a way to remove all doors from a Building?
is it possible to assign a property to a specific magazine?
the only way i can think of is to cache the amount and if that changes, take it as new magazine/magazine change
"property" ?
If you want to identify a unique magazine you can use special ammocount or magazineID
magazineDetail script commands
thanks
@drowsy axle Marker names are strings, not variables. So it's "b_mrap_f" not b_mrap_f
sleep 2;
(_this select 0) setUnconscious false;````
some times the unit do not come out from the unconscius animation, even when the life state changed, is there a fix for it?
try a playMove maybe? or playAction, something along the lines
@astral tendon playAction (or playActionNow) "PlayerProne" could do the trick I think
i use the swichmove "" to cancel that.
though i though that could be a better way to do it.
I just had the problem on the player unit, and I solved it by selecting a weapon.
I forgot to change the ingame variables to suit. NVM it all works...
Demellin's answer, quotes quotes quotes yes
There is a module under Environment that does just that. Not sure how that would work in game via script, though maybe you could tie it to a trigger?
@peak plover ^
I have a probably silly question about a simple caching script I'm using. Basically the idea is to get rid of everything outside of 1000m radius to the player, just to save some performance.
I have an _excludedVehicles param
So I can add named vehicles to it, like arty and transport choppers, so they can operate properly.
But...I want to spawn in jets for CAS, and I can't figure out how to name them upon spawning them, OR how to simply exclude any/all air vehicles from the caching.
Any assistance would be appreciated. I'll paste code segments if anyone wants to see em, but I don't wanna spam unprompted. XD
diag_log format ["%1 %2 %3",_listerUID, (typeName _listerUID), _listerUID == (getplayerUID player)];
"76561198132926159" STRING false
``` any idea's guys ? it doesn't seem to comparing the string correctly
@tough abyss _obj isKindOf 'air'
Ah interesting @peak plover thank you. So where would that go in this:
_excludedVehicles = [PBR1, PBR2, PBR3, Mortar1, Mortar2, Mortar3, Howitzer1, Howitzer2, Howitzer3, Howitzer4];
_checkDistanceSqr = (1000 * 1000);
_toCheck = (allunits - allplayers - _excludedVehicles);
while {true} do {
{
_dist = getposatl player distanceSqr getposatl _x;
if (_dist < _checkDistanceSqr) then {_x enablesimulation true;_x hideobject false;_x enableAI "FSM";};
if (_dist >= _checkDistanceSqr) then {_x enablesimulation false;_x hideobject true;_x disableAI "FSM";}
} foreach _toCheck;
sleep 0.1};
};```
Within the excludedVehicles array maybe?
Is this for multiplayer?
How do I delete map objects? no way, you can't delete map objects. You can use hideObject or hideObjectGlobal @peak plover
None of the assets coming from a map can be deleted
simple objects i create myself, can I delete those?
Anything from mission.sqm and createVehicle (or similar) can be deleted.
Is there any scripted command to detect if you are a FFV gunner at the moment?
Try using assignedVehicleRole in combination with gunner and commander
@peak plover Sorry just saw this, no singleplayer
@unborn ether you can tryfullCrew
@meager heart Found the way, its assignedVehicleRole + cameraView. Obviously if you are "cargo" and "GUNNER" means that you are able to shoot from a passenger seat.
oh and its better to check !isNull (objectParent player), since assignedVehicleRole is buggy.
//--- return player in FFV seat/turret
systemchat str (fullCrew [vehicle player, "", false] select {_x select 4} apply {_x select 0});
``` possible need some corrections ^
@unborn ether
assignedVehicleRole isn't buggy
it's just that a unit can have a role assigned but still be outside the vehicle
^
isn't assigned role to the vehicle you are not in a bug ? 😃
nope
assign vehicle role -> tell them to get in
or, better, move them in said position instead of using what is pretty much a bunch of deprecated commands
also assignedVehicleRole will return role after unit will be not in a vehicle, or there are no vehicle any more
role is still assigned
and to which of 10 vehicles ive entered it stays actual?
and if unit will switch seats... role will be autoassigned to new one
What is the difference between accessing inventory of a vehicle compared to accessing the inventory of a crate in terms of scripting commands used?
Can we use same commands to access vehicle inventory
InventoryOpened
containers are containers
Ok thats what I need
Everything is an container. I want to save the contents of it for the next battle... Persistent mission
So you want to save the contents ?
I made crates saved but not vehicles yet
You would probably just want to write a save script, using InventoryClosed.
the event handler.
Already done
so what are you asking then ?
if it works the same for containers as it does for vehicles ?
findDisplay or uiNamespace var ? which ones better , in your guys opinions.
Am looking for someone to help me test some network code, any volunteers?
what is it ?
Testing my VTOL, need to check it syncs over the network currently am quite sure it does but can't confirm it. https://i.imgur.com/GPVvoLq.png <- this thing
dqfuq
Wanna help? 😛
im messing with dialogs rn 😉
Awesome! Also to answer your question, I love findDisplay.
best way of converting parts of an existing dialog, into a controls group without messing up the positions ?
When it comes to UI... https://i.imgur.com/BHG3ua8.png
Oh boy am I the dude to talk too
I'll PM you, I love arma UI
addEventHandler ["FiredNear", "
if((_this select 6) == 'Sub_F_Signal_Green' AND (_this select 1) cursorobject == (_this select 0)) then {hint 'ok'};
"]
Why is that considering AND a object?
_this select 1 is an object
why is not reading cursorobject ?
seems like people will never learn to script UI more than "arma level"
Why is _this select 1 even there?
@astral tendon because of arma means let it be always the same ugly forver?
So why is it there?
@astral tendon and you missed the Object argument before your addEventHandler
Uh, he probably just omitted it
Dude
I see, it was wrong
@strange urchin Well
_this select 1 \\ vehicle: Object - Object which fires a weapon near the unit
I know
@unborn ether I working on prettying up my dialogs xD
But that’s not relevant
So, any other way to know if a unit is aiming at another one?
Most likely its a Generic error in expression here
AND (_this select 1) /#/ cursorobject == (_this select 0))
object object == object?
that’s what I said
Perhaps you could try assignedTarget (_this select 1) == (_this select 0)
Assuming it’s an AI
@wary vine @wary vine Scripted UI is the key in that.
Its a player
No, an AI that is firing
@unborn ether Im just so used to GuiEditor 😛
GUI editor is limiting
You better use 🇵 🇦 🇷 🇦 🇲 🇸 instead of _this select
Good for visualization some times
to understand what are you looking at
the amount of controls I have in my market system, I would have probably gone crazy getting the layout right with scripted controls
Demellion, you sound like someone that uses apply
@wary vine Well it doesn't really give you a power of scripted management. Just for the case you can't use ctrlDelete on config UI elements, what gives a huge difference on flexibility.
this addEventHandler ["FiredNear", "
if((_this select 6) == 'Sub_F_Signal_Green' AND cursorobject == (_this select 0)) then {hint 'ok'};
"]
Well, that works, but i imagine that i will have trouble if ported to a MP coop right?
I made a sonar without using GUI editor, it’s pretty overrated for anything but visualization
@strange urchin No I just sound like a dude who likes params
Yes, you might have trouble in MP
Any other option?
@strange urchin Ok, im gonna give you an example. I have a dynamic list (not RscListBox) for N-amount of elements inside a RscControlsGroup. Once the changes come, i just delete the whole group and regenerate it the same way it was before. Yes, I just use one ctrlDelete instead of hiding and showing stuff or changing their content. Oops, can't ctrlDelete config controls..
I know
All that its because the flare revolver does not count Hit
And yeah, @ is usually used to turn to people in discord, so you can undestand im talking to you
😄
Well sorry if that bothers you, I was just talking to a different people at once.
doubt it.
🤔 👍
i am working on something that uses scripted dialogs though 😃 https://gyazo.com/6a2427e3e887f96df17696f930cbe722
Anyone use simple objects?
It says they don't get damaged?
Does that mean
Simple objects have less impact than map objects?
@peak plover Yes, as said they are simple. They only do send packets about positioning, dir and up, and ofc "im existing!". So no damage, no namespaces and etc attached.
@peak plover You cannot set any EVH or setVariable on them.
@unborn ether So no damage, no namespaces and etc attached. Wrong.
They have namespaces and what does "etc" mean?
How do i seach and select somthing in a array? like
["stuff","morestuff","anotherstuff"]
i want to select anotherstuff but i cant use numbers like select 2
it returns a number, that is the select number?
yes
Thanks.
What does this means?
a = [""AAA"", ""BBB"", ""CCC""];
What?
You mean "What does this mean?" ?
It's a syntax error.
So.. One could say that it means nothing
But that was the result of diag_log format [a];
format [a] Wtf? 😄
That means a is a string containing a = [""AAA"", ""BBB"", ""CCC""];
I'm sorry I mean [""AAA"", ""BBB"", ""CCC""]
thx, I'll give that a try.
@still forum do eh work? damage?
wwut?
<@&105622502444711936> The screenshot sqf command fails for me with E_FAIL when creating a D3D11 device, according to reference on MSDN that means a device with debug flag is being created when no debug layer is installed, what gives?
Can you reproduce? Can other people reproduce that?
Right now It's actually on my friend's machine and on my machine it doesn't happen, but he is able to reproduce 100%
latest graphics drivers?
No, but I don't think it's the drivers
the rpt writes:
DX11 error : Saving of screenshot to file failed: : E_FAIL
Where does that say "when creating a D3D11 device"
And you really think a graphics error is not connected in any way to the graphics drivers?
E_FAIL literally means "FAIL"
Nothing at all to do with creating a D3DDevice or any debug flag or whatever.
looks like a generic error, like usual
You shouldn't try to interpret something into something that's just not existent
It says fail. Because it failed. That's it.
When I see an error code that looks like it's associated with related MS API and MS specifically defines what it means in that context, I would assume things, yes
Oh look https://feedback.bistudio.com/T120379 Google returns results! Who would've thought that?
And that guy even answers what solved his problem.
Man.. That internet seems to be a really great place. You just try to search for something. And you find something about it. Pure magic (∩`-´)⊃━☆゚.*・。゚
More people should use this stuff.
Don't know what's with hostility, I just asked a question
I answered you. By googling for you which you could've done yourself
I don't see any hostility?
The profiles= cmdline param is not being used, checking HDR in a moment
Dedmen is just a bulli
Maybe people just think I'm hostile because I show them their weak points
Weak points? I don't think their "weak points" apply across the board. But I guess you could say that
It's more of the mentality of most that gives them these weak points. "Hold my hand and tell me everything to do"
you guys are pansies, you wouldn't believe how much shit commy can send at you huehuehue
@lone glade Gib medical rewrite
am not on it
Is there a PR for it?
if you wanted to yell at me you should've said gib fixed arsenal camera (I seriously have 0 drive to fix it) and do the arsenal stats documentation
yes ^
multiple ones
GIB Fixed arsenal camera :-)
The HDR setting was the solution. Thanks for the assist
You needed 1 hour to solve that by asking in here.. Just googling for the error would've given you just that one result with the solution inside it.
So I hope you understand now why I complain about people who cannot just do a simple google search before asking here
I did the search, I did not stumble on that particular ticket
If you don't mind sharing your query
"DX11 error : Saving of screenshot to file failed: : E_FAIL" <--
Exactly your error message with quotes around it
Thanks
[
cursorObject,
"test",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"\a3\ui_f\data\IGUI\Cfg\holdactions\holdAction_connect_ca.paa",
"_this distance _target < 10",
"_caller distance _target < 10",
{},
{},
{hint "hi?"},
{},
[],
0,
0,
true,
false
] remoteExec ["BIS_fnc_holdActionAdd", 0, true];
removeCompleted is set to true but that action still there for the other player
Any way to fix that?
BIS_fnc_holdActionRemove < this
can you have two private statements in a sqf file?
ex:
private ["_myvar1","_myvar2];
//later in code
private ["_myvar3","_myvar4"];
Yes. Also, beware of the missing quote!
That action still there for the other player, also, how do i give a ID to my hold actions?
(X) DOUBT
press F to pay respects
Hi All. I am looking for a script to teleport from Perhaps a Flagpole into a Vehicle.
player moveInCargo <YourVehicleHere>
_flag addAction["To Vehicle",
{
player moveInCargo vehicle_1;
}];
etc etc
hrmm. Re-logging gonna try. ty
player is local, any vars above need to he defined.
vehicle_1 as well, you can pass any created vehicle to addAction as an array right after given code
private _veh = "BlahVehicleClass" createVehicle [0,0,0];
_flag addAction["Bleh",
{
params["","","","_pass"];
player setPosATL (getPosATL (_pass select 0));
},[_veh]];
getPosATL _pass#0 😄
I'll make sure to hide that card under a dustry rag once it becomes usable
You're going to need to clean it off here in a few weeks.
I'm getting a "Generic Error in Expression at the sleep 5; line. Is there something I'm missing?
if (_color == "blue") then {
hint "It's blue";
_helipad = createVehicle ["Land_HelipadEmpty_F", _tagPos, [], 0, "CAN_COLLIDE"];
sleep 5;
deleteVehicle _helipad;
deleteVehicle _tagObject;
} ;
when it was just this it worked fine:
if (_color == "blue") then {
hint "It's blue";
_helipad = createVehicle ["Land_HelipadEmpty_F", _tagPos, [], 0, "CAN_COLLIDE"];
} ;
@vapid drift you cannot suspend a script in a unscheduled environment
so should I just create a function to pass the tag and helipad objects to that will handle the deleting after a set time?
you can use spawn or use a event script that is scheduled.
_this spawn
{
params[["_color","",[""]]];
if(_color == "blue") then
{
//your code here
};
};
You can use canSuspend to check if the scope you are in is scheduled
or rather
that suspension can occur
ok, thank you
there really is a big difference between animate and animatesource in MP ?
Speaking about optimization mainly
using source is better
it can triggre multiple simultaneous parts to move at the same time
afaik
Wanted to know if it's really more optimized for MP, or i can stay with animate
this will be returning one due to it being in the array ["Apples","Oranges","Pears"] find "Oranges" but what if i want to look for "Oranges" in this array ["Apples mums","OrangesAnd some weird things","Pears are good"] in this array i want to check if anywhere there is the work "Oranges" i want that string to be able to have other thins in it aswell. Hope that makes sense
_yourArray findIf {_x find "Oranges" != -1}
Using new current dev-branch findIf command
you basically iterate through every element manually. And use find on each string
But thats not in the current build?
true
you can use forEach and if then exitWith and _forEachIndex to build something similar
Don't have time right now to write that out
No worries thanks for the help as allways.
o so basically findIf is select but breaks the loop upon returning true
Better Name would be selectFirst
🤔
@hasty violet execvm parses a file and compiles it then Acts more or less like spawn
The latter Block will not compile as you expect because preprocessor is not parsed in strings with "
Ohh.. Variable
Still... You compile final it
Meaning you got Code in there
Use ifs...
Hey guys, noobie question here. Trying to simulate the need for a radio operator in a single-player scenario. Player can add or dismiss static units (not spawned in). "T02" is the RTO. Using the Unsung mod and ideally I'd like it so that the support provider only becomes available when you are interacting with your RTO's radio, but I'll settle for it, for now, just becoming active once you have added the RTO to your squad. I've seen scripts that have like if in thisgroup stuff but I don't have the first idea how to implement such a variable. I tried syncing the support providers to the AI and then adding him to group but it didn't work. Any ideas?
were i can find about class RenderTargets? the config viewer is empty about it
Like here configfile >> "CfgVehicles" >> "B_UAV_02_F" >> "RenderTargets"
http://killzonekid.com/arma-scripting-tutorials-uav-r2t-and-pip/
Im trying to to this but with a Laser designator but it does not turn
if you are about the positions and directions for the camera, check UAV model config, you are looking for this things
uavCameraDriverPos = "PiP0_pos";
uavCameraDriverDir = "PiP0_dir";
uavCameraGunnerPos = "laserstart";
uavCameraGunnerDir = "commanderview";
@astral tendon
Also what is the procedure for changing an AI's name in the sqaud AI in the bottom left of the HUD? Is there a simple init command I can do?
@meager heart were i find that? i tried it and did not worked
which drone you are using ? 😀
B_Static_Designator_01_F
uavCameraGunnerPos = "eye";
uavCameraGunnerDir = "look";
Now the camera is moving and my notepad decide to fart, thanks for the help, but were did you find that?
sldt1ck - Today at 08:24
if you are about the positions and directions for the camera, check UAV model config
@astral tendon
how?
afaik was using my eyes... back then
Hello Im trying to keep people from opening a bar gate but this code is not working
((nearestobjects [this, ["Land_BarGate_F"], 5]) select 0) setVariable ['bis_disabled_Door_1',1,true];
lol
oh you mean
configfile >> "CfgVehicles" >> "B_UAV_01_F" >> "uavCameraGunnerPos"
location to look at, is there (in your case) https://gyazo.com/649c530d0b71c483081ae6fcd9f19d3d
you need extract files from that pbo and unbinarize them, google will help you... 😀
@astral tendon
i just find it here in the config view
up2u
@queen cargo Better Name would be selectFirst What? No. That would be a completly different thing.
@hasty violet curious what the functional difference is between using description.ext preInit to spawn a scheduled thread vs. execVMing something in init.sqf
preInit doesn't spawn a thread. Init.sqf runs later, after preInit and maybe potentially but maybe also not before or after or inbetween or above or below postInit.
also execVM doesn't store the script in a variable while CfgFunctions does. Assuming you mean CfgFunctions when you say "description.ext" because "description.ext preInit" is pure non-existent bullshit.
@hasty violet Probably just being unable to compileFinal structured text in general Uh.. yeah.. compileFinal takes string. Not Structured text. So who would've expected that, that would work at any point in any timeline of any parallel or orthogonal universe?
If I wanted to add some event handlers to a vehicle, but maintain those event handlers through locality changes such as from the owning player logging out, what would be the best way of doing this? Should I just add the event handlers to every player that logs in after? Or is there a better way to do this
You mean always have the eventhandler on the unit that owns the vehicle?
Yeah
There is a locality changed eventhandler
you can use that to detect locality change. And then just remoteExec to the new owner
to re-add the EH
If someone disconnects the object is usually transferred to the server
Perfect, that should do the trick. Thank you 😃 One more question though, on the topic of persisting vehicle related stuff. I also want to maintain added actions to vehicles too. I assume theres not really any other better way than to just initially globally remoteExecute the script which adds the actions, and then run the script on JIP players for all vehicles?
I can't think of a better way
You could store the action parameters in a public variable on the vehicle
on JIP everyone will get the variable. And then on postInit you read it and add actions dynamically based on that variable
Alright cool, I might do it that way. Thanks again for the help.
How would I be able to bind a key action to a custom key # ? Such as fire a script when a user presses Use Action 16 in custom controls?
Is there a dik_code I am missing for those keys or does it have to be done another way
https://community.bistudio.com/wiki/BIS_fnc_holdKey could help you maybe?
https://community.bistudio.com/wiki/DIK_KeyCodes here are the keycodes
I know how I would add it - I just don't know how to add it to a custom control
like adding a bind to 9 I would use the keycode 0x0A but no clue on custom controls
custom controls would be "commands" and not directly "keys"
commands are bound (binded?) to keys, but you want to get the command activation
Hello, beginner problem here: itemCargo doesnt return the full cargo, it always stops at the AK-74 Mags
testFn = {
_container = _this select 1;
hint str itemCargo _container;
};
player addEventHandler ["Take",{
_this call testFn;
}];
Yes. itemCargo returns items
As the wiki page of that command says
same as magazineCargo returns magazines. And weaponCargo returns weapons
ah, didn't realize magazines are not items
is there an allCargo or something similar?
well you have magazineCargo, weaponCargo, ItemCargo.
no there isn't
thanks
figured out my thing @winter rose
if (_keyCode in (actionKeys "User2")) exitWith
{
code to run when actionKey is pressed
};
👍
noice!
@torn juniper
#include "\a3\editor_f\Data\Scripts\dikCodes.h"
if(DIK_yourKey in (actionKeys "User2"))
Makes everything more readable
was running it on a keyUp EH thats why I had the code above
Same thing applies, to the UI EVH and your action key returns.
ace is pissing me off with its view distance limiter i can't disable it.. someone knows how ?
how what?
Disable it?
Uhm.. Just like.. Disable it.
Change the view distance limiter setting from enabled to disabled.
i did and nothing happens
Well
Why not you know, restart your mission and have everything reload?
https://github.com/acemod/ACE3/blob/master/addons/viewdistance/XEH_clientInit.sqf#L7 That code says something different
i've disable that thing and restarted the game
You disable it. And it will be disabled.
i even check my description.ext
If you're on a dedicated then it's set view distance may be lower than you want
i'm hosting
You can disable it with the ace setting
with steam
You can run arma without steam?
I'm hosting the mission
Well I don't know why it doesn't work for you
but it can be disabled with the setting.
Probably something intercept does in a superior way
If i press Esc i don't get the ace option. i have to go to configure >
i disable it and it doesn't work
..
yes. CBA options are ace options
ACE options are CBA options and CBA options are ACE options
so i gotta disable it in CBA too?
so is a CBA setting
that i need to add in the mission
to disable it
i had to restart the game 4 fucking times to disable that thing
horrible
along with the NVG effect
not even close to the real one. i have an script that makes nvg look more realistic. if ace wants the script i can give it to them
having an issue with ctrlDelete here
Lega_editListingOpen = true;
_1 = _display ctrlCreate ["Lega_Market_EditingListing_Title", 9999991];
_2 = _display ctrlCreate ["Lega_Market_EditingListing_Background", 9999992];
_3 = _display ctrlCreate ["Lega_Market_Listing_CreateListing_Button", 9999993];
_4 = _display ctrlCreate ["Lega_Market_EditingListing_ListingName", 9999994];
_5 = _display ctrlCreate ["Lega_Market_EditingListing_Description", 9999995];
_6 = _display ctrlCreate ["Lega_Market_EditingListing_Price", 9999996];
_7 = _display ctrlCreate ["Lega_Market_EditingListing_ListingExit", 9999997];
_8 = _display ctrlCreate ["Lega_Market_EditingListing_ExitBtn", 9999998];
_8 ctrlAddEventHandler ["buttonClick", "[_this] call Lega_CloseEditListing"];
Lega_editListingControls = [9999991,9999992,9999993,9999994,9999995,9999996,9999997,9999998];
``` creating the controls.
```sqf
Lega_CloseEditListing = {
diag_log "OHFUCK";
{
ctrlDelete ((uiNamespace getVariable ["Lega_Market",displayNull]) displayCtrl _x);
}forEach Lega_editListingControls;
Lega_editListingOpen = false;
};
``` deleting the controls... and its just crashing arma xD probably something im just being retarded about.
Have also tried putting the actual controls into the array and (ctrlDelete _x) getting the same crashes.
have someone a short time for me to help me with 2 overrides that must be merged ? pls
Ace is over writing my Earplug script my script
how can it prevent that ?
VAR_PICTURE = "<img image='scripts\BEW\Ear_plugs\Earplugs.paa' align='left' size='2.5'/>"; //--- add your picture
VAR_TEXT = "";
CTRL_TEXT = parseText (VAR_PICTURE + VAR_TEXT);
waitUntil { !isNull(findDisplay 46) };
(findDisplay 46) displayAddEventHandler ["KeyDown", {
if (_this select 1 == 0x3B) then
{
_earplugsctrl = (_this select 0) displayCtrl 9001;
if (isNull _earplugsctrl) then
{
_earplugsctrl = (_this select 0) ctrlCreate ["RscStructuredText", 9001];
_earplugsctrl ctrlSetPosition [SafeZoneXAbs, SafeZoneY + (SafeZoneH - 0.03) / 2, 0.5, 0.2];
_earplugsctrl ctrlSetFontHeight 1;
_earplugsctrl ctrlSetStructuredText CTRL_TEXT;
_earplugsctrl ctrlShow false;
_earplugsctrl ctrlCommit 0;
};
[_earplugsctrl] spawn {
_ctrl = _this select 0;
playSound "EarplugsOn";
_shown = ctrlShown _ctrl;
1 fadeSound (if (_shown) then {1} else {0.2});
_ctrl ctrlShow !_shown;
};
};
}];
is it possible to attach an eventhandler to a weapon?
So if the weapon is fired, a script is executed
https://community.bistudio.com/wiki/checkVisibility
I think it worth put a note on it about that this page leads to understand that it only works with unit x unit but also works with other objects by using the getPosASL or eyePos on the object in that case sounds weird use eyePos on a rock for exemple and getPosASL maybe put the position below the ground, Also, smoke grenades seems to give a high number than 1 but they are bellow 0.1 and higher than 0.
@half hornet no not to a weapon, the weapon is not separate object. you add fired eventhandler to the user of the weapon
Can I save stuff into code blocks and call/compile in php like in sqf?
@ud9d-1#6325 because this
_8 ctrlAddEventHandler ["buttonClick", "[_this] call Lega_CloseEditListing"];
is destroying the control from its EVH.
For that type of actions you need to
_8 ctrlAddEventHandler ["buttonClick", "[_this] spawn Lega_CloseEditListing"];
You cannot just call the script which destroys the very same control.
And tbh that UI structure is done really badly. Just my opinion.
can someone help me with a file merge ? i dont get it please
Open destination mission. Select merge from menu. Select mission you want to copy objects from. Click merge. Save.
How hard would it be to add a sound effect to a moving object via a trigger?. I currently have it fine for static objects such as speakers but would love to have Wehrmacht propaganda trucks driving around.
try say3d
@fossil yew that would have the sound follow the object?
yes @obsidian chasm
Ye I have no idea how to do it, honestly
in trigger execution field just type
name_of_your_truck_object say3d soundName;
you obviously need to name your truck
do you know how to import sounds into the mission via description.ext?
@ornate pawn remove the hearing module in ace
@fossil yew yes I have them working for static objects
I mean that would suffice but i was wondering how hard it'd be to activate it via a trigger spawned AI vehicle
it's easy, like I said. Name the truck and use the line written above. It just works.
for example:
_truck = "truckType" createVehicle somePos;
_truck say3d "YourSound";
truckType being the exact class name of the truck you want to create and YourSound name of the sound from description.ext
@unborn ether I ended up doing it like ```sqf
_1 = _display ctrlCreate ["Lega_Market_EditingListing_Title", 9999991];
_2 = _display ctrlCreate ["Lega_Market_EditingListing_Background", 9999992];
_3 = _display ctrlCreate ["Lega_Market_Listing_CreateListing_Button", 9999993];
_4 = _display ctrlCreate ["Lega_Market_EditingListing_ListingName", 9999994];
_5 = _display ctrlCreate ["Lega_Market_EditingListing_Description", 9999995];
_6 = _display ctrlCreate ["Lega_Market_EditingListing_Price", 9999996];
_7 = _display ctrlCreate ["Lega_Market_EditingListing_ListingExit", 9999997];
_8 = _display ctrlCreate ["Lega_Market_EditingListing_ExitBtn", 9999998];
_8 ctrlAddEventHandler ["buttonClick", "Lega_editListingOpen = false"];
_arr = [_1,_2,_3,_4,_5,_6,_7,_8];
[_arr] spawn {
disableSerialization;
params ["_arr"];
waitUntil{!Lega_editListingOpen};
{
ctrlDelete _x;
} forEach _arr;
};
var names are being changed now its working.
@wary vine Mate you should really learn what's RscControlsGroup. It will make your life easier
just to say you can ctrlDelete the whole group with all related controls.
it broke it xD
Yeah, next dialog, ill be using controls group
like it did with an old project, ill just be finishing / remaking it
gimmie a sec , ill get a gif
that was a bitch to make
I hope thats a controls groups 😄
controls group inside controls groups xD
even made a replacement for the pop up thing.
@wary vine That ctrlDelete issue. spawn the deletes instead of doing it directly in the EH.
@half hornet is it possible to attach an eventhandler to a weapon? No. But you can add a FiredEH to the unit that holds the weapon
@astral tendon about the wiki note. #community_wiki
@peak plover Why do you ask PHP question in #arma3_scripting ?
thats what I did in the end, I did a spawn, then waitUntil !var, then delete
works perfect
Nigel, We do not speak of the language-which-must-not-be-named.
Yeah. Sorry I wrote before I was done reading.
Actually accidentally hit enter :u
@errant jasper U mean SQS?
@still forum Wrong xD
create a weapon as a vehicle ?
then cant you put event handlers to it 😛
What?
@still forum Lol, suppose SQS would be a runner up
A weapon is not a vehicle
You can't spawn a weapon as a vehicle
Well.. Static weapons? Do they fire the Fired EH? never tried that
thats one to be tested xD
static weapons (turrets) are "vehicles" like any other. Only the hand held weapons cant be accessed with scripts. Even on ground they are in ground weapon holder object
So, I can't rember why this happens, I know it's a scope issue but.
this addAction ["action", {this someFunc}];
in the init field of a unit or object
and this is a undefined variable.
Does it not have the scope of the location the code was compiled, in this case the init on the unit? Is it even compiled then?
Just trying to clear this up for myself.
You want _this instead
Does it not have the scope of the location the code was compiled
That's not how scopes work.
in this case the init on the unit That's not how compiling works.
Is it even compiled then? No. Not at all.
@hearty plover having the scope of where "it was compiled" is known as lexical scoping. Must language have that. But SQF has something close to dynamic scoping.
For one scopes don't work from where it was compiled.
Second it isn't even compiled there.
addAction stores the code as string and recompiles at every execution. Just like eventhandlers -.-
hmm, having a little issue with
//Pushing back all the needed controls for the actual script.
private _neededControls = [
_editListingTitleControl,
_editListingDescControl,
_editListingPriceControl
];
``` and
```sqf
_editListingBtn ctrlAddEventHandler ["buttonClick", format ["[ %1 , %2 ] call Lega_fnc_editListingClient",_info,_neededControls]];
Yeah.
if I push back the idcs it doesn't error , but doesn't let me doing ctrlText
nope,
its does'nt even work xD
14:53:04 Error in expression < Title","Listing Description","12313"],[Control #9999994,Control #9999995,Contro>
14:53:04 Error position: <Control #9999994,Control #9999995,Contro>
14:53:04 Error Generic error in expression
but with the IDc then on the otherside displayCtrl and ctrlText it doesnt pick up the text
Why not use a global variable?
Or store the variable on the control itself
and then getVariable inside the eventhandler to get it back?
good point.
(findDisplay 46)\_thisDisplayVariable setVariable ['yourCtrlsArray',_arrayOfCtrls];
easy accessible, no need in utilizing if this is display is unloaded
That's what I did ;)
looking for some coding design input:
i am in the process of converting a SP campaign to MP COOP - thus most code should just run on the server and RE only relevant code on the clients
as such i am considering to turning triggers made with the 2d editor into scripted code
- necessary/good idea, or not?
- would you keep the triggers to define the areas? or replace with markers or just script the area detection altogther?
- any other ideas or thoughts?
Make a complete new campaign :)
- not necessary.
- if script then I'd probably use markers. Replacing triggers with triggers+scripts wouldn't make much sense.
- keep it simple.
If triggers work for you. I'd say keep triggers
so just add isServer check to condition?
There is a checkbox to make triggers only run on server
in 2d editor?
2d = old editor; i see no point converting to 3d/Eden
If it has no checkbox you could try to look at what config entry Eden uses for that in mission.sqm and add that entry manually
one other main consideration to make it scripted, is to have all code in script files. sqm/2d editor is messy to interact with
Well. Replace trigger condition and action by _this call X
scripts are most likely worse for performance if you don't do a spawn with 0.5s sleep
yeah did this for the mission logic already essentially
true; on the flipside scripted allows customized condition check frequency
@still forum so I should NOT put addActions in init fields, got it.
Just wondering what kinda hit would happen if I have 10-20 guys running around re-compiling addAction code.
Nothing
Does it do that even if you pass it a script right?
because that's not possible
Only you run your addActions code
And init field or not doesn't change anything on it
So the compile hits only affect the client
You could just re-read what I wrote
addAction stores the code as string and recompiles at every execution.
and the global effects of anything come back to the rest of the stuff right?
Like, if I have something like setFlagTexture
Scripts will run like any other script
Wat?
Okay, so. addAction stores the code as a string, and compiles that every time the addAction is called.
Correct?
This is why the this scope isn't shared with the stored code.
But, what happens to stuff I define in cfgFunctions
But, what happens to stuff I define in cfgFunctions None different with addAction. Because as I said 3 times already. it converts to string. no matter if you pass a variable.
Why are you being so rude man?
What?
You have been like this for days now.
I am not
Just because I repeat stuff that I said before because you ask the same question again means I'm rude?
Nevermind Dedmen, I am not going to argue with you.
If I’m going to use the fired event handler and do something when a bullet lands (nearestEntities) will I regret the performance cost?
No
depends on what you do with the bullet hit! 😄
It should be fine. @tough abyss
Think of it like this, there won't be anything noticeable regardless of having an eventhandler being called or not. However, it does matter what you do in that eventhandler of course.
realoding a specific magazine via script (a mystery was solved):
https://gist.github.com/RZSenfo/c64a74b4dead6655b15f42c14a567b34
@rotund cypress yep thank you
nope, not fine at all
@tough abyss the fired EH is one of the most expensive ones, using nearestEntities on top of it is a very bad idea
be very careful
Only checking 20 meters for a player being close
depending on how many entities you add it to it could get messy
Just one
from the handledamage is select 4 (projectile) supouse to fire 5 times in one shoot?
how do i make a gun have infnite ammo?
@weary pivot fired eventhandler and just use smth like setVehicleAmmo 1
@wary vine what kind of mod/mission are you making there? (with money and stuff)
Campaign?
@fossil yew Im making a heavily modified altis life 😃
cool
It uses a lot of outdated functions now, and some parts are being improved upon, and loads of stuff being added.
can someone help me with this, what am i doing wrong?
im trying to convert strings in an array and then remove decimals for each of them
_test = ["1.200","2.345","3.654"];
_cut = { parseNumber _x; } forEach _test Call BIS_fnc_cutDecimals;
do you want [1,2,3] as a result?
exactly
im trying to make a script which will round the position of an object and compare the position against an array.
_cut = _test apply { [parseNumber _x,0] call BIS_fnc_cutDecimals };
@Dedmen thanks!
Btw no need to cross post across multiple discords.
Assume I have a declared macro like this:
#define MY_MACRO(arg) some stuff with arg
If I want to use said macro I can do it like that:
MY_MACRO(someArg)
My question is: Can I also use the macro like this?
MY_MACRO (someArg)
(Note the whitespace before the bracket)
_this addMPEventHandler ["mpkilled", {
_Unit = (_this select 0);
_killer = (_this select 1);
_this remoteExec [ "RemoveAllActions", 0, true ];
if (Side _Unit == civilian) then {
HINT "Civilian Killed!";
};
if (Side _killer == west AND captive _Unit) then {
HINT "ROE violated";
};
}];
Why is it firing saying its a civilian being from the side east?
What? That doesn't say what side the civilian is
the hint "Civilian Killed!" is firing
Yeah.
So?
What if you hint format ["civilian killed %1", side _unit] ?
Does it show civilian too?
yes, it says CIV
thoug, i am using (side cursorObject == civilian) on the console and returns false
same
could be that they become civilian after death
Just only add the eventhandler to civilians
then you don't need to check anymore
because _unit will always be the same unit as _this of the addMPEventhandler
the civilian one works now but i am having a problem with this one
_this addMPEventHandler ["mpkilled", {
_Unit = (_this select 0);
_killer = (_this select 1);
_this remoteExec [ "RemoveAllActions", 0, true ];
if (Side _killer == west AND captive _Unit) then {hint "ROE violated"};
systemChat "this apears";
}];
The unit is captive and the killer is from the west side, but the hint does not shows, and the systemChat apears
It's completly normal that the systemChat appears
systemChat is to make sure the EH is firing
try adding the side _killer and captive _unit to the systemChat to really make sure that it is how you think it is
the captive is returning false, its seens like it also turns false when the unit dies
_this addEventHandler ["Killed",{
_Unit = (_this select 0);
_killer = (_this select 1);
_this remoteExec [ "RemoveAllActions", 0, true ];
if (Side _killer == west AND captive _Unit) then {hint "ROE violated"};
systemChat format ["Unit is %1", _Unit];
systemChat format ["killer is %1", _killer];
systemChat format ["captive? is %1", captive _unit];
systemChat format ["killer is %1", side _killer];
}];
same problem
You could store the captive state in a variable instead of trying to retrieve it after death. But that's ugly
In some points the unit may have to turn out from the captive... I may forget about that in some point and cause trouble
exactly that is the "ugly"ness
Anyone know of any creative antidupe methods - the game doesn’t update fast enough with my scripts. I have a button that removes a weapon from inv but if you remove your weapon with rightclick arma doesn’t recognize you lose the weapon and removes it twice thus duping it
I have a check to see if a player has no primary but it passes that check because arma isn’t fast enough.. i think ill have to just change from call -> spawn and add a uisleep
removing something twice.. Would dupe it?
But.. Removing twice results in -1 in my brain. Not 2.
Execute your script in unscheduled
In scheduled it might suspend right after your check. Player drops his weapon. Script resumes and removes weapon again although player doesn't have one anymore.
It removes it then adds it to somewhere else so, removes it twice then script adds back
i had the same problem with a drop weapon script i made, i fix by adding a randon delay for the while loop
So you end up with one on the ground one on the back
Yeah. unscheduled.
Add it back only if player has a weapon currently.
Then remove players current weapon
The game freezes while you do that. So the player cannot drop his weapon in the meantime
Doesn't really matter
Calling a script is nonscheduled correct?
It calls from a button action
Eventhandlers are unscheduled
Ugh
Yea, it calls from that, two checks to see if they have no weapon
Both pass saying yes, weapon is there then it removes it
Well the game freezes while that script executes. Meaning the player has no way to remove it
But they remove it just before not while
That means your check if player has weapon should fail
Exactly
Dedmen, I fixed it by cheking if had a weapon
_this addEventHandler ["Killed",{
_Unit = (_this select 0);
_killer = (_this select 1);
_this remoteExec [ "RemoveAllActions", 0, true ];
if (Side _killer == west AND (currentWeapon _Unit isEqualTo "")) then {hint "ROE violated"} else {systemChat "Suspect had a weapown"};
}];
https://youtu.be/qTRJVgIt4LA 0:32 dedmen
Thanks for the help.
If someone right clicks their gun to drop it then clicks that button to swap it
In a really fast manner you can get it to drop and add one to your back at the same time
Thus duping it
Can you show me your script? Where you check the current weapon?
"really fast manner" isn't possible. As I said. If the script really is unscheduled the game freezes. No one can click two buttons in less than a millisecond while the game is frozen.
what does "fast manner" mean? How fast?
U can check if he duped it and setdamage 1
Could you maybe just close the inventory dialog?
//calling
action = "(primaryWeapon player) call SecondaryWeapons_events_addSecondaryWeapon;";
//compiled code
_weapon = _this;
if(_weapon == "") exitWith {};
if(_weapon == primaryWeapon player) then
{
if((primaryWeapon player) == "") exitWith {_error = true;};
player removeWeapon _weapon;
};
if(_error) exitWith {};
you can check canSuspend to really make sure that it actually is unscheduled
you can also do that with a spawn+uiSleep+isNil
or just call on CBA function 😄
So yeah.. I would go for the uiSleep route then.
you could also use the Drop eventhandler to catch when the player dropped something that he shouldn't have anymore
I do that.. kinda
_className = _this select 2;
if((_className isKindOf ["Rifle", configFile >> "CfgWeapons"])) then
{
disableSerialization;
_dialog = uiNameSpace getVariable ["RscDisplayInventory", displayNull];
if (!(_dialog isEqualTo displayNull)) then
{
SecondaryWeaponsDupe = true;
_buttonDown = _dialog displayCtrl 1337;
_buttonDown ctrlEnable false;
_buttonDown ctrlCommit 0;
};
};
if(SecondaryWeaponsDupe) then
{
Systemchat "No duping please";
};
that catches it actually
most of the time
but thats still an issue because I know I could get the game to delete it
in regular play thats not a good solution
Could probably solve most Arma dupe bugs if BI would fix that.
Apparently it schedules the item for dropping.
Then creates the ground weapon holder. And one or more frames later actually drops the item. But ignores if the item is still in inventory at that point.
Item ids on items
Sounds like a easy to fix issue
Where Item ID's won't help in any way I could imagine
Well if something just happens to be created (duped) you just check against the array of real ids
what do you mean by just uiSleep?
Just delay the weapon swap
If the player tries a dupe. The weapon will already be gone after the uiSleep is done. And the script will detect non-existent weapon.
I just don't understand why BI made the engine side weapon swap asynchronous :u
i might be wrong, but isnt there a drag EH? Couldn't you find the inventory LB and register something on it and do something when it leaves a certain margin?
or is it too late at that point
The right click is the problem right?
yup
I don't see how to detect a right click with a drag eh
well i thought you can drag items out inv?
hmm maybe we can just come up with a custom UI for inventory and close the one arma makes
is there an easy way to getPosATL and then remove the decimals or round the numbers?
yes
ah ok
@still forum thanks for muddling through it with me - uiSleep 1; after the first check and before the second works it seems