#arma3_scripting
1 messages · Page 579 of 1
We have been going over that. We can get the preset to run in game just fine. by using that Chat command.
@still forum oh okk! ty! and what about _this select index? why u said no to that one as well? is it bad to use for parameters?
You're stuck on trying to use the chat command to do it. But if you want to do it automatically as part of the mission, you should use the "via code" (acex_fortify_fnc_registerObjects) method described in that documentation. You probably can somehow get the chat command to run automatically, but that's not the smart way to do it.
In init.sqf, put your register command (based on the example provided in the documentation) inside if isServer then { yourcodehere };
Ok, so I'd place that in Init.sqf, and then include my item array code in those brackets
That is what I said, yes
Make sure your item array code is correctly formatted based on the documentation for the acex_fortify_fnc_registerObjects method.
@polar anchor _this select x is obsolete;
params does everything for you: selection, using private, even filtering the data type if you want.
So for the examples in their framework it should look like this?
if isServer then { [west, 5000, [["Land_BagFence_Long_F", 5], ["Land_BagBunker_Small_F", 50]]] call acex_fortify_fnc_registerObjects };
And we would just replace or add item classNames for each item we want to add or replace, correct?
That is what I, and the documentation, said, yes
as described in the documentation, the number after each item classname is the cost within the ACE Fortify budget system, and the number after west is the total budget available, and west is the side for which the object list is being registered
Yeah, we get the parameter coding. We're just trying to muddle through it.
So, complete code would look like this, placed in an Init.sqf?
if isServer then { [west, -1, [["Land_BagFence_Round_F", 5],
["Land_BagFence_Short_F", 5],
["Land_BagFence_Long_F", 10],
["Land_Plank_01_4m_F", 10],
["Land_BagBunker_Small_F", 25],
["Land_HBarrierTower_F", 100],
["Land_HBarrierWall4_F", 25],
["Land_HBarrierWall_corner_F", 25],
["Land_HBarrier_1_F", 5]]]
call acex_fortify_fnc_registerObjects };
if (isServer) then
{
[
west,
-1,
[
["Land_BagFence_Round_F", 5],
["Land_BagFence_Short_F", 5],
["Land_BagFence_Long_F", 10],
["Land_Plank_01_4m_F", 10],
["Land_BagBunker_Small_F", 25],
["Land_HBarrierTower_F", 100],
["Land_HBarrierWall4_F", 25],
["Land_HBarrierWall_corner_F", 25],
["Land_HBarrier_1_F", 5]
]
] call acex_fortify_fnc_registerObjects
};
(formatting only, I don't know anything about ACE)
Thank you sir. I'll try that instead
@jaunty shadow don't try to use the chat commands, serverCommand doesn't work. Call the scripts that the commands are calling directly
@polar anchor
why u said no to that one as well? is it bad to use for parameters?
It just doesn't make sense as it does the same as params, in longer, slower, harder to read
thanks @still forum and @winter rose for all this infos 🙂
Are you sure you want to use -1 in the budget parameter? @jaunty shadow If that's the "infinite budget" number then OK, but it's not described on the wiki so I would not assume it'll work if you don't know.
I am pretty sure that's the infinite number.
try it and find out I guess
Hmm missing semicolon somewhere it tells me.
then change something somewhere 🙃
usually the error message tells you approximately where the semicolon is missing
I suspect it's after fnc_registerObjects, but I'm not sure. Just put semicolons in likely spots until you get the right one.
Is there a faster way to add something to the start of an array than reversing it, appending it, and reversing it again?
so for example private _newJarvis = [_rFirst, 0, 0] pushBack _jarvisArray;
yup
cool. I was hoping for something that didn't need copying the array
like append but for the front
wait, pushBack returns a number
there is a deleteAt, but not an insertAt
let's see if there is a function though
@mortal wigeon ^
I see Killzone Kid has a function he says is much faster than that
KK_fnc_insert = {
private ["_arr", "_i", "_res"];
_arr = _this select 0;
_i = _this select 2;
_res = [];
_res append (_arr select [0, _i]);
_res append (_this select 1);
_res append (_arr select [_i, count _arr - _i]);
_res
};
// Example
arr = [1,2,3,4];
[arr, ["a","b"], 2] call KK_fnc_insert; //[1,2,"a","b",3,4]
much faster
private []
HAH
Killzone Kid has a function he says is much faster than that
Killzone Kid is a developer, who can just edit the BIS functions, I doubt that he wouldn't fix the main game function but instead make a faster version and publish it somewhere where only few people see it.
Also that script there is very clearly outdated
so it's not faster?
maybe the BIS function has been updated since, yes
at the time it was posted it may have been faster, but (most likely) not anymore
anyway, is (high) performance important, is it a frequent operation you do?
yes
the benchmark button (bottom left of the debug console) it is then
Can anyone explain what I'm doing wrong?
Running this:
_array1 = [ [d,e,f], [g,h,i], [j,k,l] ];
_array2 = [a,b,c];
[_array1, [_array2], 0] call BIS_fnc_arrayInsert;
Returns this:
[[any,any,any],[any,any,any],[any,any,any],[any,any,any]]
@still forum do you want people to ask for help or not? You're free to simply not reply. Why are my variables undefined?
Well I assume your variables are undefined because you never defined them
Your code is doing exactly what you wrote
what did you expect if the result you got wasn't it?
Cool I'll ask for help somewhere else
Can't help if you don't tell me what I need to know to be able to help ¯_(ツ)_/¯
@mortal wigeon your array elements are undefined. you'll need to declare them elsewhere in your script.
@somber shuttle oooohhhh got it duh thank you
@jaunty shadow Lou didn't provide any new code. That was just tidying up the formatting on your existing code to make it readable on Discord. As for why it doesn't work...I mean...does it give any error messages? Anything? What does happen?
Yes. I get that. I was just letting him know it worked for me in one instance and not the other.
It's a step in the right direction and I appreciate the help.
In editor when I go to play>mp Fortify works fine and the array of items available is correct.
When exported and run on a dedicated server, Fortify just doesn't init it seems.
Perhaps the "MUST BE CALLED ON SERVER" note in the documentation means it needs to be called on the server and clients. Try it without if isServer { };
no
server only
it does public variable internally
plus it has a if (!isServer) exitWith {}; in the first line
So I need that if (!isServer) exitWith {}; in my code instead?
No, you do not.
you don't need any isServer check
That is something that is in the function your code calls
but doesn't explain why it doesn't work
Ok. I'll try it without the IsServer line and see what happens
You should check whether your dedicated server has ACE set up correctly, and is in fact using a mission with the Fortify module in it.
I'll try it without the IsServer line and see what happens
shouldn't make a diff
We verified that first. ACE is running no problem, Fortify module is placed.
We can run it with the Description.ext method fine. It all works using that.
The Code version that lets us bypass the Admin command is giving us fits.
Yes, we know. No one thinks there's a problem with the description.ext/admin command method. (Other than that it can't be automated)
are you sure that… your init.sqf is not indeed a init.sqf.txt?
Would that work in local testing? The problem seems to be somewhere in the move from local to dedicated, I think if it was .txt it would break in local too
oh true, it works at one point.
unless it is put somewhere else in the mission and doesn't run on the server 😄
at this point, I don't know (and I don't know ACE functions so *shrugging intensifies*)
Meh, we'll figure it out down the line.
try a fresh new mission to narrow it down, if this is not the case already
Hey, wondering if anyone can help me turn the following contents of a initPlayerServer.sqf file to an Add Action, I want to run the script on player demand, not on player connection. The contents of the file is:
_thisPlayer = _this select 0;
[_thisPlayer]execVM "scripts\UTFN\fn_Server_getUnit.sqf";
you cannot addAction in initPlayerServer.sqf, its serverside, actions are clientside only
you want initPlayerLocal
with
player addAction ["look at me! I'm flying!!!", "scripts\UTFN\fn_Server_getUnit.sqf"];
Thank you @still forum I'll test it now.
@still forum can said add action be applied to an object?
Why don't you try later?
Lean back and chill out and savor the moment for a second
yes, it basically passes it to a database query
as player is always player anyway
it is meant to run that script on the server?
so does it need to run on the server?
player addAction ["look at me! I'm flying!!!", {[player, "scripts\UTFN\fn_Server_getUnit.sqf"] remoteExec ["execVM", 2]}];
works if you use params to get the parameters
which you should anyway always do so I'm not gonna even assume nor offer you solutions for the case that you're not
Giving this one a go, pretty sure I'm using params
So this one does something, throws an error of
Error select: Type Object, expected Array,String,Config entry
File mpmissions\__cur_mp.VR\scripts\UTFN\fn_Server_getUnit.sqf..., line 6
Error: Object(4 : 3) not found
Line 6 being
_Player = _this select 0;
In place of _Player on line 6?
in place of _Player = _this select 0;
I'll give it a shot, thanks @robust hollow - sorry if a bit clueless - first time looking at SQF yesterday
That one returns the same error as above
File mpmissions\__cur_mp.VR\scripts\UTFN\fn_Server_getUnit.sqf..., line 6
Error: Object(4 : 3) not found
I'll try again just to double check
u still using select
I think I forgot to pack the file, running it again.
Nope that does indeed work @robust hollow @still forum many thanks. Really helpful.
wup wup wup
I am having a problem with a script I am calling from a addon not fully executing, essentially when it hits a 'if' it kicks out and stops executing. Has anyone experienced this or know where I can start to figure out this problem?
it also does not display any errors as if it just gives up
I tested adding more lines to execute before different ifs and moving stuff around and it seems to only be if statements alone
What are your if statements?
//stuff here
};```
very simple things like that really
I added systemChats around everything and it neither finishes the script as in it stops running at the if and checked to see if the bool was true and it was
have you made sure your if statement conditions are true?
it would
one sec
huh, it won't let me upload the script even in parts lol
even copy and pasting it seems to kick back one second
there we go
shouldnt paste entire scripts in the chat. use pastebin or something similar
gotcha one sec my bad
There we go
I call this from a addon using a EH on a unit
Respawn = "_this spawn compile preprocessFileLineNumbers 'AV_Pack\Scripts\InitLibrarian.sqf';";
};```
Think it might be this causing your issue,
https://community.bistudio.com/wiki/get3DENAttribute
Specifically Attributes are available only within the Eden Editor workspace. You cannot access them in scenario preview or exported scenario!
Lemme try removing them and if it gets past the first if then
And because you use those as conditions for your if statements it would stop them from running
If it did work then you would run into a syntax error because get3DENAttribute returns an array. If statements cannot have an array as their condition.
Yea I removed them and changed the _canCast bools to directly true and the first if hasInterface doesn't even evaluate. Out of all those systemChats the only one that prints is the first one.
Do you get Exited Librarian Init Script?
Hey guys
I have dabbled in coding but Ive never modded any game
I was thinking about a dodge mod
When you get shot, your stamina is drained a certain amount, should you not have enough stamina, the shot will deal damage
so it acts like regen health
how hard would this be to code?
sounds straight forward. would probably only need the get/setfatigue script commands in a handledamage event. (along with ur conditons and whatever)
What EH I can use to track unit incapacitated status (without ACE)?
o.O
I don't think there's a specific EH for it, but you could probably use a dammaged EH and use the lifeState command to check if the unit became incapacitated as a result
make your own EH using https://community.bistudio.com/wiki/lifeState ?
Thanks guys. I think there is no sense in making scripted EH, it should be called by script in any case.
Will try to make MPHit EH.
well not exactly sure what you need as a trigger for said EH... knowing that will help.
onLoad = "uiNamespace setVariable ['vin_loadingScreen', _this select 0]";
onUnload = "uiNamespace setVariable ['vin_loadingScreen', displayNull]";
Somehow when I read this value in sqf I get type error, and somehow it is controlNull instead of displayNull?
private _display = uiNamespace getVariable ["vin_loadingScreen", displayNull];
if(!(_display isEqualTo displayNull)) then {
(_display displayCtrl 101) ctrlSetText _message;
};
"Exception has occurred.
displayctrl: Type Control, expected Display (dialog)"
is that onload event on a control instead of a display? or, does a control also set to that variable?
yeah, actually i just realized I think I am making a group control not a screen, sorry!
Hello, I am currently trying to install infistar to my server but it won't work at all any advice would be great
Can anyone think of a reason why diag_log doesn't work for me anymore on dev branch?
Nevermind. No logs was enabled for some reason
@torn coral you probably should contact infistar support for that. It is external unofficial program.
Hey guys, im doing a project with the arsenal and im trying to get every image, ingame class name/id and weight and few other things of every item in the arsenal , do you know if there is a way do to it? maybe if arsenal items are saved in some file so i can get it from there?
So, I assume someone has already done this - I want to have a spawn point follow the squad. IE if player_1 is dead, it moves to player_2, and so on. if all players are dead the spawn point does not exist.
@tough abyss what do you need those for? Where do you intend to use them?
With ace is there a way to log what medical actions someone did?
@young current the goal for my clan is to use those "values" in our website in a way that every role/ duty in missions will have loadouts that when you log into the server your automaticly get the loadouts you need for you role in the mission
So I have a question regarding a mod I was working on: If I want to give the bagpacks of disassembled guns (e.g. the vanilla mortar) a different skin, it works perfectly fine by creating a new backpack based on the original class and just overwriting the hiddenSelectionsTextures. Then I can just use the regular assembly function and the normal turret is being spawned/created. BUT: When I disassemble it, it spawns the gun in the original vanilla bags. Can I add an addAction or something like that to the vanilla objects (the HMG for example), which goes like "disassemble to <CustomBagName> [...]"? Is there an easy way to add an action to a gun turret, when it's being assembled?
Note: since it's vanilla, I obiously can't change the gun itself. Ideally as a mod, since I want to do it for the unit I am a part of.
I would think, that those addActions usually belong into the init.sqf, but since I can't edit it (vanilla - duh...), I need to solve this mystery differently.
I think you may need to create custom guns too that use those custom bags.
are you answering to chaser?
Yes
ok
For you I don't quit have an answer.
Since you want to put that data outside of Arma you need to collect it from the configs somehow
@young current I hoped to avoid that, because I have to copy quite a bit of code 😦 is there no way to abuse an eventhandler or sth like that, which listens to createVehicle commands?
@young current i know, but what im asking here is if someone know where this data might be? like in which files
alright, cheers! I'll look into that, then
If you unpack the configs properly then in the config.cpp files in each pbo respective folder
Or you can try the all in one config dump. Since you want ace stuff you may need a custom dump with ace loaded
Possibly. Don't remember off the top of my head
If you want simple approach, just make gear collections/loadouts ready in game that your players can choose from
If you unpack the configs properly then in the config.cpp files in each pbo respective folder
@young current what is pbo folder, and what do you mean unpack the configs?
I think you have a weekend of googling ahead of you.
i bet, i dont know anything about that stuff and i never had any work with arma before
its gonna be Big OOF time
@young current can you help me in understanding what i need to google about to understand where i can find this config.cpp?
@spark rose set the waypoint on leader group _playersGroup? else cycle through all the units and stop at the first alive one
in Eden Editor properties iirc, there is a "Virtual" tab
And if I put this to a server through eden will it stay?
For example when you buy it through a shop will it have that amount?
For example in an Altis Life server how would I add more virtual storage?
go to the L*fe Discord Server to talk about L*fe scripting, you will have a better chance to have a precise answer
(see #channel_invites_list)
hm. i have some issues with saved variables. i am saving stuff in mission 1, then i go to mission 2 and everything works. BUT if i am in mission 2, save, leave the campaign, and in the main menu then revert to mission 2, suddenly the game seems to have forgotten the saved variables ... is there anything i can do here?
actually the mein menu thing isnt even necessary. it's enough to just revert the current mission
saving and reloading the savegame is ok. it's really just completely reverting the current mission that seems to cause this
heh, ok i know why
or actually i dont
so i've added some debug messages ... and they tell me that the variable content is still correct.
yup ... seems the code is running too early. i've moved it into a new [] spawn and added a sleep 1; before running it and now reverting the mission will not break it anymore
thanks for the help, folks :>
you're welcome! anytime
@west grove you did use saveVar I believe?
yup
since there is no "getVar" (and given the last time I used these was in OFP), this is a global variable that is automatically set on next mission's namespace, right?
wiki says it is saved in campaign space
(even campaign's namespace iirc, so you had to use a numbered var so you don't load mission 1 and get the mission 7 var)
I may add a note to the page if it is still the case; would you mind to give it a try? like saveVar "varMission7" and try to load it in mission 1 ?
i dont really have a setup like that in my campaign
but i can tell you that persistency seems to hold up from mission to mission
even if i revert to an older mission now, it will behave correctly
^ yes! the revert was the issue with one campaign i played: I got badly hurt at the end of mission 2, started mission 3 pretty hurt, I said let's revert… started mission 2 injured
something like this happened to me when i used it wrong
i saved the variable in some other name space
i think it was profile namespace, because i didnt know better
ah, yes indeed 😅
there was no access to profileNamespace in OFP:R
with a bit of luck they fixed this saveVar variable "descending" to the next mission
if not, I should try and document that
is there a way to make a script so you can't remove or exchange gear?
tried with an open inventory eventhandler but its not very reactive
you would still be able to "refill ammo", too
yeah
so what I've done so far is
found a way to remove corpses in a creative way
and trying to make a Keydown eventhandler to close the inventory if someone presses "I"
what is going wrong then?
oh I had this idea after I asked
not even sure if it works
figured one would made the other redundant
nope as you could still open a subordinate's inventory (if any)
better have belt and garters? :p
luckly there are no sub inventories in the mission if I remove bodies
subordinates imply group members, not corpses 😄
there are not backpacks either
unless there is an hidden button to check in your homies cheeks
B 👀
now that doesn't help me, I am looking for a nice motivating idea in order to use some nice effects like conversations, ppEffects, noice scripting, ambience…
I can't find the perfect idea 😢
what are you trying to do?
some kind of "showcase", of I don't know what it could be!
I am okay with scripting one stuff as a Proof of Concept, but making one full interesting story is another (story)
lol I have the exact opposite problem
have a ton of ideas but need to learn all these various functions to make them reality
how can I apply the EH in a MP mission?
tried with addMPEventhandler
but nope
for inventory? player addEventHandler in initPlayerLocal.sqf
oh yeah
thanks
still can't seem to make it work
player addEventHandler ["InventoryOpened",{
_this spawn {
waitUntil {
not isNull findDisplay 602
};
if (_this select 1 isKindOf "Man") then {closeDialog 602}
}
}];```
closeDialog doesn't take a IDD
it takes a button code
usually 0 or 1
I think you used the same copy paste than my units mission maker
he gave me that garbage a few weeks ago too and I had to fix it up for him
probably the same thing
weird, seemed to work for the guy we copied from
Just read wiki https://community.bistudio.com/wiki/closeDialog
player addEventHandler ["InventoryOpened",{
if (_this select 1 isKindOf "Man") then {closeDialog 1; true}
}];
this is what i have
mhmm true it doesn't take the IDD
and apparently it hasn't since flashpoint
no idea how it worked for that guy
@still forum still doesn't work
exactly that snippet works fine for me
just ran that last week
i copy pasted it out of my mpmissionscache
did you put it in initPlayerLocal.sqf?
yes
mhm, lets me open the inventory just fine
maybe it doesn't work in the eden testing or something?
@winter rose thanks but I can't even get to that point. If i click "select custom respawn position" under multiplayer in the 3den menu and run the game, then try to respawn, i get a long error and get stuck in the map screen.
can you provide the error?
imgur?
https://imgur.com/upload
or become a veteran
thats the hard route
apparently you've given variable names that lead to nowere
I can repeat this on the fly. Open a new livonia map, put down multiple respawns (respawn_west_1, respawn_west_2, etc) click to choose respawn position in multiplayer settings in 3den, and thats it
are you using any scripts in the mission?
i'm using a ton, but for troubleshooting, i just did this on a brand new map
as in any custom scripts
reason being, i've never seen this happen before
so this error happens without any custom scripts?
Can you try replicating that with just the contact addon loaded and without any mods?
Sure gimme a sec
I assume that this is one of those contact addon incompatabilities
i assumed that too, but then i just ran livonia without the "DLC" and had the error. I'm going to unplug all mods and try again
odd
Hmmmmmm. With all mods uninstalled i don't get the error. Now to find which one is doing it...
Odd
mods are ebol
nope I was wrong
it's the Contact DLC
now i have to figure out how to unload the "contact_ui" from my mission...
so i can use it without having the DLC checked
we talked about this
stop moving missions between contact dlc and contact platform
its gonna cause these errors
what is in the mission right now?
@smoky verge Thank you for your kind advice. I began this mission on the contact DLC before I knew better.
not trying to be mean but we already told you in #contact_discussion
@smoky verge Yes, you told me a few days ago, again, I've been working on this mission for about 3 weeks.
I believe you cannot open it anymore without Contact?
can you remove everything that is Contact-y and open it again in non-Contact Arma?
try merging the mission with an empty mission to solve all dlc and mod related issues and start fresh without having to completely start over
@winter rose I've removed all i can think of but the contact_ui is the one that's killing me.
if everything has been removed, edit (MAKE A BACKUP) your mission.sqm and remove it from requiredAddons
interesting
in previous titles, AI subordinates could activate actions added with addAction using the commanding menu
they cannot in A3
@winter rose how do i go about doing that?
open up mission.sqm with a text editor
search for addon name
delete
nvm. merging it with a blank map worked
noice!
Yes, thanks @winter rose and thanks @smoky verge
Scripting friends. Please forgive a questions from a scripting newb. I've been trying to do the research, but hitting a few stumbling blocks. My goal is add a function into a mission to change the ammo loadout in a modded artillery piece; and once I get it working in SP/MP, have it usable in a zeus-run setting as the vehicles are spawned.
I created the function (based on a sample script from the mod creator) as an sqf file. I defines the sqf in the description.ext under both class cfgFunctions and class CfgRemoteExec. Then I list [<params>] RemoteExec [<function>, Object] in the init script for the vehicle. The last bit (specifically the 'Object' argument) is giving me errors.
1> should I class the function as both Function and RemoteExec, or only one? Or more classes that I'm not aware of?
2> Is remoteExec correct, and what is the actual string I should put in the 'Object' line if I want the code to be executed on the machine where the vehicle is local? Does it have to be the specific vehicle's "name", or can I use a pointer like "_this" or similar?
3> Perhaps beyond the scope of the initial question, but once I have it working, is it possible to bind it to a vic in a mission so that it executes when the vic is placed by a zeus (i.e. not on pre-existing assets, but things taken from the spawn menu that don't exist at mission or server start)?
Hi, im trying to create some form of spawn system, i have succesfully got it to choose a random marker to teleport the player to but id like to make it so the player gets teleported to a random building with a certain distance of the marker, this is what i have so far:
spawnBuildings = ["jbad_House_c_10", "jbad_House_c_3"];
if (playerSide isEqualTo resistance) then {
indepSpawn = selectRandom ["indep_respawn1", "indep_respawn2", "indep_respawn3"]
};
//player setPos getMarkerPos indepSpawn;
playerPos = nearestObject[getMarkerPos indepSpawn, spawnBuildings, 50];
player setPos playerPos;
cutText [" ", "BLACK IN", 3];
_camera = "camera" camCreate (getpos player);
_camera cameraeffect ["terminate", "back"];
camDestroy _camera;
"dynamicBlur" ppEffectEnable true;
"dynamicBlur" ppEffectAdjust [100];
"dynamicBlur" ppEffectCommit 0;
"dynamicBlur" ppEffectAdjust [0.0];
"dynamicBlur" ppEffectCommit 4;
closeDialog 1;
Thanks in advance for any help.
I think you're meaning to use nearestObjects there instead of nearestObject. fix that up and you can just use selectRandom to select a random nearby building, like you do for markers.
playerPos = selectRandom nearestObjects[getMarkerPos indepSpawn, spawnBuildings, 50];```
you may want to rework that script a little though, because if the playerside isnt independent it will error (unless indepSpawn is also defined elsewhere)
I’ve got a different spawn system for the other sides they just spawn directly on markers with code executed from a dialog directly
But thanks for the help I’ll give it a go in the morning!
I am trying to create a "zone" ellipse around a marker. How do i get that to happen?
_marker = createMarker ["dropMarker", position _crate];
_marker setMarkerShape "ICON";
_marker setMarkerType "hd_destroy";
_marker setMarkerText "Air Drop";
_marker setMarkerColor "ColorWhite";
_marker setMarkerSize [0.5,0.5];
_marker2 = createMarker ["zone", position dropMarker];
_marker2 setMarkerShape "ELLIPSE";
_marker2 setMarkerColor "ColorRed";
_marker2 setMarkerSize [5,5];
_marker2 setMarkerBrush "DiagGrid";
thats what i have but it does not work. The first marker creates just fine
is dropMarker a defined variable?
so position dropMarker wont work
change it to position _crate like the first marker
that snippet works for me. is there already a marker called "zone"?
Good morning, or whatever time you are all living in :D
I am about to start working on a script to add some radiation hotspots to a mission so players have to use CBRN gear when they want to go inside those areas and I'm wondering what the best mechanism for detecting them would be
I had a prototype that used a trigger which spawned and removed a script to add tick damage when the player entered or left the trigger area, but that doesn't work well with overlapping hotspots
my second idea was to just have a script always running on the client that checks for game logic objects with a certain variable set using nearObjects, but I'd need a radius of at least 500 meters for that
any other ideas, or should I just go with one of those two?
yea, inArea
if you use rectangle/ellipse for 'defining' your area on the player's map you can use that to check if they are in the area
hmmm... would that have any advantage over just calculating the distance to the hotspot?
the part I'm trying to avoid the most is having some script running a loop even when there's no hotspot nearby
@solar chasm the remoteExec of a function takes a string as an argument, so "tag_fnc_functionName", between quotes
well i think that calculating the distance to the hotspot is less performant than your previous ideas
triggers are quite annoying to deal with (in my experience) and the near objects wouldnt be very performant
but imo the inArea is just a neat way of doing it, even if you need to do a while loop
would running it once per second with a radius of like 100 to 300 be a performance problem though?
I can also increase the sleep to 5 if there's no hotspot nearby
wdym the radius? you could just measure the distance between the player and the center of the hotspot?
I have to find the hotspots first though 😄
for now they're just game logic objects with a "contamination_level" variable set
ohhh i get you, so are you not using a marker for these hotspots?
nope
if so your nearobjects is your best bet I think
ideally I want them to be dynamic
so I can also spawn hotspots with a halflife that despawn if I ever feel like it 😄
why not add the logics to an array of hotspot logics, then check the distance to each one?
I was considering that just now
that way u are specifically checking against the logics you have spawned rather than any nearobject, logic or otherwise
then the hotspot would need to have more logic of its own though
not really
hmmm...
where would I save the hotspot array though?
all I can think of is a filthy global variable
nothing wrong with global variables
lots wrong with global variables, actually
I'm not against using them per se
I just like to avoid it whenever possible 🙂
one wont hurt
well, in that case assign the variable to something else?
I'll add that to my list of reasons why Arma 4 should use Lua for scripting /offtopic
is there actually a way to benchmark how long the nearObjects takes?
yea, the code performance button on the debug console
imo it doesnt make sense to be searching for a logic if you already know it is spawned somewhere, but you do you
hmmm...
guess I'll write your idea of caching the hotspots in an array into a comment and go with Donald Knuth for now
premature optimization is the root of all evil
someone did read the wiki!
wiki?
that has become one of my favourite quotes
probably second after "Improve code by removing it"
https://community.bistudio.com/wiki/Code_Optimisation 😉
Then you are cultured in the good areas
🙂
so far spawning the script 20 times from the debug console doesn't even change my FPS by one
bottom-left "timer" button will run the code 10000 times and benchmark it (the execution itself, not the actual spawn running)
I will try that then, thanks 😄
0.039 ms
guess I'mma just go with this then 🙂
And now is the moment when you all cringe because I tell you it's for an altis life server ;D
Is there away to figure out vectorDir and vectorUp from vectorFromTo?
I'm trying to make objectA to point to objectB. Apparently I can calculate all I need manually working with sin/cos, but I'm looking for a more engine-optimized way.
I benchmarked the (position player) nearObjects [ "logic", 300] select { shenanigans }; that I use to find the objects 😄
okido, then all good!
@quartz pebble in dev there is https://community.bistudio.com/wiki/BIS_fnc_transformVectorDirAndUp
there is this in current version
https://community.bistudio.com/wiki/BIS_fnc_setPitchBank
and I don't know much more 😅
Yep, I saw it. But so far I decided to go with manual sin/cos. Tx.
GL, because this is clearly not my 🍵
_obj = getItemCargo _test select 0;
hint format ["%1", _obj];```
returns error
what am i doing wrong?
whats the error
generic error in expression
i imagine this might help _obj = getItemCargo (_test select 0);
oh yeah .... silly me
hmmm... is there some way to detect when a player equips some gear?
like one of those fancy CBRN masks and such
I've had a look at the event handler list, but there's nothing related to equipping/unequipping items
you'd be doing some kind of loop for it
I feared that might be the case...
not "equip" per se, but you can e.g check if the headgear has changed
if he takes it in his inventory then equips it, you're doomed
hmmm... yeah, guess I'm gonna go with the loop then xD
yup, way safer (and no EH for that)
Does anyone have a good example on how to make AI say custom sentences (out of standard radio protocol words)?
Trying to make a scripted AWACS in mission, but cannot grasp how I can define custom sentences for kbTell (using existing words)
I am looking at it right now. Trying first without an argument. Here's what I got so far:
description.ext
class CfgSentences
{
class AWACS
{
class Contact
{
file = "awacs\contact.bikb";
#include "awacs\contact.bikb"
};
};
};
Mission file awacs/contact.bikb:
class Sentences
{
class ContactReport
{
text = "Contact at";
speech[] = { Contact, at1 };
actor = "awacs";
class Arguments
{
//class Team { type = "simple"; }; // refers to %Team, first element of speech[]
//// "RequestingCloseAirSupportAtGrid" is part of Radio Protocol
//class Location { type = "simple"; }; // refers to %Location, last element of speech[]
};
};
};
class Arguments {};
class Special {};
startWithVocal[] = { hour };
startWithConsonant[] = { europe, university };
There's an HQ entity called 'awacs', but calling ["Contact", "AWACS"] spawn BIS_fnc_kbTell; does not seem to do anything
Hm, changing HQ entity to actual soldier helped. Wouldn't have thought
Now to get it working over radio..
I'm not 100% sure if this is the right place to ask, apologies if it's not.
I have a script setup and working in: initPlayerLocal.sqf for a mission.
Was wondering if there is a tutorial/easy way to convert it to a Server Side Mod so it runs the on every mission?
Now to get it working over radio..
Anyone knows how I can force sentence to be played over radio and not directly?
["Contact", "AWACS", "", true] spawn BIS_fnc_kbTell;and/or settingchannel = 4in.bikbdo not seem to help
there is no channel parameter in bikb 🤔
According to code of BIS_fnc_kbTell, there seems to be:
//--- Custom channel
_noChannel = false;
private _channelCfg = gettext (_cfgSentences >> _sentenceId >> "channel");
if (_channel isequalto false && _channelCfg != "") then {_channel = _channelCfg}; //--- When undefined, use config channel
Or rather, that's CfgSentences parameter, but since I'm using an #include anyway...
Got it working using plain kbTell though, was missing kbAddTopic
oh well, time to document it then!
Wish I could :(
Registraion of new accounts for the Community Wiki has been temporarily suspended. We apologize for the inconvenience.
(sic)
I was talking about myself 😉
Ah, splendid
Splendid\™* 😄
Hi, i sent a message in here early this morning asking for help with an issue i was having, after applying the change that was mentioned i am recieving an error and cannot figure out what it means, the error is: https://gyazo.com/98ba0d0f39cbb37db16b47d472981236 and the code used is:
spawnBuildings = ["jbad_House_c_10", "jbad_House_c_3"];
if (playerSide isEqualTo resistance) then {
indepSpawn = selectRandom ["indep_respawn1", "indep_respawn2", "indep_respawn3"]
};
//player setPos getMarkerPos indepSpawn;
_playerPos = selectRandom nearestObjects[getMarkerPos indepSpawn, spawnBuildings, 50];
player setPos _playerPos;
cutText [" ", "BLACK IN", 3];
_camera = "camera" camCreate (getpos player);
_camera cameraeffect ["terminate", "back"];
camDestroy _camera;
"dynamicBlur" ppEffectEnable true;
"dynamicBlur" ppEffectAdjust [100];
"dynamicBlur" ppEffectCommit 0;
"dynamicBlur" ppEffectAdjust [0.0];
"dynamicBlur" ppEffectCommit 4;
closeDialog 1;
Once again any help is greatly appreciated
getMarkerPos "indepSpawn",
at a guess I'd say your nearestobjects is returning an empty array, selectrandom is selecting nil and therefore _playerPos is not defined. but idk for sure.
Do not use global variables.
private _spawnBuildings = ["jbad_House_c_10", "jbad_House_c_3"];
private _playerPos = selectRandom nearestObjects [getMarkerPos "indepSpawn", _spawnBuildings, 50];
Then, you want to use objects as coords for setpos? :)
_playerPos contains object in your case.
private _playerPos = getpos (selectRandom nearestObjects [getMarkerPos "indepSpawn", _spawnBuildings, 50]);
But it is better to check if the array is not empty:
private _indepSpawn = "";
if (playerSide isEqualTo resistance) then {
_indepSpawn = selectRandom ["indep_respawn1", "indep_respawn2", "indep_respawn3"]
};
private _spawnBuildings = ["jbad_House_c_10", "jbad_House_c_3"];
private _objects = nearestObjects [getMarkerPos _indepSpawn, _spawnBuildings, 50];
private _playerPos = getpos player;
if (count _objects > 0) then {
_playerPos = getpos selectrandom (_objects);
};```
indepSpawn is a variable not a marker
then
at a guess I'd say your nearestobjects is returning an empty array, selectrandom is selecting nil and therefore _playerPos is not defined.
what @robust hollow said ^ @jagged elbow
"and therefore _playerPos is not defined" - this is what Prent's log says, and it is obvious.
He should use marker name, or another correct position.
"indepSpawn is a variable not a marker" - variable can contains marker names.
right, but doing getmarkerpos "indepSpawn" doesnt get the contents of the variable
This is what I said before.
your snippet didnt reflect it but i see you've fixed it now 👌
Thanks for all the help, its very appreciated, i tried to use the snippet from @unreal scroll , there are now no errors however the player doesnt get moved instead just stays where it was.
yea because there are no near objects
Hey, I would got a small question as well. I am currently trying to do a livefeed. This is my script so far:
cam1 = "camera" camCreate [0,0,0];
cam1 cameraEffect ["Internal", "Back", "man1rtt"];
cam1 attachTo [source1, [0.12,0,0.18], "head"];```
So it basically works quite fine. but I noticed that the camera is only rotating on the Z axis. Does anyone know how you make it so it gets the EyeDirection of source1 and applies it to the cam1?
@jagged elbow Check the nearestobejcts with nearestObjects [getMarkerPos "indep_respawn1", ["jbad_House_c_10", "jbad_House_c_3"], 50]; for all your markers
Sorry if this sounds stupid, still very new at this, what do you mean by check the nearestObjects?
run that little snippet in debug to see if it returns any objects
If there is an empty array you get in output, then try to use empty objects array - maybe you use incorrect classes:
nearestObjects [getMarkerPos "indep_respawn1", [], 50];
Also check the markerpos - does it correct?
so when i run nearestObjects [getMarkerPos "indep_respawn1", ["jbad_House_c_10", "jbad_House_c_3"], 50]; in the debug console it finds the buildings, but only the ones placed by me in the editor and not the existing map objects, is there a way to find the class names of the buildings already on the map, im using a modded map btw.
@jagged elbow https://community.bistudio.com/wiki/nearObjects
nearestObjects finds only objects that are entities - it means what you said exactly. Standard buildings at the map are not entities.
ah, so would there be a way to look for the map objects? i essentialy want to pick a random city using the indep_respawn1, indep_respawn2, indep_respawn3 markers and teleport the player to a random building within a certain distance from the marker
"and teleport the player to a random building within a certain distance from the marker"
Then most probably you will need this: https://community.bistudio.com/wiki/BIS_fnc_buildingPositions
hi everybody. I'm trying to create a weapon workbench script.
I want to place the player's current weapon on a table.
So, I create a variable: _pWeap = currentWeapon player;
And after that a table with an id: workb_table
Then use that syntax:
_pWeap setposATL [getPosATL workb_table select 0, getPosATL workb_table select 1, ((getPosATL workb_table select 2)+0.83) ];
_pWeap attachTo [workb_table];
But it doesn't works. The program shows me that error:
_pWeap |#|setposATL [getPosATL workb_table select ...'
Error setpostatl: Type String, expected Object
the error being Type String, expected Object
currentWeapon returning a String.
@tough abyss You don't need to setpos. attachTo is enough, but your syntax is wrong.
Also you can't attach your weapon directly. Your weapon is not a world object. You need to create WeaponHolder.
- Create a WeaponHolderSimulated
- Put a weapon in it, with all attachments
- Remove player weapon
- Use attachTo: https://community.bistudio.com/wiki/attachTo
ufff i'm very noob scripting, how can i create a WeaponHolderSimulated?!
createVehicle
_pWeap = createVehicle ["WeaponHolderSimulated", [0,0,0], [], 0, "CAN_COLLIDE"];
I'm on the right direction?!
@tough abyss
"I'm on the right direction?!" - yes.
The syntax: _holder = createVehicle ["WeaponHolderSimulated",_pos, [], 0, "CAN_COLLIDE"];
Then you will need to drop your weapon with attachements and ammo to _holder container.
Try the "DropWeapon" action, but in general your idea is hard to impelement for beginners without reading manuals/command description, and it is ~90% of success.
Also you can try _holder addWeaponWithAttachmentsCargoGlobal [_your item, 1]; and then remove your weapon.
Something like this?!
{hide_attach_crate addWeaponcargo [_x,1];player removeWeapon _x} forEach (primaryWeapon player);
it's simply for a weapon without accessories
now I need the final part, place the moved weapon into the holder on the table
Hey peeps whats the best way to give vehicle unlimited ammo?
unti now, I have this:
_holder = createVehicle ["WeaponHolderSimulated",_pos, [], 0, "CAN_COLLIDE"];
{hide_attach_crate addWeaponcargo [_x,1];player removeWeapon _x} forEach (primaryWeapon player);
_pWeap attachTo [workb_table];
hide_attach_crate - use the local variable, like _hide_attach_crate.
And why forEach? AFAIK there can't be more than one primaryweapon 🙂
_pWeap attachTo [workb_table]; - did you read about the command syntax? 🙂
Then, you create _holder, but trying to attach something to undifined object.
private _weapon = primaryWeapon player;
_holder addWeaponcargo [_weapon,1];
player removeWeapon _weapon```
@oblique arrow fired eventhandler to se ammo in magazine to full after each shot perhaps
it shows me an error of undefined _pos variable
Hi, currently just looking through some scripts hoping to gain some more understanding and came accross this: ```sqf
_pos = getMarkerPos "PlayZone";
_size = getMarkerSize "PlayZone";
_size = _size select 1;
_size = _size/2;
Wondering if anyone could explain what `_size = _size select 1;` and `_size = _size/2;` mean?
_size is result of getMarkerSize, which returns an array. _size = _size select 1 assigns second value from array to that variable (instead of array itself), _size = _size/2 divides that value by 2 and assigns into same variable
Yay, I got the dynamic AWACS phrases working. https://www.youtube.com/watch?v=aB9O3dUL4CI thanks to extensive documentation
I see, thanks for the explanation
@unreal scroll what does this "_pos" refer to?
Position where you want to spawn the object.
Theoretically, you can spawn anywhere - attach command will place it at relative coordinates from parent object.
But for dedicated you can get some bugs with it. If you're not using dedicated - don't care about this. Just spawn it where you want. I.e. [0,0,0]
in my case i want to spawn it at the same coordinates of the placed table that i want to use as a workbench, is it possible?!
I don't recommend it, as sometimes you could see its turning on the table. Spawn it somewhere you can't see, and attach.
well, until now, I've this.
private _weapon = primaryWeapon player;
_holder = createVehicle ["WeaponHolderSimulated",[1,1,1], [], 0, "CAN_COLLIDE"];
_holder addWeaponcargo [_weapon,1];
player removeWeapon _weapon;
_weapon attachTo [workb_table];
_weapon attachTo [workb_table];
Firstly, not _weapon 🙂 You need to attach _holder.
Secondly, again: read the command manual we gave to you 🙂
It is essential
well, as I undestand I need to add the position relative to the objecto to attach, right?!
jmm something doesn't work, there's no error message, but the weapon doesn't appear on the attached table
private _weapon = primaryWeapon player;
_holder = createVehicle ["WeaponHolderSimulated",[1,1,1], [], 0, "CAN_COLLIDE"];
_holder addWeaponcargo [_weapon,1];
player removeWeapon _weapon;
_holder attachTo [workb_table,[0.5,0.5,0.5]];
Does workb_table variable contains the real object? Check it, for example
player setpos (getpos workb_table)
Also, try to add some time for weapon to be added to holder.
sleep 1;
player removeWeapon _weapon;
_holder attachTo [workb_table,[0.5,0.5,0.5]];```
Finally, I think it works, so do u know if it's possible to rotate the attached weapon on the table?!
Of course. Try to experiment. If you need only yaw rotation, try setDir before attaching.
Depends on what you want. Is I remember, after attaching it will use the parent object orientation, and its axis.
Hi guys, so I have a trigger that BLUFOR players activate a trigger. However, they will have air support which i don't want prematurely popping a trigger. Is there code so that the trigger will not pop for blufor players in a helicopter?
I could use trigger height I know, but there's been glitches where players survive impossible to survive crashes that could still pop the trigger
Maybe this can help @dry tendon https://forums.bohemia.net/forums/topic/186677-checking-if-a-player-is-in-a-vehicle/
It's a server only trigger, so does it check "player" variable?
I don't know much about this forgive me if it's a stupid question
Mmh not sure about that actually
Hey guys, Anyone know of a script to make all buildings/trees on my map indestructible / take no damage? Most objects I placed in Terrain Builder
Make them simple objects?
@dry tendon "It's a server only trigger, so does it check "player" variable?" - of course no.
You should use allplayers array to find the player on a server.
"Make them simple objects?"
It will disable all doors.
But if it doesn't needed, then it is the best way to keep perfomance level.
I'm not trying to find a specific player
@dry tendon ```sqf
this && (({_x isKindOf "Car"} count thisList) > 0 || ({_x isKindOf "Tank"} count thisList) > 0 || ({_x isKindOf "Armored"} count thisList) > 0)
pretty sloppy so if someone wants to make a tidier version, go ahead, but put this in the condition of the trigger
this && !({_x isKindOf "Air"} count thisList > 0)
might be better now that i think about it
That looks perfect thank you
anyone able to recommend a script that i can use to have buildable structures a little like how bulwark has it im working on a a mission and one of the aspects is going around and setting up road blocks and id like the players to be able to build the gates, barricades and bunkers themselves then have a trigger go off when the required items are built in the areas, im pirtty good a being able to figure how scrips are working and bend them to my will just dont know where to start when building anything from the ground up
hey, im making a script to drop money when someone dies and add an action to the money. here's my onPlayerKilled.sqf
_deathLocation = getPos _player;
_moneyObject = "Land_Money_F" createVehicle _deathLocation;
[_moneyObject, ["Pickup", {[_moneyObject] call crimilo_fnc_moneyPickup}, [], 6, true, true, "", "(_this distance _target) > 3"]] remoteExec ["addAction", 0, true];```
moneys get created correctly, problem is the addaction never gets added. someone knows where is the problem?
also, should i pass arguments the way i made it (`[arguments] call functionName`) or should i pass them trough `addAction` arguments parameter?
have you got that > the right way around? that condition is if you're more than 3m away

should i pass arguments the way i made it ([arguments] call functionName) or should i pass them trough addAction arguments parameter?
personally, i'd do it through the way you've done it since it's just easier to read, but i don't think it makes too much difference at the end of the day
it makes the difference by how u select it in your function, because the way i made it allows me to use params. passing it trough addaction parameter force me to use _this select 3 select index i guess
that's what i meant; easier to deal with imo when you do it that way
Hi, im attempting to create a script that randomly spawns checkpoints with random groups of units and creates a task along with it, i have managed to get this to work the way i intended however i am trying to use an event handler to switch the task state to complete once all units have been killed but i recieve this error: https://gyazo.com/eecd4c94e8944ace30f71cb91414ec12
the code i have wrote is as follows: ```sqf
private _title = "Take Out The Checkpoint!";
private _description = "Kill The Checkpoint.";
private _waypoint = "checkpoint";
//groups
_group1 = ["rhsusf_army_ocp_rifleman_10th","rhsusf_army_ocp_rifleman_10th","rhsusf_army_ocp_rifleman_10th"];
_group2 = ["rhsusf_socom_marsoc_teamleader", "rhsusf_socom_marsoc_teamchief", "rhsusf_socom_marsoc_sarc", "rhsusf_socom_marsoc_cso"];
_group3 = ["rhsusf_socom_marsoc_sniper", "rhsusf_socom_marsoc_spotter"];
_groups = selectRandom [_group1, _group2, _group3];
//markers
_markers = selectRandom ["checkpoint1", "checkpoint2", "checkpoint3"];
//create group
_groupWest = createGroup west;
_groupWest = [getMarkerPos _markers, west, _groups] call BIS_fnc_spawnGroup;
_vehicle1 = "rhsusf_m1025_d_m2" createVehicle getMarkerPos _markers;
//create Task
private _title = "Take Out The Checkpoint!";
private _description = "Kill The Checkpoint.";
private _waypoint = "checkpoint";
private _myTask = [player, ["task1"], [_description, _title, _waypoint], _markers, 1, 2, true] call BIS_fnc_taskCreate;
//complete task
_groupWest addMPEventHandler ["MPkilled", {["task1","SUCCEEDED"] call BIS_fnc_taskSetState}];
Any help is greatly appreciated.
the syntax for addMPEventHandler is that it requires a player object, you’ve used a group
ah, is there any way to set a task state to succeeded without using an event handler?
Not sure, but you could use a for each loop and units _groupWest
To assign each player with an event handler
ill look into that thanks for the advice
{ _x addMPEventHandler ["MPkilled", {["task1","SUCCEEDED"] call BIS_fnc_taskSetState}]; } forEach units _groupWest;
This worked perfectly for me. Thanks for the help! @spring lodge
I'm trying to get a unit to walk to a chair so I can play the SIT animation in it, but he won't walk within 5 m of it when using doMove or waypoints. Is there any way to force unit to walk to a position?
I'm sure I can get precise movement when using squad command, how can I replicate this precision with sqf?
yeah but its not accurate sadly
i set it in editor to 0, 1 or 0.1 it still completes within 3 m or so
I want to to walk to an exact spot, but it seems its not really possible :/
i have to use setPos to move them the last few meters which looks bad of course
oh thx@robust hollow
and then you'll want to delete it from this channel otherwise you get done for double posting
@ebon ridge I had a similar issue with getting units to run in a very strict formation for an intro sequence. The most precise method requires using the walking animations a set number of times. PM me if you don't manage to Google it.
Looking for someone to help me debug a mission, one or two errors left to find in the script simply out of my capabilities, namely the h_cam functions, turning the screen black upon loading then getting stuck on a wait until, can't remove the script, tried, just causes more errors because the scripts are all interlinked to work properly, any help appreciated
where is the code @stark granite ? we cannot help if we don't see it
Right on, hold on I'll get an rpt generated and find the code that's messing me up
So im getting (bellow) allot, but that dosent seem to be the main issue, paste bin to follow
11:07:57 Error in expression <]] call ace_common_fnc_canInteractWith} >
11:07:57 Error position: <>
11:07:57 Error Missing )
Shoot with the mouse in a static screen. I want to find a way of shooting with a static screen. The screen doesent move when you move your mouse only the haircross moves and when you click the left mouse button it shoots.
You can see a short example of what im trying to do in the movie below.... https://www.youtube.com/watch?v=_0z9R86-pR8
This seems to be a main issue
@vague perch Take a look at the deadzone setting (I think it was)
https://pastebin.com/yGh5DbKd My other issue, I belive this is the error causing the screen to turn black
@vague perch Take a look at the deadzone setting (I think it was)
@oblique arrow So, you think I can get a deadzone over the whole screen? Where do I find Deadzone... hmmmmm
@stark granite missing ) it is
Where abouts?
I havent even edited those scripts xD And they work perfectly before I ported them Sad times....
somewhere in the code
Ill find it, thanks
I like to help
Hey I am rather new to the whole scripting thing. But I am currently trying to create a livefeed script. This is what I got so far:
cam1 = "camera" camCreate [0,0,0];
cam1 cameraEffect ["Internal", "Back", "man1rtt"];
cam1 attachTo [source1, [0.12,0,0.18], "head"]; ```
The problem I got is that the camera only turns on the Z-axis though. Does anyone have an idea on how to fix that?
Mmh i think Killzone Kid has a good camera live feed script, might be worth taking a look at that
thanks for the quick response. I actually used the killzonekid script for what I got so far. But because he uses it on a drone and I was planning to have a helmet-cam kind of thing I didnt really found any more input that helped me with that in his tutorial.
I was thinking it might be possible to connect the camera to the head the same way vanilla does it with helmets. But I am not sure if that is too complicated
Is there a way to prevent airdropped objects from drifting laterally?
Tried setVelocity but it didn't seem to do anything.
turn off the wind
I'm rather upset. Thank you lol
@unreal scroll Hi, did you konw if there's any way of changing that weapon _holder that I have attached to the table for another weapon type?!
@tough abyss Hm... Don't know. Theoretically it should change its model appropriately, depending on what you put inside.
Hey all. So i have a simple script to keep the respawn point on a squad member when a player dies. It works fine on a Hosted server, but does not work on the dedicated one. See below. if (alive player_1) then { "Respawn_West_1" setMarkerPos getpos player_1; "Respawn_West_1" setMarkerText "Squad Location"; }; if (alive player_2) then { "Respawn_West_1" setMarkerPos getpos player_2; "Respawn_West_1" setMarkerText "Squad Location"; }; if (alive player_3) then { "Respawn_West_1" setMarkerPos getpos player_3; "Respawn_West_1" setMarkerText "Squad Location"; }; if (alive player_4) then { "Respawn_West_1" setMarkerPos getpos player_4; "Respawn_West_1" setMarkerText "Squad Location"; }; if (alive player_5) then { "Respawn_West_1" setMarkerPos getpos player_5; "Respawn_West_1" setMarkerText "Squad Location"; }; if (alive player_6) then { "Respawn_West_1" setMarkerPos getpos player_6; "Respawn_West_1" setMarkerText "Squad Location"; }; if (alive player_7) then { "Respawn_West_1" setMarkerPos getpos player_7; "Respawn_West_1" setMarkerText "Squad Location"; }; if (alive player_8) then { "Respawn_West_1" setMarkerPos getpos player_8; "Respawn_West_1" setMarkerText "Squad Location"; };
oh
thanks
{
"Respawn_West_1" setMarkerPos getpos player_1;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_2) then
{
"Respawn_West_1" setMarkerPos getpos player_2;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_3) then
{
"Respawn_West_1" setMarkerPos getpos player_3;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_4) then
{
"Respawn_West_1" setMarkerPos getpos player_4;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_5) then
{
"Respawn_West_1" setMarkerPos getpos player_5;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_6) then
{
"Respawn_West_1" setMarkerPos getpos player_6;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_7) then
{
"Respawn_West_1" setMarkerPos getpos player_7;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_8) then
{
"Respawn_West_1" setMarkerPos getpos player_8;
"Respawn_West_1" setMarkerText "Squad Location";
};
/```
i call the .sqf with a trigger for each player, which the condition is !alive player_1 (and !alive player_2 for the next trigger and so on)
not sure why my code isn't highlighted
because you put a line break before the sqf
```sqf
/* your code */
hint "yes!";
```
↑↓
/* your code */
hint "yes!";
if (alive player_1) then
{
"Respawn_West_1" setMarkerPos getpos player_1;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_2) then
{
"Respawn_West_1" setMarkerPos getpos player_2;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_3) then
{
"Respawn_West_1" setMarkerPos getpos player_3;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_4) then
{
"Respawn_West_1" setMarkerPos getpos player_4;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_5) then
{
"Respawn_West_1" setMarkerPos getpos player_5;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_6) then
{
"Respawn_West_1" setMarkerPos getpos player_6;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_7) then
{
"Respawn_West_1" setMarkerPos getpos player_7;
"Respawn_West_1" setMarkerText "Squad Location";
};
if (alive player_8) then
{
"Respawn_West_1" setMarkerPos getpos player_8;
"Respawn_West_1" setMarkerText "Squad Location";
};
and where is this code launched?
first i had it server only, then i unchecked that box, thinking that would fix it
didn't seem to
in a trigger then. put it in initServer.sqf
private _players = [player_1, player_2, player_3, player_4, player_5, player_6, player_7, player_8];
private _index = _players findIf { alive _x };
if (_index != -1) then
{
"Respawn_West_1" setMarkerPos getpos (_players select _index);
"Respawn_West_1" setMarkerText "Squad Location";
};
Lou i feel like you are Morpheus...but i am not Neo
Where is your faith, Arthur Neo?
there is, in the mint ice cream I am about to eat!
lol
lockdown and great weather, what a shame 😛
not here. windy and rainy.
@winter rose it's not working through testing in 3den...hmm
initServer.sqf , and not initServer.sqf.txt?
also, this code will only move the marker once
Yes, initServer.sqf , i think what happens is it moves it at the very beginning, when everyone spawns in. But it would need to continue to move whenever the condition is met to be effective for my purposes.
my previous triggers were repeatable so the spawn point would be wherever the squad was when a player died.
but of course they didn't work in a dedicated server environment...
[] spawn {
private _players = [player_1, player_2, player_3, player_4, player_5, player_6, player_7, player_8];
while { sleep 1; true } do
{
private _index = _players findIf { alive _x };
if (_index != -1) then
{
"Respawn_West_1" setMarkerPos getpos (_players select _index);
"Respawn_West_1" setMarkerText "Squad Location";
};
};
};
^ will check every second
you should not set the marker's text every second though
@spark rose ?
hi.how can i chek if a module is present in a scenario?
do you mean like in scenario editor, or if you're actually playing that scenario? @sturdy cape
like in "if (module present in mission) then {do something}"
@winter rose due to the storms I've lost my internet connection...
heh… sun and internet are indeed better
Yes...much sadness.
does the code do what you want though? 🙂
damn.. im really not sure, never thought i'd need something like that. I'll try to find what i can on the interwebz @sturdy cape
@sturdy cape @tough abyss I believe the following could work:```sqf
entities "moduleClass" isEqualTo []
I don't know yet, since I wasn't able to copy it before the internet went out, I will try to do it when it after I've got some house work done
okido! glhf
tell us how it's working then BAD
nearestTerrainObjects [
[worldSize/2, worldSize/2],
["MODULE CLASS NAME HERE"],
worldSize,
false
];```you just need to know which module,in my case thats enought
won't nearestTerrainObjects return a terrain object? 🤔
yes
¯_(ツ)_/¯
Is there a way to export for example, the class names & friendly (display) names of all items in a crate/arsenal - or alternatively any way to export/access a list of classnames / friendly names of a specific mod?
you can use ```sqf
private _friendlyName = getText (configFile >> "CfgWeapons" >> _weaponName >> "displayName"); // iirc
but it is doable
Hi. Can you tell me how to limit the spectator? I need the Reds to only watch the Reds. ACE spectator.
im not 100% sure, you might have options in Attributes/Multiplayer
if not you could maybe find it in addon options that may have possible instructions for ACE Spec
Thank you @winter rose
won't
nearestTerrainObjectsreturn a terrain object? 🤔
@winter rose yeah well i typo´ed there^^
ah :p ok
@copper raven thanks!
Hello, is there another way than https://community.bistudio.com/wiki/drawLine3D
to draw a thick line
unfortunately, no besides drawing many lines side by side (which might be performance-hungry)
drawLines3D is acutally not that hard on performance so would be worth a try
Not sure though if it would look fine visually
BIS_fnc_ambientAnim
This command seems to cause units to lose their gear?! Surely it should restore it once it is complete, or when I call BIS_fnc_ambientAnim__terminate?
I am also passing in ASIS to try and avoid it but it still causes them to lose their primary
Gear is removed depending on the animation that is playing.
It is however, re-added once the animation has been finished.
Alright will give it a try, thanks @winter rose @cosmic lichen
Oh, but when you create a new line3D, the old one is automatically deleted
So I think that's not possible
It is however, re-added once the animation has been finished.
@cosmic lichen I don't see where, I'm looking at the function code and there is no place that it even stores let alone re-adds the stuff it changes.
@winter rose It works, thank you. Quick question - when doing it this way - does the "sleep" command pause all code execution or just this one?
just this one loop
@compact maple I don't think so? 🤔 both drawings have to be made per drawing frame, though
don't use onEachFrame, use addMissionEventHandler @compact maple
For debug purpose I have to use onEachFrame right ?
it's easier yep
@winter rose so my understanding is the "private" command is simply assigning a local variable and preventing it from being overwritten?
in a way yes, it reserves this variable name for the current scope (and lower ones)
(you can edit your messages on Discord ^^)
_index != -1?
it means _index different of -1
okay
! is not.
!= not equal
?¿
why is "Land_MedicalTent_01_white_IDAP_closed_F" (idap medical tent closed) enterable ?
[_building] call BIS_fnc_isBuildingEnterable; return true for this one
units / agents can go inside, but players not 🤔
a question on physx forces and scripting: The Unsung A-1J Skyraider model is not aligned with the ground and drops the rear when the mission starts. Once this happens and the rear wheel touches the ground, it starts moving forward. Is there a way I can see which forces are applied to the plane by script and probably can counter them? Or would a setVelocity [0,0,0]; per frame until engine is on the best way to counter it script wise?
from the config, it works fine if I exclude the rear drop: https://cdn.discordapp.com/attachments/352085781566980099/699334508905889812/20200413210438_1.jpg
@winter rose when you spawn a script from a trigger, will that script keep running even if the trigger is non-repeatable?
yes
the trigger, once triggered, "fires" its code
if it is repeatable, it will fire it again (and if not, not, hehehe)
fantastic. I'm using while {true} to update the enemy on player's position with doMove. seems to be working
previously if the player moved after the ai was given the waypoint, and the ai was far away, player would be long gone before they ever got there
don't while true with waypoints, add some 10s sleep or something
great minds think alike! already did
seems the ground is not physx, an epecontact eh doesn't get triggered when the rear drops 😦
i need abit of help with some code
so to start of the Hints are just for testing those will be replaced with code later
so i need to check what side a player is on and i also need to be able to recheck incase there swap from blufor to opfor for example heres what i have so far but i dont think this is the best way to do
waitUntil {!isNil "preloadFinished"};
while {true} do {
waitUntil {!isNull player};
if (side player == west) then Hint "You are on the West Side";
if (side player == east) then Hint "You are on the East Side";
if (side player == ind) then Hint "You are on the Indipendent Side";
sleep 10.00;
}; ```
@lofty anchor if ( ... ) then { ... }; also ind => independent
@lofty anchor ```sqf
see pinned message for code formatting
also, then takes { }
im not sure what you mean with the if & then tbh im no scripting Veteran im sorted intermediate with my level of skill so id need a little more explanation
if (side player == east) then Hint "You are on the East Side"; // WRONG
if (side player == east) then
{
hint "You are on the East Side"; // CORRECT
};
do you mean the wrong way of formatting it as it dose work in its current state im just not sure if the while loop is the best way to check it the player swapped sides
//initPlayerLocal.sqf
switch (side player) do
{
case west: { hint "You are on the West side"; };
case east: { hint "You are on the East side"; };
case independent: { hint "You are on the Indipendent side"; };
default { hint "You are renegate"; };
};
//onPlayerRespawn.sqf
switch (side player) do
{
case west: { hint "You are on the West side"; };
case east: { hint "You are on the East side"; };
case independent: { hint "You are on the Indipendent side"; };
default { hint "You are renegate"; };
};
not tested @lofty anchor
@real tartan so how will i get it to run the onPlayerRespawn.sqf
would i need to put a execVm in for it
no, just put it in root folder of mission, it will automatically run when player respawn
ahh i see thankyou
same goes for initPlayerLocal
@lofty anchor https://community.bistudio.com/wiki/Event_Scripts
oh thankyou so much for your help im going to test now
initPlayerLocal.sqf
addMissionEventHandler ["PreloadFinished", {preloadFinished = true;}];
[] execVM "getside.sqf";```
getplayerside.sqf
```sqf
waitUntil {!isNil "preloadFinished"};
switch (side player) do
{
case west: { hint "You are on the West side"; };
case east: { hint "You are on the East side"; };
case independent: { hint "You are on the Indipendent side"; };
default { hint "You are renegate"; };
};```
onPlayerRespawn.sqf
```sqf
waitUntil {!isNil "preloadFinished"};
switch (side player) do
{
case west: { hint "You are on the West side"; };
case east: { hint "You are on the East side"; };
case independent: { hint "You are on the Indipendent side"; };
default { hint "You are renegate"; };
};```
@real tartan would this work?? as id need to wait for the player to fully initialise just thinking ahead
Hi, im attempting to create a databse using inidbi2 and im coming accross an error: https://gyazo.com/60b945b60de8a6a92af9b656ebb91ec7
I have inidbi loaded through the launcher and the code so far is as follows:
init.sqf
_clientID = clientOwner;
_UID = getPlayerUID player;
_name = name player;
checkForDatabase = [_clientID, _UID, _name];
publicVariableServer "checkForDatabase";
initServer.sqf
"checkForDatabase" addPublicVariableEventHandler {
private ["_data"];
_data = (this select 1);
_clientID = (_data select 0);
_UID = (_data select 1);
_name = (_data select 2);
_inidbi = ["new", _UID] call OO_INIDBI;
_fileExists = "exists" call _inidbi;
if (_fileExists) then {
hint "file does exist";
}else {
hint "file doesnt exist";
};
};
If anyone has any idea what is causing the error help would be greatly appreciated.
Is there anyway to nest a forEach loop and refer to the first magic variable from within the second loop, as well as the second magic varaiable. e.g.
{
{_x1 deleteVehicleCrew _x2} forEach crew _x1;
deleteVehicle _x1;
} forEach (_vehArray);
Evene better is there a way to delete the crew and vehicle from an array of vehicles?
Hi, I want to use an Unitplay function for inserting with the advanced flight model, so I could land the helo (CH-47D from RHS) on the runway and then roll to the point where the crew should disembark. Sadly I´m unable to disengage the wheel brakes so the helo crashes when it touches the runway. Could someone help please?
Or wait, I'm dumb, maybe I can just assign the _x in the first nest to a new var
yeah i was gonna say
{
_x1 = _x;
{
_x2 = _x;
_x1 deleteVehicleCrew _x2
} forEach crew _x1;
deleteVehicle _x1;
} forEach (_vehArray);
Thanks
is there a way to get the internal name of a location from the config file?
i.e.
configfile >> "CfgWorlds" >> "Stratis" >> "Names" >> "NatoBase1"
is Stratis Air Base - how does one go about getting "NatoBase1" ?
should work
_name = configName (configfile >> "CfgWorlds" >> "Stratis" >> "Names" >> "NatoBase1")
solved it: discovered a new command className 
I can force the map open, but I can't seem to find the script for moving the map's focus :/
Nvm, I'm figuring it's 'mapAnim' and related?
I suppose so yes; I never really wrapped my head around map controls
Yeah; mapAnim, set how long to wait, how fast it goes, and where it goes, then mapAnimCommit
Or rather, how fast, how close in, where it goes... the wiki is a bit unclear at times :/
we can update it
if you have a precise description, I'll gladly update the page(s)
Lemme double check so I'm sure :p
Sorry again, but I dont know why I'm getting an Undefined error for this function call.
specialArray = ["_arg1"] call fnc_specialFunction;
you are sending a string as an argument, yes
yes
I don't know the rest of your code nor do I know where the error triggers, sooo…
could you e.g post a snippet on sqfbin? or here if short (see pinned message for formatting)
It's supposed to return an array.
Init reference:
execVM "functions\fnc_specialFunction.sqf";
fnc_specialFunction.sqf:
fnc_specialFunction =
{
private ["_arr"];
_arr = [];
{
_obj = _x;
{
if ([_obj, format ["%1",_x]] call BIS_fnc_inString) then {
_arr append [_x];
};
} forEach allMissionObjects "ALL";
} forEach _this;
_arr
};
Credit for the func goes to Wolfenswan
first,```sqf
private ["_arr"];
_arr = [];
// ↓
private _arr = [];
I was correct; Time for how long to complete the move, Zoom for zoom level (which seems to run from .001 to 1, full in to full out), and location is self explanatory.
GJ! @manic sigil
yey :3
if you have wiki wishes, let's head #community_wiki
@potent dirge this code is… weird
what is the error you are getting, and what do you want this code to do?
Error undefined variable in expression: fnc_specialFunction.
It's supposed to return an array of every object containing the specified string argument.
and where is the code executed? it seems that your execVM arrives too late
execVM is run in init.sqf the function call is within a script, the script is called by the init of an in game object. What makes this more weird is that I tried it with the in game debug console, even after the error threw and the function returned properly
init field happens before init.sqf iirc
this is why you define custom functions with https://community.bistudio.com/wiki/Arma_3_Functions_Library
Wow, maybe that's it. Because I have another function with similar parameters that works perfectly but it was triggered by a trigger later on in game.
this is it, actually ^^
and of course the debug console happens once everything has been initialised, so you can't see that it didn't exist at the time
Thanks you've saved me, I might actually sleep tonight
pulled hairs from other people don't have to be re-pulled by others 😄
back again 😅
I'm getting a Type string expected Bool error for this line:
_this select 0 addAction[
...
];
_this is the parameter for the script. The script was executed in an object init by
0 = [this] execVM "scripts\choosePlan.sqf";
Which is strange because _this select 0 is neither bool nor string, and addAction doesn't even accept string
the solution might be in the ... @potent dirge
also, use params whenever possible
I've finished debugging each parameter and I think I figured it out. Somehow the radius parameter is only accepting string and not number? Using any number value throws Expected String error even though the Biki description says it only takes number
Wait no this is wrong I missed one param. Clear sign I need to sleep. Good night
@jagged elbow https://www.youtube.com/watch?v=J8Ae9yrqAyM great video on how to use inidbi
is there function to get "select one from array"? _one = (_array select { code }) select 0;
Is there an easy way to detect if an object is a map object?
I would assume isKindOf but there isn't really a base class I can use for saying type of map object
@tiny wadi maybe the smallest nearestTerrainObjects search ever yes ^^
thats actually what i've ended up resorting too
seems like a waste tho
in performance
not if you use the object's position and the smallest radius?
private _isTerrainObject = {
params ["_object"];
private _terrainObjects = nearestTerrainObjects [_object, [], 0.1];
private _result = _object in _terrainObjects;
_result;
};
```@tiny wadi
yeah no need to grab the whole map for comparison, I am behind you on that one 😄
though an isTerrainObject would be nice… 🤔
not too late to ask!
haha it might be 🤔
but yeah nah i did a 4meter radius check initially for mine
the 0.1 will be much better
is there function to get "select one from array"?
_one = (_array select { code }) select 0;
@real tartan this…? also, be sure to cover the case where the array is empty
@lucid valve how do you execute unitPlay?
also, have you tried with a vanilla airplane?
Hey I send a message here earlier this week. But I got another quick question. I used the tutorial from killzone kid to create a livefeed which I wanted to use as a helmetcam. All good so far, works fine. But when I wanted to use it in multiplayer I noticed that only the character sending the feed is able to see it on screens. Now my question: Is the script working clientside only or what error may I have done?
cam1 = "camera" camCreate [0,0,0];
cam1 cameraEffect ["Internal", "Back", "man1rtt"];
cam1 attachTo [source1, [0.12,0,0.18], "head"];```
it is indeed clientside only
not because of the setObjectTextureGlobal, but because the camera is a local object I believe.
try to remote exec a function on each client for best results @queen junco
@winter rose thanks for the fast answer. I am not that into arma scripting though. So am I correct if you suggest I remoteexec the script on every player?
Found a hacky workaround to my earlier problem. I was able to get the functions to work, but somehow in the process of defining description.ext, none of my mods would load so long as I had that description.ext. Maybe there's a way to define mods to load ni description.ext I don't know.
Instead I just made the object public and made the function call after execVM compiled in init.sqf and it works fine
yes
not to use ["camera", [0,0,0]] remoteExec ["camCreate"]❗
but to make one file and have it called e.g in initPlayerLocal.sqf
okay, thanks ^^
@queen junco don't forget, some players have PiP disabled too 😉
This may not be the correct channel to ask in but I've heard somewhere that AI units spawned by a Zeus are processed on the Zeus' machine instead of the server, kind of like a Headless client. Is this true?
I don't think this is true
Yes thats true
Is it possible to avoid it trough scripting?
you can setGroupOwner
Alright, thanks for the lead
wb, "Dedmen"! ^^
@still forum in new update is changed something with inventory?
what mean
i tryed to fix duplicating backpacks with loot a few days ago - duplicating is worked
now - not working
so i understand is fixed with update?
depends on what method you used
there is a fix for a method that was used on dev branch. but not in todays update
can i send u pm with screenshots?
is it related to sitting in a vehicle?
yes, but not only inside vehicle (u can do that from outside)
How can I handle JIP player connection but on client side?
initPlayerLocal.sqf ?
@still latch do you mean "if someone else connects, other players should get notified"?
if so, possibly an addMissionEventHandler ["PlayerConnected"] on the server that would then broadcast something.
I want to create action menu entry on player connection
initPlayerLocal.sqf ?
@still forum
seems legit except that it will be executed before init.sqf where I want to define condition related value.
Hope spawn and waitUntil !isNil "var" will work in initPlayerLocal.sqf
waitUntil { not isNull player }``` ?
[] spawn {
waitUntil { !isNil "allowedUsers" };
if (player in allowedUsers) then {
player addAction .....;
};
};```
isNil
also, aren't public variables sent before the inits are run? 🤔
nothing said here
https://community.bistudio.com/wiki/Initialization_Order
@still forum, you maybe have a tip on that? ^
Hey I got another question. I am still trying to get the cam feed working in multiplayer. But after adding the script to one file beeing loaded only the last player spawned could see all cams. I assumed this is due to the camera being created again with the same variable once a new player spawned.
_retVal = if (!alive cam1) then {
cam1 = "camera" camCreate (ASLToAGL eyePos source1);
cam1 cameraEffect ["Internal", "Back", "man1rtt"];
cam1 attachTo [source1, [0.2,0,0.2], "head"];
}
else {
cam1 cameraEffect ["Internal", "Back", "man1rtt"];
cam1 attachTo [source1, [0.2,0,0.2], "head"];
};```
This was my idea on a solution. But it seems like it broke everything. Anyone got an idea?
```sqf
also, use only setObjectTexture since the script is local
you also might want to check (if not isNil "cam1")
formatting tips is in the pinned messages
receiver1 setObjectTextureGlobal [0, "#(argb,512,512,1)r2t(man1rtt,1)"];
_retVal = if (!alive cam1) then {
cam1 = "camera" camCreate (ASLToAGL eyePos source1);
cam1 cameraEffect ["Internal", "Back", "man1rtt"];
cam1 attachTo [source1, [0.2,0,0.2], "head"];
}
else {
cam1 cameraEffect ["Internal", "Back", "man1rtt"];
cam1 attachTo [source1, [0.2,0,0.2], "head"];
};```
```sqf ← line return
/* your code */
hint "works!";
```
↑↓
/* your code */
hint "works!";
yup
also, no use of _retVal here
so I see 3 variables, although none of them are the current player, and all are global:
receiver1= object which displays feed(?)cam1= camera object which is recording the feed toreceiver1source1= object on which the camera is attached
so how is this called and how are the variables defined?
-receiver1 being the screen which displayes the feed
-cam1 as you said
-source1 as you said as well
receiver1 and source1 one just being the variable name of the object in the editor
do you reuse cam1 anywhere?
source1 addEventHandler [
"Respawn",
{
_handle = execVM "livefeed.sqf";
}
];
source2 addEventHandler [
"Respawn",
{
_handle = execVM "livefeed.sqf";
}
];
source3 addEventHandler [
"Respawn",
{
_handle = execVM "livefeed.sqf";
}
];```
yes, when anyone else spawns
_handle = useless to create a variable that you're throwing away right away anyway
So basically if I dont use the if then else the feed will be displayed to the last player spawned. And I thought checking if the camera was already created could fix this issue but not sure.
Trying to make a IED explode when a AI is shot and killed, but when I do !alive it just sets of the IED straight away. How to I reverse this
Trying to make a IED explode when a AI is shot and killed
when I do !alive it just sets of the IED straight away
…what do you want to do, delay it?
When the AI is shot and killed I want a IED to explode
and what is your code…?
Im doing if {!alive x; IED setdamage 1}; But that just explodes it straight away, as its returning True.
because this is the wrong syntax, see https://community.bistudio.com/wiki/if
That code isnt working now, I was playing around with and broke it.
also: you don't want to "check if the unit is dead", you want to "wait until the unit is dead".
if is an immediate check, waitUntil is what you need
try the following
waitUntil { not alive x };
IED setDamage 1;
```given that `x` is your unit varname
Didnt work
where is this code, in a trigger?
init for the AI, should I put it in a trigger instead?
no, no
ideally, don't use init fields for MP missions
NO urgh
urgh?
if you have to use init fields, use```sqf
if (isServer) then
{
this spawn {
waitUntil { sleep 1; not alive _this };
IED setDamage 1;
};
};
I just placed it in a trigger, it works so gonna leave it as is
make it server-side ☝️
Thanks for the help, and I did.
Hey, a button on a GUI should call or spawn a script ? Whats the better way
it all depends on what you want to do with it
The script is going to change a text of a ui element
the current interface?
Yes
then call I would say, if it doesn't take ages
Ok. call just put the script at the end of the scripts list to be executed right ?
spawn execute it right away?
no, that's not that
code1 call { code2 }
code1 waits for code2 to finish
code1 spawn { code2 }
code1 and code2 run """in parallel"""
Ok got it, thanks, again
idk if this is a good channel to ask in but i dont think i can do it anyway other than script it
how can i do that players without guns will be civilians and if they take any weapon they will be back to their old faction
you can use setCaptive when they have no weapons
ok thanks
Hello every one, I have a simple question, how do I force an aircraft to drop a bomb? I tried forceWeaponFire and Fire commands
1/ how did you try them?
2/ which plane?
2/ which bomb?
You could try BIS_fnc_fire
I tried this:
driver jet1 forceWeaponFire ["pylon1rnd_FuelTanka4_w","LoalAltitude"];
jet1 forceWeaponFire ["pylon1rnd_FuelTanka4_w","LoalAltitude"];
driver jet1 fire "pylon1rnd_FuelTanka4_w";
jet1 fire "pylon1rnd_FuelTanka4_w";
maybe de name of the munition is wrong, I get it by ussing getPylonMagazines jet1; I dont know if it is the correct way to get it
oh yeah, I was using the incorrect munition, thanks @wet shadow I made it work using that function
https://discordapp.com/channels/105462288051380224/105462984087728128/699641829703942226
Aaah thats how that works and what that means, nifty
yipp yep
Does anyone know of any tutorials for extdb3? All i can find is altis life and exile tutorials and the documentation for extdb3 is slightly advanced for my current level of knowledge
I found a case where BIS_fnc_attachToRelative fails totally: I'm trying to attach Sign_Pointer_Cyan_F to Land_WoodenTable_02_large_F and it doesn't preserve orientation at all.
setVectorDirAndUp doesn't work on these Sign_Pointer_Cyan_F properly either
Is there some known bug with some objects like this?
mission with #include #include "\a3\ui_f\hpp\defineCommonGrids.inc" in description.ext works in single/multiplayer editor and fail if exported to multiplayer.
Is this known behavior? How to fix?
how does the new arsenalRestrictedItems work exactly? and what would be a better way to create a Arsenal that has limited objects?
@still latch double include is not correct, hope you have only one in your source.
Not working includes after eden export is a known issue.
You can just copy the folder and use that. Missions does not have to be a PBO
at least for an windows server.
Yep I just copied needed defines directly in description.ext. Thank you
Hey, does anyone know how I'd apply loadouts to a group of ai units? I spawn the units with
_groupWest = [getMarkerPos _markers, west, _groups] call BIS_fnc_spawnGroup;
and I tried using, but setUnitLoadout needs a Object not a Group
_groupwest setUnitLoadout [
["arifle_MX_ACO_pointer_F","","acc_pointer_IR","optic_Aco",[],[],""],
[],
["hgun_P07_F","","","",["16Rnd_9x21_Mag",16],[],""],
["U_B_CombatUniform_mcam",[ ["30Rnd_65x39_caseless_mag",2,1] ]],
["V_PlateCarrier1_rgr",[]],
["B_AssaultPack_mcamo_Ammo",[]],
"H_HelmetB_grass","",[],["ItemMap","","ItemRadio","ItemCompass","ItemWatch","NVGoggles"]
];
Regarding attachTo not working I found a related post at last that had the solution: run attachTo twice :/
_mrk attachTo [_object, _relPos];
_mrk setVectorDirAndUp [_vectorDir, _vectorUp];
_mrk attachTo [_object, _relPos];
Now it works perfectly in all cases I have tested.
If I don't run the second one it will not correctly orient objects when attaching them to some other objects, its not clear what the differentiating factor is.
This should really be in the docs somewhere as its a major bug with this function.
@upbeat grove just do that but instead run
{
_x setUnitLoadout [blahblah];
} foreach units _groupwest;
Thanks @ebon ridge, that worked splendidly. I might be pushing it here, but is there any way to give separate members of this group separate loadouts? This is my units
_groups = ["CUP_B_US_Soldier","CUP_B_US_Soldier","CUP_B_US_Soldier"];
well i guess you know they come with their own loadout when you spawn them right, based on what the class author gave them?
yea, but I'd like to give them custom loadouts separately from each other ideally
but of course you can customize all the units differently
This is my units
That looks like a list of unit classes
anyway if you make an array of loadouts you could assign random ones to each unit in the group like this:
private _loadouts = [[loadout],[loadout],...];
{
_x setUnitLoadout selectRandom _loadouts;
} foreach units _groupwest;
Or if you have 3 loadouts and want to assign it to three units you could do it like:
private _loadouts = [[loadout],[loadout],...];
{
_x setUnitLoadout _loadouts#_forEachIndex;
} foreach units _groupwest;
That will give an error of some kind if you don't have enough loadouts defined
Thanks I really appreciate it, I'll see if I can get that working
k
I have a script to make vehicles appear from the virtual arsenal that works very well in solo and once in multi and then it makes the vehicles appear normally but the other players don't see why ?
at a guess id say the vehicles are local only, but idk for sure.
or ur unhiding them locally? upload ur script so i can see what u are working with.
No the vehicles are not local I can try to send you back the script page
sure
works for me, but the best I have to test on is a local server with multiple clients of me connected, so its not identical conditions.
Okay, but I'm going to try to see if it might work.
i could do with some help if anyone could, i made a Warlords mission and i added a custom hint that welcomes the player and give my discord info i added a little scrip to wait for the player to initialise before displaying the hint but now im not able to enable AI because if i do it brakes the warlords, warlords wont start up and will display a load of errors so the only code i changed is as follows
initPlayerLocal.sqf
_iff = [units group player] execVM "a3\missions_f_exp\campaign\functions\fn_exp_camp_iff.sqf";
addMissionEventHandler ["PreloadFinished", {preloadFinished = true;}];
[] execVM "Welcomehint.sqf";```
Welcomehint.sqf https://pastebin.com/Jad4aBdJ
Hey quick question: How do I check if a player is dead in a if then command?
if (isNil source1) then {};
This is what I came up with. But it seems like it is not working.
if !(alive source1) then {};
thanks ^^
I worked around it by using addEventHandler "killed"
but thanks ^^
Is there an EH for weapon switching? I.E. Player has pistol equipped, then switches to primary?
Trying to force holster while a player is moving an attached object. I'd like to avoid using a while loop in the interest of performance
I'll take a look. Haven't really gotten into their stuff yet, thanks!
Using getObjectTextures on a vehicle works nicely. I tried this on a cargo box "Land_Cargo40_orange_F" and it returns nothing. What is the logic or what am I doing wrong?
hiddenselections i think theyre called. basically you can only get the texture if you can set it too. evidently you cant set the texture on that cargo box.
All objects are not configured with them
Thx. Seems that 'all' cargoboxes behave that way.
you can still find the texture paths. its been a while but iirc they are in the cfgvehicles object class which you can look at in the config viewer.
im not sure that applies to all objects though.
I'll just attach a sign to the container as I could change the texture on it. 🙂
is there a list of keywords for BIS_fnc_randomPos, or is it just "ground" + "water"?
there is a list, and that list is
- "ground"
- "water"
https://community.bistudio.com/wiki/BIS_fnc_randomPos
😁 yeah figured as much
I just checked the code, and there is no other "magic keyword"
technically it's just surfaceIsWater and !surfaceIsWater
how dare you reveal the dark secrets of our evil overlords…!
😆
but you can use the condition field to add additional checks (like {isOnRoad _this} in the comments of the wiki page)
I may look into that. Don't think it'll be too useful for what I'm planning though.
Basically just want to select a random position either starting from the map center, or from one of two bases (depending on which team is winning at the moment) to spawn bonus weapons & gear.
May just use two triggers & a switch/if tree to select which mode to use
Hi.
Is there any way, form the server side pov, to run a command when a mission starts, without having to edit missions init.sqf ?
eg:i want to run "myserver.sqf" at mission startup, no matter what mission is loaded or if the mission editor included something in init.sqf or not.
my best bet would be to make a mod (probably there are some to do this, already)
Help me please...
waitUntil {!(isNull player)};
waitUntil {player==player};
switch (side player) do
{
case WEST:
{
[[west], [east,independent,civilian]] call ace_spectator_fnc_updateSides;
FW_SpectatorSides call ace_spectator_fnc_updateSides;
};
case EAST:
{
[[east], [west,independent,civilian]] call ace_spectator_fnc_updateSides;
FW_SpectatorSides call ace_spectator_fnc_updateSides;
};
case RESISTANCE:
{
[[independent], [west,east,civilian]] call ace_spectator_fnc_updateSides;
FW_SpectatorSides call ace_spectator_fnc_updateSides;
};
case CIVILIAN:
{
[[civilian], [west,east,independent]] call ace_spectator_fnc_updateSides;
FW_SpectatorSides call ace_spectator_fnc_updateSides;
};
};
@lapis ivy ```sqf, see pinned message
Is that correct?
I need to prohibit surveillance of the enemy. But the script returns an error. Can you help me?
What error?
I deleted a line "FW_SpectatorSides call ace_spectator_fnc_updateSides" nd now it works.
waitUntil {!(isNull player)};
waitUntil {player==player};
```is redundant - you could simply use ```sqf
waitUntil { not isNull player };
Thanks
small question
what does this do exactly?
if ((!isServer) && (player != player)) then {waitUntil {player == player};};
I think it means that its waiting for the player to be loaded in? That'd be my guess atleast, the smarter peeps props know
the && player != player is useless
I see this basically in all multiplayer scripts so I was curious of what it did
it waits till player is initialized
in init.sqf
because init.sqf starts before player is ready
by initialized it means the player can actually see ingame?
I guessed correctly, just with the wrong wording
by initialized it means the player can actually see ingame?
no
when the unit is assigned
before that player returns objNull
waitUntil {player == player}
Sound useless for me.
true == true / false == false will always return true
Oh, so
player == objnull
Would also return false here?
yes
✍️
objNull == objNull // returns false
was looking for ways to make sure my scripts worked for the entire server and not only for the trigger activator
should I just activate the server only checkbox or do I need extra lines?
objNull == objNull // returns false
Damn, you are right.
oh thank you!!1!
but it is more readable to do ```sqf
waitUntil { not isNull player };
lol
We NEVER complete learning
…especially AI and driving 😁
waitUntil { not isNull player };
Thx, this would be my check in general. But it is also important to know how other checks would work in that case ☝️
so how do I activate a script for everyone in the server and not just for me?
though that did the job
Depends on what it does I imagine, maybe a forEach player kinda thing if it does somethig for every individual player?
as in call/spawn forEach player (not accurate Syntax)
There are special event scripts, you can create.
Check this: https://community.bistudio.com/wiki/Event_Scripts
Most Servers use:
init.sqf
initServer.sqf
initPlayerLocal.sqf
Oh ye fair, depends on when the script needs to be executed I guess
Yes, correct.
You can also do everything just within the init.sqf by a check like this:
if (isserver) then {
....
};
if (hasinterface) then {
....
};
But there are several ways to differ where a script will be called.
Help please...
@winter rose
You helped me make the call Serp unitprocessor work. But now I have another problem.
The script issues equipment at the beginning of the game and after the player respawn. But it gives respawn not to one unit, but to everyone who has one script written.
Example:
There are three units with equipment "officer_squadleader"
With respawn, it is activated on all three units, it does not matter if they are alive or not. Also, when you enter the game slot, the same thing happens.
[this,"opfor","officer_squadleader"] call SerP_unitprocessor;
if ( isServer ) then {
this addMPEventHandler ["MPRespawn", {
params ["_unit", "_corpse"];
[_unit, "opfor", "officer_squadleader"] call SerP_unitprocessor; }];
};```
How can I make one script work on several units, but for the script to give out equipment only to the unit that has just respawning or entered the game.
unitprocessor.sqf
_unit = _this select 0;
_faction = _this select 1;
_loadout = _this select 2;
_item_processor = {
removeAllItems _this;
removeAllWeapons _this;
removeAllItemsWithMagazines _this;
removeAllAssignedItems _this;
removeUniform _this;
removeBackpack _this;
removeGoggles _this;
removeHeadgear _this;
removeVest _this;
};
_unit call _item_processor;
_svn = format ["SerP_equipment_codes_%1_%2",_faction, _loadout];
if (isNil _svn) then
{
missionNamespace setVariable [_svn, compile preprocessFileLineNumbers format ["Equipment\%1\%2.sqf", _faction, _loadout]];
};
[_unit] call (missionNamespace getVariable [_svn, {}]);
officer_squadleader.sqf
comment "Добавляем Items, карту, компас, часы и рацию";
_unit linkItem "ItemMap";
_unit linkItem "ItemCompass";
_unit linkItem "ItemWatch";
_unit linkItem "ItemRadio";
comment "Добавляем униформу";
_unit forceAddUniform "rhs_uniform_msv_emr";
_unit addHeadgear "rhs_6b27m_green";
_unit addVest "rhs_6b23_digi_6sh92_headset_mapcase";
comment "Добавляем ДВ рацию";
_unit addBackpack "tf_mr3000";
comment "Добавляем бинокль";
_unit addWeapon "Binocular";
// Добавляем Items, карту, компас, часы и рацию
_unit linkItem "ItemMap";
_unit linkItem "ItemCompass";
_unit linkItem "ItemWatch";
_unit linkItem "ItemRadio";
// Добавляем униформу
_unit forceAddUniform "rhs_uniform_msv_emr";
_unit addHeadgear "rhs_6b27m_green";
_unit addVest "rhs_6b23_digi_6sh92_headset_mapcase";
// Добавляем ДВ рацию
_unit addBackpack "tf_mr3000";
// Добавляем бинокль
_unit addWeapon "Binocular";``` btw.
no need for the `comment` stuff
Okay
Anyone know how i can mute von locally from near players?
Anyone able to explain why when i kill the Ai with the variable name testAI it sets my cash variable to 200 istead of 100? Cash is initially defined as 0 so to my understanding once the AI is killed it should update the value by 100 but its updating it by 200?
execVM "shop.sqf";
_clientID = clientOwner;
_UID = getPlayerUID player;
_name = name player;
cash = 0;
checkForDatabase = [_clientID, _UID, _name];
publicVariableServer "checkForDatabase";
// player addAction ["Sync Data",
// {
// _UID = getPlayerUID player;
// _gear = getUnitLoadout player;
// saveData = [_UID, _gear];
// publicVariableServer "saveData";
//
// }];
"loadData" addPublicVariableEventHandler
{
private ["_data"];
_data = (_this select 1);
_gear = (_data select 0);
cash = (_data select 1);
player setUnitLoadout _gear;
};
player addAction ["hint cash", {hint str cash;}];
testAI addEventHandler ["Killed",
{
cash = cash + 100;
hint str cash;
}];
_saveDataScript = {
execVM "saveData.sqf";
};
waitUntil {
_until = diag_tickTime + (2 * 60);
waitUntil {sleep 1; diag_tickTime > _until;}; // wait until the timer is greater than whats time is stored in local variable _until.
0 spawn _saveDataScript;
false; // Loop waitUntil forever. Once the timing condition is met and the function has been spawned as a separate thread, it will return false and loop to the beginning of the original empty waitUntil.
};
@tough abyss can you elaborate on what your end goal is? May or may not be possible depending on what you are trying to achieve
@jagged elbow you may run your script twice. put a systemChat to be sure.
who here knows cfgFunctions
i know him. good guy.
I need help with cfgFunctions and scripts not running
ok... set the scene for us. how is everything set up? what are you working with?
@tough abyss but the wiki has
@tough abyss what other info would you want?
Greetings. To get a grasp on the modding stuff, I am currently "creating" a module that syncs to any kind of static objects and adds an action to them (through addAction). This works fine, however, any kind of "big" flag poles do not have that action applied to them.
The function that is run by the module is the following:
private _logic = param [0, objNull, [objNull]];
private _objects = param [1, [], [[]]];
private _actionDText = _logic getVariable ["ActionText", ""];
private _actionDistance = _logic getVariable ["ActionDistance", 3];
{
_x addAction [
_actionDText,
{ createDialog "CORP_TeleportDialog" },
nil,
100,
true,
false,
"",
format ["(player distance _target) < %1", _actionDistance]
];
} forEach _objects;
I have placed the module in the editor and synced a few objects to it. Namely, a camping table, an Altis map, a Flag (Checkered), a Flag (BI) and a Flag (Blue). Objects in bold are those on which the script seemingly has no effect (there is no addAction).
However, I tried to apply the same addAction to said objects in their init fields, and this worked fine.
I am consequently unable to understand what is going wrong in the function, compared to the actual "addAction" script in the init field of the objects.
hint (str _objects) clearly shows that all objects (including the flags that don't work) are listed in the _objects array
maybe the poles are simple objects somehow?
not sure if they can have actions
However, I tried to apply the same addAction to said objects in their init fields, and this worked fine.
nevermind I didn't finish reading yet
are the synced flag poles in _objects the same object as what you actually look at in game? it doesnt pull some sneaky switch-a-roo on you?
it doesnt pull some sneaky switch-a-roo on you?
Sorry, I don't understand that.
are the synced flag poles in _objects the same object as what you actually look at in game?
Is there a way I could confirm that?
