#arma3_scripting
1 messages ยท Page 653 of 1
if (_task != "" && { not completed _task }) then
{
// task incomplete
} else {
// no task or task completed
};
(pseudo code, don't go copy-paste that)
// Check for mission and if mission is completed if !(_currentTask isEqualTo "" && _currentTask call BIS_fnc_taskCompleted == false) exitWith { systemChat "Please complete your current task before starting a new one."; };
Seems to be working
done
Alright well that seems be working but im not 100% there yet ๐ค
ah man i think i gotta rework it orsomething its just not what i want xD
Even tho BIS_fnc_taskCompleted is true now it still says systemChat "Please complete your current task before starting a new one.";
if (_task != "" && { not completed _task }) then
I am not sure lazy eval is faster here ๐
yeah well :p
@heady quiver you kept your isEqualTo and the ! outside the parenthesesโฆ
Yea i just saw that
xD
it uno reversed it self
i got it working now tho
if (_currentTask != "" && {_currentTask call BIS_fnc_taskCompleted != true}) exitWith { systemChat "Please complete your current task before starting a new one."; };
Anything wrong with this code or?
No, except that lazy eval is probably slower, but that's minimal
it wont be a huge script tho
Yeah all good. Get it working first.
hi, i have a quick question, can someone tell me what does this script mean / do ? it's almost everywhere, thank you
if ((!isServer) && (player != player)) then {waitUntil {player == player};};
it's an old code supposed to wait until the player is initialised on a JIP machine
so basically when this is in mission init.sqf it means that the server should wait until a player becomes a player? ๐
it's never executed on server
it makes the client waiting until the player unit is ready
this just makes me confused, so it tells the game to wait until a player is recognised as player and not ai, is that correct?
it's more or less```sqf
if (didJIP) then
{
waitUntil { not isNull player };
};
AI = Server. This script will never run on the server. So it waits on a client machine and makes 100% sure that the player unit is ready
BIS_fnc_spawnGroup; is there a eventHandler to check if the group is dead ๐ ?
you could use EntityKilled mission EH
There will be soon I think
so there is no point of havng it in init.sqf if it's meant for a dedicated server?
init.sqf is run by every machine
Isn't EntityKilled just for a single NPC btw?
allright, thank you
What do you wanna do with that group?
you could also do waitUntil {sleep 1; isNull _group}; //Not tested
or waitUntil {sleep 1; units_group isEqualTo []}; //Not tested
Thats not gonna work if the script is only triggered once right?
It depends.
If you tell us what it is you want to do, we might be able to tell you.
Alright so group one spawns in and then after that group is dead i want a second group to spawn in (spawns about 500 - 1km away and moves into area)
Wait until is what you want.
That works even tho i only call the script once?
waitUntil {blub};
...
Spawn 2nd group
Mmm im gonna leave that for a bit
Is there a way where i can see the folder directory order?
[_spawn_area, east, (configFile >> "CfgGroups" >> "East" >> "3CB Takistan Insurgents" >> "Infantry" >> "Fire Team (AA)")] call BIS_fnc_spawnGroup;
trying to spawn a group not sure if this is the right path
Config Viewer?
Ah yea
btw that global variable doesnt work
me mate just tested and he is able to start another mission
maybe i need lil break
Might be a good idea to post the whole script
Just post it here?
you can use sqfbin.com if it's longer
you are executing this how?
init.sqf and i exec a custom file
Quick tipp for random names: use time
enableSaving true; execVM"missions.sqf";
missionNamespace setVariable ["currentTaskOn", taskName]; โ missionNamespace setVariable ["currentTaskOn", taskName, true];
And read https://community.bistudio.com/wiki/Identifier to create better and unique variable names.
objective = format["%1",object] createVehicle _spawn_area;```
No format needed here
yes, because you never set the variable globally.
Read what I wrote
yes, because you never set the variable globally.
then set it globally?
Read
I literally posted the solution ๐
maaayhaps? ๐
what is the value of taskName? ๐
taskName = format["task_%1", rndNmb];
then it worked
i activated a task and then my buddy also
there is something else that is wrong yeah
which shouldn't be possible
`
// Check if there is already a mission activated.
if (_currentTask != "" && {_currentTask call BIS_fnc_taskCompleted != true}) exitWith {
systemChat "Please complete your current task before starting a new one.";
};
`
private _currentTask = missionNamespace getVariable ["currentTaskOn",""];
if your script is local (which it is since you use systemChat), every player can have only one task
Yes thats true but thats why i wanted it globally
so only one task at a time (for entire bluefor)
how do you add the task? modules?
Code
private _myTask = [west, taskName, [_description, _title, _waypoint], objNull, true, 0, true, "destroy"] call BIS_fnc_taskCreate;
The whole task thingy works
the 'check' just doesnt work
i mean it works for me but as soon as someone joins he is also able to start one
thats where the problem is
how do you get the _currentTask?
private _currentTask = missionNamespace getVariable ["currentTaskOn",""];
everything seems clean, so maybe it is a code organisation issue?
mmm
thanks
@heady quiver where is that run? init.sqf?
yes sir
setVariable set to , true] then (since the code)
Yea already did that
Then tested it with a friend and nope
https://sqfbin.com/iteyuqevewarunahuxoh <-- current
I guess I have to fire up my dedicated server ๐
xD
taskName is a very bad variable name
Since it's a new command in the version I use ๐
private _taskName =
it works locally yea
I can't start one twice but my mate can start one and i can start one after that
I have hosted a mission
no
wtf.
๐ช
Try this
Put a laptop or something down
this addAction ["Search & Destroy", { call createDestroyMission; }, nil,1.5, true, true, "", "true", 3, false, "", "" ];
prob wanna tidy that up a bit lolz
see if both can activate
works ๐
once missionNamespace setVariable ["currentTaskOn", _taskName, true]; is executed, it's set globally, there is no way around it
how does your init look like
enableSaving true; execVM"missions.sqf";
mine is just this
I just executed the code globally in debug config
which is pretty much the same as init.sqf
mmm
Could you join my session and activate it for me ๐ ?
initPlayerLocal might be better
True, many things about that script could be better ๐
But first he needs to get it working.
But since @little raptor Is here now. He can take care of you ๐
no 
lel
yes 
I cannot
oh ok
I am currently running a special a3 version
ah ok
plot twist: Your mate is secretly resetting that task variable globally and then telling you it doesn't work ๐
are you using init.sqf @heady quiver ?
yes sir
Inside iniq.sqf
enableSaving true; execVM"missions.sqf";
Well
Long story short
Only 1 mission allowed at the time (which is checkable via global stored var) but for some reason i was able to start a mission and my friend also.
`
private _currentTask = missionNamespace getVariable ["currentTaskOn",""];
// Check if there is already a mission activated.
if (_currentTask != "" && {_currentTask call BIS_fnc_taskCompleted != true}) exitWith {
systemChat "Please complete your current task before starting a new one.";
};
`
this part should have stop him starting another one
But @cosmic lichen just tested and hes own server and works for him so i dont know
_currentTask call BIS_fnc_taskCompleted != true -> !(_currentTask call BIS_fnc_taskCompleted)
not the issue tho
@heady quiver what's your setter code?
task setter I mean
Revo is right
It should've worked
Are you sure your friend has this task too?
Also this is a terrible idea:
rndNmb = ceil (random 9999);
private _taskName = format["task_%1", rndNmb];
use increments
Also:
[taskName, "SUCCEEDED"] call BIS_fnc_taskSetState;
wrong again. you should use that "currentTaskOn" variable
hi, is here anyone familiar with anomaly (paranormal) scripts made by alias?
i need a little help
wat
oh! did not know it was a thing itself ๐
can you help me with those?
@little raptor Yea on 'Search & Destroy' button we get that task so not sure why the check didnt work
negative, no XP with them sorry
that's pity but they are really great you should check them out, it gives arma a totally new dimension
seems like i fucked something up and now nothing works
Task ID cannot be empty string lolz
Alright fixed it again lolz
I know the code is shit but it should've worked right i mean..
Hi, i trying to make something like "key codes" for loot box.
Trying to make a message (if player don't have codes - it gives message and not allow player to look into gear)
Tryed this way, but inventory is not closed for player...
_box addEventHandler ["ContainerOpened",{
params ["_container", "_unit"];
if (isNil 'the_razlom_keys_token') then {
the_razlom_keys_token = false;
};
if !(the_razlom_keys_token) then {
titleText['ะะพะทัะผะธัะต ะบะพะดั ั ะฝะฐัะฐะปัะฝะธะบะฐ ะะะ "ะ ะฐะทะปะพะผ"', "PLAIN"];
waitUntil {!(isNull findDisplay 602)};
systemChat "Gear Opened";
closeDialog 0;
false
};
}];
SystemChat return Gear Opened, but gear dialog is not getting closed...
is possible to prevent open gear dialog with that event handler? Thank you!
well for one thing, don't use waitUntil inside event handlers
you can try this:
[] spawn {
_disp = displayNull;
_endTime = time + 10;
waitUntil {
_disp = uiNamespace getVariable ["RscDisplayInventory", displayNull];
!isNull _disp || time > _endTime
};
_disp closeDisplay 2;
}
(in MP you should execute that for the client that opened the container)
@dusky pier also you can use the lockInventory command
when the user acquires the key, unlock it for them
@little raptor ty, but i wanted to give message for player, and lock status is must be local (not same for all players)
@little raptor ty a lot! Understand now
`
group_spawn = [_spawn_area_group_1 , east, _listEnemies, [], [], [0.2, 0.5]] call BIS_fnc_spawnGroup;
group_spawn_2 = [_spawn_area_group_2 , east, _listEnemies2, [], [], [0.2, 0.6]] call BIS_fnc_spawnGroup;
group_spawn_2 move (position group_spawn);
`
How do i force group_1 to move to group 2 ๐ ?
- use ```sqf
-
group_spawn_2 move ASLtoAGL getPosASL leader group_spawn;
ty ty
Btw i use _spawn_area = [] call BIS_fnc_randomPos; this to get a random pos on the map but its mostly in the open, is there also a way to put near buildings and such?
oh sorry.
i keep forgetting -.-
_spawn_area = [] call BIS_fnc_randomPos;
ah
Where can I find the function that does the "animation" for locked doors?
Hi, one question I want to make a system , basically it's like a jail. I want to do that one player can arrest an other player. I know how to do this, my question is that I want to make a variable that have to be permanently, basically , if you disconnect you still have the same time. Idk how to make this variable , maybe with mysql or idk. If anyone can help me pls.
@candid cape You do not need any outer source like a database unless you want this feature to persist in such scenarios where server has to restart... If you do not care about such scenario, what you basically can do is, pass the values such as player UID and either how much time left (upon disconnection) or save current time and how long is player jailed..
and create an event for joining and see if these player had been "jailed" before. You can also use database solution if you got something in your hand, such as if jail time is long periods like days, it could also be done like that. It is a matter of preferability but not necessary in this scenario.
@hardy tree Repeatable trigger already covers you in this scenario, so I believe your main question is, what should you do so in a scenario the player reenters the area, the Hellos do not flow again for a certain amount of time, right?
I mean there are ways but it would be nasty doing this...
Using triggers
May I suggest you to check out cfgSentences?
@hardy tree
Because from what I understand, you are trying to create a dialog in a trigger
am I right?
If you are trying to achieve something else, that depends on what the continuing script will be.
concerning finite state machines (FSM) ...
background: working on an A3 project and considering how to approach "production", i.e. factory sectors that produce resources; then similarly "logistics", i.e. lines that deliver resources between locations.
Q: what is the overhead for establishing an FSM, over all? is it like an execVM running?
Q: in particular, I am considering whether it would be better for "one FSM to rule them all", i.e. production FSM, or "FSM per concern", i.e. FSM per factory sector, for instance.
obviously, states are states, transitions are transitions, FSM does not care about all that, it is in what I identify as such... notwithstanding overhead considerations.
Q: what is the overhead for establishing an FSM, over all? is it like an execVM running?
I don't think there's a real overhead compared to (other) scripted solutions, if not better performance wise.
Q: in particular, I am considering whether it would be better for "one FSM to rule them all", i.e. production FSM, or "FSM per concern", i.e. FSM per factory sector, for instance.
Just to make it simple for yourself I would make different FSM's based on the type of purpose.
For example; AI uses FSM's to define their combat state, and is even split per combat state so it can behave differently per state.
ACE Medical uses a FSM as well to handle the different states of a player/AI regarding their medical status. And they work perfectly fine at the same time.
So yes; FSM does take resources, because it's constantly checking for it's current state and running scripts to handle that. But the alternative is a while {true} do {}; with all kind of checks build in to do the same.
You could use the default FSM stuff in Arma, or take a look at the scripted FSM in CBA (either fully scripted or through classes) which makes it a lot easier to work with.
@hardy tree Without developing an additional script that records on what point the dialog is and handle interruptions, I doubt you can achieve that in a single trigger.
About your second question
You need to modify identity of the character which can be done through setName command (if u re in 3Den, I believe there is an option to assign name to units)
Just to make it simple for yourself I would make different FSM's based on the type of purpose.
Well, of course. That was the ground level boundary I would consider, of course. Would not make sense for one FSM to do both production and logistics, for instance.
No, rather, my question was more one of whether it made sense to have one FSM "manage" all of production, or FSM per factory sector, for instance.
Sounds like either is possible, just depends on what I do arranging the machines.
"WFBE_CL_VAR_SKILL_WEST" addPublicVariableEventHandler {
private ["_skillWestRequest","_skillWestRequestID","_skillWestRequestIDplayerSkill","_skillWest"];
_skillWestRequest = WFBE_CL_VAR_SKILL_WEST;
_skillWestRequestID = WFBE_CL_VAR_SKILL_WEST select 0;
_skillWestRequestIDplayerSkill = WFBE_CL_VAR_SKILL_WEST select 1;
_skillWest = missionNamespace getVariable format ["WFBE_CL_VAR_SKILL_WEST_REQUESTID_%1", _skillWestRequestID];
missionNamespace setVariable [format ["WFBE_CL_VAR_SKILL_WEST_REQUESTID_%1", _skillWestRequestID], _skillWest set [count _skillWest, _skillWestRequestIDplayerSkill]];
};
Should this work? ๐
no
For AI, side chat displays the name of the unit's group. So you need to give the group a name using setGroupID.
Note: if this is a multiplayer mission, both setGroupID and sideChat should be remoteExec'd from a server-only script to avoid potential locality issues; don't forget to set the JIP flag to true when remoteExec'ing setGroupID.
Is there a way to clear out all the <objNull> agents in the agents array?
array - [objNull] maybe
Hello hoping i can get some help i have been able to figure so much out on my own with trial and error but i cant figure this out. Basically i wish to change the intro music to my own that i want to use. the first line of code is what is included in the file already for this mission then below that is my CfgMusic. I am wondering how i would get my custom song to fit into this every attempt i do I either get errors or no errors but no music plays either.
Client_Fncs
INS_intro_playTrack = {
//Plays a random intro track:
// 0 => title, 1 => start delay
playMusic "";
private _track = selectRandom
[
[["LeadTrack05_F", 1], 33],
[["AmbientTrack01a_F", 32], 33],
[["LeadTrack01_F_Bootcamp", 36], 32.9],
[["Track06_CarnHeli", 1], 33],
[["BackgroundTrack01a_F", 63], 33],
[["BackgroundTrack01a_F", 27], 33],
[["EventTrack02_F_EPA", 1.63], 34.3],
[["EventTrack01_F_EPA", 1.63], 34.3],
[["LeadTrack03_F_EPA",60.85], 33.678]
];
0 fadeMusic 1;
playMusic (_track # 0);
uiSleep (_track # 1);
playMusic "";
};
Description.ext
class CfgMusic
{
// List of tracks (.ogg files without the .ogg extension)
tracks[] = {intro};
// Definition for each sound
class intro
{
name = "intro"; // Name for mission editor
sound[] = {\music\intro.ogg, db + 0, 1.0};
titles[] = {0, ""};
};
};
With
_turrets = [_unit] call BIS_fnc_getTurrets;
I can get the turrets data like this:
"Turret: bin\config.bin/CfgVehicles/B_MBT_01_TUSK_F"
"Turret: bin\config.bin/CfgVehicles/B_MBT_01_TUSK_F/Turrets/MainTurret"
"Turret: bin\config.bin/CfgVehicles/B_MBT_01_TUSK_F/Turrets/MainTurret/Turrets/CommanderOptics"
Is there any way to get the turret paths from this data? If not, do I always get the paths in the same order by this?:
_paths = [[-1]] + allTurrets _unit;
How to implement such thing with ACE interaction menu:
if i'm squad leader and my cursor target is bot from my squad,
i want ace interaction on this bot with
action: load bot as passanger to the nearest vehicle(distance to vehicle < 10m)
You create the action that loads the object into the closest vehicle, and then add it to all group members
ok, locality question... dedi/client stuff...
I have a bobcat spawn on the server it has an epecontactstart EH added to it. Players drive the bobcat to do stuff.
later, I need to remove the EH, I'm using removealleventhandlers for that...
does the fact the bobcat changed from server to client mean i must remoteexec everywhere the removealleventhandlers command?
Why would the bobcat change locality?
The eventhandlers might be local to each client
because player got in to drive it
That doesnt change locality afaik
yeah, testing it now, its owner 2 when spawned, and 3 after test client gets in it
Hi how would i run a function everytime between 10 and 20 minutes ๐ ?
_max_delay = 1200;
_avg_delay = 600;
_min_delay = 300;
sleep (random [_min_delay,_avg_delay,_max_delay]);};
Would this work ๐ ?
sleep takes a number in seconds
Yes
Do i need to while wrap it or something so it keeps looping ?
OK, testing shows... the EH was added when the bobcat was local to server... running the removealleventhandlers on the server (while the bobcat is remote) does work... the EH is removed
while {true} do {
// Do some code here
// Sleep
sleep (random [_min_delay,_avg_delay,_max_delay]);};
}
Like this?
while takes a code to run, also check the pinned message
while(condition), no?
while {condition} do {};
ah
randomAiSpawnToPlayer = {
// Settings
_max_delay = 700;
_avg_delay = 600;
_min_delay = 500;
while {true} do {
// Do some code here
// Find safe position around player between (x and x meters)
_player_circle = [player, 400, 700, 0, 0, 20, 0] call BIS_fnc_findSafePos;
// Enemy List
list = ["UK3CB_TKM_O_GL","UK3CB_TKM_O_ENG","UK3CB_TKM_O_IED","UK3CB_TKM_O_RIF1","UK3CB_TKM_O_SPOT","UK3CB_TKM_O_SL"];
// Spawn enemy
group_spawn = [_player_circle, east, list, [], [], [0.3, 0.5]] call BIS_fnc_spawnGroup;
// Make the enemy move to player location
group_spawn move (position player);
// Sleep
sleep (random [_min_delay,_avg_delay,_max_delay]);};
}
};
Does this make sense?
No
So I've got a class CfgDifficultyPresets defined in a config.cpp. Packed it into a .pbo, loaded it up, and in SP the difficulty preset shows up in the dropdown just fine, but cant seem to get it to show up on the server in the #missions selection, what could I be missing?
Not sure where you do that but you should spawn it
wouldn't while{true} just become a lag generator?
It wouldn't
its sleeps right
ah rog
anyone have anything on the difficulty preset problemo i having?
it is, rog - ill try there
thanks
Is the difference in network impact between dynamic simulation and creating/destroying objects huge?
Anyway worked with alive framework?
when holding BIS_fnc_holdActionAdd it will fade out after some 10+ seconds and you don't see progress, is there a way to prevent this?
use your scroll wheel I think
but iirc nothing script-wiseโฆ maybe editing that action on the fly, unsure
scroll wheel did not help
@gloomy cradle I think #creators_recruiting is right channel
Sorry
delete the msg here and post it there
๐
Revo, you got experience with alive framework?
nope
damn
Alive has a discord
for 'x' from 0 to 1 step 0 do {
};
what it mean?
It is creating a variable x and stepping from 0 to 1 with interval of 0.
so, what it mean, if interval 0?
Is there any reason why I can't use GetOver as a shortcut for an action?
I did some more tests and this always freezes the game.
besides being pointless.
thanks, it was called by 0 spawn
its just a while true loop
thx, Dedmen.
an ugly one
Can you poll the game for keystates, without using inputAction or eventHandler? (Im inside a mouse event handler, and want to know if any modifier key is pressed. And inputAction requires the key to be bound already)
Im inside a mouse event handler, and want to know if any modifier key is pressed.
https://community.bistudio.com/wiki/User_Interface_Event_Handlers#onMouseButtonDown tells you that?
Yes, but I'm in onMouseZChanged. So no modifiers are sent to it.
(params ["_displayorcontrol", "_scroll"];)
ah, shoot indeed
(could create a feedback ticket forโฆ 2.04)
but why not inputAction?
or you can combine it with 'onKeDown', set a global variable (eg. TAG_CTRL_DOWN = true;) and check that inside your EH.
it's not perfect, but probably the best you can do
Then it's probably way better/cleaner to just assign a keybinding to it
So that I can use inputAction instead
Or use CBA Keybinds, those are easier to manage IMHO
where can I find more about
LOD: String - level of details to use. Possible values are: "FIRE", "VIEW", "GEOM", "IFIRE", "PHYSX"
and meaning of those values
How would you add an Action to an info stand which deletes a vehicle inside a specified trigger?
put an addAction on a info stand object, and call a script which will check if there is a vehicle inside a specific area (marker is easier than trigger), and then delete it
the wiki is a great source about how to script stuff
Why is this an invalid number in expression?
onMapSingleClick {
private _obj = vehicles select {typeOf _x isEqualTo "..."} select 0;
_obj setPos [(_pos#0), (_pos#1), 0.1];
// ^^^^^ (?)
onMapSingleClick "";
};
Is the SQF parser having difficult with the code block?
According to the examples, code blocks seem to be allowed?
https://community.bistudio.com/wiki/onMapSingleClick
Works fine for me
try just that in the console? because it might be a missing {[ in your script
I see the note in the docs actually. onMapSingleClick might just be borked is the reason, with the migration path being the mission event handler, which does work.
huh โฆ ?
Good evening, is it possible to remove the action to open a door from a door, and script it in to be a addAction at another place?
Like you have to be at the top of an ATC-Tower to open a hangar door.
does anyone have any simple clean up scripts that work on dedicated servers?
define cleanup?
cleans up dead bodys, destroyed vehicles, and dropped items that are not placed from the editor
there is the garbage collector, see Eden options :)
i will look, thanks ๐
Asking here, because it is the only place I can think of. Is there a way to use an external script (python/c/etc.) to get the list of players on a server? I know some websites can do it so I was wondering if anyone could point me in the right direction
trying to make a script to compare peolpe in arma vs people in TS
Also could you @ me if you know, as I am unluckly to remember this come morning
Seach for RCON scripts in any language you want, connect to the server and get what you need
Could you link me? Applogies, but my internet searching are not returning what I think is the correct scripts
๐คฆโโ๏ธ https://lmgtfy.app/?q=RCON+python
Really?
Ah, sorry. TYVM
Q: is there a variable we can use, like vehicles except for static objects, like cargo buildings?
nearestTerrainObjects
buildings are terrain objects
or maybe nearestObjects should also return mission placed ones.
or allMissionObjects if you wanna go crazy
well, perhaps I should clarify. these are actually built objects, cargo buildings. i.e. created via createVehicleLocal and createVehicle
right. okay dokay then.
figured as much, wasn't certain if there was an easier way
the rub being we need to know a reference object, location, etc, which is not the worst thing. anywho.
or just a position
hmm actually this works also nearestObjects [getPos objNull, ["..."], 50000] adjust range accordingly. which object or pos is [0, 0, 0]
getPos objNull you can also just write [0,0,0]
also if you just want all objects and don't care about where they are, nearestObjects is a bad choice as it sorts all objects by distance, nearObjects doesn't sort
I see. so it still makes sense to do some persistent cataloging to avoid that case. plus for ordering anyway, makes sense.
Does removeAllActions remove holdActions as well as normal actions?
I see.
Followup: does the "remove on completion" parameter of BIS_fnc_holdActionAdd have global effect, or only local?
Am I using BIS_fnc_doorOpen wrong here?
case "openDoor": { //this only works with a radius of 10
private _doorArr = [cursorTarget] call hachii_door_breaching_fnc_getTargetDoors;
if(count _doorArr > 0) then {
_building = _doorArr select 0;
_doorRot = (_doorArr select 1) select 0;
_doorNum = (_doorArr select 1) select 2;
_doorBreached = _building getVariable [format["Door_%1_Breached"], false];
if (_doorBreached) then {
[_building, _doorRot, nil, nil, 1] call BIS_fnc_doorNoHandleOpen;
systemChat "1";
} else {
[_building, _doorRot, nil, nil, 0.25] call BIS_fnc_doorOpen;
systemChat "2";
};
};
};
``` outputs ``2`` but door doesn't open. BIS_fnc_doorNoHandleOpen works.
[_building, _doorNum, 1] call BIS_fnc_door; works fine
just curious as to why doorOpen isn't
Can you try doorOpen with a whole number for the animation phase? It may be that the animation doesn't support partial opening for whatever reason
both 1 and 1.0 don't do anything
the .25 was listed in the examples: https://community.bistudio.com/wiki/BIS_fnc_doorOpen
of course, but that doesn't mean every door has the same animation setup. There are plenty of animations in the game that only change at the 0 and 1 states. It was worth a shot just because you never know what strange limitations you might hit in Arma.
Okay, so BIS_fnc_door uses animateSource but BIS_fnc_doorOpen uses animate. You need a different animation name.
I was comparing doorOpen to doorNoHandleOpen which I would expect to use the same animat method
use the animate command instead.
yeah I am now
private _doorArr = [cursorTarget] call hachii_door_breaching_fnc_getTargetDoors;
if(count _doorArr > 0) then {
_building = _doorArr select 0;
_doorRot = (_doorArr select 1) select 0;
_doorNum = (_doorArr select 1) select 2;
_doorBreached = _building getVariable [format["Door_%1_Breached"], false];
if (_doorBreached) then {
_building animate [format["Door_%1_rot",_doorNum], 1, true];
} else {
_building animate [format["Door_%1_rot",_doorNum], 1, true];
_building animate [format["Door_%1_handle",_doorNum], 1, true];
};
};
I just wanted to know what was up with that particular function
It's a stupid function. You can even tell by looking at its parameters:
Parameters:
building: Object - (Optional, default objNull)
doorAnimation: String - (Optional, default "")
upDownAnimation: String - (Optional, default "")
downUpAnimation: String - (Optional, default "")
animationPhase: Number - (Optional, default 1)
all parameters are "optional" 
hello, i'm wondering, is sun on the sky in arma an actual object? is it possible to create a script that can refer to the sun?
(asking because i'm trying to fix something broken)
no 
you can change the sun "texture" by modding, but you can't "refer" to it in the game
cleared = true;
_this pushback 1000;
sleep (900 + (random [-30, 0, 30]))
while {cleared} do
{
_missile = createvehicle ["ammo_Missile_cruise_01", _this];
[_missile, [0, -90, 0]] call BIS_fnc_setObjectRotation;
_missile setvelocity [0, 0, -100];
};
For some reason this is throwing a missing ; error in line 4 when I try to run it from the debug console. Anyone know what I've done wrong?
I assume _this is correctly formatted - is an array of numbers, starts with 2 elements before you pushback 1000?
because it's missing a ; on line 4
Yes
Where should it go though?
At the end of the line
at the end of sleep (900 + (random [-30, 0, 30])) <--
Ah, I see it now.
Hi, one question. Anyone can helpme with a DB?. Thanks!!
if we know the problem we might be able to help
that's interesting, i've got here a script that doesn't work properly and it has been made by a person that says that the script is activated/deactivated depending on whether is the sun visible or not and since i have a thick fog in that location i think it's because the sun can not be seen through the fog, what do you think about it?
hard to say without seeing the script
here you + @little raptor go https://steamcommunity.com/sharedfiles/filedetails/?id=1395604511
I need to make a script that subtracts a number from a row every 10 minutes
It's a bit difficult to read since all the custom variables are in a different language and there's no comments, but as best I can tell, the part of the script that would actually check the daytime/nighttime parameter......doesn't exist
the parameter is passed to the script when it's execVM'd, and the script receives that and saves it as a variable...then never refers to it again
so day time / night time activity with parameter true / false in init.sqf is just fake?
as far as I can tell, it would be active at all times regardless of what you set the parameter to
I'm hesitant to describe it as "fake", as such a thing could easily be done - it's more likely that the person just forgot about it, perhaps when making the major change to the script structure that's described in the changelog.
that's actually true, even when the parameter is false it keeps working 24/7
would you be able to fix it?
ehhh...it is technically possible. You would use something like this:
if (sunOrMoon > 0.4) then {exitWith {}};
But it needs to go somewhere in the loops that run the entity's behaviour, and it needs to have proper handling to pause the entity, put it somewhere safe, and turn it back on when it's night again. That's doable but I can't read this script well enough to put it in myself.
For best results, find a scripter who reads this language (not sure what language it is, sorry) or contact the person who originally wrote it and let them know that the functionality is missing.
well i tried talking to him but he seems to be overloaded with work
@hallow mortar By the way, you seems to be a person that knows a lot about it, would you mind helping me with scripts for my server? I would really appreciate it. (Nothing complex like this strigoi, i just need simple things like addaction and these.) I'm lost in it.
What specifically do you need?
Can i send you a private message? I don't want to bother other people here with not-related discussion.
Go for it.
Start using visual Code and install one of the plenty sqf extensions ๐๐
hello there fine lord of scripting
I want to save player loadouts between missions is there a script done for this or a tutorial?
What is the use case? Between missions? You meaning campaign missions or scenarios?
ALiVE has this inbuilt, as for scripting, not sure, also fancy seeing you here ๐
hey! ๐
Ill DM you a link, but its alive, so its a beefy boy mod
yes I was asking for a campaign I'm making. I need players to save their loadouts, they wont have unlimited sourves
Then it should have a builtin function to do that
ah very cool, thanks
Well, I've never done campaign thingies so... gimmie bit, I think I'm closing to the thing
need some help please, i trying to make a 2 phase objective with to stage targets/ one target is ID75 and the other is ID76 they are all set up but how do i set a tigger to "tigger" when both are killed would i use [ !Alive ID75; !Alive ID76; ]
I can't find it, sorry. You can try luck in missions_f_epa
๐
!alive ID75 and !alive ID76```
that simple REEEEEE
while i have you now that that problem is fixed on that said tigger, on activation conditions what would i use to enabledamage to ID77 and ID78 (the next set of objectives)
What do you mean? What is the situation?
co op mission, take out the 1st two targets, that will enable the next two
allowDamage?
just pop that in?
You doubt, then read wiki
https://community.bistudio.com/wiki/allowDamage
very sorry this wiki is hard to use/understand, im to use
ID77_object allowDamage true and ID78_object allowDamage true;
No no no... I thought it's easy enough
ID77 allowDamage true; ID78 allowDamage true;```
im trying so hard to understand the wiki
So I'm trying to get a basic radio dialogue flow going for a singleplayer mission I'm trying to make. I've got a test script set up for that now, but it's behaving oddly, likely where its sleep function is concerned. Here's what I've got so far:
sleep (5.3); // Pause for 5.3 seconds...
player sideChat "Well guess what? You're not." // Play the final dialogue line.```
When I try running it in my mission, it just plays both dialogue lines at once and throws an error, seemingly related to the sleep function. How could I fix my script here?
Where/how do you run it?
I'm running it via a Trigger. I don't really know how else to run scripts in the 3DEN Editor.
That's why. tldr; you can't do sleep in some conditions/places. Use something like:sqf 0 spawn { player sideChat "bra bra"; sleep 1; player sideChat "bra bra"; };
Looks like adding the 0 spawn {} part fixed it all up for me.
Also, how do you play audio files with the dialogue?
Well there's plenty of ways IMO, so can't say which is better
Probably simplest way is just say3D or such command
hello all! i was wondering if some nice person could help?
i would like to know how to fade out the sound and not just suddenly not just stop
_source = playSound mission_intro;
_source spawn
{
sleep 20;
deleteVehicle _this;
};
Unfortunately no
You should use playMusic and fadeMusic
i will try that thank you
Does anyone have any idea how to fix or circumvent this?
It's not a key?
To expand on that: if you run code from a trigger window or an init field of a unit, thats a unscheduled environment, meaning it can not suspend code = no sleeps, no while loops. Nothing timed. All happens within one frame.
By using _handle = spawn {mycode} you "spawn" new code, in a different , suspendable environment. There you can use sleeps and while loops.
It runs parallel to the game
Intended. IIRC it's 50K but so won't cause a hang
I thought 10k
yes you can use while loops in unscheduled.
while doesn't automatically mean "loop forever" a while loop can also be 5 iterations
biki says 10k
According to inputAction/actions-page it is.
Q: if I have an array of objects and I want to make a copy of it, i.e. +[...], that takes a snapshot of the array, and not a copy of all of the objects, correct?
IOW, I want to get a snapshot of the array without necessarily risking changes to the array midstream.
it copies the array
not the objects no
well it copies the object references/values
is there a way to make this text bigger
["Special ArmA Service Presents...",format["S.A.S OPERATIONS \n%1",toupper(worldname)],"By Gaffey","Don't Kill Civillians..."] spawn Core_intro;
it calls my cam intro
the code you posted has absolutely nothing about text size
not enough information to tell you if there is a way or not
{ 109 cutText [format["%1",_x],"PLAIN",5]; sleep _time; }forEach _titles;
109 cutText ["","PLAIN DOWN",0];
Since Arma 1.73 https://community.bistudio.com/wiki/cutText supports structured text
you can make big text with structured text
btw your format there doesn't do anything at all. its just useless
but. Its useful for structured text
109 cutText [format["<t size=2.0>%1</t>",_x],"PLAIN",5, true, true];
109 cutText [format["<t size='2.0'>%1</t>",_x],"PLAIN",5, true, true];
``` dont forget quotes around structured text attributes :)
thanks guys that worked nicely
Guys I am doing a loop to check if there are objects in front of a vehicle and making it stop if there is. The thing is that I only got it working with lineIntersectsWith but I believe it could be faster if I use lineIntersectsSurfaces? Or should it stay as it is? Here is the important part of the loop: ๐
read the doc :p
if (_speed > 1) then {
_objectsIntersected = [];// Extra measure to reduce speed if a object is in the way, quite performance friendly!
if (vAiDriving_useLinesIntersectWith) then {
private _carFrontPos = ATLToASL (_car modelToWorld [0, 2, -0.2]);
private _distanceToCheck = 10;
_distanceToCheck = ((_speed)*1.1);
if (_distanceToCheck < 10) then {_distanceToCheck = 10;};
private _carFrontDistanceToCheck = ATLToASL (_car modelToWorld [0,_distanceToCheck, 0.5]); //position far in front of vehicle
_objectsIntersected = lineIntersectsWith [_carFrontPos,
_carFrontDistanceToCheck, _car, _driver, true];
if (vAiDriving_show3DLine) then {drawLine3D [ASLToATL _carFrontPos, ASLToATL _carFrontDistanceToCheck, [1,0,0,1]];};
};
// If vehicle already slowing down because of linesIntersect no point in searching for other Entities (Reduces resources usage!)
if !(_objectsIntersected isEqualTo []) then {
_car setSpeedMode "LIMITED";
_car forceSpeed 1;
_car limitSpeed 5;
_car setVelocityModelSpace [0, 0, 0];
if (vAiDriving_debug) then { systemChat format ["Car hit the BRAKE due to: LINESINTERSECT",""]; };
```
๐ Any suggestions? Tested with 30 Ai Driven vehicles and only lost perhaps 4 fps but haven't tested it in Multiplayer, the script is only run by the server of course
In its current form the script reduced the Ai crashing into walls, other vehicles and even pedestrians to almost cero... (Saving countless Ai Lives!)
The whole loop is on a 1 second sleep, that becomes 2 seconds if the vehicle is already stopped or hitting the breaks
made the doc clearer on that. correct example first, wrong way in red box :) https://community.bistudio.com/wiki/Structured_Text#Syntax
Thanks ^^ lots of Dedmen out there :D
@still forum cool thanks. so to be clear, I get the snapshot. would not see subsequent deleteAt, pushBack, etc, on the original.
I've asked before, not sure the response was satisfactory... what is the global stringtable (?). as compared/contrasted to stringtable <Package name="..."/> (?)
specifically, the error in the log is: @STR_MY_TITLE: string @STR_MY_TITLE cannot be localized client-side - move to global stringtable
but it does exist in the <Package name="General"/> element.
best guess booting up A3 from a cold start does not see these for the mission file?
any insights are appreciated.
Package and Container "groups" are only helpful for organisation and have no impact on the translations; use them for your own sanity.
So they don't matter
and believe that error simply means a translation is not available ๐ค
yes
- does a deep copy
@exotic flax hmm well it must matter. I am running in "English" AFAIK, those translations are indeed there.
so... putting the keys on the shelf for the time being. what is a global string table? i.e. <Key ID="..."/> can exist at the "root" level, directly child to <Project name="..."/> (?)
where did you get the name "Global" stringtable?
in the error log ^^
huh, never seen that error
literally copied and pasted from the log; it's an A3 thing, not anything I am dumping.
I guess it refers to the dta/languagecore.pbo stringtable
I'll have to look up that message to see what it means. Doesn't make sense to me
right, but in terms of this mod, I should move the keys under the project itself?
apparently it does care when there are apparently references in the mission file.
no it doesn't
the log would disagree
omg yes it did...
where?
that's exactly what it reported, @STR_MY_TITLE: string @STR_MY_TITLE cannot be localized client-side - move to global stringtable
Yes that says nothing about package/project entries?
which IIRC is in the mission file. but the keys are in a "general" package.
Again, Arma doesn't read project/package it doesn't care
as far as the keys "being there" in the xml, they are. but A3 is complaining about it, and does not present player slots
Not sure what that message means
It doesn't say "not found"
The @ is weird. string keys are usually $STR not @STR
come on man... I am reading between the lines there. cannot be localized... what else is that supposed to mean?
literally in the mission file, which is why I ask:
briefingName="@STR_MY_TITLE";
overviewText="@STR_MY_DESCRIPTION";
maybe the syntax in the mission file is incorrect.
i.e. it should be $STR_MY_TITLE instead (?) ๐คทโโ๏ธ
not sure, it is "inherited"
because these are config classes like any other I suppose, so I don't expect the syntax to be that different...
class Mission
{
class Intel
{
briefingName="@STR_KPLIB_TITLE";
overviewText="@STR_KPLIB_DESCRIPTION";
};
};
as I said, "I didn't", the code was inherited. just troubleshooting it is all.
Try $ then
yep will do. appreciated.
And then someone tell me what the difference between @ and $ is :u
besides syntax, ๐คทโโ๏ธ ... probably innocently misinformed, my best guess
or maybe it really does reference a "global" string table, IDK
is it possible to use regex to use the find command to find a number in a string?
Does anything that is shipped with A3 support regex?
Never seen it
If you have a generally regular string, maybe you can do things like rudimentary splitString, something like that, along predetermined delimiters.
I've done that before, but it is C-R-U-D-E.
duu eet ๐
license ones?
no
so i have a particular line under bis_fnc_typetext
["29% UNKNOWN", "<t align = 'left' shadow = '1' size = '0.7' color='#ffff0000'>%1</t><br/>", 30]
how do I make only "unknown" a different color in this syntax? right now the %1 points to the whole sentence, do I need a %2 and to place "unknown" in a different section?
Also put structured text in the first param?
What even the heck is this error? Error Type Number,Not a Number, expected Number
you gave a number, but it's not a number, but it wants a number
so something returned NaN (Not a Number) instead of a number
I find it strange that NaN could be type number
ArmaScriptProfiler shows you network traffic caused by scripts
$ for config, @ to mark strings as localized in Eden Editor attributes
good to know, thank you @cosmic lichen
Q: concerning isKindOf, is there a "go to" spot where I can see the general kinds, i.e. "ground", "air", what about for sea? "ship"? or *UAV *or UGV, those are also "air" or "ground", etc... thank you...
isKindOf just checks config inheritance
People often think it checks if a object is of a certain type, it doesn't
I'm not interested in the class name. reviewing some code here, I think that about covers my bases, with maybe a few exceptions, buildings, unmanned, etc.
but isKindOf is all about classnames
I see it used that way all the time, i.e. _x isKindOf "Tank", or _x isKindOf "Air"
I think you are confusing that with typeName which is about class names
No typeName is not about class names it returns type names of script values
completely different thing
first statement in the docs, isKindOf, Checks whether the object is (a subtype) of the given type. i.e. base type of Tank, Air, etc
best way to convert to .ogv? my premiere doesn't have it as an option
I think we're arguing semantics
VLC
I understand it is about the class hierarchy
I was just curious if those basic classes were enumerated somewhere
Not really, because thats not how it works :u
You can have a tank that isKindOf Air.
best way is to look in config viewer
For example the AL-6 Pelican drone is isKindOf
"UAV_06_base_F","Helicopter_Base_F","Helicopter","Air","AllVehicles","All"
right I understand that. what I was curious about was seeing the base classes enumerated, i.e. Ground, Air, etc
do not know if such a listing exists
it is a mod? okay dokay, thank you.
hmmm my vlc doesn't have a .ogv container. it does have .ogm though with a codec of Theora
Guard Waypoints: Does the group assigned a guard waypoint actually have to reach the waypoint or have reached a guarded by trigger before they will start pursuing enemies known to their side?
dumb question maybe... without loading all in one... how do I obtain the base class of a class name?
should I be using stringtables? I see them a lot in other peoples missions. is it worth learning?
@fair drum If you want to have your mission available in other languages, yes, otherwise no.
re: config viewer, thanks... got there from the editor. perfect thank you.
Hi, I was hoping I could get some advice, on this one. This mission will work in editor and will work in a local MP mission. But won't work on my server
_this addMPEventHandler ["Fired", {
params [">
3:27:33 Error position: <addMPEventHandler ["Fired", {
params [">
3:27:33 Error Foreign error: Unknown enum value: "Fired"
3:27:33 File mpmissions\__cur_mp.Tanoa\tung.sqf..., line 1
3:32:15 Error in expression <missions\__cur_mp.Tanoa\tung.sqf"
_this addMPEventHandler ["Fired", {
params [">
3:32:15 Error position: <addMPEventHandler ["Fired", {
params [">
3:32:15 Error Foreign error: Unknown enum value: "Fired"
3:32:15 File mpmissions\__cur_mp.Tanoa\tung.sqf..., line 1```
The script is:
params ["_unit", "_weapon", "_muzzle", "_mode", "_ammo", "_magazine", "_projectile", "_gunner"];
if (_weapon == "CUP_Vmlauncher_9M311_veh") then {
_turretPath = _unit unitTurret _gunner;
_unit addMagazineTurret [_magazine, _turretPath, 1];
};
}
];```
@warm hedge i just started using your animation viewer mod and wow that's so much better
I kinda have no idea how to make a simple animations viewer that complicated and slower
The error is Error Foreign error: Unknown enum value: "Fired"
Which is happening because Fired is not a valid event for the addMPEventHandler command.
If you use addEventHandler then it will work
So, I tried it as a normal event handler and it didn't work also
What was the error?
Let me get out of this game and I'll tell you, give me like 30 minutes
@verbal saddle I forgot to reupload the version where I changed from MPEventhandler to just Eventhandler. Thanks for your help. I need sleep
use inheritsFrom repeatedly until you get to the root https://community.bistudio.com/wiki/inheritsFrom
vlc can convert to ogv? didnt know that ๐
I've never done it... very anglo centric, I know, but it's quite time consuming to add it to a mission 6 years into the development cycle
Does anybody knows any way to check if player is honking in a vehicle? Sadly the fired event handler does not pick up the act of "firing" the horn "weapon".
Weapon selected and keydown maybe
Might trigger in menus and such
Check also what display is active?
Car horn is weapon empty sound. Maybe something in there that could be detected
maybe it works with the "fired" event handler
Sadly the fired event handler does not pick up the act of "firing" the horn "weapon".
So the question is: how do you detect dry firing a weapon? The fired EH doe not pick up empty rifle dry firing either
I don't think there's any way
I would say, no easy and clean way. I guess one could kludge something, but it has the chance to be pretty wonky
Yeah I mean there's no "direct" way, if there's possibility, must be a big workaround
Because the horn sound is actually the dry sound of the weapon, so it never actually fires the weapons, so the EH doesn't fire
If it's for some specific vehicle I would use @unique sundial's Left-Mouse-Button override in vehicle:
http://killzonekid.com/arma-scripting-tutorials-how-to-override-lmb/
Play the horn sound artificially via say3D or something similar and then proceed with the code that is supposed to follow.
Why are you tagging me?
So that you know about this completely random topix
enableSaving [false, false];
_launches=0;
while { ((diag_tickTime > 10) && (_launches < 5)) }
do {
west reportRemoteTarget [t1, 3000];
t1 confirmSensorTarget [west, true];
g1 fireAtTarget [t1, "weapon_vls_01"];
_launches = _launches + 1;
};
i can't understand why my while doesn't work as intended
it simply launches 1 vls tomahawk and its over
t1 target is quadbike with redfor bot with damage to immunity
if i simply change to while { diag_tickTime > 10 }
all working as intended
there's no sleep in your while loop. the firing units needs some time to load the next shot. right now you are just adding +1 to _launches and the unit can't fire
roger
so this will work without sleep
while { ((diag_tickTime > 10) && (diag_tickTime < 60)) }
no?
always add sleep (when your while loop is indefinite)
while { ((diag_tickTime > 10) && (_launches < 5)) }
_launches = _launches + 1;
for
random_group_spawn = [randomMarkerPos, east, _list, [], [], [0.1, 0.2]] call BIS_fnc_spawnGroup;```
How do i tell this group to loiter at the location they spawned?
diag_tickTime > 10 seems nonsense to me
it can never become not that
no reason to repeatedly check it in a while loop
Yea i think i got it not sure tho
_wp = random_group_spawn addWaypoint [randomMarkerPos, 0];
_wp setWaypointType "LOITER";
What do you mean "not sure"? Just test it 
Does anyone here do advanced vehicle shit?
I'm thirsty for a CVT "gearbox" right now.
Before you go on about durability and reliability, I DO NOT MEAN THE KIND THAT USES BELTS.
That's an article about Allison Transmission buying stock in Torotrak.
Maybe the default LOITER radius is 0, I don't know, could be worth a try
Q: working with object variables, seems to me as though the keys are being converted to lowercase. is that accurate? i.e.
_obj setVariable ["My_Var", true, true];
// ^^^^^^
_obj getVariable ["My_Var", false]; // is false
// ^^^^^^
_obj getVariable ["my_var", false]; // is true
// ^^^^^^
variable names are case insensitive
Not that I know of; my object varspace variables all work the exact way I spell them.
upper or lowercase makes no difference.
The answer to the question is, yes. But I don't think you actually asked what you wanted to ask.
Atleast I think they are stored as lowercase, would need to check.
_obj setVariable ["A", true];
_obj getVariable "A";
```This really should work properly, not quite sure how you're getting different results there.
No wait, allVariables returns correct case does it?
lowercased
and the verdict is? ๐ pretty sure that's lowercase...
casing does not matter when accesing the variables.
However...
I'm pretty sure I've had few occurences when after doing:
_obj setVariable ["My_Var", true, true];
_obj getVariable ["My_Var", false];
it returned false
It looked like var was not set on object immediately.
ok I got it I think...
Never got consistent repro on it tho.
allVariables is the issue. getVariable is fine in terms of case arity. so any queries on allVariables should case accordingly.
No it's not an issue.
repro:
player setVariable ["A", true];
"A" in allVariables player; // is false
toLower "A" in allVariables player; // is true
I just corrected the record.
and to be clear, in is not case sensitive. the result from allVariables is lowercase, regardless what went in during setVariable.
inis not case sensitive
why you're saying such things when you apparently have no clue how it works.
it is documented.
https://community.bistudio.com/wiki/allVariables

quick question about random. will random 5 == 5 ever be true?
almost certainly not
ceil random 5 will, and round random 5 will but not a fifth of the time
I think yes
but 5-epsilon might round up?
according to ingame comref its exclusive 0 and 5
"The random real value from 0 to x. (0<=random<1)"
its rightArg*Random(0,1)
the random value is any float between 0 and 1
so inclusive both 0 and 1
in practice though.....
Hm we only use 30 bits though
but the last 2 bits of a float always being 0 won't matter here
in practice "ever" means "ever"
even if highly unlikely
but original question was ever. And as far as I can see the answer is yes
I think the best answer is, yes it will, guaranteed.. eventually
#include "..\includes.sqf"
_myscript = "do_test";
__tky_starts
a= 0;
while {random 1 !=1} do
{
a=a+1;
};
diag_log str a;
__tky_ends```
a is 3.85817e+006 and still going
1.04139e+007
it ended..not sure if random 1 was 1 or it just got bored ๐
10^7 is basically the limit of float precision
yes, im sure i remember you saying that the other day
I wish we could script animations to force a particular angle
aka, open a door the opposite way of which it was designed to
Question how would i run an action on all players?
titletext ["9 Hours later", "PLAIN"];
titlecut ["", "BLACK OUT"];
sleep 1;
skiptime 9;
sleep 8;
titlecut ["", "BLACK IN"];
Put that code in a function or at least its own script file and remote execute that, not every line one by one.
Yea in in my sleep.sqf
this addAction ["Sleep","sleep.sqf"] how would i remoteExec this?
[this,["Sleep","sleep.sqf",[],1,false,true,"","_this distance _target < 2"]] remoteExec ["addAction",2];
Seems te be working ๐
2 is the server (i.e. you, in Eden)
Do you not want all players to sleep at the same time?
skipTime also requires special attention with Remote Execution.
What I'm trying to say is that it probably doesn't do what you want it to do right now. It does so in testing, but it will not once you increase the amount of players beyond one.
Yea i want all players see that cutscene
So when one of us presses the 'sleep' button we all go to sleep
Is that the only code in sleep.sqf?
This will be on the init of a sleeping bag```sqf
[this,["Sleep","sleep.sqf",[],1,false,true,"","_this distance _target < 2"]] remoteExec ["addAction",2];
this is the sleep.sqf
```sqf
titlecut ["", "BLACK OUT", 0];
sleep 2;
[] Spawn {
[
[
["CAMP HOLLAND", "<t align = 'center' shadow = '1' size = '0.7' font='PuristaBold'>%1</t><br/"],
["9 HOURS LATER", "<t align = 'center' shadow = '1' size = '1.0'>%1</t>", 15]
]
] spawn BIS_fnc_typeText;
};
sleep 1;
skiptime 9;
sleep 6;
titlecut ["", "BLACK IN"];
Alrighty.
Thats gonna work?
No, I'll explain. It'll just take a few minutes to type
So your mission starts on the server (no client can connect to your mission or load the mission before the server has loaded it, right?), and the server begins by executing the init fields, executing addAction in the process. The target of that Remote Execution is 2 though, so that's just the server himself (which is why this works when you test it on your own, you are the server).
So now the "Sleep" action is available - but only on the server.
Then, once the player on the server (if there is one) activates the "Sleep" action, sleep.sqf is executed (but only on the server). The player on the server will see all the fading to black, animated text and so on.
skipTime is special: The wiki page says "Most be run on the server" (SE icon below the page title). Again, you get lucky with your testing, you are the server, so skipTime works.
If you were testing it with other players, only you would see the fading and the text, the effect of skipTime would apply to everybody though.
So, not quite how you want it to play out.
Instead, what you have to do is run addAction on all machines - that should (provided my brain is still working at this hour) work without issues using the sleeping bag's init field. So then every player can use the "Sleep" action.
Next, let's look at how we get sleep.sqf going.
We need sleep.sqf running on all machines (simultaneously) - except for skipTime (remember, it's special).
For that, we modify the addAction code:
this addAction ["Sleep", {"sleep.sqf" remoteExec ["execVM", 0];}];
```Note that the Remote Execution target is now `0` (everybody) instead of `2` (server).
Because `skipTime` is special, it's probably best if you wrap the line with `skipTime` in an if-statement like so:
```sqf
if (isServer) then {
skipTime 9;
};
```And now we should be good if I have not missed anything.
Small remaining problem: Your "Sleep" action is still available on the machines where it was not used (so it could be used again, putting everyone back to sleep and skipping nine more hours), so you might want to remove it with Remote Execution as well.
Damn
You took your time
I appreciate it
Its alot of info
xD
Alright so i made those changes
But you said removing the sleep option right?
But i want it to stay available in-case we want to make it day again
Well then you can ignore my last "Small remaining problem" paragraph; the current behaviour should just be what you want then.
Terra is typing...
One more thing:
["Base of Operations", "<t align = 'center' shadow = '1' size = '0.5' font='PuristaBold'>%1</t><br/"]
Why doesn't size do anything? i change it to what ever but not changing
oh..
im stupid

Or not thought i figured it out but guess not, you know anything about that? @willow hound
[["9 Hours later", "PLAIN"]] remoteExec ["titleText", 0];
[["", "BLACK OUT"]] remoteExec ["titleCut", 0];
sleep 1;
9 remoteExec ["skipTime", 2];
sleep 8;
[["", "BLACK IN"]] remoteExec ["titleCut", 0];
``` could work. in this case all the logic is handled on the client who is activating the addaction whereas handling it on the server might be the better option. on the other hand you would have to double remoteExec or split the script in two functions. btw it seems that you are adding the action in the init field of the object which is a bad idea. It will add an action for each joining client on every connected client. try to avoid the init field.
i had some different apporaches typed out until i realized they are not going to work so took me a bit :D
Don't forget its gonna be a 3 man squad play trough tops
I don't use format text often; maybe the incomplete <br/> tag at the end?
I thought about the init field adding more actions on all players but I thought since the init field runs its code local and since addAction only has local effect we should be fine-ish?
Also this addAction ["Sleep", {"sleep.sqf" remoteExec ["execVM", 0];}]; its on the sleeping bag not on the player right?
it executes every time a player connects for all players. so players that already have the action will get another one for each newly connected client afaik
this actually makes it worse since the init field is already doing that :D
I think we're good... as good as it gets with init fields 
i just remember from my early scripting days that whenever i made an addaction it would show up multiple times
Good guy singleplayer keeping things simple ๐ผ
Yea but i had this addAction on a map board before and didnt get any double actions
atleast not that im aware off
Anyway thanks for the help
is there a way to easily grab the class of a particle when a new one is created?
an oneachframe handler looking for isKindOf "#particlesource" or something?
nearestObjects [player, ["#particlesource"], 5]; ?
how do you set the particle(s)?
I don't
I want to grab particles made by the engine
do I want to use nearObjects, nearEntities, nearestObjects?
not sure if you can use that at all on particles, since they're not objects...
when you create a particle with a script, you use createVehicle, so wouldn't it be?
in that case it would be "#particleSource", which afaik is local only
and even then; the particle "object" itself will be set with setParticleClass or setParticleParams (no getters available)
so even if you know it's a particleSource (which means nothing than "something with particles"), you still don't have access the details of those particles
I'm trying to create the particle effect when you shoot a wood surface, but I can't see it. I'm not using the right class because when I use the "ObjectDestructionFire1Smallx" class, it works
_particle = "#particlesource" createVehicle _worldPos;
_particle setParticleClass "ImpactDustWood";
Does anyone here think they could demonstrate a CVT "gearbox" script?
Does anybody know with the "Guard" waypoint, whether the group assigned to that waypoint must first reach the waypoint or be assigned a guard trigger before they will begin pursuing enemies known to their side?
They will move to that waypoint and then move to a "guarded by" trigger.
Check the biki for waypoints
well it also says that they will move to engage any enemies known to their side. HOwever it doesn't say whether they must first arrive at their guard waypoint or have moved to a guarded by trigger.
Hello,
I need your help to figure out how you guys deal with race condition in sqf in multiplayer. For example I want to share a counter between all my players:
_actualValue = _obj getVariable[โcounterโ,0];
_obj setVariable[โcounterโ, _actualValue + 1, true];
How to be sure if two clients executes this code at the same time that it will increment by two?
can animated objects, such as objects that say have a particle effect, be subject to dynamic simulation? or only entities?
Why don't you try it? Literally takes 1min in the editor
If _obj is global (which it usually is) you can get the counter from all clients, but also set the counter from all clients.
Normally it shouldn't be an issue, since the chance that 2 people will execute that code within the same frame at the same time is pretty hard.
You could remote execute an update to the server and run it in a spawn so it won't do the same update at the same time.
The remote mutability is actually a quite complex problem with loads of research.
Most simple solution tho:
- Do it Serverside
Thank you for your response!
Is it guaranted that if i remoteexec to the server, the thread scheduling will not stop the thread between the line getVariable and the line setVariable to schedule the other thread (from other client)?
If the set/getVariable is done on the server you shouldn't have that issue; just send a "update counter" to the server.
Getting the counter can still happen locally.
Yes but correct me if Im wrong: two clients calling the โupdate counterโ function on the server will result with two spawns on the server. So the concurrency problem is now local but can occur. There is no command like TestAndSet in sqf afaik.
trust me, there's no programming language or system in the world which is able to handle that ๐
Yes there is! In asm you have atomic instructions and in c/c++ you have locks (using the underlying asm atomic instructions)
I tried to load guys up into a helicopter in editor they get in then get out
Irk why
Idk
I just wanna now if there is a way in sqf, if there is not, i will write an Extension to handle the problem
If two pieces of code would do something at the exact same time (nanosecond precise), which one will set the lock? That is the issue you'll always have, but gets bigger when timings are less accurate ๐คทโโ๏ธ
๐
@wind hedge Use the tilde key ` without holding shift, not apostrophe ' (Use the key to the left of your #1 key)
You are not guaranteed wich one get the lock but you can guarantee that no one will get the lock, be paused and the other one will update the value
(I just want to ensure that getVariable and setVariable are executed atomically)
vShowAllyOnMap = {
findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw"๏ปฟ, "
_display = _this#0;
if (visibleMap && diag_fps > 15) then {
{
_icon = getText (configfile >> 'CfgVehicles' >> typeof _x >> 'icon');
_display drawIcon [
_icon,
[0,0,1,1],
getPosVisual _x,
24,
24,
getDirVisual _x,
name _x,
1,
0.03,
'TahomaB',
'right'
];
} forEach (allUnits select {side _x isEqualTo side player && (isFormationLeader _x));
};
"];
};
๐ That is giving me an error:
It says missing ] in line 2...
This line: (findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", ")
Add a ] before the parenthesis ๐
(findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", ")//No bueno
(findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", "])//Mucho bueno```
Help, I made my gets move to helicopter and did get in, then i@made the helicopter go to a point where they drop off the guys, once all the men get in they all ge to it please help
try:
vShowAllyOnMap = {
findDisplay 12 displayCtrl 51 ctrlAddEventHandler ["Draw", {
_display = _this#0;
if (visibleMap && diag_fps > 15) then {
{
_icon = getText (configfile >> 'CfgVehicles' >> typeof _x >> 'icon');
_display drawIcon [
_icon,
[0,0,1,1],
getPosVisual _x,
24,
24,
getDirVisual _x,
name _x,
1,
0.03,
'TahomaB',
'right'
];
} forEach (allUnits select {side _x isEqualTo side player && (isFormationLeader _x));
};
}];
};
``` makes it easier to read as well
Because if the second parameter is a string I believe you can't have line breaks in there
any ace coders let me know why this isn't working? [player, 1, "LeftLeg", "falling"] call ace_medical_fnc_addDamageToUnit;
@wind hedge After the next update you might wanna use (units (side player) select {isFormationLeader _x}); which is twice as fast as your current code.
That is valuable info right there! Fixed!
After I am done with this script suite I am gonna five @little raptor a run for his money ๐ ๐
Hello, I'm trying to do an op where a small group (that is unknown to the main group) works to link up with the main group. So naturally I'm gonna cut comms between the groups to make the linking up harder but I don't want to make it impossible either so I'm planning to restrict radio range for a certain person/group to around 200m. Not sure if anyone's done that but I looked up and can't find any help on that. We use TFAR Beta.
@desert cargo here is some stuff that I wrote down a while ago, might be useful for you and TFAR
// jam radios
unit setVariable ["tf_sendingDistanceMultiplicator", 0.05,true];
unit setVariable ["tf_receivingDistanceMultiplicator", 0.05, true];
unit setVariable ["tf_transmittingDistanceMultiplicator", 0.05, true];
// un-jam radios
unit setVariable ["tf_sendingDistanceMultiplicator", 1,true];
unit setVariable ["tf_receivingDistanceMultiplicator", 1, true];
unit setVariable ["tf_transmittingDistanceMultiplicator", 1, true];
and be careful of locality
be careful of locality?
so for a dedicated server, it should be fine right?
and if I just put these lines in the unit init, the player controlling this unit will be affected?
"this setVariable ["tf_sendingDistanceMultiplicator", 0.05,true];"
if you do that, every time a player joins your server, that line will run
so say you unjam them, and someone joins, that init field is fired again on his machine thus jamming again
init fields are fired on every machine when they initialize the mission
yeah the idea for the op is for that small group to have severely limited radio all the way anyway
how would you use it?
like, I'm used to doing 3den stuff but not playing with scripts, the most I do is unit init functions once in a while
put it in initplayerlocal
player setVariable ["tf_sendingDistanceMultiplicator", 0.05,true];
...
~~you can try a
if !(local this) exitWith {};
this setVariable ["tf_blahblahblah, blah, blah];
if you are set on using init fields~~
you'd have to do that for every player
yeah I'm just wondering how to use these scripts, coz I have no idea how scripts work outside of init field
that's true, because that variable has to be available on every machine for every unit you assign it to
how many players are going to be jammed?
8
all in one group at the start?
yup
k, let me make something to try
it's a recon team that's shot down and lost, the platoon will have no idea they exist all the way until that team finds them
sort of an interesting idea but I'll have to reduce the recon team's radio range so they don't just talk to each other right off the bat
maybe something like this?
// initPlayerLocal.sqf
params ["_player", "_didJIP"];
private _jammedGroup = insertGroupVariableHere;
if (group _player == _jammedGroup) then { //jam the radios
_player setVariable ["tf_sendingDistanceMultiplicator", 0.05,true];
_player setVariable ["tf_receivingDistanceMultiplicator", 0.05, true];
_player setVariable ["tf_transmittingDistanceMultiplicator", 0.05, true];
};
I have no idea man
like, I understand code enough to know it would probably work but I don't know how to use it for arma
try that. as long as you don't have dynamic group system on that allows players to change stuff, you should be good. obviously i didn't put in a check to see if the group still existed because if its that far into the game and the group dies, I don't think there are going to be any join in progress players
I assume this one I need to attach it as an sqf file in the pbo and name the group "__jammedgroup"
no, name your group in the editor whatever you want in the variable line (with no underscore)
then make a new file in the root folder of the mission
name it initPlayerLocal.sqf
then put those lines in and change the insertGroupVariableHere to whatever you put in the variable line of the group in the editor
ok so it's like naming specific units to have zeus modules in zeus owner and unit variable, except it's an sqf
cheers
yes, those "names" you give those units are actually stored as global variables that you can access directly with scripting. you just have to remember what you named them
I wonder, if I assigned the jammed players to another group mid-op, would that effectively change their group tags and make them unjammed? or is it something that only runs once upon joining the server?
it has nothing to do with groups
it sets the radio range per unit
it only runs once. you would have to call another set of code to unjam them as well as pull the group variable that you switched them to
or directly just call the unit you want to change and skip the check all together
is it possible to make a serverside only mod that creates a map/diary/task url link on JIP? and since copytoclipboard doesnt work in MP how do i make it easy for ppl to goto the link? i have over 700 missions on my dedicated so modifying mission pbo is out of the question. also will i need to do server config
allowedHTMLLoadURIs[] =
so far i got
createDiaryRecord
htmlLoad
remoteExec global on mod init
thoughts?
displayCtrl is binary command.
Game can get confused here
findDisplay 12 displayCtrl 51 ctrlAddEventHandler []
can be either correct
((findDisplay 12) displayCtrl 51) ctrlAddEventHandler []
or wrong, ctrlAddEventHandler doesn't take number
(findDisplay 12) displayCtrl (51 ctrlAddEventHandler [])
you can have line breaks in strings
["te
st"]
this is valid.
(allUnits select {side _x isEqualTo side player && (isFormationLeader _x))
FYI
Next Arma update lets you do
units side player select {isFormationLeader _x}
Ahh R3vo 
Yes I still reply faster than I read-
and still it was the only thing which make it broken ๐คทโโ๏ธ
Seen it before, code as a multi-line string does not seem to work in several cases.
Using an actual code block does work (and is more readable)
The code runs once when the player joins the game. So it depends on which group the players are in at start of the mission.
I am having an issue with not being able to properly put a parameter _unit into the spawn extension. I tried it a global variable, but the issue is, that the global variable changes to fast for the sleep to work.
DEKdonotevertouchthis = _unit;
if (_ammo isEqualto "AmmoStingerPistol" or _ammo isEqualto "PoisonBomb_Remote_Ammo" or _ammo isEqualto "PoisonBomb_Remote_Ammo_Scripted")
then
{
[] spawn
{
sleep (4 + random 5);
DEKdonotevertouchthis setDamage 1;
deleteVehicle DEKdonotevertouchthis;
_PoisonBomb = "PoisonBomb_Remote_Ammo_Scripted" createVehicle position DEKdonotevertouchthis;
_PoisonBomb setDamage 1;
};
};```
if anyone has an idea to transfer the parameter easier, that be nice.
it truly should be, thank you very much it works.
Hi everyone Can you help me with a script that can make ai invisible but you can see them on thermal and your still can kill them if you are shooting the place they are in
Im not sure but shouldnt it technically be possible to make an transparent texture? (Just food for thought)
But i have a question too:
We currently use a workaround for creating concealment on a large scale PVP mission, we use the tall grass for that.
Its spawned by createsimpleObject (as it seems to be the only way to spawn it)
The issue is that when you drive a vehicle inside, you cant get in anymore because the interactions are missing
Is there any non-hacky way to solve that?
I tried a script and it made the ai invisible and you can see it only on thermals but you can't kill it except you have thermals one
So I saw a video of people used the same thing I want
I can send you a link
So only one of them can see the unit (anomaly ) and the others can kill it with him guiding the team to were the anomaly is
I read somewhere that AI uses raycasts from eyepos to eyepos and can therefore be fooled by standing behind a roadsign that blocks your face. Is that still true?
sounds reasonable
If you are standing with your face right up against a streetsign, you cannot see either
but I think AI checks from eye to center of mass
you might see from your scope though ๐
So you re saying there is a chance to recreate that skyrim thing where you place a bucket over an NPC and he becomes docile :D
Iirc that should work
Though you probably will get armaed by the engine
The Sensors of weapons work in a similar way
(Sensor source raycasts towards center of vehicle)
done
Would this work in a Dedicated MP mission to make Static C130 make an engine noise?
object say3D "enginenoise";
sleep 100;
}; ```
No, that would only play for the dedicated server client. Which doesn't have an interface or audio.
You would need to remote execute the say3D command to the clients.
Unless that is already being run locally on the clients.
it might be better to do it locally, idk
regarding performance and loop timing "quality"
anyone know how to make the vls shoot at a position? i know how to make the hammer fire at a postion. but not the vls. ive tried a few things but none seem to work. this is what works for the hammer.
_turret doArtilleryFire [_pos, currentMagazine _turret, 1];
ive googled it and tried suggested solutions for the past 4 hours.
Used something like this years ago. Might still serve as a starting point. vls needs enabled datalink ofc.
laser = "LaserTargetE" createVehicle some_pos;
east ReportRemoteTarget [laser, 999999];
vls fireAtTarget [laser];```
@cerulean locust well that made them fire but the missiles just went way up in the air.
then try this:
vls addEventHandler ["Fired", {
_this#0 setMissileTarget laser;
}];
laser = "LaserTargetE" createVehicle some_pos;
east ReportRemoteTarget [laser, 999999];
vls fireAtTarget [laser];
make sure you only add the event handler once
@little raptor that is complaining about laser being an array and not an object.
The thing is that im randomly selecting a building pos in an area and trying to get the missiles to fire on it every x seconds.
I got the hammers working but not vls.
are you sure you didn't change anything?
laser is an object
according to that code
laser = "LaserTargetE" createVehicle some_pos;
i changed some_pos to be _my_pos
post the full error
@little raptor sorry i had a work call. i resolved the error it was my fault but the missiles still go straight up in the air.
@still forum I'm currently writing a test project with Intercept. How does server receive request to execute something with remoteExec if the server side is written in C++?
Rgr
hello there, I'm a little bit pissed off from AI
how to make them watch to something behind any obstacle?
I've tried doWatch, doTarget, glanceAt, lookAt and it still aim to nothing
if anyonce can have a look at this plz i have the part that make ai visible only on thermal but only the one that is using thermal can kill him
0 = this spawn {
while {true} do {
waitUntil { currentVisionMode player != 2 && sunOrMoon < 0.5;};
_this hideObject true;
waitUntil {currentVisionMode player == 2 or sunOrMoon >= 0.5 ? is the semicolon missing?};
_this hideObject false
}
};
_pos = position _target;
_mark = "Target_F" createVehicle [_pos select 0, _pos select 1, (_pos select 2) - 2];
_mark attachTo [_target, [0, 0, -2]];
while { (_target inArea ttt) && (alive _target) } do {
ai reveal [_mark, 4];
ai glanceAt _mark;
ai doTarget _mark;
```with this code AI just hold it's weapon down and didn't aim anything
ai setBehaviour "COMBAT"; ai disableAI "all"; ai enableAI "TARGET"; ai enableAI "WEAPONAIM"; ai enableAI "MOVE"; ai enableAI "ANIM"; ai setSkill 1; this addeventhandler ["fired", {(_this select 0) setvehicleammo 1}];
```Init from AI
It can aim though, but only if it see the target
@still forum Speaking of registered functions, is it possible to register a SQF command so that it accepts only set types of variables as parameters (and return value)?
The IDE gives weird errors if I use eg. intercept::types::GameDataType::STRING when I register the custom function and then try to use game_data_string or eg. game_data_type::STRING in the actual C++ function parameters
uh
You always take game_value_parameter as argument. You can cast it to other types
Check intercept-cba or intercept-database for examples
I'd just like to have static typing so that IDE nags me if I try to use uncompatible variable types ๐
Aight
for callExtension it does exist pretty much ๐คช
float, std::vector<sqf::value>, std::string, bool are the accepted types
see https://github.com/arma3/sqf-value methodhost
you should be able to mangle it into intercept too
@queen cargo The link doesn't work
fixed
can someone confirm ?
[getPos player, civilian, 5] call BIS_fnc_spawnGroup; is not spawning civilians, when I change side, is spawns normally, but civilians not. bug or I am missing something ?
Hello all. Ive got a kinda weird script error here. Got two computers, two tablets and two USBs. The computers both got a Addaction "hack" and loading hacking1 and hacking2 for the other PC.
Both scripts are identical, except one named "hardware1" and other named "hardware2".
First line of code is "hackcount = 0; ishacking = false;", some lines that shows the tablet and usb and next line is removing the addaction from all PCs, so the user only can hack one PC at a time.
Ive got a "while, do" script that begins to count the hacking percentages up with a hint.
Whenever the counter reaches 100 it will remove tablet and USB.
Last line of coding a "if !hardware2hacked then" and then adding a addaction for hardware 2, so the user can hack the second PC.
BUG comes if i start with PC2 and the hack PC1, i can hack PC1 again - it goes the other way around too.
- what is the script error?
- what is the code?
- and a bug?
@real tartan civilian is not defined in the function
see BIS_fnc_returnGroupComposition
if you want the function to work, you must provide a config or array as the third param, not number
Sorry, not script error but rather script problem.
I don't know how to paste codes here in order for it to look fancy, please tell me how.
The bug being that the player can interact with the last PC they just hacked, even though they should not be able to
did you remove the addAction from the first PC?
shame
you can make it work
see the new note I added
if you want the function to work, you must provide a config or array as the third param, not number
Yes. Both script got the "removeaction" for both PC
I don't know how to paste codes here in order for it to look fancy, please tell me how.
see the pinned messages
if your code is too long, try sqfbin.com or pastebin.com
https://pastebin.com/R4uKUZFF Pastebin link. This is for PC2, script on PC1 looks identical, only difference all "Hardware2" is replaced with "Hardware1"
I've also got a "Hardwarehacked" sqf that tells if Hardware1 or 2 is true or false, script being "IsHardware1Hacked = false;"
well for one thing you're always using ```
Hardware1 removeaction 0;
Hardware2 removeaction 0;
these actionIDs could be invalid
use params ["_target", "_caller", "_actionId", "_arguments"]; at the top of the script, and use _actionId to remove it from the current object
to remove it from the other one, use setVariable
