#arma3_scripting
1 messages · Page 623 of 1
the code is working. but if i lock (obfuscated) the pbo file the code doesn't work
if you think your are CHANGING a variable with that name, it wont work
I dont think you can obfuscate .sqf
ok i will ask a question. what can i do to protect this file i created?
I want to prevent someone else from stealing
seriously speaking, nothing
there will ALWAYS be a way for people who want to look inside, to do so
spawn the ojbects server side.
take your initserver.sqf and call it server side...
this is why I suggested you join the exile discord. Plenty of info, and help.
Okey. Thank you for help @obtuse sigil @grave torrent
I will have one last question
0 execVM "RD\RD_Client\data\Traders\NPCs\BMCapeZefyrisTraderObjects.sqf";```
What is the difference between these two codes?
on the last one you pass 0 as a parameter into the script
inside the script you can use params command to read what is passed in there
or _this
ok thanks
Hi noob here trying to get enemy ai spawn when enemy unit count is <5.
My code has been edited so many times I need to start again.
I so wish to work it out but hitting a wall, help
what is your issue?
Either code spawns 300 or not at all
Count enemy ai
Enemy ai - player
Remaining < 5 then spawn etc
300 Oo
Will have to switch pc on to get code
Damn loop
pseudocode:
wait until count enemies < 5
spawn enemy
loop
Is there an sqf editor that highlights errors and or gives alternatives
sqflint identifies syntax errors, if thats what you mean.
👍
this is what i ended up with and doesnt work at all
if (_enemy_left == _player) then (true) else (false);
while {true} do { _grp = createGroup east;
"O_IS_Team_Leader_01" createUnit [getMarkerPos "mark1", _grp, "", 0.6, "SERGEANT"];
"O_IS_Veteran_Grenadier_01" createUnit [getMarkerPos "mark1", _grp, "", 0.6, "SERGEANT"];
"O_IS_PKM_Gunner_01" createUnit [getMarkerPos "mark1", _grp, "", 0.6, "SERGEANT"];
hint "heres your men";
wrong brackets on that if:
if () then {} else {}
then it can be simplified to just the condition
while {true} do { a loop that never ends?
what you are doing:
- nothing (+ script error)
- then while always true, spawn an enemy
why it doesn't work 😉
simplify please
is that the entire script?
init file
[] ExecVM "Reinf.sqf";
while {true} do
{
total_count = {alive _x} count allUnits;
player_count = {alive _x} count units group player;
enemy_left = total_count - player_count;
hint format ["Enemies Left: %1", enemy_left];
sleep 5;
};
ok... so is there any more code or is that all of it?
that bit in init works fine
so other code in reinf.sqf does nothing, but it did spawn 300 till i edited it now nothing
while { true } do { spawn enemies }
do you see the issue?
bracket??
while {true}
true
the loop has no end condition
but in the snippet you pasted it also doesnt have an end bracket so idk how its looping at all
(referring to this one https://discordapp.com/channels/105462288051380224/105462984087728128/763690879230935040 )
if {_enemy_left == _player} then (true) else (false);
while {true} do { _grp = createGroup east;
"O_IS_Team_Leader_01" createUnit [getMarkerPos "mark1", _grp, "", 0.6, "SERGEANT"];
"O_IS_Veteran_Grenadier_01" createUnit [getMarkerPos "mark1", _grp, "", 0.6, "SERGEANT"];
"O_IS_PKM_Gunner_01" createUnit [getMarkerPos "mark1", _grp, "", 0.6, "SERGEANT"];
hint "heres your men";
does not work at all now deleted many lines hence to start again
if {_enemy_left == _player} then (true) else (false);
this line does nothing but a compile error
if enemy left = # then spawn??
no, no
pseudo code again:```sqf
while { true } do // while the mission runs
{
- wait until there are only 5 enemies
- spawn enemies
};
ah?
the while will then loop back to the wait
wait until there are only 5 enemies
yes
thought I would recommend checking if inferior to six
so, what does your code look like? ^^
{alive _x && (side _x) == east} count allUnits <= 2
while {true} do { _grp = createGroup east;
"O_IS_Fighter_01" createUnit [getMarkerPos "mark1", _grp, "", 0.6, "PRIVATE"];
hint "heres your man"; sleep 30;
};
while {true} do { _grp = createGroup east;
"O_IS_Fighter_01" createUnit [getMarkerPos "mark1", _grp, "", 0.6, "PRIVATE"];
hint "heres your man"; sleep 30;
};
{alive _x && (side _x) == east} count allUnits <= 5
'''sqf while {true} do
{alive _x && (side _x) == east} count allUnits <= 5;
{ _grp = createGroup east;
"O_IS_Fighter_01" createUnit [getMarkerPos "mark1", _grp, "", 0.6, "PRIVATE"];
hint "heres your man"; sleep 30;
};
First of all, add syntax highlighting to your code
code
It's the tilde key
`
Next to 1
private _grp = createGroup [east,false];
while {true} do {
waitUntil {{alive _x && (side _x) == east} count allUnits <= 5};
"O_IS_Fighter_01" createUnit [getMarkerPos "mark1", _grp, "", 0.6, "PRIVATE"];
hint "heres your man";
};
{alive _x && (side _x) == east} count allUnits <= 5;
{ _grp = createGroup east;
"O_IS_Fighter_01" createUnit [getMarkerPos "mark1", _grp, "", 0.6, "PRIVATE"];
hint "heres your man"; sleep 30;
};
total noob
😐
while {true} do
{alive _x && (side _x) == east} count allUnits <= 5;
{ _grp = createGroup east;
"O_IS_Fighter_01" createUnit [getMarkerPos "mark1", _grp, "", 0.6, "PRIVATE"];
hint "heres your man"; sleep 30;
};
hooray
proper indent reveals:```sqf
while {true} do
{
alive _x && (side _x) == east} count allUnits <= 5;
{ _grp = createGroup east;
"O_IS_Fighter_01" createUnit [getMarkerPos "mark1", _grp, "", 0.6, "PRIVATE"];
hint "heres your man";
sleep 30;
};
there is a misplaced {
also, you are not waiting until the condition is met
I recommend that you read:
https://community.bistudio.com/wiki/Introduction_to_Arma_Scripting
before writing code. It can save you a lot of headache.
(especially Data Types, Control Structures and SQF Syntax)
thanks i really want to learn but some of the scripts i open up are far too advanced i need baby language first
@winter rose ok np
tried to set license plate number?
@winter rose Nope, that doesn't do anything.
ah welp.
How to find out, if a certain ai unit is a medic?
many thanks
Hi all, I'm making a custom mision with the editor and I want to put a weapont but I dont want to interact with it at any way.
Anyone knows if there's any way to put it completely static and non interactable?
you could create a simple object with the model path @light badge 🙂
but a weapon item doesn't let you to put as a simple item...
you mentioned a weapon, not a weapon item ^^
createSimpleObject doesn't care what it is, as long as the .p3d is valid 🤷♂️
sorry, I just want to place some item weapons to decorate and the player shouldn't be able to interact with them.
yeah, createSimpleObject can do that
great, Ill try it.
Thank u so much
because fArma
is there a command I can use to force a keystroke of a player? or force a specific control like "CBA Next Optic State"?
@ebon citrus I would get w.s as weapon slot, but idk about c.o
Hello there, i want to get the players variable name to execute scripts on them later on, should I use getVariable ? I'm not really sure what the return value is in there
player returns the player; see allPlayers or BIS_fnc_listPlayers maybe?
@fair drum - rather than simulating a keypress, you probably want to find the CBA function that does what you want and call that.
allPlayers with a forEach seems to works ! great help as always Lou 🙏
mind that allPlayers also grabs Headless Clients, if there are any 😉
If I need to run a local function globally on vehicles (and their respawns) how should I do that?
@tough abyss what function you doing?
I am trying to make a turn script. I need a script that runs disableUserInput on all players in an array then selects the first player in the array, enables it for fives seconds, disables input once again, and then does the same for the next player and so on until it gets to the last player in the array and enables input for all
Any suggestions?
it is not recommended to disable user input… they cannot even alt-tab or escape-quit the game
Hey Lou, do you remember my issue with the mortar thing from a few nights ago? Well I got it resolved mostly. I can get a unit to move to a waypoint and then deploy a mortar and fire from there, but when I try to add a vehicle in the mix with a get out -- > move waypoint scheme it breaks.
[M1] spawn {
_unit = _this select 0;
_pos = _unit modelToWorld [0,1,0];
_unit playMove "AinvPercMstpSnonWnonDnon_Putdown_AmovPercMstpSnonWnonDnon";
removebackpack _unit;
_mortar = "O_Mortar_01_F" createVehicle _pos;
sleep 2;
_unit moveInGunner _mortar;
_pos = [[[getpos arty1, 50]],[]] call BIS_fnc_randomPos;
_unit commandArtilleryFire [
getpos arty1,
(getArtilleryAmmo [vehicle _unit]) select 0,
((magazinesAmmo (vehicle _unit)) select 0) select 1
];
};
The unit will get out of the vehicle, move to the waypoint, deploy the mortar and get on, but then quickly get off and move around for a short duration. Between the mortar being created and the unit getting on the mortar, the unit moves a few meters or so. This only happens when the vehicle is involved at all.
assign as gunner and allow getin maybe
_unit assignAsGunner _mortar;
[_unit] orderGetIn true;
_unit moveInGunner _mortar;
``` doesn't work either. Unit still gets on and gets off and runs around for a short bit before coming to a halt
First waypoint is hold, then get out, then move
the code is executed in the on activation of the move waypoint
When I remove the vehicle and the get-out waypoint, it all works fine
when I remove the move waypoint and put the code in the on activation of the get out marker, the behavior changes. the unit gets on the mortar and doesn't get off but he won't fire.
its there a script that will keep a door from opening cause the door im using doesnt have the little lock option in the ace menu
could be a door for a modded building?
yea modded hallway
some of them just aren't set up for that
Is there a way I could find all vehicles with a class name and do code on each of them in initplayerlocal?
That sounds perfect
You can also do it in an addon config, but regardless you'll have to use a mod. CBA or your own
can you remoteExec closeDialog?
i assume you could, but you would be better off remote executing code that finds and closes the specific display you want closed.
@little raptor Ok so Im asking this but how can I make the script so it has two parts, insertion and extraction
The insertion is on the very start of the mission but the extraction comes in the very end
How to force a human player to start the mission in prone position?
setUnitPos works for AI, but not for players. There is no action.
switchMove is forcing him to do animation but ... then he is stuck in it.
@fossil yew
put this in the init field:
this switchAction "PlayerProne"
Thx.
@fossil yew Use the updated code
@cold cloak Execute the codes at different times. If you use triggers, put them in different On Activation fields. You can do a similar thing for tasks as well.
aigh
also I need few lines of script because I got no clue how to script lmao
- Heli take off once its emtpy
- Yeet all the passengers out once the heli lands
Hey guys, can anyone point me in the right direction to use addAction to make a vehicle delete itself and spawn a vehicle on its exact position?
I essentially want to turn an SUV into an armored SUV through an action
I know I've gotta use createVehicle and deleteVehicle but I don't really want to have to run it from a script in the mission file
You can put them directly in addAction
I thought addAction could only do one?
You can put code in it
object addAction ["Respawn", {
params ["_target"];
isNil {
_respawnPos = _target getVariable ["RespawnPos", [0,0,0]]; //AGL position
_newVeh = createVehicle [typeOf _target, _respawnPos];
_newVeh setPos _respawnPos;
deleteVehicle _target;
}
}];
You need to set the respawn pos for the vehicle (when it initializes)
object setVariable ["RespawnPos", ASLtoAGL getPosASL object];
If I set the respawn as the vehicle the action is performed on will the new vic just spawn and explode before it gets deleted?
I don't think so
The code is unscheduled
Hold on
No
It's scheduled
Updated the code
Sweet. Thanks heaps man this is really helpful
Np. You might need to save the orientation of the vehicle as well
So. I'm a pretty newbie to scripting. in our unit someone made a super awesome template that unfortunately hampers some of our efforts. He left, but we're trying to minimize the use of backpacks. Right now. All items are being dropped in a backpack at mission start using the following:
// LOADOUT: RIFLEMAN
case "r":
{
_unit addweapon _rifle;
if (isNull (unitBackpack _unit)) then {_unit addBackpack _bag};
(unitBackpack _unit) addMagazineCargoGlobal [_riflemag, 11];
(unitBackpack _unit) addMagazineCargoGlobal [_riflemag_tr, 2];
(unitBackpack _unit) addMagazineCargoGlobal [_grenade, 5];
(unitBackpack _unit) addMagazineCargoGlobal [_mgrenade, 5];
(unitBackpack _unit) addMagazineCargoGlobal [_smokegrenade, 5];
(unitBackpack _unit) addMagazineCargoGlobal [_ARmag,1];
};
I tried looking up similar things for unitBackpack to make all that stuff drop into the vest instead, but I can't seem to find the equivalent of unitBackpack.
There's none
Darn.
Use this instead
https://community.bistudio.com/wiki/addItemToVest
Alright. Thanks. I'll fiddle with it.
Also, if the backpack is already on the unit, why don't you just use the addItemToxxx commands?
.. Yes.
Not sure. This template was made by old clan staff like.. 3/4 years ago. We're finally getting around to change things. Keep walking into hoops to jump through, Yay for versatility I guess..
Is there an event that fires when vehicle gear shifts? Or an eventhandler that can be used when that happens?
I tried looking up similar things for
unitBackpackto make all that stuff drop into the vest instead, but I can't seem to find the equivalent ofunitBackpack.
@tough abyss vestContainer _unit
Oh, nice. thanks!
there is also uniformContainer and backpackContainer which is same as unitBackpack
Awesome. That's good to know.
where did those come from?! 😄
Yeah. I get it. Back in the day this template was made to safeguard any missionmakers from doing weird loadouts to make sure we all get proper gear and don't forget anything. And while it works wonderful, it is kind of weird to work with now we decided to change out the large backpacks (Everybody was getting carryalls) to smaller onces we want to add more items to the vest (Because somebody thought it was nice to just dump everything into a carryall leaving the vest empty)
But. With addItem instead I think it'll overcome some issues. I'm already pissed we can't have no backpack without rewriting litterally half the base of the loadout system.
Thank you for your help, I really appreciate it.
We do, yeah.
Hah. Willdo.
I got a question. I want to rewrite a loop to something event driven.
When a vehicle reaches 10% fuel, the driver should look for some fuel source, move to the source, then refill the fuel tank.
What event handler can I use to achieve this?
there is no such even only when you deplete completely or refil from 0. You can set a trigger and set interval to check every minute to save performance
@little raptor Sorry dude, I'm getting absolutely nowhere with your code, still super new to this
Where should I be putting in the classname for the armored suv?
Nah it was an SUV, I wanted the script to delete the SUV and replace it with an armored SUV
Sorry, should've been more clear on that
I KNEW it would be one of those. Cheers again mate. I'll give it a crack
CfgNetworkMessages.hpp:
{
module = "RdGaming";
parameters[] = {"OBJECT"};
};
class packVehicle
{
module = "RdGaming";
parameters[] = {"STRING"};
};```
what does this code mean?
It's not a code. Ask in #arma3_config
oke
@unique sundial thanks for reply. This is the way I am currently doing it. Just wanted to ask in case I overlooked something.
@little raptor Hey dude back again - please don't feel obligated to help if you're sick and tired of me 😂 I've got everything working, but I can't get it to spawn on the same location as the original SUV.
Testing out with spawning on player works fine, the orientation is good also
I just can't figure out how to get it to spawn on the same pos as the SUV the action is being activated on
where do you want to spawn it?
On the same location as the SUV the action is being done on
Sorta like the SUV is transforming into a new vehicle
So the new SUV needs to spawn on the same place as the one that's getting deleted
object addAction ["Respawn", {
params ["_target"];
isNil {
_respawnPos = getPosASL _target;
_newVeh = createVehicle [typeOf _target, [0,0,0]];
_newVeh setVectorDirAndUp [vectorDir _target, vectorUp _target];
_newVeh setPosASL _respawnPos;
deleteVehicle _target;
}
}];
Still not working unfortunately, here's what I'm working with
params ["_target"];
isNil {
_respawnPos = getPosASL _target;
_newVeh = createVehicle [CUP_I_SUV_Armored_ION, [0,0,0]];
_newVeh setVectorDirAndUp [vectorDir _target, vectorUp _target];
_newVeh setPosASL _respawnPos;
deleteVehicle _target;
}
}];```
hi. when using player attachTo vehicle, the aiming for the player is restricted. im creating a script to hold on to vehicles, enabling players to lie down on top of slow moving vehicles and fire
is there a way to unlock player aiming after a call to attachTo?
anyone remember how to export cfgPatches?
@naive osprey The only way is to create a fake vehicle with FFV position, put the player in the vehicle, then attach that vehicle to the vehicle you want.
@ebon citrus What do you mean?
export all of cfgPatches
@crude stream "CUP_I_SUV_Armored_ION"
You want to export the config or their names?
I mean with the whole contents right?
yes
Not just their names
ok
and
Is what you want
(I'm not sure what you intend to do with it because cfgPatches is useless)
oh, thanks. could you point me in the right direction regarding creating a vehicle? (assuming i have to create a custom vehicle type)
The guys at #arma3_model can help you out. I don't have much experience in creating vehicles.
That did it!! Thank you so much Leopard20!
Guys, I would like to add an event handler to players only. This is what I currently got:
class Extended_Hit_Eventhandlers {
class CAManBase {
hit = "_this execVM '\NIC_HealMe\functions\HealMe.sqf'";
};
};
Inside the script, I can filter out any non player. But is there a better way doing this?
I don't think so.
Also, create a function instead of that
One last thing. I assume that's a code that contains some loop isnt it?
yes, there is a loop
I'm alone atm, but publishing on steam, there could be more
If the number is just a few, it doesn't matter.
If you converted that code to a fucntion, it could save you more performance than the minor performance cost for the condition inside the code.
oh, so i need to use object builder?
Roger, will do. Many thanks for the advice!
So if I'm making a custom scripted mission which I want to have custom inventory items or weapons, can all of this be created inside of the mission file itself which players download when they join the server (as opposed to having to download a workshop mod) or where is the limit with that? I've already made some good progress with custom gui and scripted functionality as well and I would prefer for my players to not have to download any mods to join.
Afaik, yes. You can create a config.cpp in the PBO and patch the config to add your new items and vehicles.
@little raptor you can?
i wanna know too
no, because campaigns can load addons
so can missions
i thought CfgWeapons, CfgVehicles, CfgItems, CfgPatches and some others were outside the scope of the mission
there is a missionconfigfile scope
but im unsure how much that can actually do
Except you wouldn't be modifying them in a "mission"
You put them in the PBO, along with your mission files
so you make an addon?
Afaik, yes. You can create a
config.cppin the mission folder and patch the config to add your new items and vehicles.
@little raptor
this part confuses me
I meant in the PBO
afaik all configs have to be loaded during startup. but you can add cfgSounds, cfgFunctions, etc. in description.ext
would be cool to have a list of what the missionconfigfile scope can add
I've never done this. Hopefully someone with more mission making experience could let us know
found it
so inventory items would have to be done through an addon, as predicted
@little raptor ^^
👆
Can anyone tell me why this just makes the action still available to those not in the driver seat, and just displays it twice for the driver?
params ["_target"];
isNil {
_respawnPos = getPosASL _target;
_newVeh = createVehicle ["CUP_I_SUV_Armored_ION", [0,0,0]];
deleteVehicle _target;
_newVeh setVectorDirAndUp [vectorDir _target, vectorUp _target];
_newVeh setPosASL _respawnPos;
[], 7, true, true, "", "driver vehicle player == player";
}
}];```
Its almost like its creating the action twice, once for the driver and once for everyone else
Because the radius doesn't change either
Did you even check the syntax?
https://community.bistudio.com/wiki/addAction
I'm not even sure how that works for you!
Ah okay I see my mistake
this addAction ["<t color='#FF0000'>CODE RED", {
params ["_target"];
isNil {
_respawnPos = getPosASL _target;
_newVeh = createVehicle ["CUP_I_SUV_Armored_ION", [0,0,0]];
deleteVehicle _target;
_newVeh setVectorDirAndUp [vectorDir _target, vectorUp _target];
_newVeh setPosASL _respawnPos;
}
}
[], 7, true, true, "", "driver vehicle player == player";
];
Yeah cheers again man
Think it just takes someone pointing out the obvious to realise how stupid you're being 😅
hey, how do i properly translate player coordinates to the vehicles model coordinates? player worldToModel position _veh puts me on the floor... (_playerpos select 2) - (_vehpos select 2); puts me a few meters above the model
vehicle worldToModel getPosATL player```?
https://community.bistudio.com/wiki/worldToModel
@naive osprey what are you trying to achieve?
(_playerpos select 2) - (_vehpos select 2) makes no sense?
thats just the z value, get the height difference
trying to get player attachTo _vehicle at the current position, meaning world position for the player remains the same before and after attachTo
but maybe im doing it wrong. this language is completely new to me!
just do attachTo? 🙂
without position parameter, it takes the current relative position
See also BIS_fnc_attachToRelative in order to keep angles as well
https://community.bistudio.com/wiki/BIS_fnc_attachToRelative @naive osprey
does this addeventhandler ["fired", {(_this select 0) setvehicleammo 1}] Still work? tried adding it to units in zeus but they still seem to run out of ammo
Is it possible to add more sub categories for ACE3? Something like
Animations -> Briefings -> More Briefings -> Briefing 1 Animation
if you're talking about ACE Interaction Menu, than yes, you can make sub-sub-submenus
just be aware that if you add too much that it might be impossible to use
@zinc sorrel setVehicleAmmoDef, or setAmmo too
How do I do that @exotic flax ? 😄
I read that but I don't see anything that mentions sub categories 😦
Or wait is it
["Tank_F", 0, ["ACE_MainActions", "CheckFuel"], _action, true] call ace_interact_menu_fnc_addActionToClass; ```
so that "CheckFuel" part?
@winter rose will try that, thankyou
ace3 documentation even has an example for sub actions:
// Adds action to check fuel levels for all land vehicles
_action = ["CheckFuel", "Check Fuel", "", {hint format ["Fuel: %1", fuel _target]}, {true}] call ace_interact_menu_fnc_createAction;
["LandVehicle", 0, ["ACE_MainActions"], _action, true] call ace_interact_menu_fnc_addActionToClass;
// Adds action to check external fuel levels on tanks. Will be a sub action of the previous action.
_action = ["CheckExtTank","Check External Tank","",{hint format ["Ext Tank: %1", 5]},{true}] call ace_interact_menu_fnc_createAction;
["Tank_F", 0, ["ACE_MainActions", "CheckFuel"], _action, true] call ace_interact_menu_fnc_addActionToClass;
Then it's that, thanks a bunch
What can I use to prevent people from closing a dialog with Esc? I need the dialog to only close when a button is pressed
_display displayAddEventhandler ["KeyDown",{_this#1 == 1}];
@robust hollow Will that stop all key presses from registering while the dialog is open??
only if the pressed key code is 1 (esc)
Okay perfect thanks!
If it returns true, it overwrites the default behavior (in this case, close dialog)
wat
if you capture and overwrite the default esc-behaviour with an EH, you wont be open the escape menu
not if the event is added to an open dialog
so this doesnt mean the dialog isnt closed by hitting esc, it means esc wont do anything so long as the EH is in place
it would only block the escape menu if you blocked esc on display 46 (and maybe child menus?)
displayAddEventhandler can be only added to displays, not dialogs, iirc
dialogs are displays
maybe this would be better? https://community.bistudio.com/wiki/ctrlAddEventHandler
oh, never mind then
yea, adding it to a control would not block esc closing the display
i was in the belief that dialogs are dialogs
displays are displays
since a dialog can be added ontop of a display
but i guess it's just a weird naming convention
no, it seems that dialogs are dialogs on displays
so you'd still have to add the displayEH to the display
whichever it is
usually 46
do correct me if im wrong
creating a dialog doesnt seem to return any kind of object
well, it returns a boolean
but no reference to a display either
right, but you still find it with finddisplay or whatever variable you set in the onload event
yes, but if you set that EH, you need to remember to remove it aswell
just closing the dialog wont remove it
since the EH is not tied to the dialog, but the parent display
just be careful when overwriting default behaviour
always leave yourself a way to open the esc-menu
might get infuriating otherwise
like painting yourself intoa corner
i have personally blocked myself out of the esc-menu a couple times and having to restart the whole game gets stale
since the EH is not tied to the dialog, but the parent display
Are you sure about that? that an EH added to a child display is added to the parent and staays even after the child is closed? 🤨
sec
i can findDisplay on a dialog?
with its IDD?
and no, im not sure
i had a hunch
that's why i said, PLEASE correct me if im wrong
so that im not only misleading others, but also so that im not misleading myself
createDialog "RscDisplayEmpty";
private _display = allDisplays select (allDisplays findIf {ctrlIDD _x == -1});
_display displayAddEventHandler ["KeyDown",{systemChat str _this}];
when the dialog is open it systemchats every key you press. when you close it, the systemchats stop
you didn't even say "please", you said "do" 😜
yep
it seems im wrong
just took a look at MY OWN CODE
and i do it
guess i need to double down on those dementia pills 😅
(findDisplay 5730) displayAddEventHandler ["Unload", {...}
];```
like a total jackass i am
from what I can tell, the main differences between dialogs and displays are:
createDialog force creates on display 46 (or the newest child dialog of), and blocks player movement.
closeDialog assumes you want the newest child dialog closed.
whereas with displays you choose what the parent is and what display specifically to close.
so what makes a display different from a dialog?
The notable difference between createDisplay and createDialog is that with createDisplay the player would be able to move whilst having control of the mouse pointer.
there, i answered myself
oh yeah, i remember using createdisplay back in like 2019 now
welp, fortunately i wont have to be here for much longer bothering you
Good job on correcting me Lou!
clarifying* ^^
the thing of which I am not sure is "can we create a dialog by scripting, and reference it"
can you create a dialog by scripting in the first place?
i mean, but like from the ground up
since a dialog needs to be referenced from the description or another resource
that method of referencing it would not always be reliable, but for the test it is enough.
@robust hollow stop face-palming me!!1! 😄
but yeah, for dialogs idd's are kind of a "must have"
i found it incredibly easy to start using cutRsc though
what's the engine side difference between cutRsc and dialog?
like is there a performance gain
i dont see why you couldnt add a config option to make a dialog without any interaction (mouse included)
or im jsut not seeing it
well... dialogs are meant for interacting with, while cutrsc is for making hud layers just meant for show.
yep, i got that
but what's the big deal?
like there must be a better reason to make such a large divide between dialogs and cutrsc
or is it just incremental changes that caused incremental issues and required new solutions
the usual "the guy who made it no longer works here, so nobody wants to touch it"
presumably limitations of the time 🤷
or is it the fact that a hud obviously doesnt need the same kind of support that a dialog needs
and thus it's handled so much differently from a dialog on creator and presumably engine side
i dont know what is going on behind the binary wall, but i guess they have their reasons
i jsut hope arma 4 sees a script overhaul
whether it be Enforce script or otherwise
Arma 3's script base and all the other creation tools are like a labyrinth
or a maze
i dont remember which one is which
many ways to correct, but different solutions
for the same purpose
anyway, we won't know right now
Arma 3's script base and all the other creation tools are like a labyrinth
or a maze
That's the downside of backwards compatibility.
will the scripts work in 2040 when Arma4 will be released?

hey, waitUntil {time > _x} throws error if false... what am i doing wrong
but works if its true
what does the error say?
if it works when true then my first guess would be it is running in an unscheduled environment and only errors on false because thats when it attempts to suspend the script.
running it in debug console generates generic error, waitUntil {time |#|> _x}
is _x defined?
wrote _x here but actually im using 1
if i look at the watch in game, pause just before say 30 seconds, run the script: generic error, then just after 30 seconds it works...
generic error in waituntil is usually because it is executing in unscheduled (which debug is)
hmm... also running in init.sqf:
class Extended_PostInit_EventHandlers { class Man { init = "_this call (compile preprocessFileLineNumbers 'holdon\functions\init.sqf')"; }; };
spawn it
yea that will be unscheduled too. make sure you spawn it, or spawn the part of the code within that needs delaying.
also, aren't you preprocessing the file for every unit? you should rather use a CfgFunctions
it does exist, but it is parent to more than just "human"
Yeah I know. But I remember I was trying "Land" once and it didn't work
So I had to break it into "Car", "Tank" etc.
it does execute at start... i just want it to run for players
Also, _this call Func is not needed. You can simply say call Func (spawn still needs it)
Because _this is still defined in Func (they're in the same handle)
If you didn't understand why, don't worry about it. What you wrote was correct. But redundant.
hehe i kind of get that, but i mean in general, this language, the way of executing etc
class Extended_PostInit_EventHandlers
you will be getting native postinit EH which would fire after vehicle creation
SU EAT
Hey guys, anyone knows why this ```sqf
_action = ["Anims","Briefing listening","",{player playMove "Acts_Briefing_SB_Loop";},{true}] call ace_interact_menu_fnc_createAction;
[(typeOf player), 1, ["ACE_SelfActions", "Animations"], _action] call ace_interact_menu_fnc_addActionToClass;
doesn't show up as sub category but this ```sqf
_action = ["Animationen","Briefing zuhoeren 1","",{player playMove "Acts_Briefing_SB_Loop";},{true}] call ace_interact_menu_fnc_createAction;
[(typeOf player), 1, ["ACE_SelfActions"], _action] call ace_interact_menu_fnc_addActionToClass;
``` does?
Does "Animations" exist as a class in the "ACE_SelfActions" class?
https://discordapp.com/channels/105462288051380224/105462984087728128/764294760260698142
Just as the example; make sure you have an existing parent to put the action to
I have a quick question regarding client/server relationships. Let's say I have this:
// initServer.sqf
TAG_fnc_buttonAction = {
closeDialog 1;
};
and then in an HPP file which contains an RscButton I have this:
class ExampleButton: RscButton
{
idc = 1500;
text = "Example";
x = 0.463906 * safezoneW + safezoneX;
y = 0.588 * safezoneH + safezoneY;
w = 0.0721875 * safezoneW;
h = 0.044 * safezoneH;
action = "call TAG_fnc_buttonAction";
};
In this scenario, the function inside of the action IS called for myself (the host) but not for my other clients. Am I doing something wrong here?
you define the function on the server, and call it, what's wrong?
I explained what is wrong in the last line of my message @copper raven
its working how its supposed to, if you want clients to know about the function, you should define it for them aswell
So I have to include it in initPlayerLocal.sqf?
what you're saying is, pressing the button in the gui works for the host, but not the others, yes?
Yes
well yeah, gui stuff should be client side(player-host is also technically client), take the definition away from the initServer and put it in initPlayerLocal
Awesome, I'll give it a shot, thank you
why not use CfgFunctions to define the function? This will make sure it's always available
I'm relatively new to the way Arma 3's scripting works. What is CfgFunctions?
That seems like a great solution. Does it matter where I create the class CfgFunctions?
Mission and campaign specific functions can be configured in Description.ext, while addon functions are defined in Config.cpp. Configuration structure is the same in both cases.
Thank you
Can someone please correctly layout the process for delcaring a missionNamespace variable, editing it, and broadcasting it to all clients? From what I understand it is a very simple process but I think I've messed something up in my code and I would like to see a correct example
if the code is executing in the missionnamespace (it usually is by default) you can do
myVar = 1;
publicVariable "myVar";
or from any namespace you can do
missionNamespace setVariable ["myVar",1,true];
you then repeat the process when you want to update the variable value and broadcast again.
I am trying to parse the config and pull out all the class names for stuff that I want to use and categorise it. I've been using BIS_fnc_itemType and BIS_fnc_objectType. What I am looking for is a way to get the "content" for a given class name so I can categorise which class names require which content. So I can for example say give me all vanilla content and GM content. Does anyone know how I can get this information from a class name? The only data I see in the config is the "author" field, is there another way to achieve what I am looking for?
my addon works fine, except it is necessary to be admin (not host) on a server or the script wont fire... do i need to do something serverside?
how are you trying to execute the script?
firstly from:
class Extended_PostInit_EventHandlers { class CaManBase { init = "_this call (compile preprocessFileLineNumbers 'holdon\functions\init.sqf')"; }; };
(i know, run only for players instead, will change that eventually, unless this is the actual problem)
init.sqf (this code is not run):
PlayerSpawned = [] spawn { waitUntil {time > 1}; systemChat "holdon initialized"; HoldingOn = 0; moduleName_keyDownEHId = (findDisplay 46) displayAddEventHandler ["KeyDown", {if ( inputAction "User10" > 0 && HoldingOn == 0) then { _nul = [] execVM 'holdon\functions\holdon.sqf'; HoldingOn = 1;}}]; moduleName_keyUpEHId = (findDisplay 46) displayAddEventHandler ["KeyUp", {if (inputAction "User10" == 0 &&HoldingOn == 1) then {detach player; HoldingOn = 0;}}]; };
@sly mortar you might be able to identify source addons/mods by using
https://community.bistudio.com/wiki/configSourceAddonList and/or
https://community.bistudio.com/wiki/configSourceModList
I'm not sure if they are 100% accurate though.
@naive osprey and you say it only executes if you are logged in admin? 🤔
just tried with friend, i was admin, it worked immediately for me, but he had to log in as admin and call init.sqf through console
sounds like being admin is just a coincidence as it shouldnt effect how scripts execute at all. try adding diag_log everywhere and see how far it makes it. add one in the init event itself, and then through the init.sqf before the spawn, before the waituntil, after the waituntil, and in the eventhandlers before, inside of and after the if.
thanks! alright... and it couldn't be a JIP thing?
shouldnt be. i havent used cba so dont know how it works but in vanilla post init fires for everyone, so i assume xeh postinit events do too.
Using deleteVehicle on an Object automatically resets all variables set on that object as nil, right? Or is it better practice to set all variables as nil manually prior to deleting the object?
You don't need to worry about setting variables on an object to nil @violet gull. What's your main concern? Garbage collection/deallocation of resources?
The reason why I ask the dumb question is because back when I used to use attachTo for objects in my furniture script, even after deletion, the attachedTo command still returned an array of objects/objNulls.
The attach bug was fixed eventually a few updates ago, but was just curious
Ah, yeah, that definitely was a bug!
Do I have to do something special to access missionNamspace variables from files outside of the regular Event Scripts? I'm currently trying to use a missionNamespace variable inside of a function which I have in a separate file and is also defined in CfgFunctions
And what about BIS functions?
not usually. scripts usually execute in missionnamespace by default so you can return them raw or with getvariable
missionNamespace is available in the mission namespace, so it doesn't matter where you access it
as long as its inside a mission 😉
can you share code to show specifically how you're trying to do it?
missionNamespace setVariable ["MyGlobalVariable","Yay!"];
Is kind of the same as doing:
MyGlobalVariable="Yay!";
They return the same thing
Sure @robust hollow. I'm specifically trying to execute this database call from within my function but when I try to output this variable into systemChat the systemChat command doesn't appear in chat for some reason
_health = [DRTO_DB_PLAYERS, [_uid, "HEALTH"]] call BIS_fnc_dbValueReturn;
["Health: " + str(_health)] remoteExec ["systemChat", 0, true];
And I know the database exists because I can output that as a string and it is as it should be
setVariable lets you make it JIP/persistent though
is systemchat allowed to be remoteexec'd?
Yes it is
Actually hold on I may have found the issue
Lol I forgot to uncomment something, I've been working on this too long today. Thanks for the help anyway guys
Alright so I'm almost done with this, I have one more question. On this page https://community.bistudio.com/wiki/DialogControls-Buttons#CT_BUTTON.3D1 the action states
The variable "this" is available, and contains the unit that pressed the button, but unlike User Interface Event Handlers no "_this" information about the current control is passed.
but when I try to access it it says this is undefined. How do I correctly access it?
presumably like this params ["_unit"]; or similar
@robust hollow I tried this params ["_unit"]; as well as just params ["_unit"]; and neither of them worked for some reason
params uses _this by default so defining this in front should have worked. give me a moment i'll try to test it myself.
Thank you Connor, you are a huge help
yep, i get undefined variable too. guess the wiki is wrong.
hmm, well regardless, I need to be able to access the unit somehow
I wonder if there is a resource with better information about this
you can use player. the event will only ever fire if you have pressed the button yourself.
why didn't I think of that 🤦♂️
Is there a script anyone has handy to attach a logo to a side of a vehicle?
I would like to add solid numbers to some tanks to allow easy identification
usually you would only do this with vehicles that have a texture selection intended for showing numbers (like ships), or if thats not an option you'd apply numbers on the texture directly, but if you need to you can attach one of the image tile objects and apply the number texture to that. probably won't look great but it'll work.
UserTexture_1x2_F or UserTexture1m_F is the object im thinking of
Is it redundant to enableSimulation false simple and super-simple objects?
yes. pretty sure simple objects dont simulate anyway.
https://community.bistudio.com/wiki/Arma_3_Simple_Objects#Performance
Simple Objects is feature that allows creation of objects with very limited simulation. so not quite none but still usually better than disabled simulation.
yep, i get undefined variable too. guess the wiki is wrong.
@robust hollow it adds script to the scheduler (hence undefined errors) but it is not spawned. The argument is _this but it is just empty string is passed as argument.
I can't seem to figure out how to force my intro script to waitUntil the client isn't displaying the default loading screen (https://imgur.com/a/WpCcHKH). After I host the mission or even connect on a dedicated server, the mission hangs in the above loading screen immediately after clicking Continue but proceeds to play the intro in the background. The following code doesn't help in this case:
waitUntil{scriptDone _this};waitUntil{!isNull(findDisplay 46)};waitUntil{!isNull player};waitUntil{getClientStateNumber>=10};
_this is the init.sqf
read the notes here https://community.bistudio.com/wiki/startLoadingScreen @violet gull
waitUntil is as good as sleep
So in other words, have my init.sqf call the code within a custom loading screen and exit it to play the intro when all code is loaded?
No idea but you are better off spawning scripts from init sqf, you can wait until in them without problem
@robust hollow button script is sqs as well inserts Connors avatar
well there you go 🙂👍
Any idea why ctrl+backspace gives me the Delete character (Unicode 127) in an RscEdit box?!
To see the character, open the debug console and type: toString [127]
your keyboard is FUBAR?
no! 😄
The weird thing is, it works fine in debug console when I'm writing code (so does in other programs).
It appears that only RscEdit with autocomplete="" are affected
Oh and I've added a "keyDown" event handler to my display as well, if it matters (it returns false for backspace, so it's not related)
Could be a game bug
I'll investigate
Cant reproduce so check your windows
your arma
Yeah you were right!
Can anyone else reproduce this?
Run the mission, pause, run this in debug console, unpause:
_txt = findDisplay 46 ctrlCreate ["RscEdit",-1];
ctrlSetFocus _txt
Then simply press ctrl+backspace
Yeah I'm able to repo that
@unique sundial There
Also, according to that SuperUser page:
So it sounds like if the application does not use SHAutoComplete it will not support the feature unless it has been explicitly added by the application's author.
Then simply press
ctrl+backspace
@little raptor did exactly that no probs
Your Arma is special! 😛
Maybe your IME issue?
Nah that wasnt it. Disabled all input methods besides English. Didn't help.
Hm is there a way to display text on a screen that can be changed rather than a picture?
Yes? Not sure what you meant but yeah, you can dispaly text on screen.
Not sure what you meant
I mean just giving the game a text "x" to display on an ingame model (like a screen) rather than a pre-made picture @cunning crown
Ah, then I think it's not really possible but I'm not 100% sure
Hey I've got some issues with a small setIdentity script I want to do.
When using the following code:
class CfgIdentities
{
class Spooky
{
face="Deerface3";
pitch=0.8;
};
};```and
```// unit init
this setIdentity "Spooky";```It gives this error:
```No entry 'C:\Users\thoma\OneDrive\Dokumente\Arma 3 - Other Profiles\Northgate-O\missions\spooky-test.VR\description.ext/CfgIdentities/Spooky.name'.```
This is pretty annoying as it blanks out the name and all, which isn't optimal. Otherwise it 'works'. I want to use this in multiplayer so players need names. Is anyone able to help me with this one?
It clearly says that you need to define a "name" property for the identity.
And you need more:
https://community.bistudio.com/wiki/Arma_3_CfgIdentities
Yeah I saw that. But I can't define a name since it's multiplayer, and I don't want to make everyone be called the same name.
Save the name, set indentity, set name
Thanks, but it's multiplayer. How can I make it so that a player who joins doesn't get their name changed by the identity script?
@snow badge use setFace and setPitch, not setIdentity since you obviously don't want to use identities
Oh, thanks! I'll try that.
@little raptor sorry to ping you
but the script you helped me with
isnt working in a new mission
Let me just annoy you one last time: I found this script in https://community.bistudio.com/wiki/setFace:
if (isServer) then {[_unit, "AsianHead_A3_02"] remoteExec ["setFace", 0, _unit]};
If I replace "_unit" with "player", will this script persisently apply on any player who joins?
no.
Oh deer. Is there any way without having to give every unit an individual name, that it applies that script to every playable unit?
player is null on the server
Thanks, I'll check that out. Man, sometimes I wish my monkey brain understood SQF
that's not #arma3_scripting, that's #server_admins. search for server config on the wiki @copper needle
I switched it over thanks!
I've been looking at allPlayers but I still haven't been able to understand a thing. How can I make it so that allPlayers are set to that face whenever they join / respawn?
in init.sqf:
player setFace "theFace";
player addEventHandler ["Respawn", {
params ["_unit", "_corpse"];
_unit setFace "theFace";
}];
Jesus, thank you so much. So this works when someone joins and respawns? What does "_corpse" mean by the way?
the respawn corpse of when player died?
So this works when someone joins and respawns?
well yes, that's what you asked 😎
Boss, thanks so much.
I want to do a spooky operation where everyone has a special face, now with October around ;) This helps greatly.
How do I make one players camera shake? if I use addCamShake will it shake the whole server?
addCamShake is local, so it would only apply to the client where it is run
thanks
im trying to set up ai spawners that send units to a waypoint using this command _mrk = ["mrk1","mrk2","mrk3","mrk4"] call BIS_fnc_selectRandom;
wp =(_this select 0) addWaypoint [(getMarkerPos _mrk),0]
but when i start scenario even though i have markers set up they don't move
So I'm trying to do a little scripting, my original goal was to add a function to a post that when activated, would announce in global chat that the post had been touched
this addAction ["Touch Post", [west,"HQ"] remoteExec ["globalChat",0]];
Is what I've begun with
I'd ideally like it to announce who touched it but I think that's a little out of my league
I know I've probably gone ridiculously wrong with it, but I honestly have no idea what I'm doing, I appreciate if anyone can point me in the right direction.
second element of addaction should be wrapped in {}
this addAction ["Touch Post", {[west,"HQ"] remoteExec ["globalChat",0]}];
also, globalChat expects an object as the first argument, so west is incorrect.
Ah right, hugely appreciated. Looks like I wasn't too far off. Should I just put the variable name instead of 'west' then?
if the variable is a unit, yes. The first argument is the unit sending the message, the second is the message.
Okay, got it. cheers.
in init.sqf:
player setFace "theFace"; player addEventHandler ["Respawn", { params ["_unit", "_corpse"]; _unit setFace "theFace"; }];
@winter rose lou, wouldn't running player setFace "theFace" on an onPlayerRespawn.sqf be simpler?
Are arrays automatically removed from memory when there are no remaining references to them? I'm on Arma2OA.
@tough abyss could you make a FT ticket with request please
@drifting sky thats the idea
Anyone got a time calculator or smh for while loops? I would like to raise an object via setPosATL in 10 seconds from Z = -2 to Z =0.
better to use setVelocityTransformation for these sort of tasks
hey, is there a good editor for sqf? to get syntax highlighting etc?
vscode, atom, sublime, notepad++
oh, i have np++... set it to smalltalk or something?
no, to SQF https://www.armaholic.com/page.php?id=8680
wow, i should really just have googled that instead... thank you!
Hello !
I installed the Wages Script. But wages notification come as text. just like that: http://prntscr.com/uxgbea
I want the notifications to be more specific. Just like that: http://prntscr.com/uxgd9b How do i do this?
The Notification Code:
while {alive player} do
{
_wages = (player getVariable ["ExileMoney", 0]);
if((player call ExileClient_util_world_isInOwnTerritory) or (ExilePlayerInSafezone)) then
{
_wage = 0;
[parseText format["<t size='0.4' shadow='2' color='#3FD4FC' shadowColor='#131718' font='RobotoRegular'>You did not earn poptabs while at base or trader</t>"],0,-0.35,5,1] spawn bis_fnc_dynamictext;
uiSleep 900;
}
else
{
_wage = 500;//awards a player 500 poptabs every 900 seconds whilst not in trader or their territory
_wages = _wages + _wage;
[parseText format["<t size='0.4' shadow='2' color='#3FD4FC' shadowColor='#131718' font='RobotoRegular'>You received %1 poptabs, you now have %2 poptabs - Remember to bank it or, gone at restart!</t>",_wage,_wages],0,-0.35,5,1] spawn bis_fnc_dynamictext;
player setVariable ["ExileMoney",_wages,true];
uiSleep 900;
};
};```
I asked the Exile support forum but got no answer.
instead of calling bis_fnc_dynamictext you should call the function which displays the "nice" text
Below is a code that does the same.
This is exactly the way I want it. However, there are some differences.
Can you edit my code by looking at this code?
private _waitTime = 15;
private _wage = 500 + (missionNamespace getVariable ["perk_inmateWages", 0]);
if ((player call ExileClient_util_world_isInOwnTerritory) || ExilePlayerInSafezone) then
{
["ErrorTitleAndText", ["<t color='#C62551'>INMATE WAGES</t>", format["<t size='20' color='#E9E9E9' font='PuristaMedium'>Total Earned:</t> <t color='#C62551'>ERROR</t><br/>Can't be earned here!<br/>%2 Minutes until next wage!", _wage, _waitTime]]] call ExileClient_gui_toaster_addTemplateToast;
systemChat "INMATE WAGES: Total Earned: ERROR!";
systemChat "INMATE WAGES: Can't be earned here!";
systemChat format ["INMATE WAGES: %1 Minutes until next wage!", _waitTime];
}
else
{
["SuccessTitleAndText", ["<t color='#9FDE3A'>INMATE WAGES</t>", format["<t size='20' color='#E9E9E9' font='PuristaMedium'>Total Earned:</t> <t color='#3ED3FB'>%1</t><img image='\exile_assets\texture\ui\poptab_inline_ca.paa' size='25'/><br/>%2 Minutes until next wage!", _wage, _waitTime]]] call ExileClient_gui_toaster_addTemplateToast;
systemChat format ["INMATE WAGES: Total Earned: %1 Poptabs!", _wage];
systemChat format ["INMATE WAGES: %1 Minutes until next wage!", _waitTime];
["addWageRequest",[str(_wage)]] call ExileClient_system_network_send;
};
@exotic flax
well, instead of doing it for you, which won't teach you anything, I can tell you how to do it yourself
ok. i am listeningg you
like I said, instead of calling bis_fnc_dynamictext you should call the function to display the nicer version, which in this case is ExileClient_gui_toaster_addTemplateToast (parameters are different, but it's easy to se where the text and values go)
so:
[parseText format["<t size='0.4' shadow='2' color='#3FD4FC' shadowColor='#131718' font='RobotoRegular'>You did not earn poptabs while at base or trader</t>"],0,-0.35,5,1] spawn bis_fnc_dynamictext;
has to look the same as
["ErrorTitleAndText", ["<t color='#C62551'>INMATE WAGES</t>", format["<t size='20' color='#E9E9E9' font='PuristaMedium'>Total Earned:</t> <t color='#C62551'>ERROR</t><br/>Can't be earned here!<br/>%2 Minutes until next wage!", _wage, _waitTime]]] call ExileClient_gui_toaster_addTemplateToast;
(since it's an error message)
There is no "_waitTime" code in the overall code.
so it's not in my code.
is this a problem ?
it's probably the same as uiSleep 900;
although I don't know the full code of ExileClient_gui_toaster_addTemplateToast, so can't tell
/**
* ExileClient_gui_toaster_addTemplateToast
*
* Exile Mod
* www.exilemod.com
* © 2015 Exile Mod Team
*
* This work is licensed under the Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
* To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-nd/4.0/.
*/
private["_template","_placeholders","_placeholder1","_placeholder2","_placeholder3","_placeholder4","_templateConfig","_color","_templateText","_rawText"];
_template = _this select 0;
if !(isClass (missionConfigFile >> "CfgExileToasts_SG" >> _template)) exitWith
{
systemChat format ["UNKNOWN TOAST TEMPLATE: %1", _template];
};
_placeholders = param [1, [""]];
_placeholder1 = _placeholders param [0, ""];
_placeholder2 = _placeholders param [1, ""];
_placeholder3 = _placeholders param [2, ""];
_placeholder4 = _placeholders param [3, ""];
_templateConfig = missionConfigFile >> "CfgExileToasts_SG" >> _template;
_color = getArray (_templateConfig >> "color");
_templateText = getText (_templateConfig >> "template");
_rawText = format [_templateText, _placeholder1, _placeholder2, _placeholder3, _placeholder4];
[_rawText, _color] call ExileClient_gui_toaster_addToast;
that still doesn't tell me anything
I would suggest to just follow the functions that are being called to see how stuff works, or simply try out some stuff to see if it works or not
best way to learn it is by trying to break it 😉
🙂 ok i try now
https://yadi.sk/i/GxNLuTY8l-01SA @exotic flax
Wages.sqf:
while {alive player} do
{
_wages = (player getVariable ["ExileMoney", 0]);
if((player call ExileClient_util_world_isInOwnTerritory) or (ExilePlayerInSafezone)) then
{
_paycheck = 0;
["ErrorTitleAndText",["Activity reward", format ["You do not earn Activity rewards in Safezones and your Base!"]]] call ExileClient_gui_toaster_addTemplateToast;
playSound "addItemFailed";
}
else
{
_paycheck = 250;
_pay = (player getVariable ["ExileMoney", 0]);
_pay = _pay + _paycheck;
playSound "readoutClick";
["SuccessTitleAndText", ["Activity reward", format ["You received +%1 <img image='\exile_assets\texture\ui\poptab_inline_ca.paa' size='24'/><br/>You have now %2 <img image='\exile_assets\texture\ui\poptab_inline_ca.paa' size='24'/>", _paycheck, _pay]]] call ExileClient_gui_toaster_addTemplateToast;
player setVariable ["ExileMoney",_pay,true];
call ExileClient_object_player_stats_update;
};
};
initPlayerLocal.sqf:
//#include "initServer.sqf"
if (!hasInterface || isServer) exitWith {};
0 call compileFinal preprocessFileLineNumbers "MarXet\MarXet_Init.sqf";
// NPC Traders
[] execVM "Traders\NPCs\BMCapeZefyrisTraders.sqf";
[] execVM "Traders\NPCs\ExileTraders.sqf";
//StatusBar
[] execVM "ClientCode\StatusBar\StatusBar.sqf";
ExileClient_cratedump_network_receiveMoneyAndRespect = compileFinal preprocessFileLineNumbers "ClientCode\R3F_LOG\objet_deplacable\ExileClient_cratedump_network_receiveMoneyAndRespect.sqf";
//Wages
execVM "ClientCode\Wages\wages.sqf";
execVM "ClientCode\Wages\announcepay.sqf";
_wages = compileFinal preprocessFileLineNumbers "ClientCode\Wages\wages.sqf";
[60, _wages, [], true] call ExileClient_system_thread_addtask;
if it works you're done 🙂
Wages.sqf:
while {alive player} do
{
no sleep?
ah..
Correct? @little raptor ```c++
while {alive player} do
{
_wages = (player getVariable ["ExileMoney", 0]);
if((player call ExileClient_util_world_isInOwnTerritory) or (ExilePlayerInSafezone)) then
{
_paycheck = 0;
["ErrorTitleAndText",["Activity reward", format ["You do not earn Activity rewards in Safezones and your Base!"]]] call ExileClient_gui_toaster_addTemplateToast;
playSound "addItemFailed";
uiSleep 900;
}
else
{
_paycheck = 250;
_pay = (player getVariable ["ExileMoney", 0]);
_pay = _pay + _paycheck;
playSound "readoutClick";
["SuccessTitleAndText", ["Activity reward", format ["You received +%1 <img image='\exile_assets\texture\ui\poptab_inline_ca.paa' size='24'/><br/>You have now %2 <img image='\exile_assets\texture\ui\poptab_inline_ca.paa' size='24'/>", _paycheck, _pay]]] call ExileClient_gui_toaster_addTemplateToast;
player setVariable ["ExileMoney",_pay,true];
call ExileClient_object_player_stats_update;
uiSleep 900;
};
};
900s?
yes
Put both outside the scope. at the end
Doesn't make any difference. It's just redundant
what is superfluous?
while {alive player} do
{
_wages = (player getVariable ["ExileMoney", 0]);
if((player call ExileClient_util_world_isInOwnTerritory) or (ExilePlayerInSafezone)) then
{
_paycheck = 0;
["ErrorTitleAndText",["Activity reward", format ["You do not earn Activity rewards in Safezones and your Base!"]]] call ExileClient_gui_toaster_addTemplateToast;
playSound "addItemFailed";
}
else
{
_paycheck = 250;
_pay = (player getVariable ["ExileMoney", 0]);
_pay = _pay + _paycheck;
playSound "readoutClick";
["SuccessTitleAndText", ["Activity reward", format ["You received +%1 <img image='\exile_assets\texture\ui\poptab_inline_ca.paa' size='24'/><br/>You have now %2 <img image='\exile_assets\texture\ui\poptab_inline_ca.paa' size='24'/>", _paycheck, _pay]]] call ExileClient_gui_toaster_addTemplateToast;
player setVariable ["ExileMoney",_pay,true];
call ExileClient_object_player_stats_update;
};
uiSleep 900;
};
and use sqf for syntax highlighting. Not C
which syntax highlighting code ?
```sqf
```
ah ok tyhank y ou.
Is it possible to change the mouse cursor icon in displays (other than map)?
Just what I thought
try #arma3_gui?
i dont believe so.
Hey guys i have a pretty easy question with a possibly very difficult solution:
Is it possible to readout the IP of the server instance(either directly or from any other place) via SQF?
My current appraoch for a extension needs to know the IP(for a REST API on same IP but different port), but i cant use a cfg file for the extension as all instances run from the same Arma installation
From the extension would be an option too, but from SQF would be easier to adapt in the curremt system
no, i dont think there is a way for a server to know its own ip using sqf alone.
Is there a way to readout the server.cfg?
you probably could with filepatching if the config is in the right directory.
Hmm, thats a bummer
(Its for a rework of my rework of ASM, cause i need some higher FPS values XD)
I have a functioning extension but the GUI needs an update(i use some unknow version of the old ASM)
I think i can make use of saveProfileNamespace
As all instances have seperate profiles
@dusty dawn - You could probably load up the config file in your extension, and also search the list of processes on the current machine for Arma, checking for the -port parameter in its startup arguments. If there's no -port, use the default.
Not exactly a nice way of doing things thoug.
read a post somewhere about triggering ragdoll, do you still need to push the unit with something? or have they implemented a command for it?
setUnconscious?
I guess you're talking about http://killzonekid.com/arma-scripting-tutorials-forced-ragdoll/
Which is all you need to make it work.
afaik is there no engine implementation / BIS_fnc_ for that
yeah that post. alright!
@dusty dawn - You could probably load up the config file in your extension, and also search the list of processes on the current machine for Arma, checking for the -port parameter in its startup arguments. If there's no -port, use the default.
Not exactly a nice way of doing things thoug.
@cold glacier thx for that idea, i foundd a good way, would be to make a single CFG that has the Servernames from server.cfg as 1 entry and a IP as second entry
Does inputAction work with findDisplay 46 displayAddEventHandler ["mouseButtonDown", {...}] ?
it should
although in the comments on the wiki it states:
inputAction does not return the actual state of the queried key when a dialog screen is open. Instead, it will always return 0.
guess you'll have more luck with actionKeys
So far have a feeling inputAction works only with keyboard. At least, if I map action to the RMB, input action returns 0.
_anyveh = selectRandomWeighted [
opfor_ARMED_CAR1_X,0.5,
opfor_COVERED_TRUCK_X,0.1,
opfor_TRANS_TRUCK_X,0.1,
opfor_AMMO_TRUCK_X,0.1,
opfor_REPAIR_TRUCK_X,0.1,
opfor_APC1_X,0.5,
opfor_APC2_X,0.5,
opfor_AA_APC_X,0.9,
opfor_MBT_TANK1_X,1.0
];
does anyone know what the numbers to the right of those units are?
is that spawn chance?
it's basically a percentage (0.5 = 50%, 0.1 = 10%, etc.), although combined they don't have to add up to 1
in that case they will all have the same chance of being selected
okk
appreciate it
_faction = _this select 0;
_vehClass = _this select 1;
_position = _this select 2;
_radius = _this select 3;
// DETERMINE LA FACTION
_side = EAST;
// Find a safe location FAR FROM ZONE CENTER (keeps buggy zone selection from surprising BLUFOR)
_vehpos = [[(_position select 0)+10, (_position select 1)+0],400,600,15,0,0.5,0,[],[]] call BIS_fnc_findSafePos;
// ARRAY of Random Vehicles
_car = selectRandomWeighted [
opfor_ARMED_CAR1_X,1.0
];
_anyveh = selectRandomWeighted [
opfor_ARMED_CAR1_X,0.5,
opfor_COVERED_TRUCK_X,0.1,
opfor_TRANS_TRUCK_X,0.1,
opfor_AMMO_TRUCK_X,0.1,
opfor_REPAIR_TRUCK_X,0.1,
opfor_APC1_X,0.5,
opfor_APC2_X,0.5,
opfor_AA_APC_X,0.9,
opfor_MBT_TANK1_X,1.0
];
_airveh = selectRandomWeighted [
opfor_TRANS_HELI_X,1.0,
opfor_ATTACK_HELI_X,1.0,
opfor_MISC_AIR_X,0.5
];
_createdVehFnc = [];
if (_vehClass == "car") then {
_createdVehFnc = [_vehpos,0,_car,_side] call bis_fnc_spawnvehicle;
} else {
if (_vehClass == "air" && AttackHeli == 1) then {
_createdVehFnc = [_vehpos,0,_airveh,_side] call bis_fnc_spawnvehicle;
} else {
_createdVehFnc = [_vehpos,0,_anyveh,_side] call bis_fnc_spawnvehicle;
};
};
_veh = _createdVehFnc select 0 ;// vehicle object
createVehicleCrew _veh;
if (_vehClass == "air" && AttackHeli == 1) then {
_veh setPos [_vehpos select 0, _vehpos select 1, 300];// set height
_veh setvelocity [0,0,300];
};
_vehGroup = _createdVehFnc select 2;
_vehGroup deleteGroupWhenEmpty true;
{
_x setSkill opfor_ai_skill_random;
} foreach units _vehGroup;
// Set the waypoints
//hint format["%1",_patrolRadius];
_opf_patrol = [_vehGroup] execVM "WARCOM\WARCOM_wp_opf_patrol.sqf";
this is the entire script
check the command's wiki page
Hey guys, quick question. I already asked this in the model_makers section but perhaps it would be better to ask it here. I'm making a custom mission and I know I can have custom audio / images without the players having to download any mods but can I also have custom 3D models just contained within the mission or is that beyond the scope of what is possible without mods?
yes you can, but they can sometimes cause issues (at least in mp). you can use createSimpleObject to spawn models from a mission file.
What sort of issues exactly?
in my experience it was kicks without a reason, but more recently i think i've been told it can blame bad signatures. not 100% sure on that but the point is it may cause being kicked off when you go near the object. it is possible that is a fault of the model though. i havent tried it in a long while.
That's interesting. I'm pretty meticulous when it comes to things like this so if there is a right way to do something like this I want to understand it. I will look into it and try to create some simple objects
that should be addressed in 2.00
hmm question about remoteExec/remoteExecCall; is it "better" to use remoteExecCall for a command (e.g hint) or does it make no difference at all (no new scope, etc)?
i suspect it starts a new scope either way
one scheduled, the other not yeah… perf-wise, the same? 🤷♂️
commands are unscheduled for both arent they?
ah, very well might be
wiki seems to think so
dang, I should really read it 😄
So yeah, just matters for functions? I guess
Hi all !
i have a question
I want the gun on a dying AI to be removed.
mission config.sqf:
DMS_RemoveLMG1 = true;
fn_OnKilled.sqf
if (_unit getVariable ["DMS_RemoveLMG1",DMS_RemoveLMG1]) then
{
_unit removeWeapon "MMG_01_hex_F";
};
this is correct ?
possibly. have you tried it?
yes i tried However, the weapon is not deleted after the AI dies
is _unit the dead body?
yes
how does fn_onKilled.sqf execute?
(needs to execute on the owner of the AI as removeWeapon expects a local argument)
@digital plover look at how dms does it for launchers
also, maybe the unit's weapon is not its weapon since the gun gets dropped
The code did not work on my first try. but now it worked when I try again. Strange
I looked at the code for the launcher. However, it was a little confused, I did not understand @grave torrent
actually I better use that code
Can you help me about how to edit it?
do you want to remove all weapons from said unit @digital plover?
also, maybe the unit's weapon is not its weapon since the gun gets dropped
The event handler fires before that
yes @winter rose
See removeAllWeapons then 🙂 @digital plover
I tried this but it doesn't work
if (_unit getVariable ["DMS_RemoveLMG1",DMS_RemoveLMG1]) then
{
removeAllWeapons _unit;
};```
Correct ? @winter rose
should work 🙂
i try now 🙂
*boom*
I am executing the following line of code in my initServer.sqf-script but it doesn't seem to work. Any idea why?
[_vehicle,"addVehicleActions.sqf"] remoteExec ["execVM",0,_vehicle];
not work 😦 @winter rose
config.sqf:
DMS_RemoveLMG1 = true;
if_onKilled.sqf:
if (_unit getVariable ["DMS_RemoveNVG",DMS_RemoveNVG]) then
{
_unit unlinkItem "NVGoggles";
};
if (_unit getVariable ["DMS_RemoveLMG1",DMS_RemoveLMG1]) then
{
removeAllWeapons _unit;
};
yeah, those weapons are in weaponholder containers
what ?
they are on the ground, not on the unit
sure, and onKilled executes after the unit dies so it appears you need to delete the weaponholder container object instead of using removeallweapons (or similar).
The event handler fires before that
not according to @little raptor?
hmmmm, the picture disagrees 🤔
I can't solve this problem somehow
I dont think the classname is correct but something like this might work
private _containers = nearestObjects[_unit,["WeaponHolderSimulated"],5];
{deleteVehicle _x} forEach _containers;
(2 should do, if it is right on death) but yup
😐
the code for launchers has what you need with container removal
lines 65-79
duplicate and modify it slightly for the weapon you want and itl work
if ((_unit getVariable ["DMS_ai_remove_launchers",DMS_ai_remove_launchers]) && {(_launcherVar != "") || {_launcher != ""}}) then
{
// Because arma is stupid sometimes
if (_launcher isEqualTo "") then
{
_launcher = _launcherVar;
diag_log "sneaky launchers...";
_unit spawn
{
uiSleep 0.5;
{
_holder = _x;
{
if (_x isKindOf ["LauncherCore", configFile >> "CfgWeapons"]) exitWith
{
deleteVehicle _holder;
diag_log "gotcha";
};
} forEach (weaponCargo _holder);
} forEach (nearestObjects [_this, ["GroundWeaponHolder","WeaponHolderSimulated"], 5]);
};
};
_unit removeWeaponGlobal _launcher;
{
if (_x isKindOf ["CA_LauncherMagazine", configFile >> "CfgMagazines"]) then
{
_unit removeMagazineGlobal _x;
};
} forEach (magazines _unit);
};
I'm going to duplicate and change this code, right?
yes
my english is not very good. therefore I have difficulty understanding.
Ok so how do I edit this code for snipers?
i dont know exactly, ive never used dms before. from what i can see there you would change some of the classes (LauncherCore, CA_LauncherMagazine) to the class you need, and instead of _launcher you would look for the weapon(s) you want.
_launcherVar = Is that a variable?
probably
this veriable is used in all missions. http://prntscr.com/uyh88b
I guess I should arrange these one by one for snipers
_launcher will be defined in that file though
Does anyone know how to reference classes from configFile inside mission config?
in other words:
class SomeConfigFileClass;
doesnt work when I put it in description.ext
SomeConfigFileClass is a class defined in configFile
Never mind. Found it:
import SomeConfigFileClass
Since 1.99 😉
Damn that was close! 
import
⚠ Available in or after Arma 3 v2.01.146644
🤔 https://community.bistudio.com/wiki/import
What would be the best route to keep someone alive inside of a destroyed vehicle? Or a vehicle that explodes without playing with allowdamage false?
yeah i'm trying to figure out the best route to kick it on, tried an event handler with a detection for the vehicle player but it still kills em
well yeah, it has to happen before
that's what i'm stuck on
i think i'm doing it after it happens
if (player getVariable ["slaysrevivesystemisrunningalready",0] isEqualTo 0) exitWith {
player setVariable ["slaysrevivesystemisrunningalready",1];
sleep 1;
systemchat "Revive system running!";
player addEventHandler ["HandleDamage", {
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
_unit = _this select 0;
_damage = damage _unit;
if (_damage > 0.9) then {
_damage = 0.9;
_unit setVariable ["reviveable",1];
_unit setVariable ["canbehealed",1];
//[player] call slay_injured;
//player call slays_bleed_screensfx;
_unit setCaptive true;
0 fadeSound 0.3;
_unit allowDamage false;
moveOut _unit;
systemchat "player killed";
if (_unit == vehicle _unit) then {moveOut _unit};
systemchat "godmode enabled";
_unit setUnconscious true;
systemchat "player knocked unconscious";
_unit setCaptive true;
systemchat "player set captive";
0 fadeSound 1;
};
_unit setDamage _damage;
}];
};
if (player getVariable ["slaysrevivesystemisrunningalready",0] isEqualTo 1) exitWith {
systemchat "Already running revive system!";
};
i'm assuming this method is already far too late?
the players die in the vehicles it trigger death mechanics, must respawn etc.
It works flawlessly if they get injured outside of a vehicle however, would i need to do an eventhandler akin to his but for their vehicle, then trigger allowdamage false on each passenger?
This feedback tracker states that this bug has been fixed yet I seem to be getting it with something I made? https://feedback.bistudio.com/T80668
using latest dev?
I assumed it was on stable since there has been an arma update since KK's post of fixed in next dev
huh… when did 1.98 come out?
it likely wouldnt have made it into the 1.98 build if it was only just being added to dev (1.99)
either way both Warning Message: Cannot load texture mpmissions\mission.altis\custom\ and Warning Message: Picture mpmissions\__cur_mp.altis\custom\
shouldn't one of them work even without the fix?
but yea I suppose so if it was marked as resolved on 18th of May
I'll play with it or make a work around if its not fixed until update.. I was scratching my head on it
work around like pbo'ing my mission
Thanks guys, Ill make do 😄
@torn juniper have you tried release candidate? anyway too late now as next stable is not far away
how to convert these old A2 remote execution code to A3 best?
[nil,_unit,rSPAWN,[_unit,ger_tank0,"commander"],_fnc] call RE;```
```sqf
[nil,nil,"per",rSPAWN,[],{
sleep 0.01;
"colorCorrections" ppEffectAdjust [1,1,0,[0.1,0.05,0.0,0.02],[1.2,1.0,0.8,0.666],[0.5,0.5,0.5,0.0]];
...
while {true} do
{
waitUntil {vehicle player == player};
_ps setPos position vehicle player;
sleep 0.1;
};
}
] call RE;```
[[], { /* the code */ }] remoteExec ["spawn", 0, true]```
but the best would be of course to use color correction template in description.ext, and use the corresponding BIS_fnc @velvet merlin
also attachTo 😬
that uhh.... that remoteexec spawn would require an argument too [[],{ /* the code */ }]
Fixed! I woke up 5 minutes ago and you can see that 😁
trying to think within an hour after waking up is always a terrible idea 😪
wouldnt recommend
I don't think s— ooooooh
You are already browsing arma 3 discord 5 mins after you woke up? You addicted mate? 😄
[[param1,param2], {_this spawn LIB_fnc_moveIntoVehicle}] remoteExec ["spawn", 2];
does this look right?
or rather
[param1,param2] remoteExec ["LIB_fnc_moveIntoVehicle", 2];
personally i'd go the latter, but either way works
the latter would need this, right?
functionName: String - function or command name.
While any function can be used, only commands and functions defined in CfgRemoteExec will be executed.
yes. it is better for security to do the latter but if that isnt a big deal the former would work just as well
yeah for a basic TDM conversion
You are already browsing arma 3 discord 5 mins after you woke up? You addicted mate? 😄
There are principles to follow!1!
remoteExec'ing spawn or call is a door open to potential hacks too - some peeps may want to disable it
@velvet merlin I was told to always rather create a function and remoteexec that instead of using spawn or call. I think there is even a note on the remoteExec page about that.
the only time a call or spawn is acceptable is when the remoteexec is sent from the server, and that is only because it bypasses the restrictions anyway.
so you trust functions and not the passed code 🙂
Hey guys.
Does anyone know a way to clear the "texture cache" or whatever it is that prevents the game from properly reading the updated .paa files (in mission folder)?
I mean besides renaming the files or restarting the game! 🙂
nope
😦
I am trying to execute a script that adds actions to certain vehicles using the addAction-command and because the effect of said command is only local I am trying to execute the script on every connected client machine and (as long as that vehicle is alive) on every JIP machine as well.
To do this I am using the following line of code in my in my initServer.sqf-script but it doesn't seem to work.
Any idea why?
[_vehicle,"addVehicleActions.sqf"] remoteExec ["execVM",0,_vehicle];
Is it possible to change the mouse cursor icon in displays (other than map)?
@little raptor
mod config yeah.
2.02 wen?
@unique sundial glad I waited until I woke up to download.. Next stable was not very far away at all 😛 I will test and verify that the fix is in stable and if not will take a poke at the ticket again. Thanks much!
@winter rose @robust hollow I guess I only had to wait barely 12 hours for a (hopeful) fix - thanks for the help earlier though 
Does anyone know if it's possible to check/uncheck the menu items of CT_MENU_STRIP using scripts?
https://community.bistudio.com/wiki/DialogControls-Menu#CT_MENU_STRIP.3D47
if you define:
type="checkBox";
for a menu item, it will behave similar to a CT_CHECKBOX. But it doesn't work with cbSetChecked because it is not a control.
2.02 wen?
aRmA 5 v1.0 wEn?
@still forum
mod config yeah.
I mean temporarily. Similar toctrlMapCursor
Another day another update
Anyone know how this can be used? I can't think of how it may be safer
What would be the difference between just having a global variable on the clients mission
variables cannot be broadcast out of or into this namespace in multiplayer
Global variables can be replaced. This one can't (apparently)
And also:
will not be serialized when game is saved. UI variables can be safely stored in this namespace
Temporarily I'm quite sure no
nah 1.99 into 2.00
2.01 into 2.02
We branched off early, I think back in August. And after that only fixes or important stuff gets merged back.
So the last months of stuff is all 2.02 basically
localNamespace cannot be messed with via publicVariable.
people would need to remoteExec whole scripts to change values there.
explain?
yes missionNamespace will not save stuff like ui displays and such, might even complain with warnings
If you define:
MyCtrl = _displ displayCtrl ID;
It won't work anywhere else right? (unless you put disableSerialization)
I've never done it but I assume it won't
it will but complain with a messagebox
ah ok
it will complain, and it will work, until you save+load the game.
or if you send it via publicVariable to others
Is it possible to localize text in a language other than what the user has selected in game options?
not as far as I know, nope - why?
not necessary at all?
<Key ID="STR_lang_en">
<Original>English</Original>
</key>
<Key ID="STR_lang_fr">
<Original>Français</Original>
</key>
<Key ID="STR_lang_de">
<Original>Deutsch</Original>
</key>
…nvm, my mind is boggled @ work
Any Idea how to force calculatePath to stay on roads even if routes are longer ? Maybe a vehicle with horrible terrainCoef ? No idea how AI pathfinding considers that.
When using this command to get the predicted path of vehicles driving and having them stay on roads (not go cross country) is important, the best vehicle to use is "wheeled_APC" and careless behaviour.
I'm having difficulty getting a script spawned AI group to board a player aircraft. I created a script to create the squad and addwaypoint. The squad does not board the aircraft unless I use waypointattachvehicle. Also, once they board, I can't get them to use a new waypoint to get out.
Main goal is to have a billboard with an add action that a player land in front of, call the squad to board, and take them to a player specified LZ.
_Squad1 = [
(getMarkerPos "BFS1S"), West, (configfile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfSquad")
] call BIS_fnc_spawngroup;
_Squad1 deleteGroupWhenEmpty true;
_Pickup1 = getMarkerPos "Squad1Pickup1";
_DropOff1 = getMarkerPos "Raven1 Deploy Alpha";
_S1Attack = getMarkerPos "S1Attack";
_Squad1Units = (units _Squad1);
_Raven1P = group player addwaypoint [_Pickup1, 0];
_Raven1P setwaypointtype "LOAD";
_Raven1P waypointattachObject BFS1HP;
_S1W1 = _Squad1 addWaypoint [_Pickup1, 0];
_S1W1 setWaypointType "GETIN";
_S1W1 waypointattachVehicle Raven1;
@exotic flax Sadly doesnt work, still wants to go up 80 degree inclined cliffs instead of the road around the cliff
"Fixed: Dead crew would not delete when a vehicle was deleted with deleteVehicle - FT-T148420"
Does that means we don't need to rum deleteVehicleCrew before delete the vehicle?
https://community.bistudio.com/wiki/deleteVehicle
rum all you want!
maybe it's a stupid question, but - does setTimeMultiplier command affects time call result? Is time function operates with "real", not multiplied seconds?
setTimeAcc affects time, not sure about the other one maybe just date is affected, test it
setTimeMultiplier only affects the speed of in-game daytime simulation.
so it won't affect time.
Hey
How can I view all icons that I could use for respawn loadouts?
like "a3\missions_f_exp\data\img\classes\assault_ca.paa" and "\A3\ui_f\data\map\VehicleIcons\iconManLeader_ca.paa"
I downloaded PBO manager but apparently the files don't follow any logical paths...
I'm having trouble with setWaypointPosition
I want a unit to move abut randomly
so I just update a waypoint every time it is completed
and I set its position with setWaypointPosition to the 0th waypoint (the spawn position) with a radius of 100
but for whatever reason it only moves the waypoint within a very small area and just to one side of the center
I also placed some arrows at the exact coords to make sure that the center is, indeed, the units spawn position and doesn't change
[group this, 1] setWaypointPosition [waypointPosition [group this, 0], 50];
[group this, 2] setWaypointPosition [waypointPosition [group this, 1], 0];
arrow_1 setPos waypointPosition [group this, 0];
arrow_2 setPos waypointPosition [group this, 1];
That's the on activation code for waypoint 1 (type: move) and waypoint 2 is just a cycle waypoint
any ideas?
also, if I change the radius to 10, it just snaps to a nearby building and doesn't change at all anymore
oh, after like 30 waypoints I just got one on the other side
still looks pretty broken though, does setWaypointPosition try snapping to buildings or something?
or, idk, apply some weird heuristics to figure out where to send units or something
because this certainly isn't "a random position within the radius"
Does anyone know if it's possible to check/uncheck the menu items of CT_MENU_STRIP using scripts?
@little raptor not sure if you found an answer for this yet, i cant spot one in the chat, so just incase:menuSetCheck
https://community.bistudio.com/wiki/Category:Command_Group:_GUI_Control_-_Menu
@little raptor I was just about to write an example 😄
Also, enjoy the new command groups 🙂
Hmm
I'm trying to update a respawn location
but I'm getting "init local variable in global space"
is ```sqf
"respawn_west" setMarkerPos _pos;
not supported?
probably wants you to hardcode the pos instead of using _pos local variable
Anyone able to see what I'm doing wrong? Trying to slap allowdamage false onto the player, then the vehicle when it hits a specific damage amount. It doesn't seem to be working at all for me sadly. I did a similar script with players outside of vehicles that functions, but it doesn't seem to work the same for the vehicles.
player addEventHandler ["GetInMan",
{
params ["_unit", "_role", "_vehicle", "_turret"];
_systemchat = format ["Vehicle script running on players vehicle, %1",_vehicle];
systemchat _systemchat;
_unit = _this select 0;
_damage = damage _vehicle;
if (_damage > 0.7) then {
moveOut _unit;
_damage = 0.7;
_vehicle allowDamage false;
_unit allowDamage false;
};
_vehicle setDamage _damage;
_unit setDamage _damage;
}];
@robust hollow so how should I go about having the spawn follow the group?
Quick question, am I correct in saying configOf and isNotEqualTo were not added in the 2.00 release and are still only on dev?
Yes @south rivet
@quaint oyster That eventhandler would only fire for getting into the vehicle, you would need to add say a handleDamage EH to the vehicle within the getInMan EH, you also do not need to use _unit = _this select 0; as it is already defined in the params
GetInMan EH -> check variable of veh if it has a handledamage EH, if not assign it -> handledamage ignores damage over 0.7 and kicks out players
also an EH for getting out and checking if there are any players left in the vehicle, if not, remove handledamage EH
@south rivet I take that back, configOf made it into 2.00 even thought he biki says otherwise
isNotEqualTo didn't make it though
you would need to add say a handleDamage EH to the vehicle within the getInMan EH
@slim oyster
Something like this?
player addEventHandler ["GetInMan",{
params ["_unit", "_role", "_vehicle", "_turret"];
_vehicle addEventHandler ["HandleDamage", {
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
//code
}];
}];
@cosmic lichen thanks for the info, I didn't see configOf in the changelog when I checked, so I checked wiki and that confirmed the changelog. So I thought it was left out
I thought so too but the debug console says it's in 2.00
Is setcombatunitmode/unitcombatmode still on dev branch? Thought it was going to be part of 2.0.
introduced in 2.01
That means it's not yet on stable ;D
I gathered that.
Is there a command to unload/delete a units magazine. I cannot seem to find one..
removeMagazine?
im dumb...
Who knows how to close system dialog? (eg "Steam Overlay is disabled...", with buttons "website" and "close"). closeDialog doesn't work and this has no display
I found a small bug on one of the scripting examples on the wiki, missing [ causing errors, I tried to make an account so I could report it but wiki says that new accoutns is temporarily suspended
what page
example 1
call BIS_fnc_rotateVector2D takes one argument, but bc of missing semicolon it gives script error
_y = 45; _p = -80; _r = 0;
BRICK setVectorDirAndUp [
[sin _y * cos _p, cos _y * cos _p, sin _p],
[[sin _r, -sin _p, cos _r * cos _p], -_y] call BIS_fnc_rotateVector2D
];```
thats what it should be
fixed
Who knows how to close system dialog? (eg "Steam Overlay is disabled...", with buttons "website" and "close").
closeDialogdoesn't work and this has no display
I mean this dialog https://i.imgur.com/meyaRvi.png
press "cancel"?
Via script
I searched for emulating ESC key, but I didn't find anything about it in Arma
it should be a simple BIS_fnc_guiMessage, so ```sqf
uiNamespace setVariable ["BIS_fnc_guiMessage_status", false];
it should be a simple
BIS_fnc_guiMessage, so ```sqf
uiNamespace setVariable ["BIS_fnc_guiMessage_status", false];
@exotic flax thanks! I'll try it now...
status is the result from the button you click
false aka "pressed cancel" 😉
ah yes
unless it's BIS_fnc_3DENShowMessage, because than I have no idea, other than manually trying to find the messages somewhere in findDisplay 313
nah that uses 3den style controls.
Sorry I missed the enableUnicode discussion, only saw some part of it.
Is this command relevant only for copying text to clipboard or for other things too?
at least these i believe
copyToClipboard
copyFromClipboard
count
select
find
in
Because as I recall arma's strings are UTF-8 encoded, so they should be able to handle non-standard characters too.
Oh wow, how? Are they not working with non-english characters? :O
not quite. count for example does this
count "привет" == 12
😟
Insane! Wiki says that strings are indeed Unicode with UTF-8 encoding. I have no idea how this was done this way 😳
it should be a simple
BIS_fnc_guiMessage, so ```sqf
uiNamespace setVariable ["BIS_fnc_guiMessage_status", false];
@exotic flax doesn't work :(
So I guess that if I do select on a string with non-ascii characters, I will get total nonsense?
Since it would cut out bytes which might be in the middle of a UTF character? 🤔 but UTF should resynchronize after that so it's not so bad.
Who knows how to close system dialog? (eg "Steam Overlay is disabled...", with buttons "website" and "close").
closeDialogdoesn't work and this has no display
I mean this dialog https://i.imgur.com/meyaRvi.png
It creates byopenYoutubeVideo
https://community.bistudio.com/wiki/openYoutubeVideo
If the user has Steam overlay disabled, the command will display appropriate message to the user and return false.
So solution is to enable Steam Overlay
because since it's a command, and not a function, being used, it's all handled by the engine
I need to detect steam overlay using :) It means that no visual effects need to be
It's only way to do this, isn't?
it seems to be hard coded, so I'm afraid it's either having the message or not using the command
which only applies out of a game anyway (eg. main menu), for which other solution can be made
Hey I'm trying to use BIS_fnc_taskPatrol
[group this, getPos this, 200] call BIS_fnc_taskPatrol;
But I'm getting
Error group: Type Group, expected Object
Is there a way to find out what causes this error?
reading it
group this group expects an object to get the group of, but this is a group already so it cant get the group of a group
aah
so I'll have to move it to the group leader of all
fuuuuqqq
well I suppose I can edit the file manually
@robust hollow thank you!
_groupPos = [[spawn_area], ["water"]] call BIS_fnc_randomPos;
{
_x setPos ([_groupPos, 0, 10, 1, 0, 0.5, 0, nil, [_groupPos, _groupPos]] call BIS_fnc_findSafePos);
_x setDir (random 360);
} forEach (units survivors);
"respawn_west" setMarkerPos _groupPos;
null = [] spawn
{
_count = 0;
_pos = getMarkerPos "respawn_west";
{
_pos = _pos vectorAdd (getPos _x);
_count = _count + 1;
} forEach (units survivors);
if (_count isEqualTo 0) then
{
_count = 1;
};
_pos = _pos vectorMultiply ( 1 / _count);
_pos deleteAt 2;
"respawn_west" setMarkerPos _pos;
sleep 10;
};
Why would this result in me being spawned in ocean
It's in initServer.sqf
Basically just getting a random position on land within a certain area and spawning everyone there
setting the respawn marker there also
and then continuously updating that respawn marker
wait, it's showing [0, 0, 0] as the marker location even in editor debug window
But getting the position through "log -> log position to clipboard" I'm getting the correct thing 😮
Anyone able to help me with this event handler stuff? I got it to this point, but it still applies damage higher than 0.7, and even stacks it on the player, eventually killing them. I'm stumped badly.
player addEventHandler ["GetInMan",{
params ["_unit", "_role", "_vehicle", "_turret"];
_systemchat = format ["Player entered vehicle, %1",typeOf _vehicle];
systemchat _systemchat;
_alreadyrunningrevivesystem = player getVariable ["slaysvehiclegodmode",0];
//if the vehicle doesn't have the variable, launches the event handler.
if (_vehicle getVariable ["slaysvehiclegodmode",0] isEqualTo 0) exitWith {
_vehicle setVariable ["slaysvehiclegodmode",1];
systemchat "Vehicle entered, script ran.";
//event handler to stop vehicle / player death
_vehicle addEventHandler ["HandleDamage", {
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
_systemchat = format ["%1 damage level: %2",typeOf _vehicle,_damage];
systemchat _systemchat;
//not working, still applying damage higher than 0.7???
if (_damage > 0.7) then {
_vehicle setDamage _damage;
{_x allowDamage false;
_unit setDamage _damage;
moveOut _x;} forEach crew _vehicle;
_vehicle allowDamage false;
_unit allowDamage false;
_systemchat = format ["%1 damage level: %2",typeOf _vehicle,_damage];
systemchat _systemchat;
};
}]; //end of vehicle damage watcher
};//end of vehicle var check
if (_vehicle getVariable ["slaysvehiclegodmode",0] isEqualTo 1) exitWith {
systemchat "Already running vehicle damage system!";
};
}];//end of player getin handler
https://community.bistudio.com/wiki/Arma_3:_Event_Handlers#HandleDamage
If code provided returns a numeric value, this value will overwrite the default damage of given selection after processing. Return value of 0 will make the unit invulnerable if damage is not scripted in other ways (i.e using setDamage and/or setHit for additional damage handling). If no value is returned, the default damage processing will be done. This allows for safe stacking of this event handler. Only the return value of the last added "HandleDamage" EH is considered.
Simply return the max. dmg
e.g.
_vehicle addEventHandler ["HandleDamage", {
params ["_unit", "_selection", "_damage", "_source", "_projectile", "_hitIndex", "_instigator", "_hitPoint"];
_damage = 0.2;
_damage
}];
==
0.2 damage, no matter what
interesting
sooooo
i need some help
im using drongo's map population mod and it has a built in "run this script on a vehicle when it is spawned" init script
and i want to create a script that checks how many seats are free and populates the vehicle with a certain unit type fully
is that possible with arma?
yes
createVehicleCrew
or better, https://community.bistudio.com/wiki/BIS_fnc_spawnVehicle
@celest token
otherwise, for a "specific" type of unit, see also fullCrew to get filled and empty seats
thanks brother
@cosmic lichen @robust hollow Thanks a lot guys! 👍
@astral dawn in 2.02 KK will provide a solution for that.
You will need to probably enable it per-command where you need it.
I have a question about loops
if I have a while(true) do loop, with something like this at the end
WaitUntil{sleep 2; condition};
what does that mean, that it will sleep for 2 seconds and then check the condition?
True. It should check the condition every each 2 seconds
does it not matter whether or not the condition is true
thats what i'm wondering
trying to understand someone elses code
is it just a NOOP?
I have an object the is meant to slowly move towards the player, it is an invisible object. But i have an issue where the object is rotates in isn't in the same bearing as it was once was. meaning it'll be 270 instead of 180 and such.
How do i get the logic to a point where it stays a consistent direction to the player it is getting closer to?
if condition is true, it will exit the waitUnitl, otherwise it waits until it's true
ahhh
if you just want to wait 2 seconds, use sleep
oh wait I think I get it, it won't loop over if the condition isn't true
@proud carbon Use setVectorDir. If the surface is not flat, you should use setVectorDirAndUp
