#arma3_scripting
1 messages · Page 530 of 1
yup
Afaik they aren't ready. And you don't know when they will be
set a variable at the end after all your other pvar's were sent off, and then clientside do a waitUntil isNil on it
the order of pvar's is kept
i can't use waituntil in the init EH can i?
not that it is a problem spawning i guess
How does ArmA actually handle respawning internally? Currently looking through most of the respawn templates and I can't fire anywhere an entry that contains information on how the unit gets respawned.
Is just a new unit created and player moved into that?
https://community.bistudio.com/wiki/Initialization_Order
Looks like object initialization fields are unscheduled so no, can't waitUntil there
is that the same thing as the event handler?
Event handler is also unscheduled
It would make no sense to be able to waitUntil (block mission startup) in the init field
ah yep that'll be it
i decided to spawn it anyway, although i admit i don't like the idea of spawning a few hundred of these
i'm too lazy to set up some kind of manager haha
it's only really persisting these on the clients anyway, i'm sure they have plenty of spare cpu
Afaik they aren't ready. And you don't know when they will be
We don't know? This sucks. I guess for that reason remoteExec is better, because at least I know when it will be synced up?
Yes and scheduler can't load your CPU much anyway
it gets 3ms from each frame
max
what do you need to initialize in vehicles that depends on some state dictated by the server? It smells like the right job for remoteExecCall
just a random setting for initializing what sort of lights these things have
well... remote exec call is a better thing for synchronizing persistent things
you can attach it to a specific vehicle object, with specific data and function call, and it will synchronize for JIP players
and for those who are online already, whatever you do
so it's an executed function and not a publicvariable?
function, executed with the data you set it to execute
and it will be passed to the function and executed when someone joins
you can also remove these things from the queue
yeah i probably should have used that.. ah well, publicvar should be alright here so long as you don't mind the silly spawning of functions for every object init'd
if it was something more complicated in nature i'd probably rewrite it but eh
my mission is already moving really slowly in terms of development
I'm having a little conundrum, I'm trying to include death sounds to AI, but when I have a trigger execute 'unit say3D "deathSound";' it won't play because the unit is dead and the game ignores that variable, is there anyway around this?
Try trigger as argument instead of unit
can i get an example of how to go about that? sorry for my incompetence, im still kinda new to this
What your trigger is called?
its not really a trigger, more of an execute code on death through 3den enhanced. https://puu.sh/DsHwJ/56649b8081.jpg
when i execute that same line through the debug console when the unit is alive, it works, but when he is dead it wont play
go to cfgsounds, look up what file is played and use playSound3D
do i type something like 'playSound3D ["deathSound", unit, false, getPosASL unit, 1, 1, 1000]'
new profiling branch performance binaries 1.90.145681 in #perf_prof_branch
playSound3D ["path\to\death\sound", unit] is enough
i have "dearthSound" as the name for a class under CfgSounds and i have tested it with "playSound" and it works, i just need to have it play when the unit dies, i'll try playSound3D and see how that goes
no luck
playSound3D needs a file path though. you can look up the file path in the config. i already told you that in my first reply.
Hey, is there any framwork like CBA for key handling that behaves like the default one from Arma (so support for Left_CTRL, Right_CTRL, Double keys, ...)? I know that I can use Custom User controls but there's only 20 of them. Can't add more since those are partially defined in the engine (or can't find all files related to them with extensive search). Searched everywhere and can't find anything.
https://puu.sh/DsItz/034c63765f.png i found this under the playSound3D wiki page
is it saying to place that text in description.ext?
im kinda confused
@cunning crown why not CBA?
Doesn't make the difference between Left and Right Alt/Shift/Control, can have 2xKey nor Modifier+2xKey, etc.
oh, gotcha
not even trying to shill CBA here, but it's most likely the most fleshed out system you're going to get.
Well, no choice to continue to figure out how to do it myself then xD Too bad Arma doesn't have a system for handling that the same way default controls does :/
you can bind right and left ctrl and alt as their own bindings, just not in combination with other keys it seems
So I'm reading through the playSound3D wiki page (https://community.bistudio.com/wiki/playSound3D), and at the bottom it shows how to get custom sounds to work (im using custom sounds), but i'm kinda confused on how to properly go about that
@random crescent Unable to do that in CBA, modifier must be with another key.
target1 = "LaserTargetW" createVehicle (getpos vehicle player);
blufor reportRemoteTarget [target1, 2500];
VALOR_VLS fireAtTarget [target1,currentWeapon VALOR_VLS];
``` anyone can help me out? The VLS seems to be unable to seek the cruise missile into the target. The missile will just fly over the target straight forward and that's it
it might not have locked it yet because you immediately fire
i'd not even fool around with that because AI
try this
ok
I had the same issue. garbage collector deletes your laser target while the missile is in flight. use removeFromRemainsCollector
doesn't work, Garbage collector still deletes it in flight. But a attachTo workaround does the job
so attach the laser to a object e.g. a crate
First time I hear that remainscollector deletes anything other than dead bodies and wrecks (probably because it is not true)
Hi! I need to print coordinates of an object into a .txt file. Does anyone know how to do this?
extensions
This ^^^
Thanks! Will try)))
Something was deleting mine. A deleted EH would fire about 10 seconds after it was created.
Anyone use Tedho's infantry capture script? Need some help.
I'm getting an error on this before COMBAT, am I missing something obvious?
waitUntil {behaviour nco_01 == "COMBAT"};
this setcaptive TRUE;
what the error says?
waitUntil {behaviour nco_01 |#| == "COMBAT"};
this setcaptive TRUE;
generic error
You cannot waitUntil in unit init unless you spawn it
Ohhh ok, how do I do the spawn thing again?
again?
0 = this spawn
{
waitUntil {behaviour nco_01 == "COMBAT"};
_this setcaptive TRUE;
};
It's been fucking ages since I've scripted, thanks
Is it possible to change the size of a listbox dynamically? The same way the action menu changes size up until about 5 options I believe
ctrlSetPosition, ctrlCommit
@cunning crown if you think CBA not differentiating different ctrl/shift and so on maybe create a ticket on github.
anyway to make a trigger repeatable, but should only activate again once the whole execution of the code is finished?
set a variable at the start of your code
then delete it at the end
and add a isNil check to your trigger condition
@still forum Well the problème come more from the keyDown EH. But yeah, I'll try to create a ticket when possible.
To be exact, onKeyDown gives different keyCodes for left/right modifiers but treat them as the same for the modifiers states. Same goes for onKeyUp.
I need to know whether any player is within a given distance of a given object, currently I'm using a foreach loop with an exitwith in it. Is there a more efficient way? Code I'm using:
private _noPlayersClose = true;
{
if ((_vehicle distance _x) < PARAMS_VehicleRespawnDistance) exitWith {
_noPlayersClose = false;
};
} forEach allPlayers;```
tnx
private _noPlayersClose = (allPlayers findIf {
_vehicle distance _x < PARAMS_VehicleRespawnDistance;
}) == - 1;
thanks
Not sure if better performance wise but it might be.
private _noPlayersClose = (allPlayers inAreaArray [position _vehicle, PARAMS_VehicleRespawnDistance, PARAMS_VehicleRespawnDistance]) isEqualTo [];
chances are quite high i would say
Assuming that usually there are no players close, and findIf would have to iterate all players. This should be faster. But if findIf exits early then probably not
Usually there will be players close
Does isEqualTo run faster than just doing ==?
on school wifi so cant check as BI is blocked
Yeah but it is case sensitive
Thank you @tough abyss
Also it behaves differently in case of different types.
== will error out on diferent types
isEqualTo will return false
what do u mean case sensitive @spice axle ?
this
ahhh
Is it possible to have a kick message if you use serverCommand?
#kick [PLAYER #] (REASON) on BE's documentations. You could try that but iirc, Arma doesn't allow to kick/ban with a reason from SQF (without extensionsextension)
well that was more work than i would have liked.. cfgmagazines are a mess for classifying what bullets are tracers and which are not
a bunch of magazines are labelled tracer, some are reload tracers, some are not.. some use the same projectile name as tracers even if they aren't tracer projectiles lol
i now have a script attempting to guess which they are by running through all the weapons in my mission
of course when someone is hit, i have to actually go back to the firer and check his magazine instead of using the projectile
i just hope it's not going to be too sluggish
Got a script that forces a loadout on players. Everything is working except for pistol attachments...
_unit addweapon "rhsusf_weap_glock17g4";
_unit addSecondaryWeaponItem "rhsusf_acc_omega9k";
_unit addSecondaryWeaponItem "acc_flashlight_pistol";```
The ```addSecondaryWeaponItem``` aint adding those 2 attachments(silencer, flashlight) to the rhsusaf glock. Any idea why or if i should use a different command?
for the primary weapon its "addPrimaryWeaponItem" so i figured secondary might do the trick and it is a valid command, i guess i can try with assignitem next
haha
oh my...
i'm not sure i understand the difference between the two
linkItem is for all the stuff in other slots, like the map, compass, etc
@ionic beacon
1/ enable -showScriptErrors
2/ when in doubt, read the wiki 😛
do have it enable, wasnt giving me an error.
Was on wiki but of course i missed the command like an idiot
ok np 😉 (and yes it wouldn't give you an error as this one is a valid (but incorrect in this case) command)
Does ctrlSetStructured text work with RscHTML?
can you guys help men with this, there's no errors just nothing happens https://www.reddit.com/r/armadev/comments/bommec/help_with_civilian_casualty_penalty_script/
There is an error. no there isn't
where are you adding the eventhandler?
maybe you need to remove the select 0 on _killer
init.sqf
Always a good idea to put some diag_log or systemChat inbetween lines. That way you can see at which line your code fails @swift lynx
Btw. does it need to run in init.sqf?
What the locality of addMissionEventHandler command?
i just noticed that this channel's description contains code with a syntax error. seems quite fitting.
Can someone help me with a script for starting mission unconscious then waking up?.. I’ve set up a heli crash site & want to start from there.. it’s been a while & ive lost my scripting skills, thanks guys
What's more efficient, a while true loop or a recursive function (fnc being spawned, not called)?
What is correct way to add overcast in "Server overcast is %1" remoteExecCall ["hint"];?
I mean remoteExecing this hint format ["Server overcast is %1", overcast];
format ["Server overcast is %1", overcast] remoteExec ["hint"];
So that way 🙂
Thank you M242 for the fast response 🙏🏼
Hello, I try to get the vehicle deleted when reaching the waypoint, but it just stays there. Any hints? (Also I don't know how to properly format code in here - sorry)
[{
private _vehicle = "LIB_Kfz1" createVehicle [0,0,0];
createVehicleCrew _vehicle;
private _grp = group _vehicle;
private _wp = _grp addWaypoint [[0,0,0], 50];
_wp setWaypointStatements ["true", "{_vehicle deleteVehicleCrew _x} forEach crew _vehicle;
deleteVehicle _vehicle;"] ;}, [], 1] call CBA_fnc_waitAndExecute;
No _vehicle will be undefined.
Look up biki what arguments are passed to waypoint script
@proper flower see setUnconscious 😉
Ok.. I thought that was for staying unconscious.. will the guy get up with this?
setUnconscious true then false yes
Thanks
This script is playing my sound file, but it cuts out after 1 second. Any ideas?
MISSION_ROOT = str missionConfigFile select [0, count str missionConfigFile - 15];
bike1 addAction [ "CRANK THE TUNES", {
playSound3D [MISSION_ROOT + "borntobewild.ogg", bike1];
},
[],
1.5,
true,
true,
"",
"true",
1,
false,
"",
""
];
That's the radius of the addAction
oof my bad
Does it cut off when riding or when sitting still?
how can i make the AI look into a specific direction after it reaches its destination waypoint?
Because the point of sound creation is fixed and you may be riding away from it, I think
Sitting still
hmm
@keen bough lookAt
Here's my description.ext
{
sounds[] = {borntobewild,barmusic};
class borntobewild
{
name = "borntobewild";
sound[] = {"borntobewild.ogg", db+15, 1.0};
titles[] = {0,""};
};
class barmusic
{
name = "barmusic";
sound[] = {"barmusic.ogg", 150, 1};
titles[] = {0,""};
};
};
They're different because I noticed different syntaxes for the sounds in there so trying to figure out what works
@cunning crown is there a possibility i can tell them to lookAt a specific direction instead of a pos/object? because setDir was too fast and the waypoints are not generated at the exact position.
Or should i make the waypoints bigger so they are completed instantly? Like a radius of 5 meters?
could you use this?
playMusic "borntobewild";
I am not sure if just adding it in cfgSounds adds it to the music in game though
I want it to project from the bike itself
@keen bough getRelDir
ah! nice, yeah, thanks!
I am working on a custom version of antistasi on takistan. I am trying to up the variety of vehicles that are able to be bought, the way I first thought to approach this was by setting the vehicle variables (usually like vehSDKAT or something like that depending what kind) to an array rather than an object.
I have successfully made it so a random vehicle from the array will spawn when you buy them, but have run into an issue with the way pricing works.
So prices are stored via setVariable and are called by the vehiclePrice function like so;
_tipo = _this select 1; _coste = server getVariable _tipo; server setVariable [vehSDKTruck,300,true];
obviously this will return 300 for the price of a truck, BUT in my new system it returns an error, as Arrays are NOT supported by setVariable unfortunately.
Any ideas how i can get around this?
Wait no, what I said is wrong, sorry
already saw it ^^
getRelPos maybe
I've tried Say3d too, but same thing happens
yeah, i dont wanna define extra position for the ai to look at in my generator. I think i try the waypoint radius thing
well just using %UNIT% lookAt (%UNIT% getRelPos [100, %DIRECTION%]) should work
I wonder if it's just the sound itself, I used Audacity to degrade it down to 400kb for a full song
ah, that sould do it, i will test it @cunning crown
haha, nope, the ai just doesnt want to look XD
Huh. I went from .ogg to .wav and now the sound works
glad you got it fixed
@keen bough Are you sure that everything is done correctly?
Just tried that and works perfectly fine for me:
[] spawn {
myDirection = 0;
while {true} do {
myDirection = myDirection + 10;
myUnit lookAt (myUnit getRelPos [100, myDirection]);
sleep 1;
};
};
Well sorta. It looks like if you try to get the filesize too low it doesn't want to work any more.
Ok I got my guy to start mission unconscious but how do I get him to get up my script is : player setUnconscious true; sleep 3 .. I tried adding false but still didn’t get up... any help
got it. I had to use "setFormDir" @cunning crown
Also the sound doesn't stick to the vehicle
Using Say3d fixed it for now, but I'll have to mess with getting the file under 22mb. I had it at 400kb, but it was cutting out after 1 sec
22mb or 2.2mb?
Is there a way to get selectionPosition/position of memory points in a weapon?
the only commands to get positions work on objects, and you cannot get...... 🤔 .... mh... actually. Maybe you can createSimpleObject the weapon and then use the commands on it
Can someone help me with getting out of setUncoscious.. I can start but I never get up
@sour island try converting to m4a or mp3 or something, wavs are huge uncompressed, but compressing to 400kb is a bit excessive, you can get an mp3 or something to like 4-8 mb
I didn't know Arma took mp3s, ok
Is there a volume limit for the sounds? 1 is inaudible after 20m, and there's no difference between 100 and 500 volume (as defined in description.ext).
mp3 doesn't seem to work
Got it all working with .ogg files and say3d, now I need to figure out how to stop it from playing when I want
Is https://community.bistudio.com/wiki/Arma_3_Actions a complete list? Does anyone know if there is something like aDeployWeaponAuto action?
Is there something like forceAddUniform for goggles,headgear, and facewear?
@sour island no, as there is no need
Well I have civvies wearing berets and goggles in the editor, but they won't wear them in multiplayer
I guess what I meant was is there a way to ignore the uniform restrictions?
@sour island there is -no- headgear/goggles/facewear restrictions, only uniform ones
Your issue may be related to randomised headgear
Ohhhh ok, I forgot about that.
I tried this
this setVariable ["BIS_enableRandomization", false];
but they're still not wearing the same gear they have in the edtior
@sour island Have you tried ```disableRandomization[] =
{
//"AllVehicles", // No randomization at all
//"Air", // No randomization at all for air vehicles
//"land", // No randomization at all for land vehicles
//"Ship", // No randomization at all for sea vehicles
"air_f", // There won't be any randomization on every air vehicles
"C_Hatchback_01_F", // No random on Hatchbacks
"truck_withoutRandom" // No random for this given vehicle
};
I moved on to another project for the moment haha but I'll give that a try
I'm trying to see if there's a way to get weapons to attach to unarmed vehicles, in this case a motorycle from gac JSDF. I've tried some different things, including addWeaponTurret and also just spawning a 40mm from a point on the vehicle with an addAction, but nothing seems to work.
Alternatively, if we could get a gunner seat scripted onto the bikes, that would be good too.
@cosmic lichen I tried that, but no dice. I'm wondering if adding ACE into the mission will have any effect on the AI not wearing hats and goggles
Alright Arma scripting community, I heard you guys are good at this. I have a problem.
I'm making a side-mod to Operation: Trebuchet, that features a script that switches specific vests and helmets into a different variant that has something special about it, if you have a certain insignia. These scripts seem fine, and loading them seems to not cause any problems. Here's the problem though: we have multiple scripts for specific pieces, and how we repeat them is via a separate script that runs on a while loop, that spawns the other ones. This seems to cause an obscene amount of loading time added to mission loading though, so we are looking for a different method.
So far we've tried:
Separate while loops for each script.
Each script being an if statement that gets repeated through a fourth that runs on a while loop.
Each one causing the loading time seen in the vids below.
We are still sort of novices in sqf, so we need some help. We are at a loss.
For reference to show how bad loading times are:
Without Scripts:
https://youtu.be/3vBNpFavCDE
With Scripts:
https://youtu.be/NOiirL2o_Pw
Scripts:
fn_SecretEquipment.sqf:
//SpartanJackWar (My partner)
//This script runs the other three secret equipment scripts.
if (!hasInterface) exitWith {};
while {!isNull(player) && alive player} do
{
waitUntil { isnull ( uinamespace getvariable "RSCDisplayArsenal" ) };
[] execVM "\OPCOS_Functions\Functions\Secret\fn_SecretArmor.sqf";
[] execVM "\OPCOS_Functions\Functions\Secret\fn_124thArmor.sqf";
[] execVM "\OPCOS_Functions\Functions\Secret\fn_RevArmor.sqf";
sleep 1;
};
I would give an example of the scripts called for, but it's more then 2000 characters.
Here's the breakdown though:
- Stop if running on server.
- Check what headgear, vest, and insignia is being worn.
- If headgear == CH252A && vest == M52D && insignia is correct, check if they're wearing the secret.
- If not wearing said secret, replace helmet and vest with secret.
It's structurally similar to OPTRE's Slim-Leg script, yet OPTRE doesn't cause the slowdown shown.
How are these scripts triggered?
Is it possible to override the inventory mouse button event handler? My attempts havent been working
waitUntil {alive player && !isNull(findDisplay 46)};
player addEventHandler ["InventoryOpened", {
params ["_unit", "_container"];
[] spawn {
waitUntil {!isNull(findDisplay 602)};
(findDisplay 602) displayAddEventHandler ["KeyDown", "hint 'abc'"];
hint "Added event handler";
};
}];``` This code works using the KeyDown eventhandler but using any of the mouse ones does not work.
I've tried applying it directly to the soldiertab and soldiercontainer controls as well in the inventory
The scripts are triggred postinit, then told to waitUntil the player isn't null and is alive. Then after that's finished, it's triggered again every 10 seconds from the above script. From what we could tell, there isn't really a way to detect if the player changes gear, otherwise we would of utilized that instead of a while loop.
Odd, using the event handler MouseButtonDown works, but onMouseButtonDown does not?
@tiny wadi If you make a mod to get rid of the annoying inventory scroll wheel thingy, please let me know
Working on a context menu to drop a set number of items or all at one time
@proper flower
setUncoscious
is not a command
https://community.bistudio.com/wiki/setUnconscious
is
@tough abyss It was a spelling error..
I got it to work.. just can’t get him to wake up
I got any idea how to do that?
U*
Are you using mods?
I am.. will that matter.. I just want to start off the mission with a crashed heli & my squad waking up from being knocked out
@tiny wadi prefix on is well documented on UI EH page
Yeah it could matter, mods can break things. Try the command without mods, if works then you know where to look @proper flower
I don’t have a command for the waking up part.. the unconscious part works tho.. just need them to get back up..
Mission starts with the guy unconscious. After a few seconds he wakes up
Snaps out of it.. becomes conscious .. however its worded
Try delaying setting it up, many things can go wrong if executed too soon
I don’t have a script for getting up.. as I said the starting unconscious works..
I just need him to get up but don’t know how to do it
Now you are confusing me. setUnconscious works both ways true to set, false to undo
Ok .. i trees to set both but the guy didn’t get up.. the script I have is:
Unit setUnconscious true;
Then I added unit setUnconscious false;
Maybe I’m writing it wrong with both of them
Should it be: unit setUnconscious true, false; ?
Or maybe true; false;
As I said, command works, you have either mod interfering or set it too soon when things are not fully initialised at the start
Or maybe true; false;
I gave you the link to biki there is no maybe
Well I was talking to u, I didn’t click it yet.. I was getting your input first
Just read it.. same thing I’ve been reading trying to figure it out.. yes what is on that page works... but only to set unit unconscious.. He needs to get up..
-_-
_unit setUnconscious true;
sleep 5;
_unit setUnconscious false;``` @proper flower
I tried this & it didn’t work.. the other said maybe the mods were messing with it.. gonna try that tomorrow.. thanks😑
I am logging my position in the editor , but i need to log the direction as well , how can i do that as I only see log position to clip ?
@proper flower most likely an ace medical thing
So basically I am making a custom version of antistasi, and the base code for buying vehicles is like so
initVar.sqf
server setVariable [vehSDKTruck,300,true]; vehSDKTruck = "rhsgref_nat_ural_open";
buyVehicle.sqf
_tipoVeh = _this select 0; _coste = [_tipoVeh] call A3A_fnc_vehiclePrice;
vehiclePrice.sqf
_tipo = _this select 0; _coste = server getVariable _tipo select 1;
and this works fine, the truck costs 300.
I have modified it so that vehSDKTruck is an array of many vehicles that are all similar, ural variants, kamaz variants etc, and the code looks like this
initVar.sqf
server setVariable [vehSDKTruck,300,true]; vehSDKTruck = [...];
buyVehicle.sqf
_arraytipounidad = _this select 0; //_this being the selected vehicle type (an array in most cases) if (_arraytipounidad isEqualType []) then {_tipoVeh = selectRandom _arrayTipoUnidad} else {_tipoVeh = _arrayTipoUnidad}; //to determine if its an array or not _coste = [_this] call A3A_fnc_vehiclePrice;
vehiclePrice.sqf
_tipo = _this select 1; _coste = server getVariable _tipo select 1;
BUT when I run my version, I get an error stating ERROR: 1 Element provided, 2 expected in reference to the _coste line. Everything else is working properly except code running the cost, so the cost returns 0 since it is in error, and everything is free, which is not ideal, as part of antistasi is resource management.
```sqf
your code
```
if (_arraytipounidad isEqualType []) then {_tipoVeh = selectRandom _arrayTipoUnidad} else {_tipoVeh = _arrayTipoUnidad};
Variable will stay undefined as you only define in scope of the then/else statement.
_coste = [_this] call A3A_fnc_vehiclePrice; Why do you all of the sudden expect the vehicle to be in _this?
ERROR: 1 Element provided, 2 expected getVariable with array argument needs atleast 2 arguments.
@proper flower ah wait it also doesn't work well if you don't have a primary weapon
@still forum _this is the selected vehicle. Also what should the second argument be?
and no, according to your code _this is not the selected vehicle, you said it's an array, and your old code uses _tipoVeh now you suddenly use _this and pass a whole array
there is way too much context missing in there
right, the selected vehicle does not have a price, the array has a price, then after the price is determined, a vehicle is selected at random from the array
_this is the array, and the array is what is given a price with setVariable
i do not individually assign the vehicles a price, because that would be tedious and pointless, as all vehicles within the array are functionally the same just variants of the same thing for variety, and they cost the same
You click 'buy Truck' and it runs this code and serves you a random truck.
The reasoning behind using _this instead of _tipoVeh in the new code, is that _tipoVeh in the NEW code becomes a specific vehicle rather than just using the Array name as in the old code
I have read this page on getVariable a bunch of times, and I am still at a loss for how to properly get what I want out of it
ok, so i found a way around this, and that is using setVariable ["vehSDKTruck",300] note the "" around the variable name, and then when it is time to use getVariable to somehow turn _tipo into a string, still not sure how to turn a variable name into a string though
i found a way to convert a variable name to a string, but I am having trouble with it
basically I am using a macro to add "s around the variable name
#define QUOTE(VAR) #VAR
but when i do QUOTE(vehSDKTruck); it gives me ERROR: Missing ;
I can not figure out why it is doing this
:/
did you actually define the macro in your code?
And why not just put quotes around it manually ^^
because i need it to be able to handle incoming variables, and yes i defined the macro in my defines.hpp
with the other 100 defines i have that work fine
actually, that will not work even if i fix the ; error, as it will just put output something like "_tipo" rather than figuring out _tipo=vehSDKTruck
So do you have any ideas how I can make _tipo = "vehSDKTruck" rather than _tipo=vehSDKTruck=[.....]?
I think you need to re-think what you are trying to do from the ground up
:/
turning variables into string doesn't work
the data in the variable doesn't know it's own name
is there a way to only procure the data in the variable after a certain point, and to keep its name throughout processing rather than the data being present all the way through?
just pass the variables name along and call getVariable everytime you need the data
ok, i am thinking of a way to make that work. Is there a way to make selectRandom not consider a certain element of an array?
no.. why?
does inputAction not handle multiple key combinations for a display EH?
inputAction cannot handle combinations correctly because it only has a float value. It cannot represent the big numbers that combinations have internally
Ah so precision error, what is the workaround if any?
none
I was thinking of storing the price as the first value of the array, vehSDKTruck = [300, "...","...".....]; and then getting the price via
_tipo = vehSDKTruck; _coste = _tipo select 0;
then spawning it via selectRandom (SOMEHOW EXCLUDING THE FIRST POSITION) _tipo;
actually, i see a possibility to do this with a multiArray, but I need to think about how selecting from it will work...
ok, so if i do that, how would i go about selectRandom from the nested array?
selectRandom (_array select 1)
i think this is exactly what i need, I will try to implement this. Thank you
is (ACE_player != vehicle ACE_player) still the meta?
or are people using that parent vehicle command?
objectParent is used more often in ACE I think
isNull objectParent ACE_Player to be exact
new command added to replace older slower and less reliable command
no discussion on biki page
what is this
mhh?
for objectParent
¯_(ツ)_/¯
i actually have no idea what the hell you talk about
what are you expecting @slim oyster ?
not to mention, that pretty much all contributors accepted that biki editing happens in #community_wiki channel here simply because nobody ever looks into talk pages and for those few that do actually edit the biki, waiting weeks or month on others to reply is literal garbage
fucking hell, only reason this here https://community.bistudio.com/wiki/Talk:Extensions got ever noticed is because i look into pages i reworked on a regular basis to check wether or not somebody edited something into it which is not right
Is there a way to get selectionposition from a potential/future animation? I want to get selectionPos/relative model pos from the start of an animation but check this before actually switching to the animation, is this possible?
Some hacky 1 frame animation switch and selectionPos?
I'm pulling my hair out of this. I'm trying to get onPlayerRespawn.sqf to select the player and give them an insignia, it works for when a unit loads in the first time (player is returning "B Alpha 1-1:1 Slatery") , but for what ever reason once the player respawns the returned string or object is garbled to "bis_o2_6431" both on a local host and dedicated server. I'm assuming this is normal but I need the player object returned. I've tried using waitUntil {!isNull player}; and `waitUntil {player == player] but that doesnt seem to help. Anyone have any suggestions?
if (condition) then { code }
or
if !(condition) exitwith {} code?
@slim oyster I believe that only matters if there are multiple conditions of which one can cause the code to not be executed.
Have you tested with BIS_fnc_codePerformance?
@jaunty ermine Make sure you are refering to the correct unit. onPlayerRespawn.sqf has the old unit and the new unit as paramters
maybe not, I'll do a little bit more snooping, thanks for the help so far
I'm an idiot, there wasn't anything wrong with the player statement. it was the insignia that was screwing it up. if you're using BIS_fnc_setUnitInsignia in any of the event scripts, make sure you un-set it before trying to set it to a specific insignia
@still forum I appreciate all the help man, I finally got it working.
What I ended up doing was modifying the function for adding vehicle to take 2 inputs, I keep the array separate from the price which is a simple integer, and the price runs through the price function without the complication of the array, and the array randomizes by itself. It is much simpler now, thanks again for all the guidance
There are new params for server to kick idle in the lobby no need to try to workaround with scripts any more
waitUntil {{alive _x} forEach allPlayers}; forEach only returns the last value
what is this
Curious myself, what is that quote and where did you find it? @slim oyster
I made health pickups in my mission by using triggers, is there anyway to prevent a player from activating a trigger if said player has full health?
&& damage player > 0
i put this in the conditions correct?
What is the condition now?
this && !(thisTrigger getVariable ["healthkit1_spawn",false])
And trigger activation?
[thisTrigger] execVM "healthkit1.sqf"; thisTrigger setVariable ["healthkit1_spawn",true,true];
That’s onActivation
at the end of the .sqf it also has
_trigger = _this select 0;
_trigger setVariable ["healthkit1_spawn",false,true];
Who sets the trigger off?
the trigger deactivates when a player steps on it, its so players can't play the trigger again while the health kit is "spawning"
it activates again when the sqf finishes
i placed && damage player > 0 inside the condition and it works!
thanks!
It won’t work in multiplayer
dedicated server or local hosted server?
or both
Any multiplayer
When you have more that one player
what exactly won't work? the trigger?
im new to this mission making stuff
&& {{isPlayer _x && damage _x > 0} count thisList > 0}
do i add that to make it work with multiplayer?
This should work in multiplayer but trigger will fire on every pc and item will be created on every pc so multiple kits
Unless you selected server only option
Then it should be fine
server only is currently unchecked, am i better off checking it?
You should select server only and then you don’t need make your variable public
so with the current condition this && !(thisTrigger getVariable ["healthkit1_spawn",false]) && damage player > 0;
_trigger setVariable ["healthkit1_spawn",false,true]; this doesn’t need public flag
and server only checked
that won't work?
wait wrong condition
What won’t work?
i edited it
Use the other condition I gave you, don’t use player
this && !(thisTrigger getVariable ["healthkit1_spawn",false]) && {{isPlayer _x && damage _x > 0} count thisList > 0}
like this?
Yeah
gonna give it a quick test
And don’t need true here, just: _trigger setVariable ["healthkit1_spawn",false];
sweet that worked
the condition
Try with someone
im currently waiting for a friend to get on, i'll update you after we get it tested
If one of you has max health and one damaged it will count as damaged, only when both max health it will be ignored
does that mean if player 1 is damaged and player 2 is not, then player 1 can also pick it up regardless?
if there any way to prevent player take any item
player addEventHandler["Take",{true}];
with this i can take everything
Hello everyone, i am new to the arma show, and have a few questions and need a little help, as i did many many moons ago in a far far...ok i played arma when it first came out then due to work could not play, now that the game is available and cost effective i want to start again but need voice chat help if it is possible
Hello can someone help me with an script? In the script should the player (civilian) change the faction (opfor) when he takes an weapon but he should switch back when the weapon is´nt in the inventory! I had try this at the beginning:
if !(primaryWeapon player isEqualTo "Weapon_arifle_Mk20_plain_F") then
{
_newGroup = createGroup OPFOR;
if (playerSide isEqualTo BLUFOR) then
{
[player] joinSilent _newGroup;
};
};
@tough abyss why not setCaptive?
I had found and try this, but the init.sqf didnt start:
if (hasInterface) then { // don't add to HC and server
["weapon", {
params ["_player", "_weapon"];
if (primaryWeapon _player == "" && {secondaryWeapon _player == "" && {handgunWeapon _player == ""}}) exitWith { // if all weapon slots are empty
_player setCaptive true; // set player as captive so he doesn't get shot at
};
_player setCaptive false; // otherwise set him back to normal
}] call CBA_fnc_addPlayerEventHandler;
};
please use
```sqf
// your code
```
around your code
Ok, should i send it again?
just editing your message should be fine, thanks
also, you are doing
if (/* no weapon*/) then {
player setCaptive true;
};
player setCaptive false; // this is wrong, you are missing an "else"```
it would immediately setCaptive true then false
@tough abyss
if (primaryWeapon player + secondaryWeapon player + handgunWeapon player == "") then {
player setCaptive true;
} else { // ← this one
player setCaptive false;
};```
or quicker yet uglier (less readable)
```sqf
player setCaptive (primaryWeapon player + secondaryWeapon player + handgunWeapon player == "");```
Thanks!
@winter rose
I had both, but the init.sqf did´nt recognize it! Or works this only for MP?
all this in the CBA_fnc_addPlayerEventHandler EH right?
I think yes, i mean there is the notice that i should safe it as init or initPlayerLocal! Or is the Eventhandler an other file?
Any chance there a thing like a scripting for Arma 3 class.. does that exist.. I want to learn more
Or official tutorials..
I'd say no to both
I didn’t think.. I’ve seen the wiki with all the scripts but besides the YouTubes vids I haven’t seen anything good..
I don't know any good yt vids either
official class is copy paste other peoples mission scripts until you get it :p
even being 20 year vet programmer, arma's script is still the worst
IMO C is worse :u
I like SQF, Because I understand how it works, it's so simple
SQF makes way more sense then C ever could do
the operators (important difference btw. even though i also tend to call them commands) however do not always make the blatant simplicity and beauty of SQF clear
Okey. To be clear. The language itself is awesome, the commands implemented ontop of it aren't
does copyToClipboard have a character limit? Is there any way to export/copy an output to something with no or a bigger limit?
if there any way to prevent player take any item ```sqf
player addEventHandler["Take",{true}];
with this i can take everything
@knotty arrow yes you can and you have already posted that earlier, please do not spam
Does anyone know how to write/append text from Arma to a text file? I've made a config generator, but the output is too long for copyToClipboard.
@whole light you can try change limit of clipboard in your OS
@whole light you can use custom extensions to write to files
@lost copper Unfortunately the output is still too long.
@tough abyss Like a .dll? I don't have any experience with that, is it fairly straightforward?
Yes, you put one in your arma directory and call it with callExtension. If you can’t write one yourself you can find one that someone else has written already
Okay man, thanks for your response.
Can you get an object's init field from within a mission?
If there is no straight way, I remember someone suggesting to include a mission.sqm into description.ext
Then accessing it as a config
I want to implement such a feature but I don't quite know what to start with:
Player picks up some documents item from a killed enemy. When this happens, the mission generates some dynamic task. But I want each picked up document to be used only once. Is there a way to have unique inventory items in the game? Seems like 'take' event handler gives only the class name of the taken item. How should I go about this?
Hmm I think TFAR stores settings of radios... somehow 👀
🤔 🤔 Maybe I need to have a look at how ACE implements tag items
how do you create a new entity for zues to spawn? Like say i make a modded Pawnee with different guns. How can i get that pawnee to show up in zues to spawn.
like "Pawnee GMG Autocannon" show up in zeus
not without a new config mod
hey guys, does anyone know how could one preprocess inline function so that #define's work in them?
e.g. if I have a define like this:
#define DefinedString "some text to output"
and a function like this:
MyFunc = compileFinal "
systemChat DefinedString;
";
you must do it in a file, and then do preprocessFileLineNumbers
or use cfgFunctions, it also runs the preprocessor
inline function 🤔
now I wonder how to preprocess them so that defines work
with compileFinal
inline function -> I mean when the body of a function is written inline instead of loaded from the file
like
MyFunc = {
systemChat "this is my inline function";
};
ok so you have a file like doStuff.sqf:
#define MYSTRING "abcd"
myfunc = {systemChat MYSTRING;};
you must call compile preprocessfilelinenumbers "doStuff.sqf";
or I think compileFinal in your case
this works when I'm not using compileFinal
hmm weird
but I'm using compileFinal for all functions right away to protect them
like if you check my function above as an example
I'd use
MyFunc = compileFinal "
systemChat "this is my inline function";
";
and now I wanna use a #define instead of the string in systemChat like you written above
actually, one other question first
if I put a bunch of functions in a file 'MyFunctions.sqf'
and then from 'init.sqf' I do:
MyFunctions = compileFinal preprocessFileLineNumbers "MyFunctions.sqf";
[] spawn MyFunctions;
(as I have some executable code also)
compilefinal is supposed to work like: myCode = compileFinal "a = a + 1";
what I have written is: call compile preprocessfilelinenumbers "doStuff.sqf"; (note the call)
because the myFunc = {systemChat "123";} bit must be executed (run by SQF VM) so that it creates a variable myFunc and assigns the code-value to it.
would all those functions inside of the 'MyFunctions.sqf' file get compileFinal-ed (and protected) or just the MyFunctions function (executable code part)?
I guess that only the executable code part will be compilefinal-ed, judging by the docs
because I think I remember reading the KillzoneKid's stuff and that you should compileFinal all functions inside of your SQFs so that you protect them
so I guessed that only the executable part of a file will get compileFinal-ed and that's why you need to use compileFinal for all functions that are defined in there as well
and I'm doing that, but my defines don't work then
@daring pawn does copyToClipboard have a character limit? no.
@whole light look for "Arma AIO config" on google, there is a BIF post, with a pre-made DLL included that you canjust use.
@astral dawn Is there a way to have unique inventory items in the game? Yes. Create 1000 copies of the item with different classname each, BAM unique items.
How does TFAR do it then?
By creating 1000 copies of every item, with unique classname each
what
so this is my testing scenario:
TestFile.SQF
#define DefinedText "some text"
//
waitUntil { sleep 3; !isNull player };
//
TestFunc = compileFinal "
systemChat DefinedText;
";
//
call TestFunc;
init.SQF
TestFile = compileFinal preprocessFileLineNumbers "EXT_Test.sqf";
[] spawn TestFile;
allright thanks 😄
I'm getting errors cause of #define usage
@pure arch use single quoted string
yes preprocessor doesn't raplce things in strings
' instead of "
hmm really?
Yes really :U
so... preprocessor won't replace strings in a ""-string, but will in ''-string??
if I don't use compileFinal and write TestFunc like this:
TestFunc = {
systemChat DefinedText;
};
then it works
I tried, it doesn't work
same error as when using "
the thing is, I wanna use compileFinal to protect the function
I did read your messages no need to repeat
use {} then, use str to turn it to string, and cut off the starting { and ending } using select
boom you have a string of your precompiled function
But why the hell not just use seperate files and CfgFunctions like any sane person would do
maybe he doesn't like to create a file per function (I hate it personally)
I'm using separate files
but no cfgfunctions
it's just that compileFinal-ed function don't work with #define's no matter if " or ' is used in a #define so I thought there must be a solution I'm missing
they do
If you are using seperate files already, then just use CfgFunctions instead of playing around with stupid workarounds
And I already told you the solution above dude.
Hey guys, how can I modify this to only allow civilians to use the addaction? Blocking blufor would be enough, thanks!
h2 addAction [ "RADIO ON", {
h2 say3d ["denver1", 150, 1];
} ];
if ((side h2) == civilian) then {
h2 addAction [ "RADIO ON", {
h2 say3d ["denver1", 150, 1];
} ];
};
Alright gents, here's what I'm doing. I have a trigger (server executed) that runs a script to spawn two enemies randomly within a 360 circle in a cloud of smoke who then target a particular player. Everything works perfectly. EXCEPT THE SOUND! I cannot for the life of me figure how to get the sound to run across the network. I'm using playSound3D, but have tried say3d also. Both work when testing in 3DEN, but not when playing from a dedicated server. Ideas?
@spark rose playSound3D is not jip compatible according to the wiki, could that be the issue?
because the trigger repeats, i didn't think that would be a problem. every time the enemies spawn the sound should play. Correct?
I thought maybe the problem is because the trigger is executed only on the server. But in the playsound3d wiki, it states it will be played on all machines on the network.
How long is the sound?
10 seconds each time
If a player joins the mission after the sound started playing, he won't hear it
Right. This plays multiple times in a mission, but never makes a sound when run from the server
It's a custom sound in the mission folder
This is what i have now, which works locally
//Smoke Sound
_soundPath = [(str missionConfigFile), 0, -15] call BIS_fnc_trimString;
_soundToPlay = _soundPath + "sound\smoke.ogg";
playSound3D [_soundToPlay, _smoke, false, _smoke, 10, 1, 500];
//Volume db+10, volume drops off to 0 at 500 meters from _smoke
If yes, then follow this guide http://killzonekid.com/arma-scripting-tutorials-mission-root/
funny enough, that doesn't work locally or on the dedicated server. My original works locally.
With the alarm sound?
correct. inserting that into my script results in no sound being played.
Interesting, seems that this soundfile doesn't exist anymore. Seems I have to update the wiki example. Nevermind, sound file still exists
What I think is happening is because the script is only evaluated on the server, the sound isn't being passed to network machines.
But I can't allow the script to be evaluated client side, otherwise we get oodles of spawning enemies
The effect of playSound3D is global and is broadcasted, that should not be the problem.
hm.
Given a vehicle class name, can I get whether or not it has a driver/ gunner seat?
@cosmic lichen, maybe it's something else in my script which just manifests itself as no sound when run on a server? I can send you the script.
@tough abyss https://community.bistudio.com/wiki/allTurrets
@spark rose Post it here if it's not too long, maybe someone else can take alook. I am not really experienced with sound stuff.
Nope
@cosmic lichen Does that not use the vehicle object?
lol yep. discord won't let me paste it
Implying I have to spawn it first
@spark rose Sorry, the limit is 2000 characters, I thought it was 2000 lines (Which would be quite alot now that I think about it :D)
@cosmic lichen yeah it would! lol
@tough abyss, yeah you are right.
Have you checked the config of the given vehicle for entries?
I'm not sure how to browse the config haha
In eden editor, right click on the vehicle and click on view in config viewer
Can I modify config for my mission?
Vehicle configs cannot be modified with a mssion.
Only read, okay
okay, here is a guy having a similar problem to mine. He uses remoteExec. Although I can't seem to get the syntax right. https://forums.bohemia.net/forums/topic/210210-problem-with-triggers-and-music-on-dedicated-server/
For getting object varname for later use with setvariable/setVehicleVarName, vehicleVarName only returns editor/mission maker set varname and not the generated ones like bis_o2?
if some script generates vehicle var names, then that will be the vehicles var name
gotcha, simulating the bis counter increase by just a simple setvariable seems to work thanks
hmm
how @tough abyss
Thanks @pure arch
What how? @knotty arrow
Does anyone know how to make an object invisible to all but 1 player?
I've tried [_boogy,false] remoteExecCall ["hideObject", _targetToMurder,true];
make a local object
How so?
createvehiclelocal
will that work with units?
Im trying to make it so he is invisible to everyone except for _targetToMurder, which changes every 60 seconds
what is it youre trying to do
Using CBA, ACE and Achillies
woah too much code to go through
explain it shortly
are you trying to mark a target for only 1 player?
yeah
ive got the targeting
what I need is the making it visible for only that player
So I did: _boogy hideObjectGlobal true;
to make invisible for everyone
make what invisible
and am trying to do: [_boogy,false] remoteExecCall ["hideObject", _targetToMurder,true]; to make it visible
the _boogy unit
_boogy = _grp createUnit ["C_Soldier_VR_F",_pos,[],0,"CAN_COLLIDE"];
why does it have to be invisible
because I want only one player to see it
because spooky
This is for zeus missions which is why it is a module and stuff
Ill give a quick run down of what happens in the code:
- Module created, user can select what side _boogy (VR soldier) is on before it is spawned
- Every 60 seconds, a target is chosen at random and
_boogyis teleported 25m away from that target. The target is called_targetToMurder
- The target then SHOULD be the ONLY ONE able to see the
_boogyunit
but, for some reason. Everyone can see him
What I'm assuming is that [_boogy,false] remoteExecCall ["hideObject", _targetToMurder,true]; is making everyone able to see him
@tough abyss to prevent a player don't take items . without deleting it
usually created units are synced on all clients
so even if I make him invisible to one client, all clients will see the change?
Make a mod @knotty arrow
make a mod?=
I dont quite understand that call youre making with remoteexec there
I wanted the change to be only applied for _targetToMurder, this is the only way I could think of it working
if there is a better way, please tell me
yes but does that command youre feeding to it actually do something?
Well, it makes the _boogy unit visible to everyone so it does that
but I only want it to be visible to _targetToMurder
so you have hideobject function defined somewhere
no
I was under the impression that I can use regular script commands in remoteExec for them to execute on a local player
From wiki:
Scripted function - scheduled environment (suspension is allowed, i.e. spawn, execVM).
Script command - unscheduled environment (suspension is NOT allowed).
"hello" remoteExec ["hint"]; for example of how I am trying to use it (obviously with hideObjects instead)
yeah
are you testing this in true multiplayer?
I tested it with 1 player on my unit's server
It could be the possiblility that the person who executes the command will always be able to see it with the remoteExec command
I wonder could it conflict with the earlier used hideObjectGlobal
so maybe if I do a loop of hideObject with the targets being all players?
with a remoteExec
i think you have to remoteexec hideobject on all clients except the one where you want it to be visible
sounds like a good idea
anyone good with anti hacks?
looking how to make an Anti Nuke Script to prevent kids from oofing the server
is there a way to make a trigger detect fall damage?
i was gonna see if i can have it play a sound effect everytime a player takes fall damage
probably you would like to do that in damage eventhandler
trigger is not really good for such
You can have EH watch for fall animation and when detected make a note so that damage received soon after from objNull would most likely be from fall.
Or maybe check animation inside damage EH, think this should work as player would still be in fall animation
i have to use init.sqf for event handlers correct?
define falling... if its moving donwards without moving in another direction, it should be possible to check for a negative velocitymodelspace in the z axis
could HandleDamage work? https://community.bistudio.com/wiki/Arma_3:_Event_Handlers
its not really good for that
yes, its for testing when objects take damage, but its much more about damage from bullet, rocket etc
Anyway of making a player have a fixed direction? Trying to make a sit in chair script but as of right now people can rotate 360* when sitting down... :/
I binded a key to this code["Initialize", [player]] call BIS_fnc_EGSpectator; and another key to this code ["Terminate"] call BIS_fnc_EGSpectator;First key works ok, but the second don't work because the spectator mode blocks it. How can i stop spectator mode then?
😆
Damn I remember there was that scripting command to reload addons or something like that, so that I don't need to relaunch the game and re-pbo an addon?
filePatching?
yes mergeConfigFile, thanks!
is killzonekid present on this discord?
and what would be the best way of contacting him?
No he isn't.
Good question, maybe check his website for mail address
He occasionally visits BI forums too I think.
But afaik hes not very active on Arma scene anymore?
What you need KK for, maybe we can help?
theres always #arma3_scripting
Anyone can help with my question above?
@tough abyss Add the terminate code to the spectator display, then it won't be blocked.
@cosmic lichen thanks
@cosmic lichen do you have in memory what is the spectator display uid number?
@tough abyss possible solutions: https://forums.bohemia.net/forums/topic/208724-problem-with-bis_fnc_egspectator/
@tough abyss No sorry, but you can find it in the function, or the config viewer.
@pure arch @cosmic lichen holly thanks! Problem solved!
😉
👍
is it possible to see the addon configs for vanilla assets like the pawnee? I'd like to copy it and then change it a little, rename it and make a variant that spawns in zeus
You can see all configs in the config viewer
probably you don't need to copy it then, but you can inherit from it and overwrite some fields?
ok thanks!
Hello, i have write an init.sqf which should activate an "take" and "put" eventhandler! The take part works fine, but the put part dos´nt work!
player addeventhandler [
"Take",
{
if (primaryweapon player != "" || secondaryweapon player != "" || handgunweapon player != "") then {
nul = [] execVM "scripts\faction\opfor_F.sqf";
};
}
];
player addeventhandler [
"Put",
{
if (primaryweapon player != "" || secondaryweapon player != "" || handgunweapon player != "") then {
nul = [] execVM "scripts\faction\civi_F.sqf";
};
}
];
This is in the civi_F.sqf
´´´
_newGroup = createGroup CIVILIAN;
if (playerSide isEqualTo OPFOR) then
{
[player] joinSilent _newGroup;
};
In the opfor_F is the same, only that opfor and civilian is interchanged !
Did someone know why its not working?
primaryweapon player != "" {missing} secondaryweapon player != "" {missing} handgunweapon player != "" {missing} = &&/||
if (playerSide isEqualTo east) then
Where you have write "Missing" is in the script II, didnt know why it´s not showing here
Where exactly did i have to the "if (playerSide isEqualTo east) then"?
I mean where did i have to put the line!
Put ``` before and after your code block
```
// Code here
```
// Code here
Did´nt get it to work, the "put" part! I had rewrite it now !
´´´´´
player addeventhandler [
"Take",
{
if (primaryweapon player != "" && secondaryweapon player != "" && handgunweapon player != "") then {
_newGroup = createGroup OPFOR;
if (playerSide isEqualTo CIVILIAN) then
{
[player] joinSilent _newGroup;
};
}
];
player addeventhandler [
"Put",
{
if (primaryweapon player != "" && secondaryweapon player != "" && handgunweapon player != "") then {
_newGroup = createGroup CIVILIAN;
if (playerSide isEqualTo east) then
{
[player] joinSilent _newGroup;
};
}
];
´´´´
I mean I'm not sure what you are trying to do you just switched all your logic, and seem to be making the player join the group of another faction
Also still should replace OPFOR with east: _newGroup = createGroup OPFOR; > _newGroup = createGroup east; Although does work is inaccurate in most cases eg. config
I want that the player switch to the opfor faction, when he takes an weapon, but he should switch back when he put the weapon on the ground (weapon not in weapon slot)!
I mean like in "Laws of War" DLC > Escape Mission!
Your logic in if condition is broken, it returns true when player has all 3 weapons in both cases.
Can you give me an example that it works?
The first one should be fine since he wants to joint opfor if he has weapons. The second one however is reverse
instead of != do ==
I´m an beginner in scripting can please write it for me correctly?
player addeventhandler [
"Put",
{
if (primaryWeapon player == "" && secondaryWeapon player =="" && handgunWeapon player == "") then //Switch to civilian if all weapons are gone
{
_newGroup = createGroup CIVILIAN;
if (playerSide isEqualTo east) then
{
[player] joinSilent _newGroup;
};
}
];
Thanks!
@cosmic lichen The weapon lin is working (i had check it with an hint), but the player did´nt switch back to the civilian side, the blufor units fire again at the player!
huh?
did you also try missiled of type "M_Titan_AT" ?
I create one and then set a target pos and it works just fine
createVehicle
serverCommand doesn't seem to work with the correct serverPassword correct?
not really sure what else could be wrong
works fine otherwise xD
command password is seperate
Did you read the wiki page?
Yes, it's done in a UI environment
The other part about the password
@tough abyss Yeah I use setMissileTargetPos and it works
lazy evaluation.. should I be nesting the curly brackets in a complex or?
if ((cond1) or (cond2) or (cond3) or (cond4)) then
should be
if ((cond1 ) or {{{cond2} or {{cond3}
egh
i dont even know the question, let alone the answer
if ( (cond1) or {cond2} or {cond3} or {cond4} )
should 2 3 and 4 be wrapped in another level of {}
and then 3 and 4 be wrapped in yet another level of {}
(1stcondition) && {2ndcondition} && {3rdcondition}
(1stcondition) && {{secondcondition} && {3rd condition}}
how about that?
does it gain anything?
it is exiting on first false
right, yes, that makes sense
which is more than my question did lol
thanks
this is running on client every few seconds, so i want it as lean as possible
eh?
i think the trick is to get the most likely conditions to exit the condition right at the start
the most unlikely exit condition should be tested last
anyone know why my rtt is completly fucking itself in the shithole on mp ?
i see it, they don't
Hold on lemmie bring my crystal ball
I would show code, but im litteraly rewriting it for the 3rd time
https://hastebin.com/uvifedixom.cs works perfectly fine for me
So your question about the future code? Even more reason for the ball
Does it open dialog on remote clients?
no
it opens the dialog for me, and then when i switch the feed, it updates on the monitor
Then the function probably doesn’t exist on remote clients when you call it
im using setobjecttextureglobal with rtt..
Anyway if you are withholding pieces of code trying to be clever you have succeeded
im litteraly not.
im just getting pissed off with this shit now
3 times in the past week got it working fine, then just stops working again
Cool, carry on then
private _all_cam_objects = [];
(allMissionObjects "Land_HandyCam_F") apply
{
_all_cam_objects pushBack _x;
};
missionNamespace setVariable ["Lega_AllCams", _all_cam_objects, true];
[cursorObject, 0, 3] call {
params [
["_monitor", objNull, [objNull]],
["_screen_index", 0, [0]],
["_cam_index", 0, [0]]
];
private _name = format ["rtt%1", str _cam_index];
private _cam = (missionNamespace getVariable [format ["lega_cam_%1", _cam_index], objNull]);
if (isNull _cam) then
{
_cam = "camera" camCreate (getPos (Lega_AllCams # _cam_index));
};
_cam camCommit 0;
_name setPiPEffect [0];
_cam cameraEffect ["INTERNAL", "BACK", _name];
_monitor setObjectTexture [_screen_index, format ["#(argb,256,256,1)r2t(%1,1.0)", _name]];
};
``` litteraly just did basic as all hell, and even this isn't working globally.
private _all_cam_objects = [];
(allMissionObjects "Land_HandyCam_F") apply
{
_all_cam_objects pushBack _x;
};
You seem to not have understood how apply works
im putting more stuff in there
that piece of code is literally equivalent to
private _all_cam_objects = allMissionObjects "Land_HandyCam_F";
There is going to be more stuff in there,
Is that code running globally?
the closest I have had it working, is getting it to flicker on the other peoples screens.
cameras are local
I see more and more people using apply instead of forEach :-x
im done for the night, might take a look at it again tomorrow morning, with fresh eyes.
well often apply is a good choice, but there are also people who simply don't understand what they are doing
Dscha has been banned
gratz (or beileid?)
both, actually
At least, you can act quicker now, when dipshits show up
Currently that's literally every 10 minutes. Not fun.
A3 on sale again?
Spambots. Literally hundred per day :/
-.-
Had a sh*tload of them on another Server -> 5min delay until peeps could write after joining -> Haven't had one since ¯_(ツ)_/¯
We have 10 minute delay, they wait the 10 minutes, drop PM spam, and then go to the next bot account
😑
Help! On this link https://community.bistudio.com/wiki/Arma_3_CfgVehicles_GUER the vehicle C_Offroad_02_unarmed_F is from Apex with scope Public. This means everyone can use it?
scope public doesn't say anything about being able to use it or not
If it's a DLC vehicle then only owners can drive
ok, thanks
for what purpose?
So I have an array of sectors
I want to have a Map to store the sectors and their owners
no there is no such thing
Aw damn
you can save just about anykind of data but there is no special map thing for that
I'll have to use a parrallel array I guess
When doing a forEach, can I get an index?
_forEachIndex
@tough abyss You could do an associative array of sorts in the form [[key,value]]. The only thing is, you have to provide your own API for it as well. I do not think the scripting in and of itself inherently knows how to work with that.
Ye that could work! _map select 0 select 1 haha
Is there a way to simulate time passing
Like actually simuatle the world and run scripts
at accelerated time
faster than the 4x in sp
depends how your scripts are written
Okay
Is there any kind of tree structure??
Damn I wish it sqf was oo
JavaScript would be perfect
for arma missions
There is a plugin for it
looks cool
Is there something like curatorEditableObjects which returns all the groups a curator has?
Would make my code run far faster
You can create an object and use set/getVariable on it, it’s the closest you can get to map @tough abyss
You could do an associative array of sorts in the form
[[key,value]].
This will be as slow as fuck
@tough abyss How can I create a "blank" object?
You could use createLocation for it
Cheeky.
I'm gonna put it on my curator object
How about trees?
@tough abyss Do you know how to add some kind of tree structure?
Like for example, a sector map
So each X is a point and each blue line is a connection between two points
uhm ... tree structure --> ["level 1", ["level 2", ["level 3", [...]]]]
nothing to thank bro
CBA does have a Map implementation of some description that might be worth looking into if you can use it.
well i am kinda stumped, something is affecting my containers and vehicles in grad persistence.. i can't take any items from containers and getting in vehicles gives me a black screen
i reduce grad persistance to just spawning the vehicle and not setting any parameters except the position and it still breaks it.. so there is some random interaction going on here
i think i found the fix, removing cba
no idea what is going awry there but ah well
not cba, but the handler itself with grads enableSimulation
odd that it affects inventories
this is my event handler code: https://pastebin.com/tQQ2MPs6
but apparently with certain sound mods, it conflicts
it seems the event handler isn't removed correct (probably removes something from that sound mod)
(this is why i've send it to a variable... but apparently that doesn't work?)
can anyone take a look at it and tell me what i'm doing wrong?
CTRG_PLAYER removeEventHandler ["Fired", 0];
you are removing event id 0 during the event.. and not your handler?
that doesn't look at all right to me?
true, i forgot this line
but nontheless, later in code, i'm using CTRG_PLAYER removeEventHandler ["Fired", lxRT_FiredEH];
so that should remove it?
might want to print out what handler ID's you are creating and deleting
just to make sure somehow its not confused
problem is, this works perfect for me, but other players are using that one sound mod, which apparently throws fired EHs around
well maybe you should get that one sound mod and see how they are thrashing the handlers
😫
sadly i don't have any other suggestions
other mods are modders worst nightmares i guess
could be your handler removing random handles is actually causing them to silently fail the system
but eh.. impossible to tell
so far i've only really worked with a tight set of mods, but i have to say i've spent a heck of a lot of time ripping through their code to try and get things working how i want haha
i got used to not using any mods at all, because most of the time i work on missions and i hated it to constantly fix dependencies or workaround bugs that aren't issues in vanilla or the other way around
oh yeah, cba comes to mind. open any mission, save it, bam, dependency set.
yeah i have a fair bit of that with the older weapon packs now
tempting to ditch them but there's not enough variety with vanilla weaponry 😦
IS there a way to create custom Zeus categories?
Filled with existing characters/vehicles?
https://gyazo.com/3332f52dcb5b63df5d6d2f1409c59841
So instead of all that shite
It's just "Infrantry" "Cars" "Tanks"
anybody know any ideas to keep vehicles from clipping into buildings and exploding when loading my mission?
place them correctly 🤷
If i am not mistaken, mission Eventhandlers can be added within the initServer.sqf? or - basically any sqf that is server-sided?
I have a small problem (i use ACE 3) when i test, killer and killed person are the same person/unit/object. The handler is executed on the server. I tested it with system chat.
"person1 killed person1" instead of "killer killed person1"
I did probably something wrong?
private _killedUnit = _this select 0;
private _killer = _this select 1;
private _nameKU = name _killedUnit;
private _nameK = name _killer;
"OH NO! " + _nameK + " killed " + _nameKU + "!" remoteExec ["systemChat", 0];
ah, so if i wouldnt use ace i would get the correct source? (just to be sure, i know about the last damage source)
not sure
hmm, dont wanna restart arma XD ill go with the ace command ^^ thanksies.
I would like to make a radio from TFR which has speakers on and volume max and with a custom freq (150), anyone know how I could do that? I didnt find any google results for that
TFAR*
which tfar version?
what's the radios classname
Item_tf_anprc152
wdym?
Old TFAR doesn't really support that
With new TFAR you can just double click the radio in editor and tick the "speakers enabled" checkbox and be done
ill spawn in an entity, disable AI, make invisible and turn on speakers
AI's don't get instanciated radios
wdym?
only human players get working radios
oof
how could I do the thing u are talking about
create a weapon holder
add tf_anprc152_1000 item. Then somehow get radio settings with right frequencies onto it, and call the setSpeaker function on it
could you please right down the script because I have no idea of scripting
no
ok, thank you a lot anyways
Don't have time for that currently
https://github.com/michail-nikolaev/task-force-arma-3-radio/wiki/API:-Functions here are some things
I need a little bit of help when spawning items on the ground using an GroundWeaponHolder.
I use building positions and it seems that some will always be spawned underground.
How can I fix that?
When you spawn on second floor, where does it spawn?
Underground? under the building or in the floor?
How do you set the position of the weapon holder
Well. I spawn it using some building position and then use setPos.
I already tried it without setPos but that also yields underground issues.
For the first floor it spawns under the floor.
Nothing seems to spawn on the second floor and higher though.
Code to get building pos
_buildings = nearestObjects [_position, ["House"], _radius, true];
{
_building = _x;
_buildingPositions = _building buildingPos -1;
{
_pos = _x;
_lootPositions pushBack _pos;
} forEach _buildingPositions;
} forEach _buildings;
Creating + Setting
_holder = "GroundWeaponHolder" createVehicle _position;
_holder setDir floor (random 360);
_holder setPos _position;
Maybe I need to use ATL instead of AGL?
@still forum
I cannot figure out how the syntax works, what am I doing wrong? I want it to wait and then do the script
SCRIPT: this playMove "AinvPercMstpSnonWnonDnon",sleep 1.3;
thanks!
Plus a new line, for good measure
Does anyone know how I can access a variable in a script within a keyevent?
@delicate lotus sorry for delay.
Actually the wiki page is quite confiusing. 2 places say AGL, but example says ATL...
😂
You could try debugging the position and looking if the height value seems sensible
well I checked the position of some items using getPos at it was below zero
ATL is the same as AGL while over land
🤔
maybe try setPosATL like wiki shows, maybe it makes a difference
well once I tried teleporting to specific objects in buildings and setPos moved me one floor below it all the time while setPosATL worked perfectly
so I think it might work here to
huh it kind of works fine now
Wiki says AGL is the same as ATL ffs
Turns out it's not
except that the items float a bit in the air... which is probably due to this:
_height = _position select 2;
if(_height < 0) then {_height = 0.25;};
_position = [_position select 0, _position select 1, _height];
Dedmen does that mean I can't trust the wiki anymore? XD
Don't think I can trust anyone anymore
thats deep
only a little bit of tweaking is needed now. Then it will probably work fine.
Thanks for the help :)
There is no version of GroundWeaponHolder that reacts to gravity, right?
Pls help
Does an event handler run in a separate scope to the script it's in?
So it can't access/modify variables
AFAIK an event handler is just a bunch of code that gets called when X happens
so yes?
only things that are executed "right here, right now" MIGHT execute in the same script
now think about when a eventhandler executes
Ye that's what I thought
So how can I make an event handler call a function from a script or access a variable?
call a function?
call my_fnc_function
access a variable? Exactly like anywhere else, a eventhandler is also just a script
But said function and variable are outside the scope of the event
Anyone know how to get the player that is carrying another unit one in ACE?
any ide with syntax highlighting for sqf?
for what?
pretty much for every major IDE
I use IntelliJ
well i meant more specifically with arma 3 commands
I use notepad++ w/ plugins which works well
Sublime and VSCode work well for me
So im not sure whats wrong here but it doesnt seem to work
_tele = _this select 0;
_caller = _this select 1;
_group1 = createGroup EAST;
_group2 = createGroup CIVILIAN;
if ((alive _caller) && playerSide isEqualTo civilian) then {
{_caller joinSilent _group1} forEach units (group _caller)
} else if ((!alive _caller) && playerSide isEqualTo civilian) exitWith {
{_caller joinSilent _group2} forEach units (group _caller)
};
Im trying to make it so that when a civilian tps they will join side EAST so the WEST can shoot them and if they leave an area or die they will be put back to side CIVILIAN. (In the code I posted I dont have it setup yet for if the civilian is in the area)
see wiki page for joinSilent… it takes an array
ok thank you
There is no else if
Anyone knows the Dialog Name for Video Settings menu?
What would be simplest code to give users set their custom shortcut to specifif action? I know how to give custom action for specific addAction via parameter but Im curious if I could give them default key and if any key is set as user action 1, use it then default shortcut.
In short.. Im asking what code should i put in addAction's shortcut parameter to give default key and make users override it with USER ACTION#
How I can set up CAS on specific areas when called in by player? I got a hostage in a building that I don’t want to kill in the bombing? Thanks guys
so how do i start to make a addon, I know C#, pretty sure i can learn sqf quick. Do i make a mission then edit the files there? or do i make a server and edit the files there? I don't know where exactly to start. Ive googled it but there are way too many guides to sift through for just that first question.
wanted to start by changing the weapons of a pawnee
and have it load into zeus
spawnable by zeus