#arma3_scripting
1 messages ยท Page 483 of 1
ha yea saw that
Still, why do you need that?
As far as i underatand if there is a person that can oerform action must say something before going for it?
Or alert player or hint, that action is awailible?
Hi, can someone help me with this? :
i want to reduce the reloading time of a tank im sitting in.
"player addEventHandler ["FiredMan",{
params ["","_weapon","_muzzle"];
private _type = _weapon call BIS_fnc_itemType;
private _time = -1;
switch (_type select 1) do {
case 'SniperRifle' : {_time = 0.1};
case 'AssaultRifle' : {_time = 0.1};
case 'Handgun' : {_time = 0.1};
case 'Rifle' : {_time = 0.1};
case 'SubmachineGun' : {_time = 0.1};
case 'MachineGun' : {_time = 0.1};
case 'Mortar' : {_time = 0.1};
case 'GrenadeLauncher' : {_time = 0.1};
case 'BombLauncher' : {_time = 0.1};
case 'MissileLauncher' : {_time = 0.1};
case 'RocketLauncher' : {_time = 0.1};
case 'Cannon' : {_time = 0.1};
case 'Throw' : {_time = 0.1};
};
if (_time isEqualTo -1) exitWith {};
(vehicle player) setWeaponReloadingTime [(vehicle player), _muzzle, _time];
}];
//not working and i dont know why.
@elder prawn Well, hitting every weapon type is not the best idea to start with, secondary, you seek for Cannon if you are not talking about MG, which is MachineGun AFAIR. And im not sure what's that " before player since no markup used.
Honestly, I would use a mission config defining each reload time and then make a macro to grab it from config and then apply it from there.
The names would have to be case sensitive in config, but it'd work okay.
He wants to reduce reload time only in vehicle he is in. So there is nice example in wiki:
_done = _vehicle setWeaponReloadingTime [gunner (vehicle player), currentMuzzle (gunner (vehicle player)), 0.5];
Yes, that is understood. The method of iterating through each of the names is not optimal
Its not completely unecessery if hes fring from tank
Unless its a turret
Even then i dont think you can throw a nade so "Throw" is still redundant
#define getConfigReload(r,c) private r = getNumber(missionConfigFile >> reloadTimes >> #c)
Note that setWeaponReloadingTime is only having effect on a current weapon state (loaded projectile) so since the projectile is fired the next one will be reverted to a weapon config defaults.
Don't forget that
Otherwise yes, you can remove unused cases
Guys, wanna real mind wrapper?
nil = 0 spawn {nil} <- ๐
That's a mind wrapper
Nothing comes from nowhere and goes to nothing.
I want to make competitive zeus vs player mode. In advance i want to ask not to suggest "hideObject". So my idea is to to make one player play an rts while retaining curators cameras flexibility, but i also want to make some kind of fog of war alternative. Basicily i want to hide players in any way or form from zeus view, and make them vissible once controlled AI finds them. Just to make sure zeus doesnt zoom in and search them manualy, but tatther send scouts. It especialy needed for situatio when zeus can use artilery. He might just insta win. Would not like to reside that on hight command becouse seeing your soldoiers in action is huge part of the fun i imagine.
Solutions?
why no hideobject with neartargets?
AI cannot reviel them or interact with them in any way if its local to zeus. If hiden with hideObject player might just stand in front of AI and they wouldnt even know
but executing setGroupOwner to zeus units?
locality would break only if zeus use remote control...
My first thouht was to try change Textures to alpha value 0, then change back once revealed.l, but not all model textures can be changed so...
I want it also be hosting friendly. One my thoughts was to change AI locality to server or to players even, but i want cleaner way
@solar coyote if MP then hideObjectGlobal from server. It doesn't care of locality of a hidden object.
i think the problem with hideobject is that hidden objects aren't registered by the AI?
I'm sorry @unborn ether, but you have completely missed my point. I want only zeus not being able to see player from skies unless knowsAbout is over 3.5
well
you could always do some
eyepos lineintersects with
but that's far more performance unfriendly than just setgroupowner and sheneanigans
As far as i understand hideObject removes model mesh from the game, i dont want that. I want only the visual part of it make it transperant in other words. Make any object - a house hiden, and you can walk through it and shout through it. And as ai detection of enemies relies on detecting meshes its out of question
I've tested it, they dont
They do register them but not taking actions, since VIEW LOD is off, they have no visuals on it, just backend.
Made my self hiden and started runing in between AI, shoting them and they were all confused
but then neartargets should show them up
@solar coyote You can't make anything just transparent. There are no such scripting commands.
did you test if neartargets showed them up?
Hiding a selection wouldn't help.
Any other workarounds then? I want fog of war effect of rts genre
create the mission with a heavy fog that makes only 300m visible
then you only hideobject if they are further than 300m visible of any troop
I think i saw desired effect on getTactical mod. Enemies would apear and disapear based on your guys vision
yeah, i mean, you can do it with eyepos lineintersect
but it won't be performance friendly
Hmmm...
maybe do that only on group leaders
I want rely only on AI ability to detect BLUFOR to reveal them
i think your only option is to make AI local to the server and just hideobject for zeus
I'm starting to think its the onky option. A3 engine seems to be incapable of that what i want
What hapens to AI local to player when he dc?
goes to the server
i think ai local to the server is not a bad option
since AI local to zeus will act wrong and slow
and it will be messy to deal with in a rts type of game
also make sure to run disableAI autocombat on all the units that zeus controls so he can actually move them in a firefight
Is in vanilla zeus missions AI placed local to server or to zeus?
im not really sure
i think it's local to zeus
all units that are remote controlled become local to zeus though
all units spawned in zeus if there is no other scripts are local to zeus
Makes scence
but units from the editor added to zeus... i think they are local to the server
but that was before setgroupowner
nowadays you can use that to switch ai locality without losing things like waypoints or AI target info
Neat
from my tests it's always better to have the AI on the server
or to a HC that's in LAN with the server
otherwise you run into bad hit reg, sniper riflemen AI
bad fps for everyone
I might just pass AI to non Zeus players in hosted situations. Poor souls will have to lift all that weight
Anyone know of a way to filter an array of objects based on height (create an array of all objects in an array if they are between elevation x and elevation y?)
@ruby breach I was hoping for a more convenient way than selecting everything and putting it one by one into a new array. Is there no other function that could do this?
Yeah that's what I'm looking at rn
allMissionObjects "" select {
private _z = getPos _x select 2;
_z > 5 && _z < 10
}
something like this you know?
Yeah - so what I'm really trying to do is make a more accurate version of loading all objects in a cargo aircraft
So you carry/drive everything on
when you drop it, it autoattaches by the aircraft doing findnearobjects, attaches, etc
I'd like to make it so it doesn't grab anything from outside by ensuring that the objects it finds are at cargo deck height
Alternative would be to define some sort of box around the aircraft hold and define offset limits, but that just seems like a lot of trial and error lol
Say you have a car parked next to the aircraft
car gets attached to aircraft
even if it's not inside
because nearobjects uses a radius, not a sector
and nearestobjects only returns one, so u could only load one at a time
https://community.bistudio.com/wiki/nearestObjects
returns array
nearestobjects does not return 1 object
also, specify what exactly you try to archive
nearestobject*
attach stuff into cargo? what?
attach everything that is in the cargo hold, yeah
to what? and why?
but without any of the scroll menu crap - writing it with the ACE framework so that when you drop something, it autoattaches, and when you pick it up, it disattaches
what you say literally is missing 90% of the information
what you attach where automatically when you pick somethiong how up?
also, vehicle cargo is not managed via some attach stuff but via xxxVehicleCargo commands
I believe I said it - but,
What: Vehicles, boxes, entities, etc
Where: Automatically as in ACE carry feature, if you drop crate it attaches to aircraft if in cargo hold
When: You pick it up with ACE carry feature...
The vehicle cargo scripting would not work with this modded aircraft.
so you try to create a feature that is horrible by design? you did noticed that most vehicles you cannot walk into?
๐คท so you want to enable it only for a single vehicle
A few aircraft, but yes, specifically created for the aircraft that you can walk into.
this is how you get the bounding box
the script is essentially what you already have been shown
just that you should obviously not just take random numbers
you might rather want to use https://community.bistudio.com/wiki/boundingBoxReal
at best, you check it for the vehicles and adjust as needed
That looks interesting, it would be more accurate than just doing findnearestobjects I suppose, but it would still have the problem that the bounding box includes the exterior (vehicles around wings, etc) - I figure the best way would be to filter by vehicles/objects at height of cargo deck
using https://community.bistudio.com/wiki/addMissionEventHandler and https://community.bistudio.com/wiki/drawLine3D + some model-to-world operators, you will be able to visualize the bounding box
chances are btw. that moving vehicles into the other vehicle will destroy said vehicle on drop
especially if they do not fit in size
Nah, they work
I already have this whole script working, it's just not as accurate as I would like. All I'm trying to fix is the accuracy of the object array.
And it's not a script for combat drops or anything - just flying supplies from one airfield to another.
Just consider it a Fedex Simulator script ๐
_arr select {
private _z = getPos _x select 2;
_z > 5 && _z < 10
}```
as you already have been shown, this is what it more or less comes down
however, in the end it will be the same work as if you would just use a full box simply because this also requires manual adjustment for every thing
I'll give it a go, thanks.
thus i again, recommend you to draw the bounding box first
then continue to adjust it until it fits
and use that instead
as you can use https://community.bistudio.com/wiki/inAreaArray for that
the moment you got the correct box setup
Aha, that looks perfect
Hey, need a bit of help updating some scripts from an old Insurgency mission from Arma 2. Somebody else modified and updated it for Arma 3, but that was back in 2013-2014. Now it's severely out of date, seems to have a lot of recursion going on. I'm a rather amateur mission maker (in terms of scripting), I depend heavily on mods and scripts already out there, but have been with the Arma community in general since back in OFP. I made a post about this in #arma3_scenario but unfortunately the text got messed up so I deleted it. Figured here was more relevant anyway.
For context, Insurgency is a gametype where players have to clear areas on the map to find intel that reveals hostile ammo cache positions somewhere on the map that must be destroyed. The scripts of my interest currently are the ones directly responsible for the areas that players need to clear, which are marked as red squares, and only in these red areas can can intel spawn. These red square markers spawn only on towns. The intel spawn script seems to run a similar script as the red square script, to find the same data or function, to spawn briefcases and laptops inside or outside buildings, walls etc.
Here's the problem: Both the red marker script that tries to find towns has variables that I'm unable to or don't know how to adjust, thus leading to a town like elektro barely having any red markers, and the spawn intel script is in fact supposed to spawn intel off of enemies killed in these red areas, instead of spawning them on/inside buildings.
Here's a sample of what the script puts on Elektro: https://cdn.discordapp.com/attachments/279085450608771072/487210344973074437/unknown.png
The scripts are as follows, hopefully this formats right:
`_cities = call SL_fnc_urbanAreas;
{
_markers = [];
_markers_cnt = 0;
_cityName = _x select 0;
_cityPos = _x select 1;
_cityRadA = _x select 2;
_cityRadB = _x select 3;
_cityType = _x select 4;
_cityAngle = _x select 5;
if(_cityRadB > _cityRadA) then {
_cityRadA = _cityRadB;
};
_buildings = [_cityPos,_cityRadA] call SL_fnc_findBuildings;
{
if ( [_x] call SL_fnc_buildingPositions >= 2 ) then {
_pos = _x call getGridPos;
_mkr = str _pos;
if (getMarkerPos _mkr select 0 == 0) then {
_mkr = createMarkerLocal[_mkr, _pos];
_mkr setMarkerShapeLocal "RECTANGLE";
_mkr setMarkerTypeLocal "SOLID";
_mkr setMarkerSizeLocal [50,50];
_mkr setMarkerColor "ColorRed";
_mkr setMarkerAlphaLocal 0.8;
_markers set [_markers_cnt, _mkr];
_markers_cnt = _markers_cnt + 1;
};
};
} forEach _buildings;
_trigE = createTrigger ["EmptyDetector", _cityPos ];
_trigE setTriggerActivation ["WEST", "PRESENT", false];
_trigE setTriggerArea [_cityRadA, _cityRadA, 0, false];
_trigE setTriggerStatements ["this", format["%1 call SL_fnc_createTriggers",_markers], ""];
} forEach _cities;`
and the other one is a bit bigger, so I'll make two posts
`SL_fnc_urbanAreas = {
private ["_locations","_cityTypes","_randomLoc","_x","_i","_cities"];
_i = 0;
_cities = [];
_locations = configfile >> "CfgWorlds" >> worldName >> "Names";
_cityTypes = ["NameVillage","NameCity","NameCityCapital"];
for "_x" from 0 to (count _locations - 1) do {
_randomLoc = _locations select _x;
// get city info
private["_cityName","_cityPos","_cityRadA","_cityRadB","_cityType","_cityAngle"];
_cityName = getText(_randomLoc >> "name");
_cityPos = getArray(_randomLoc >> "position");
_cityRadA = getNumber(_randomLoc >> "radiusA");
_cityRadB = getNumber(_randomLoc >> "radiusB");
_cityType = getText(_randomLoc >> "type");
_cityAngle = getNumber(_randomLoc >> "angle");
if (_cityType in _cityTypes) then {
_cities set [_i,[_cityName, _cityPos, _cityRadA, _cityRadB, _cityType, _cityAngle]];
_i = _i + 1;
};
};
_cities;
};
SL_fnc_findBuildings = {
private ["_center","_radius","_buildings"];
_center = _this select 0;
_radius = _this select 1;
_buildings = nearestObjects [_center, ["house"], _radius];
_buildings;
};`
`SL_fnc_buildingPositions = {
private ["_cbpos"];
_house = _this select 0;
_cbpos = 0;
for "_x" from 1 to 100 do {
if (format ["%1",(_house buildingPos _x)] != "[0,0,0]") then {
_cbpos = _cbpos + 1;
};
};
_cbpos;
};
getGridPos = {
private ["_pos","_x","_y"];
_pos = getPosATL _this;
_x = _pos select 0;
_y = _pos select 1;
_x = _x - (_x % 100);
_y = _y - (_y % 100);
[_x + 50, _y + 50, 0]
};
SL_fnc_createTriggers = {
private ["_markers","_pos","_trigE"];
{
_pos = getMarkerPos _x;
_trigE = createTrigger ["EmptyDetector", _pos ];
_trigE setTriggerActivation ["ANY", "PRESENT", false];
_trigE setTriggerArea [50, 50, 0, true];
_trigE setTriggerStatements ["{(side _x) == east} count thisList == 0 AND {(side _x) == west } count thisList >= 1", format["""%1"" setMarkerColor ""ColorGreen"";",_x], ""];
} foreach _this;
};`
`SO_fnc_randomCity = {
private ["_randomLoc", "_cityName", "_cityPos", "_cityRadA", "_cityRadB", "_cityType", "_cityAngle", "_cityTypes","_found"];
_cityName = "";
// Stuff we need
_locations = configfile >> "CfgWorlds" >> worldName >> "Names";
//_cityTypes = ["Name","NameLocal","NameVillage","NameCity","NameCityCapital"];
_cityTypes = ["NameVillage","NameCity","NameCityCapital"];
_found = 0;
while { _found == 0 } do {
_randomLoc = _locations call BIS_fnc_selectRandom;
// get city info
_cityName = getText(_randomLoc >> "name");
_cityPos = getArray(_randomLoc >> "position");
_cityRadA = getNumber(_randomLoc >> "radiusA");
_cityRadB = getNumber(_randomLoc >> "radiusB");
_cityType = getText(_randomLoc >> "type");
_cityAngle = getNumber(_randomLoc >> "angle");
if (_cityType in _cityTypes) then { _found = 1; };
};
[_randomLoc, _cityName, _cityPos, _cityRadA, _cityRadB, _cityType, _cityAngle];
};
SO_fnc_findHouse = {
private ["_found","_houses","_house","_cpos","_range","_bpos"];
_cpos = _this select 1;
_range = _this select 2;
_houses = nearestObjects [_cpos, ["house"], _range];
_houses;
};`
If this isn't the right place, please inform me.
What I'm trying to get it to do is two-fold. Part 1: Get more areas covered in Red Square Markers, I don't understand it's current detection algorithm for where it's placing the markers right now, but I need it to be looser, and place them pretty much anywhere there's a building, enterable or not, civilian or not. Part two: Any "east" hostiles in these red areas, when killed should have a chance to drop/spawn intel in the form of a suitcase/laptop, etc. (Instead of intel being spawned at buildings/near buildings.)
The intel script is separate, but I can link/upload/direct copy+paste it. I'm not sure what the established practice is here. If anyone could read through and help with this, it'd be greatly appreciated. I have only an inkling of an idea of what I need to do.
@abstract sinew please just pastebin big scripts... Also use
```sqf
<script>
```
If you wanna paste scripts
What first meets my eye is the overload of crappy private ARRAY and the missing params
Affirm, I appreciate the advice.
Here's "createmarkers.sqf": https://pastebin.com/QC8xVAqy
with one subfolder and one file within, "functions.sqf" : https://pastebin.com/c4j58yKp
In another folder called cachescript, subfolder functions, I have "spawnintel.sqf" :https://pastebin.com/KGqspYqi
Let me know how else I could help. @still forum
_cityName = _x select 0;
_cityPos = _x select 1;
_cityRadA = _x select 2;
_cityRadB = _x select 3;
_cityType = _x select 4;
_cityAngle = _x select 5;
-> _x params ["_cityName", "_cityPos", "_cityRadA", "_cityRadB", "_cityType", "_cityAngle"]
use private _var = stuff when you declare NEW variables.
private ["_locations","_cityTypes","_randomLoc","_x","_i","_cities"]; remove that completely and just write private before the variable names when you create them the first time
_cities set [_i,[_cityName, _cityPos, _cityRadA, _cityRadB, _cityType, _cityAngle]];
_i = _i + 1;
->
_cities pushBack [_cityName, _cityPos, _cityRadA, _cityRadB, _cityType, _cityAngle]
SL_fnc_findBuildings = {
private ["_center","_radius","_buildings"];
_center = _this select 0;
_radius = _this select 1;
_buildings = nearestObjects [_center, ["house"], _radius];
_buildings;
};
->
SL_fnc_findBuildings = {
params ["_center", "_radius"];
nearestObjects [_center, ["house"], _radius]
};
getGridPos = {
private ["_pos","_x","_y"];
_pos = getPosATL _this;
_x = _pos select 0;
_y = _pos select 1;
_x = _x - (_x % 100);
_y = _y - (_y % 100);
[_x + 50, _y + 50, 0]
};
->
getGridPos = {
(getPosATL _this) params ["_x", "_y"];
_x = _x - (_x % 100);
_y = _y - (_y % 100);
[_x + 50, _y + 50, 0]
};
in SL_fnc_createTriggers you have _markers in your private but that doesn't even exist
SO_fnc_findHouse is exactly the same as SL_fnc_findBuildings besides that it ignores the first parameter
This is not my scripting work. It's some scripts from written back in 2013-2014, updated from an old arma 2 mission by somebody else. That context I wrote in #arma3_scenario last night but it got messed up and I forgot to rewrite it for this post.
Well sorry but I just skipped past your huge wall of text.
Understandable.
My apologies, I'm trying my best not to be ignorant and learn what I need to do to create a better mission. I appreciate all the help.
how to insert code <execute expression="Code to execute">Text</execute> to hyperlink website url in createDiaryRecord ?
Get more areas covered in Red Square Markers, I don't understand it's current detection algorithm for where it's placing the markers right now
Currently areas are placed at locations. Locations are hardcoded into the map. You'd really need to rewrite the whole algorithm to get something different out of it
Currently areas are placed at locations.
Yes, and this isn't overly bothersome. It's attached to location names, but there's a difference between it making this> https://cdn.discordapp.com/attachments/279085450608771072/487541158583730176/unknown.png
and it making this > https://cdn.discordapp.com/attachments/279085450608771072/487210344973074437/unknown.png
in the same instance.
It's not even covering the whole city. Some smaller cities have one or two grids, and that's it. Meanwhile a whole bunch of blocks next to them have buildings. But because these don't fall within the algorithm for whatever reason, it won't spawn intel nor make a red marker.
I need to know how to increase the area, or radius, from the city name/location, that it searches for buildings or calculates into it's algorithm, or make the parameters looser for what it considers acceptable as creating a marker for. Because currently, if I understand it correctly:
_cityRadA = _cityRadB;
};
Means that it calculates certain areas to be too big to fit into it's algorithm, and
Is dictating that the marker can only be created in the area the algorithm deems a certain size.
I'm sure I must be missing something, and I'm just too inexperienced to understand what must be done.
if ( [_x] call SL_fnc_buildingPositions >= 2 ) then { That line I'd say. That counts AI positions in buildings
Only counts enterable buildings and only if there are more than 2 positions
You can just remove that if/then check. And EVERY building will get a marker. Even if no AI positions inside it
Thanks, much appreciated. I will try it.
Insurgency creates dozens of triggers? Doesn't this kill performance?
So far as I've seen, the performance drop is manageable if the ALiVE modules aren't spawning insane amounts of AI. I'll be looking out for performance issues much as I can, and if things don't work out, I'll keep an eye out for alternatives.
I would like to write a script where the player goes into a jail building (via teleport) if he shoots friendlies. A 24h Cooldown will release him when playing on a server. Does this sound trivial to implement? Rejoining the Server should have the player still in the prison.
Question here is, do players have some kind of ID to recognize them regardless of connection. The thing how whitelisting does work?
References to wikis describing exactly this would help a lot. Cannot google for it since I do not find the right terms/keywords
Or just use Profile namespace
Yeah, you want persistent storage (such as profile namespace) in case server/mission restart.
btw i think there was a lot of "jail" scripts...
But you still need an extension to get the real date
to make it real persistent probably db is de wey ๐
Profilenamespace...
No need for DB @meager heart
Not even the crap life does requires DB
yeah.. but what if you will set X39.vars.Arma3Profile file properties to "read only" ๐ค
Can't go to jail anymore ยฏ_(ใ)_/ยฏ
tadam
What if you set it server side ๐ค
imo that is the only way ^ but with namespace, or db for real persistence
What if you set it HC side? ๐ค
What if someone crashes HC on purpose ๐ค
@meager heart Server also has profilenamespace
yeah... probably better option then client one
profileNamespace rly sounds interesting - thx buddies
I am not keen with server side scripts just yet. What do I need to do to have it on the server side?
simply the if(isServer) stuff? nah eh?
Your script has to execute serverside..
If it executes everywhere you can use if (isServer) to prevent your code block from running on clients
but if your script doesn't run on server at all then if (isServer) won't do anything
init.sqf or initServer.sqf run on server for example
init.sqf is executed automatically on the server? Without need to calling it explicitly? Simply because of the naming convention?
yes
just found out: https://community.bistudio.com/wiki/Event_Scripts
Tip of the day: never use persisent in the same phrase with profileNamespace
guys, it's that ok?
cursorTarget isEqualTo player
to check if the cursor target it's a player? :p
isPlayer cursorTarget
Both are fine, but they don't do the same
You want the second one
oki
it's a player? :p no
The second one yes. First checks if cursorTarget is local player.
Can't remember, but you may also want to look into cursorObject
One of them requires you to "know" about the target. So you have to reveal them, which can be annoying.
it's better cursor object?
I think cursorObject is the one that does not care what you "know".
correct
but cursorObject is ultra accurate. You have to really aim onto the object and not just slightly near it
Also you may want a distance check too. Believe both have pretty good distance, at least 50m.
Don't know what you are doing, but you might want to look into just using an action.
doing that
player addAction ["<t color='#ff6b00'> -- QUITAR ARMAS</t>", {
[] spawn YEIIJ_fnc_DYWSearchForWeapons;
}, nil, 0, false, false, "", "(side _originalTarget isEqualTo WEST) && (isPlayer cursorTarget)", -1, false, "", ""];
is an action for the "cops"
Use isPlayer _target instead
Then you can avoid having to be laser-accurate as Scriptmen says.
no _this is the unit that's trying to execute the action
it works like that
_target is the target
Ah, yeah my bad
cursorTarget works too. Because the action object needs to be on your cursor to show the action.
i think _target wont work in this case
_target == cursorObject
_target: Object - the object to which action is attached or, if the object is a unit inside of vehicle, the vehicle
It won't work if a AI tries to execute that action though. Because cursorTarget is your target
if you aim onto a vehicle then cursorTarget will also be the vehicle
Ahh the action is attached to the player ๐ค
yes, to the "cop" (west)
side _originalTarget isEqualTo WEST is equal to side player isEqualTo WEST then
And you can just check that one before adding the action. No reason to add the action to civilians or such if that condition can never be true
true, this is for test
I mean you can remove the condition completely and only add it for player if side is west.
i will include this into Altis Life :p
Though, you may have an edge condition if side of player changes during gameplay.
thx for info and suggestions guys ๐
btw
i have my addon in server side
so the addon has the function YEIIJ_fnc_DYWSearchForWeapons;
and the action it's in client side, inside the mission
my "solution" was doing publicVariable "YEIIJ_fnc_DYWSearchForWeapons";
any suggestion on that?
it's that the correct way?
hello, what workaround(s) are you guys using for servertime, it bugs out and fails to sync after a server restart. https://cdn.discordapp.com/attachments/173767699103612928/487594615403315200/20180907140506_1.jpg
I personally would use CBA_missionTime. Which is obviously CBA and thus modded
k ty will take a look
@late gull i suggest you read documentation on player
because it may not behave the way you think it does in MP environment
you may be best off using
([switchableUnits, playableUnits] select isMultiplayer);```
Here is a quick attempt at time (that will be offset my the latency), same approach as CBA except only for multiplayer. It is untested:
https://paste.ee/p/l7q9b
pastebin has SQF highlighting as well if that's what you're referring to
this > https://paste.ee/p/qn9FC
Sharex also supports it ๐
can't set the default upload syntax for it though, can't do that either with github but pastebin supports that
ah autodetect works for SQF on paste.ee, nice
full screen mode also
How might I run a gear script for an entire editor placed group from just the group leader's init field?
So rather than execVM "Gear\AAF.sqf"; in every unit's init field, just have that neatly in the group leader's init field.
That's not helpful.
i wasn't finished but i guess i'm not being helpful enough
so i'll leave you to your devices
Pass the group leader in the arguments and use units group _groupLeader to loop through all the units.
Your question is also not helpful at all
Are they players?
There are no arguments to your execVM that doesn't make sense
Ampersand solved the issue.
Vauun and Dedmen are raising valid points though =)
ยฏ_(ใ)_/ยฏ
execVM compiles the file when you tell it to during the game, which may cause performance problems
pre-defined functions are compiled when the mission is started afaik
at preInit
It's an incomplete script in a testing environment, it will be adapted to a function when it's time.
and with arma 3 you need to fight for every frame
it takes 2 seconds to make a function but ok
even still you have debug console ยฏ_(ใ)_/ยฏ
it takes 2 seconds to make a function but ok
sometimes it takes few month ((ใคยฐ_ยฐ)ใค๐)... /s
๐ซ ๐
Woah no spam in scripting?
So im coming from Arma 2. Did a lot of custom vehicles using attachto commands. The attached objects never had any physics when the main object moved. Theyโd clip through walls and bullets would pass through. Do think itโs changed at all and handled better? Would the attached objects have a โskeletonโ?
attached objects handle pretty much the same as they have always done
excessive use of it is not adviced
and what do you mean by skeleton?
they are the objects they are
and if they have animations etc those can work
Why excessive use not advised? Server drain?
Modeled objects have a skeleton, like it architecture that abides by the physics in game. I get some errors on the server from some mods and their lack of skeleton or something to@that effect.
if an object is done correctly then it should have a skeleton too. Cant say about your mod objects though, not all people create stuff correctly.
attachto and skeletons are not related
Ok well@forgive me I donโt know the proper way to articulate this exactly. But again, why advise against using a lot of attachto objects?
no need to take offence, I just clarified the non relation. depends on what kind of other stuff you run but yes they can cause network strain.
but you will notice if there are problems so try it out
not offended friend. Thanks for your time. Iโll do a little experimenting.
@tough abyss Easy experiment, attach an object, to your unit which has a few more attached objects like 1-2-3-4. Then move on your MP server - see it die.
Creating a chains like 1-2 only will not kill a server, but still not good to use.
So less attachTo - better.
@tough abyss 2010 bug, dont get any hopes up. I'm aware of the timeframe where its ureliable
Is there a way to get all IDDs and IDCs used the by the game (including some addons)?
@unborn ether less chained attachTo right?
if I were to make a battle bus, everything would be relative to the bus itself, not relative to object relative to object relative to(โฆ) ?
@winter rose battle train > https://gyazo.com/6fdc13078eaabdb7dbc391bae2d6cfac
battle karts > https://gyazo.com/f84cac39fe43db645df9dc4f973058b6
tacticool slingload > https://gyazo.com/f207c72208381cc1615e36f921558ef1
(afaik you can "chain attachto" to anything in any order)
Is there still a limitation of not being able to set the animation phase of mainGun and mainTurret?
_tank doWatch (_target getPos [0, _tank getDir _target]);
```๐ค
@tough abyss https://community.bistudio.com/wiki/configProperties
@hidden topaz if it is limited in config then yes, UGV is not limited like that
Could worldToScreen be affected by something from the aircraft config? I am asking becouse with jet starting to move the returned position shifts
Paste of my script: https://pastebin.com/Hze94ejq
@tough abyss _vehicle animateSource["mainGun", rad 15]; That doesn't work on any vehicle ive tried; even the UGV. Is there other ways of setting gun elevation of a player controlled vehicle ?
What example on wiki doesnโt work for you? https://community.bistudio.com/wiki/animateSource
You can always put AI in vehicle order it to aim at something then remove AI
afaik if the turret config class don't have > animationsource with > source="user" type, there are no way to animate it with the scripts
@meager heart I meant performance-wise, what is killing servers
never tested that ^ i can't say something about it with 100%, Lou ๐คท
That UGV example did work, Ill try play with the animation sources and see if that does anything, Cheers @tough abyss and @meager heart
gl
Hi. Got a question. Im figuring out the CBA's scheduler environment. I wrote my own function and i want to call it via the earlier mentioned CBA_fnc_waitAndExecute;. Is it even possible to run functions inside functions? Im having issues understanding the example provided by CBA.
[{player sideChat format ["5s later! _this: %1", _this];}, ["some","params",1,2,3], 5] call CBA_fnc_waitAndExecute;
CBA's scheduler environment it not being scheduler at all is the most important feature of it ๐
Is it even possible to run functions inside functions? The command for that is called call
If i do it like that, it doesn't work. I think i misunderstood something somewhere. That's my fn_suppresiveFire.sqf file.
private ["_unit", "_target"];
_unit = param[0]; // _this select 0
_target = param[1]; // _this select 1
->
params ["_unit", "_target"]
Also you need to take the parameter inside the function
your _unit is undefined
ignore the double "call", copy paste typo. Yeah - taking the parameters inside the CBA's function is my main problem
Everything that's now executed "right now and right here" your variables don't automatically carry over
because these are always new script instances
Has anyone got an idea why cbChecked always returns false? ```private _display = findDisplay 190000;
private _window = ctrlChecked (_display displayCtrl 1409);
private _hide = ctrlChecked (_display displayCtrl 1410);
private _unconscious = ctrlChecked (_display displayCtrl 1411);
systemChat str _hide;
systemChat str _window;
systemChat str _unconscious;```
The checkbox eventhandler returns the state correctly.
You are confusing.. You are asking about cbChecked but post code with ctrlChecked
always code in the middle of the night
But you need to change your sleep rythm around
array container in a separate .sqf, Scriptmen?
And how do I explain that to my employer?
That question doesn't make sense in my brain. Can you rephrase that?
i think i don't understand it at all myself.
[[[_unit, _target] call ADI_fnc_suppresingFire]; [_unit,_target], 7] call CBA_fnc_waitAndExecute; ?
no
code is wrapped in {}
and I already told you what you need to do
and even if you wrap that in {} your _unit and _target would still be undefined
I guess my knowledge is too small yet to understand what you're trying to explain to me. I'll have to do more research and take a step back on complexity.
yeah you don't even have the basics.. You shouldn't start with "advanced" CBA stuff
@cosmic lichen there was some weirdness with controls groups (like always lol) and ctrlChecked/ctrlSetChecked
it returns/sets only the first control "state"... so > ctrlEH on/CheckBoxesSelChanged ๐คท
But Im saving our conversation to come back later to. Still, thanks for the help, Scriptmen.
how to detect if a vehicle lays sideways or is 40-60 up in the air by its barrel?
There is a BIS function wit... BIS_fnc_pitchBank I think. Dunno if that is a getter or setter
essentially get upvector and do math
and the angle of the surface beneath it.. There is a command for that
trying via
surfaceNormal getPos ct
vectorup ct
https://community.bistudio.com/wiki/BIS_fnc_getPitchBank @still forum @velvet merlin
there's a getter and a setter
ty
maybe just
vectorUp _vehicle select 2 < 0
```need some offset there ^... ๐ค
current design works alrightish. suggestions to improve are welcome
if (((getPos _vehicle) select 2) > 3) then
{
_vehicle setPos [(getPos _vehicle) select 0,(getPos _vehicle) select 1,0.1];
_vehicle setVelocity [(((velocity _vehicle) select 0) * (sin (direction _vehicle))),(((velocity _vehicle) select 1) * (cos (direction _vehicle))),0];
}
else
{
if (((velocity _vehicle) select 2) > 5) then
{
_vehicle setPos [(getPos _vehicle) select 0,(getPos _vehicle) select 1,((getPos _vehicle) select 2) - 0.1];
_vehicle setVelocity [(((velocity _vehicle) select 0) * (sin (direction _vehicle))),(((velocity _vehicle) select 1) * (cos (direction _vehicle))),((velocity _vehicle) select 2) - 0.1];
}
else
{
if ((((vectorUp _vehicle) select 2) < 0.3) || ((abs ((_vehicle call BIS_fnc_getPitchBank) select 1)) > 60)) then
{
_vehicle setVectorUp [((vectorUp _vehicle) select 0),((vectorUp _vehicle) select 1),((vectorUp _vehicle) select 2) + 0.1];
};
};
};```
suggestions to improve don't call getPos a bazillion times if you really only need it once
[(getPos _vehicle) select 0,(getPos _vehicle) select 1,((getPos _vehicle) select 2) - 0.1];
->
(getPos _vehicle) vectorAdd [0, 0, -0.1]
you can use also use (getPos vehicle) params ["_x", "_y" ,"_z"]
vehicle setVectorUp [((vectorUp _vehicle) select 0),((vectorUp _vehicle) select 1),((vectorUp _vehicle) select 2) + 0.1];
-> vehicle setVectorUp ((vectorUp _vehicle) vectorAdd [0, 0, 0.1])
Just wondering is there a way to see codes of ARMA vanilla scripting Commands? Asking becouse worldToScreen doesnt work well with modelToWorldVisual
They are not scripts
Sorry my bad
When used together in some aircraft for example, when the aircraft starts to move, modelToWorldVisual gives correct values as it is executed in render time scope. When these values are then converted using worldToScreen it only works correctly as long as vehicle doesnt move. If it moves worldToScreen introduces shift to those coordinates . The example I am talking about is interaction with cockpit
@neon snow check this vid https://youtu.be/u_nmNkz-69s I think he uses worldToScreen too
@tough abyss thank you very much for that ๐
Within my init.sqf I want to execute other .sqf scripts to declutter the init.sqf itself. I know there are many ways to do so (right?) but am not sure what is the proper one.
The scripts being called are also init type scripts like adding event handlers and stuff.
execVM
cfgFunctions
call
I found this fn CBA_fnc_addWeapon and wonder why it should be preferred to the addWeapon command? I would guess it is because the CBA fn is not prone to error if the weapon or unit does not exist...where the addWeapon command would simply throw and error?
And... should I always prefer CBA functions?
command would simply throw and error? no. It would do nothing if you pass a nullobj
should I always prefer CBA functions? There isn't a CBA function for every engine command
CBA functions are made to make some specific use cases easier
yea but if there is one... would you prefer using it?
Ah sry I did not realized there comes some special functionality with it
like dropping the item on the ground if iventory is full etc.
Otherwise it wouldn't make sense at all to be a function
There are some functions without special functionality. But these only exist because they were made when the script command for that didn't exist and they only exist now for backwards compatibility with 5 year+ old mods.
aye aye
@frigid raven you should avoid using init.sqf
what are you putting in it?
there's almost no reason you should be using init.sqf over initServer.sqf and initPlayerLocal.sqf
@tough abyss I see. So it is always better to have the scripts executed by those CfgFunction hooks like PreInit etc.?
wat
no, you can put code in init files fine
but the reason i don't suggest using init.sqf is because it executes every time a JIP joins
if you want something that needs to be local to the player, use initPlayer.sqf
else you can just use initServer.sqf for all server stuff
master racemissionFlow.fsm
Can I disable and enable Radar via script?(I mean like CTRL+R kind of disable not remove and add)
It doesnt affect player driven vehicles
@tough abyss Ah okay sorry! Btw. when does initServer be executed? because I have an addAction on a NPC unit which I set a variable name. It seems this npc/variable is not set as the initServer script ran. I think I should put this perticular script into PostInit of CfgFunctions?
initServer is run after object variables are broadcasted
addAction is a local command
so you need to execute it globally
PARAMETERS HERE remoteExec ["addAction", 0];
I think I should put this perticular script into PostInit of CfgFunctions?
nani the fuck what
dude relax I am new to this - I am sure I just misunderstand things ๐
I just was triggered by the description in the wiki: postInit = 1; //1 to call the function upon mission start, after objects are initialized. Passed arguments are ["postInit", didJIP] and they said something like after the objects are inited
you're not using a function
ah right it is just compiled
addAction is a command, not a function
functions are collections of commands compiled into a single file
they are compiled at preinit (one of the very first things the mission does when it's loaded)
alright
does initPlayerLocal fire on hosting server (playing server)?
yes
oooh, great. Thanks!
if i got it right that weirdness was only with init.sqf and that was looong time ago
Are there any commands to interact with polyline markers yet?
I wish
brett, im kinda board wana test you mission together? kust wondering
I'm actually not creating a mission, working on a HUD mod and just testing the mod
basically would you like to play together, im board.
Not atm, I'd try #looking_for_game though
alright thanks
Is there any way to kinda embed a HTML file, which lies within the mission dir into the game as a popup?
@frigid raven htmlLoad
ah wtf awesome. thx dude
is there any script I can use to track memorypoint movement via debug console?
@unborn ether but there is no way to bring a click on the html page back to the game to execute a script right? ๐ just asking
is initPlayer.sqf called for players are JIP as well? or only those who are in the lobby at mission start?
It is not called for players in the lobby, where did you get that from?
Nowhere - I am assuming things to get my head around it
Trial and Error ๐
initPlayerLocal.sqf is the init script I am looking for it seems
Where it runs for every player joining the mission
It is called for any player joining the mission JIP or not
got it
@frigid raven RscHTML represents just the HTML page, so no callback to engine is supported, for reasons. If you want to make scripted html, you can just build some GUI around it to simulate some kind of browser, but that's really big monkey work there.
guys, it's spossible to add hold action to a simple object?
and btw, it's possible to spawn p3d model not as simple object?
QQ ๐ซ
ACE is spawning invisible helper objects for where you need interaction on simple objects. Like fences
huh, interesting
but, how would i delete the simple object inside the hold action since inside on "completion" you can use only the magic vars huh?
will try something
use only the magic vars What? that's not true
you can use global vars or I'm sure you get the object inside there. Just store a variable on the object
Is it possible to hack uav via scripting? Will assigning them to group of another side be enough?
Eg I assign blufor uav to opfor group, will it be connectable via opfor terminal?
Edit: joinSilent is enough to make the uav connectable for other side.
also > player setUnitTrait ["UAVHacker", true];
But this needs that you get close to UAV and hack it.
I needed to have VLS available to Opfor
Could someone help with addon prefix in AB?
(Sorry if it's not the appropriate channel)
"AB" ? "addon prefix" ?
Explain your problem
Okay
So
I'm working on a SW mod and I was fine without prefixes so far
But now me and the team have lots of files and it would be great if I could get a working addon prefix
There is field in AB for it in the options
If I set up the path, it packs fine and the relative path is working but for some reason, it doesn't binarize the P3Ds then
You need to change the paths in the P3D's as they are absolute paths
Where?
The texture and rvmat references?
everywhere where there is a path
Every path is set to relative because we are doing tests on a server so there aren't any absolute paths in the files
I use absolute paths when I preview the materials in Buldozer but then I change everything to relative
"relative" doesn't make sense
Sorry if I'm confusing
as I said. Paths in p3d's and materials are absolute
not relative
you can't just make it take a relative path by thinking it should be
๐
๐
How to stop playSound ?
I have this
_dummy = "#particlesource" createVehicleLocal ASLToAGL getPosWorld PLAYER;
while{alive _dummy}do{
hint "Playing";
_dummy say3D "FA18_foldwing_sound";
sleep 3; //Atleast the length of your sound
}```
and I am trying to kill it with setDammage but it wont stop playing
PlaySound or say3D?
why are you using a particleSource to play sound? isn't there also a #soundsource?
hmm didnt know that, just started with sound actually. All I want is script that will play sound in loop until I decide to kill it
Will try with soundsource
CreateSoundSource will play in a loop
But I have to define the sound in different place than CfgSounds, correct?
Look up wiki it has everything you need and more
Ok thanks ๐
guys, doing my question again
i have functions compiled on server side, how is the correct way to use them on the client
i'm doing publicVar "asd_fnc_myFnc"
and then in the client i call it normally
it's that wrong? is there a better way?
I do not understand the _instigator parameter for a "killed" event. Wiki says instigator: Object - Person who pulled the trigger. When I shoot an AI I assume that my player object would be assigned to _instigator but it is not. isNull _instigator returns true. What am I misunderstanding here? I also tried to be the gunner of a vehicle but same behaviour.
maybe you added that eh to a player ? ๐
na I attached it to an npc
locality issues, maybe
Works for me
Ok I think the problem is how I try to delegate the "killed" evnet to my event handler
IsNull false
{_x addEventHandler ["killed", "call X11_fnc_onAiKilled"];} forEach allUnits;
I think this is totally wrong eh?
how would you guys do this? My first idea was to extract all params and pass them to the X11_fnc_onAiKilled Function
No itโs fine
But I thought there is a convenient way so I just have to tell the function name and the addEventHandler function would pass them through to the handler func
ah really?
So this is how I attach the handler to all units available (for testing): {_x addEventHandler ["killed", "call X11_fnc_onAiKilled"];} forEach allUnits;
and the handler is actually executed as my log msg tell me
but _unit == _killer // true
Are you testing this in mp?
_x addEventHandler ["killed", "call X11_fnc_onAiKilled"]; that is actually the perfect way to do it.
You could also _x addEventHandler ["killed", X11_fnc_onAiKilled]; But that would recompile your code everytime the EH is executed and probably wreck performance
Where do you observe the output? Locality of AI?
Dedicated or hosted?
Mission or Eden mp preview?
Still canโt reproduce
X11_fnc_onAiKilled < something there ๐ค
Shut down and restart the game when you exhausted all options
Here is the fn_onAiKilled.sqf code
private _nameOfKiller = name _killer;
private _isBlueOnBlue = [_instigator, _unit] call X11_fnc_sameSide;
systemChat format ["killer is: %1", _killer == _unit];
if (_isBlueOnBlue) then {
[playerSide, "HQ"] commandChat "Du hast einen Kameraden auf den Gewissen. Ab ins Cafe Viereck!";
_killer setPos (getPos prison)
};```
Sorry hat no Git url to this yet
Whatโs in sameSide?
just a convenient func which actually does side _first == side _second with some parameter type guards and defaults
Side of killed is always civ
You need to compare side group unit
hm ok I will try this
So I have to ask again, how could I stop say3d, say, or playSound instantly from loop?
while {alive _dummy} do
{
_dummy say3D ["FA18_foldwing_sound", 100, 1]:
sleep 4;
};```
I cant use createSoundSource as it makes sound incredibly quiet
setDammage _dummy or deleteVehicle _dummy doesnt work
Setdamage and deletevehicle both work
Yeah I just found out, I have a problem with variable acces
If you have valid reference object
anyone up for a little scripting challenge:
build a class tree of cfgVehicles showing a parameter has be set the first time (like most are in All, yet some start with AllVehicles/Man/CAManBase/Car/Tank, etc)
this would be quite useful to help commenting all config parameters, finding "unknown" parameters and such
basically a modified config dump script with a slightly different output logic
anyone up for it?
Sorry to interrupt your challenge offer but I have to ask a question again ๐
Consider this keymaster addEventHandler ["killed", {call X11_fnc_onAiKilled;}];
Now I am ingame and shoot the keymaster NPC.
The following handler script is run:
private _nameOfKiller = name _killer;
private _isBlueOnBlue = [group _killer, group _unit] call X11_fnc_sameSide;
systemChat format ["blueonblue is: %1", _isBlueOnBlue];
systemChat format ["killer is: %1", _killer];
systemChat format ["killed unit is: %1", _unit];
systemChat format ["_instigator is: %1", _instigator];
if (_isBlueOnBlue) then {
[playerSide, "HQ"] commandChat "Du hast einen Kameraden auf den Gewissen. Ab ins Cafe Viereck!";
_killer setPos (getPos prison)
};```
This is my output on systemChat:
blueonblue is: true
killer is: keymaster
killed unit is: keymaster
_instigator is: <Null>-object
now the dead keymaster went into prison ๐ that is not cool
did you kill him by fall or bullets? -> Now I am ingame and shoot the keymaster NPC.
also, SP or MP :3 -> Eden MP preview
just tried >
this addEventHandler ["killed", {
params ["_unit", "_killer", "_instigator", "_useEffects"];
hint str _instigator
}];
```and > https://gyazo.com/b97771db417bc47daac933ff6f293248 ๐
did you kill him by fall or bullets? -> Now I am ingame and shoot the keymaster NPC.
rubbing my eyes indeed
๐
Do you run mods?
Add handleDamage EH to keymaster so you could see what killed him, if he dies because of suicide then this would explain the weirdness
Yea I run ALiVE, ACE3, ACRE2, CBA, CUP and CFP
All mods I dont think they would screw up native addEventHandler... but you never know. I gonna try it on a modless environment now
and afterwards try your handleDamage analysis
works without mods
jeez that is not cool
params ["_unit", "_killer"];
if (isNull _killer) then {
_killer = _unit getVariable ["ace_medical_lastDamageSource", objNull];
};
^ - should "fix" killed EH when running ace medical.
interesting - checking it out
ok weird well _unit and _killer are still the same. The dead keymaster npc. But _killer = _unit getVariable ["ace_medical_lastDamageSource", objNull]; actually gives me my players object
But that is kinda a weird way around. I try the dammaged event as suggested by @tough abyss (you meant keymaster addEventHandler ["dammaged',...] right?) to figure out who is the proxy between the native routine
HandleDamage, but you can try dammaged and see if it tells you anything
Anyone happen to know where the vanilla death effects are? I have a custom scripted switch to a different unit when you die, but I got the shitty vanilla blurred out screen when that happens
@austere granite AFAIK if you remove all Killed EVH use your own Killed EVH that doesn't happen.
I'd really prefer not to do a removeAllEventHandler thing, in regards to compat with other mods
Yea I think I want to keep the ace medical system intact
But I wonder if there is a deactive for AI - because I have no interest in aid NPCs atm
death effects there > functions_f\Feedback and VR fx there > functions_f_bootcamp\VR
It seems like the blur is present in feedbackMain
..... does playerKilledScript.sqf not worK?
i legit 100% ABSOLUTELY want dying to not do ANYTHING from a vanilla perspective lol
i don't waant their retarded templates, i dont want PP, etc
does playerKilledScript.sqf not worK?
you mean >onPlayerKilled.sqf?
playerKilledScript.sqs*
https://community.bistudio.com/wiki/Event_Scripts at the bottom
i also tried onPlayerKilled.sqf, but that doesn't stop default behavior ๐ฆ
you can try this way > https://community.bistudio.com/wiki/Arma_3_Respawn#Custom_Respawn_Templates
No thanks, the less BIS code i use the happier i stay
I looked into respawn templates when they originally made them, staying far away from them
no, that will be your code lol
90%
ish
// Function or script executed upon death. Parameters passed into it are the same as are passed into onPlayerKilled.sqf file
onPlayerKilled = "\myAddon\scripts\respawnBeacon.sqf";
// Function or script executed upon respawn. Parameters passed into it are the same as are passed into onPlayerRespawn.sqf file
onPlayerRespawn = "\myAddon\scripts\respawnBeacon.sqf";
those are unfortunately just additions to other systems
no overrides or so
playerKilledScript.sqs should do it in theory, but it doesnt appear like it does
@tough abyss I used HandleDamage and _source and also _instigator was correctly my player this time
So it seems another killed handler is screwing up something eh?
No, this is because some mod added HandleDamage EH with override and it screwed default behaviour. By adding another HandleDamage on top you have overridden the last EH so it is back to default. If you keep it and add Killed EH now it should work too
yea well but... if this overriding of the HandleDamage EH is done by let's assume ACE medical system - wouldn't my override screw up the whole medic stuff?
BIS_fnc_feedback_allowDeathScreen should solve the death PP
nvm, they just reset it, why allows vars to disable your shit
/rant
if (isNil {player getVariable "BIS_fnc_feedback_respawnedHandler"}) then {
player setVariable ["BIS_fnc_feedback_respawnedHandler", true];
player addEventHandler ["respawn", "BIS_respawned = true"];
};
```tried that ^ looks like it works (copypasted from `fn_feedbackInit.sqf`)
ยฏ_(ใ)_/ยฏ
kinda
BIS_fnc_feedback_allowPP = false;
[{
[nil, true] call ada_snek_fnc_unitSwitch;
BIS_fnc_feedback_allowPP = true;
}, 2] call ada_core_fnc_wait;
in a playerKilledScript.sqs with respawnType = "NONE"; seems to be good
(related to my thing, not to your handledamage)
TBH the fault is on mod creators, if they mess with damage they can at least setShotParents back to original values
@frigid raven According to EVH behaviour - the return of the latest EVH is the only used. Since you do not return anything in your EVH - it doesn't override previous one and don't follow that behavior.
those vanilla feedbackPP are too stronk lol
(probably no way to disable them completely)
BIS_fnc_feedback_allowPP = all, but i want to keep some of them
so just temp turning it off, and then reenabling works to get rid of the death one
BIS_fnc_feedback_allowPP that's only health
and "fn_feedbackMain.fsm" END state code looks like that > https://gyazo.com/985aeab46a13f92f3d00a3a80319953a ๐
https://i.imgur.com/x3F70xf.png
Any ideas on this? Even though the group is local to me, when I run selectLeader on myself, it still has a habit of completely fucking up leader status
as in, it changes between me and the AI unit in the screenshot about every frame
That AI unit is also local to me btw
@austere granite AI has an ability to take command (leader) if they are higher rank than you or your group units. Usually that happens on FF and death and they tell that in chat, don't know if that happens to you.
nah nothing happening outside me pressing that button, not in combat or anything like that
๐ค
Even if he takes command, shouldn't he keep it till I exec again?
Are you sure there is no scripted influence on that?
If I want to play a sound locally, with a parameter influencing the volume of the played sound, what command should I use ? playSoubd3D has a volume argument, but it's global. playSound is local but has no volume arg.
The volume is in cfgSounds config
You don't. Best bet would be playSound with the speech syntax and using fadeSpeech, obviously that will influence other things
] Demellion Dismal: Are you sure there is no scripted influence on that?
yes
Try to create a new group and move all units there, to see if it's not group related.
say2D has volume control
@tough abyss sound must be played at different volume following an ingame situation. say2D don't seems to have a volume control, only a distance parameter, but I have no object to play sound from. Should I create one specifically for this ?
anyone know how to pause the arma process to execute some checks in c# or other lanaguare
language
If you donโt return from extension call Arma will freeze until you do if this is what you mean
sooo
if i don't return anything to the extension, the game will freeze until i do?
we can't stop return anything to the extension
is a external exe
its a launcher
custom launcher
@vernal mural you can use player as object and find distance range that you can use to attenuate the sound
@tough abyss
No return from extension. Look up callExtension
@tough abyss does that imply this syntax [from, to] say2D sound ? If I use player as from, what should I use for to ?
Is there an event type for entering a marker like a rectangle area?
Use trigger with the same shape
#scriptedevents
and how is the event type called? myTrigger addEventHandler ["activated", ... ] ?
No just set up a trigger and put your code in on activation
Ok I knew that one. But isn't there a way to make this happen outside the editor?
I'd like to keep my script code externally
Yeah createTrigger
hm I see - so no way to make this happen to an already placed one in the editor eh? Well thanks, gonna try this then
Yes you can setTriggerStatements
@tough abyss sweet thx!
@tough abyss I think you are misunderstanding... There is no such use of say2D. And when I try this in editor, as expected the sound is always played with the same volume. The second parameter, according to wiki, is the max distance at which the sound can be heard. This probably imply a volume lowering if an other object (not player) is used.
I just literally tried it myself and it worked
The distance controls how loud it is, not linear though
Well, we have a problem. player say2D ["mySound", 1] is producing the exact same sound effect than player say2D ["mySound", 1000]
(having the editor opened right now, and live trying what you said)
well for me, 1, 0.5, 0.1, 0.9, 10, 1000, is always producing the same sound with default volume. Should I mention that the sound is defined in mission config file ? Is the command reacting differently in this case ?
ohhh
Since you use it on player it doesnโt matter that it is 3D not 2D
yeah I see. Indeed the parameter seems to wontrol volume, but I have to use very high numbers to get it to a decent volume. Maybe tweaking the default volume in CfgSounds will help.
By the way, thanks for help ๐
Yeah thatโs what I thought
You can make it loud there in config and increase distance as well
could someone help me with changing a vehicle's weapons through editor scripting?
@undone citrus weapons are defined in the vehicle's addon. I think there is script commands allowing you to "fake" weapons on nearly any vehicle, but it will not trully "add the weapon" to the vehicle (no turret, no gun, etc)
yeah that's what i was going for
For user created markers the format is
_USER_DEFINED #(NUMBER)/(MARKERINDEX)/(CHANNEL)
Does anyone know what that first number is? It doesn't appear to be the players UID, and it's too large to be clientOwner
<PlayerID> - unique network id of the player (same as _id in onPlayerConnected)
Outstanding, thank you much ๐
@tough abyss It will freeze for~ 2000-3000ms or so and then resume with error saying ...took to long
@unborn ether if this true then this must be quite recent
Hi guys! can anyone help me ? If I want to modify a script to play a sound when wearing a helmet what do I have to change here ?
waituntil {goggles _player == "Mask_M50" OR goggles _player == "Mask_M40" OR goggles _player == "Mask_M40_OD"};
This is from the ricks survival script
Do I have to change "googles" for "helmets" and change classnames ?
Can you detect what type of ammo hits a target?
@rustic pendant Depends on what item slot the object is in, I doubt a helmet would be in the goggles slot.
@outer fjord yes, using the Hit EH.
Thanks, I changed googles for headgear and it works with helmets
The problem is that the sound goes away when your moving fast
Yeah, try attaching an object to your player and play it on that.
I was trying to use the breath sound to simuleta the pilots oxygen mask
Any object ?
Yeah, like a redgull can or something, it just serves as a placeholder to play sounds. Not sure if this works for what you're trying to achieve, but I recall I used it for moving sound issues sometimes.
this is what im using
_player = _this select 0;
if (isdedicated) exitwith {};
waituntil {headgear _player == "FIR_JHMCS" OR headgear _player == "FIR_JHMCS_II" OR headgear _player == "FIR_ScorpionHMCS"};
while {alive _player AND (headgear _player == "FIR_JHMCS" OR headgear _player == "FIR_JHMCS_II" OR headgear _player == "FIR_ScorpionHMCS")} do {
playsound3d ["A3\sounds_f\characters\human-sfx\other\diver-breath-2.wss", _player,false,getposASL _player, 0.8,1,15];
sleep 5;
};
null = [_player] execVM "rick_survival\rick_helmet_breathe.sqf";
tip: use:
```sqf
// code
``` to mark code blocks
So I need to name the object and put it where _player is?ยก
try:
player say3D _sound;
first.
Can you script turning on lights? I got my lamposts on disable simulation and would like to keep it that way, however I do have a scripted event for SunOrMoon change, in which case i could loop through my lights real quick and turn them on through a script
nvm, https://community.bistudio.com/wiki/setPilotLight does it
was looking at the OFP commands which didnt work
Just to make things clear:
_unit addEventHandler ["killed", "call X11_fnc_onAiKilled"]; with call
vs.
_unit addEventHandler ["killed", "X11_fnc_onAiKilled"]; //without call
Sb. here told me that it would be bad practice to have this without call because of recompilation of the fnc (if I remember right). Is this true?
wait
I mean - what is the benefit of "recompiling" the func
when used without "call"
I do not understand this. Why should I have to "recompile" the func if it is compiled already?
Meaning why should I ever use it without a "call"
So going with "call" is always a better practice
When it is not better... that is what I want to figure out actually
I want to be sure to have the right approach in the future
Ahh you mean if it makes sense to actually have a func for a given code amount
Ok yea sure - Inline code is always better than a func call
Just was talking about having the func called with and without the call keyword
Ok I see
Well thx - things got clearer
๐
i guess change goggles into helemts
oops sry the chat didnt scroll, was responding to an old message
๐
profileNamespace does save stuff on the client machine right? How to bring it to the server, so it cannot be manipulated? Sb. told me a way here few days before. Can not find it anymore ๐ฆ
Also want to keep the information between mission and server restarts. Similar to how DayZ hive is doing it a bit
But not that elegant - they use a DB connection I am sure. Don't want to get that far
profileNamespace saves to profile file.
If you execute it on server it will be saved on server.
@frigid raven B is only better for short stuff
The code is recompiled every time it runs
I can't find it right now
but there was a feedback tracker issue about it
Does anyone have any GUI knowledge that I can pick your brain?
@peak plover kk
@frigid raven Sb. here told me that it would be bad practice to have this without call because of recompilation of the fnc (if I remember right). Is this true?
I told that and yes it's true.
Also your code doesn't make any sense. It doesn't work like that.
{X11_fnc_onAiKilled} returns the contents of that variable. It doesn't execute anything.
I mean - what is the benefit of "recompiling" the func There is none.
Why should I have to "recompile" the func if it is compiled already You don't. Arma does.
How to hide all elements of HUD for recording purposes (in-game cameraman aka on the field reporter)?
showHUD doesn't work completely
thanks. I doubt though it will work, it's based on showHUD. But will try
stui is relatively easy to hide with ["STHud_Settings_HUDMode",0] call CBA_settings_fnc_set;
hud additions such as STHud/STUI need ot be turned of separately
trouble is, last time i checked showHUD did nothing for stamina/stance panels
you are using advanced stamina, correct?
yes
yep it is its own display
hence why it still renderns
check the cba settings for it
ok thanks
@still forum I thought it kinda acts like a function reference
no.
that's what the call func does
if you remove the quotes then you grab the functions code and pass it into there and let it be converted to a string
and as strings cannot be called. The engine has to compile it first before every execution
what happens in a script like: ```ttt_toast = {
systemChat "A delicious toast";
};
while {alive player} do {
[] call ttt_toast;
};```
is ttt_toast compiled again and again? or not as it is considered code?
for the mods I usually make ttt_toast a separate file with an entry in CfgFunctions so it is compiled at load time. For missions I often do the functions as above. Thanks for the clarification, @still forum
It's only engine eventhandlers that can only store code as strings
and thus need to compile everytime
so it's more performant to just say "[args] call some_func;" in the event handler than write the verbatim function in the string?
yeah
Leave the [args] away. _this is passed implicitly
After looking at the code this also looks like it is free from this problems:
https://github.com/CBATeam/CBA_A3/wiki/CBA_fnc_addBISEventHandler
As it stores the function on object/missionNamespace it is attached too.
that was a insightful discussion ๐ฆ
hey furry @still forum I think you posted something in regards to gaussian distributions in arma right?
like in regards to getting a random pos
commy
see http://sqf.ovh
Carefully and biologically produced Arma 3 sqf training site
All these blue names are the same
Yep that's exactly what i meant, thanks ๐
That's your page though right?
Is there any script command to retrieve all vertices of a selection?
selectionPosition only returns one, if you have an axis and you want to retrieve both vertices you canยดt
So I have this to grab 3DEN object placed objects with some of their attributes
params [["_layerID", "ExportLayer"]];
private _array = [];
if (is3DEN) then {
private _layerIndex = (all3DENEntities select 6) findIf { (_x get3DENAttribute "name") select 0 == _layerID };
if (_layerIndex == -1) exitWith { _array };
private _layer = (all3DENEntities select 6) select _layerIndex;
private _entities = get3DENLayerEntities _layer;
{
private _className = (_x get3DENAttribute "itemClass") select 0;
private _position = (_x get3DENAttribute "position") select 0;
private _vectorDir = vectorDir _x;
private _vectorUp = vectorUP _x;
private _initCode = (_x get3DENAttribute "Init") select 0;
_array pushBack [_className, _position,_vectorDir,_vectorUp,_initCode];
} forEach _entities;
};
private _linebreak = toString [13,10];
private _nextLine = "," + _lineBreak;
private _allText = format ["[%1%2%1]", _lineBreak, ((_array apply { " " + str _x }) joinString _nextLine)];
copyToClipboard _allText;
_array;
But when I have around 70 objects or more I believe copyToClipboard gets maxed out.
Result: https://pastebin.com/RcKTj9kg
Anyone have an idea on how to get around it or fix it?
diag_log is no good either
diag_log will work for what you need tbh
like how many objects do you expect? You could round the positions, having them that accurate is pretty pointless in most cases but that'll only give you a little leeway, otherwise you'd have to split it up in different cycles
{ <code>
_array pushBack [_className, _position,_vectorDir,_vectorUp,_initCode];
} forEach _entities;
->
_array = _entities apply { <code>
[_className, _position,_vectorDir,_vectorUp,_initCode];
};
```sqf
<code>
```
For SQF syntax highlight
private _linebreak = toString [13,10];
-> https://community.bistudio.com/wiki/endl
But when I have around 70 objects or more I believe copyToClipboard gets maxed out. nope.
NOTE that output of this command is limited to ~8Kb
use joinString to build your string
diag_log will work for what you need tbh no it won't
https://community.bistudio.com/wiki/diag_log in patch 1.59 there is a limit of 1044 characters to be printed
Then you have all the timestamps in the way
ctrl+A, ctrl+L, left arrow, press delete 4 times
And he didn't say what he needs it for. Maybe he needs it to be clipboard
save* in a .sqf and then recreate the objects using another snippet of code
private _allText = format ["[%1%2%1]", _lineBreak, ((_array apply { " " + str _x }) joinString _nextLine)];
->
private _allText = _lineBreak + ((_array apply { " " + str _x }) joinString _nextLine) + _lineBreak;
_allText = "[" + _lineBreak + ((_array apply { " " + str _x }) joinString _nextLine) + _lineBreak + "]";
Oh look at that, had totally missed that format is limited to 8kb. So used to use it that I never thought about it
muh bracket
Hats of to you guys
Is say2D distance parameter working correctly?
hello, i getting problem. In multiplayer i use player addEventHandler["Take",{_this call fnc_onTakeItem}]; but on players is not working, script not starting ๐ฆ
but on my unit is working nice
Is there a command to lock vehicle control?
Terrano, sounds like it is running inside an if (isServer) {...}
@errant jasper no is running on client
// initPayerLocal.sqf
if (!hasInterface && !isServer) exitWith {};
player addEventHandler["Take",{_this call fnc_onTakeItem}];
remove that > if (!hasInterface && !isServer) exitWith {};
if (!hasInterface && !isServer)
๐ค
isDedicated ๐ค
What....?
but i use that for headless client is loading functions from his addon
if (!hasInterface && !isServer) then {
execVM "init_HC.sqf";
};```
like on biwiki
initPayerLocal.sqf != init.sqf btw
so in your example >if (!hasInterface && !isServer) exitWith {};
that will works only for local host
you are the server and player there, at the same time
"initPlayerlocal.sqf"
if this was in init.sqf it would make a little more sense than not, but the server will never be loacal in the instance of initPlayerLocal.sqf
unless your machine is the host. In which case I don't think is going to be the most common
^
@meager heart thank you! I move that code to init.sqf. I use dedicated host for test it. When i connect - it work fine. But when my friends connect to server and trying to take item - is not working for they.
@high marsh thank you for information, i will read more about this files on biwiki
https://community.bistudio.com/wiki/Event_Scripts <-- Here is a link to all the event scripts including initPlayerLocal.sqf
@high marsh ty
I move that code to init.sqf
move it back
executed*
in, on, with, without, is.
as i understand - code for headless client - i need run on init.sqf.
i will try now test, idk maybe will work
//--- initPlayerLocal.sqf
if (!hasInterface) then {
//--- runs on headless client
};
^ Poifect.
!hasInterface && !isServer
// everywhere
isMultiplayerSolo?
If you do a lot with HC then I find it useful to make an object and set it's locality to the HC.
This way you can always remoteExec to the HC
{myCode} remoteExec ['call',headlessOwnedObject];
And this way if HC is not present, the object should be set local to the server
So your scripts still run
Maybe you'll find it useful ๐คท
thanks all for help, but headless client is working fine
i have troubles with event handlers
player addEventHandler["Take",{_this call fnc_onTakeItem}];
the _this there is useless (btw)
on multiplayer server working only for my client
what does the code do?
player is always the local client
if you run that in initPlayerLocal then every player will have that eventhandler added locally
but there was >!isServer) exitWith {};
no, this start local, when client connecting
ahh, sorry my English is terrible
yes, another EH's is working fine local on every client. But that working only on part of clients. I try'ed to use systemChat for detect when fnc_onTakeItem is started. But on another clients chat is empty and log is clear
when the other client by himself causes the eventhandler to execute?
or he doesn't see in his chat when you execute the EH?
try this >
// initPayerLocal.sqf
if (!hasInterface) then {
//--- code here for headless
};
player addEventHandler ["Take", {call fnc_onTakeItem}];
@still forum yes, when other client take item
As I said. player is always the local player
@meager heart i understand. But all another functions works fine on all clients. Only this EH
the eventhandler only executes locally
@still forum i understand. Player send me log file. And i can't find that - data logged by script. When he run EH his systemChat was empty too
@dusky pier why bother with if (!hasInterface && !isServer) exitWith {};
you've already got it in initPlayerLocal
totally pointless to include that line
We've already been over this
also maybe fnc_onTakeItem > TERRANO_fnc_onTakeItem and "cfgFunctions" ๐
:sad:
@still forum the !hasInterface would be better served as a waitUntil rather than exitWith would it not?
oh
so waitUntil would either exit immediately or wait infinetly
i see
both make no sense ^^
i was under the impression of it being until player can see the game screen
but if that's the case then why have it all
initPlayerLocal only executes on player machines
until player can see the game screen that is actually a very complicated problem as any mod may start a loading screen at any time and prevent the player from seeing the game screen
because you didn't do anything
all you did was remove the redundant check to see if initPlayerLocal is being run on the server
which it never will be
remove that line entirely
because what's happening is your local machine is also considered "the server" in sp environment because "the server" is the same instance as "the client"
that's poorly worded but
basically, in an sp environment, that will not work
i think
i've never seen anyone put something like that in initPlayerLocal
@tough abyss all client scripts running from initPlayerLocal.sqf, but not working only one EH.
It removes headless clients which are also players but without interface.. Which i already explained half a hour before now
then that's a problem with the EH
trying to fix issue with EH by changing something completely unrelated
???????????????????
@still forum oh, interesting, i guess that makes sense given the way HCs are slotted
where that fnc_onTakeItem defined ? ๐ค
yes
yes what
Where is it defined, not is it.
player addEventHandler ["Take", {call fnc_onTakeItem}];
Why isn't your function tagged?
like
TERRANO_fnc_onTakeItem
thinking emoji
and that file name is ?
show me your cfgFunctions
[] execVM "fnc_onTakeItem.sqf";
execVMing a defined function file
this is 200 IQ shit right here
that's not your cfgFunctions anyways
where you have that ? [] execVM "fnc_onTakeItem.sqf"; < that
//fnc_onTakeItem.sqf
fnc_onTakeItem = {
systemChat "fnc_onTakeItem.sqf";
diag_log "fnc_onTakeItem.sqf";
params [
["_unit",ObjNull,[ObjNull]],
["_container",ObjNull,[ObjNull]],
["_item","",[""]]
];
if !(getPlayerUID _unit in ADMINS_ARR) then {
if (_item in HACKED_ITEMS) exitWith {
[_item] call fnc_deleteItem;
};
};
playSound "click";
[] call fnc_saveGear;
};
@meager heart in initPlayerLocal.sqf before EH
execVM is scheduled
used compileFinal but nothing changed
i see about 10 prpoblems here
I vote we start with untagged functions and go from there
is still working for me, but not for another players
you want quick solution? publicVariable the function
but there's too many issues with this approach
- Tag your functions, learn to do it and just do it everywhere
- You are using execVM, that doesnt give a reliable init order so the fact that it is "in front of something" doesnt matter
- You are not passing any arguments
{ call fnc_onTakeItem }, how is onTakeItem supposed to know who the unit, container and item is?
@dusky pier i've already done this exact thing that you're looking to do, i'll just find the code and throw it at you
because it's way simpler than
whatever this is
VAN_bannedItems = [
//Put array of banned items here. They should be type "string".
];
player addEventHandler ["Take", {
params ["_unitTaking", "_container", "_itemCN"];
if (_itemCN in VAN_bannedItems) then {
_unitTaking unlinkItem _itemCN;
_unitTaking removeWeapon _itemCN;
_unitTaking removePrimaryWeaponItem _itemCN;
systemChat "It's against ROE to loot enemy weapons or gear!";
};
}];```
it could stand for some optimization, particularly with these lines:
_unitTaking unlinkItem _itemCN;
_unitTaking removeWeapon _itemCN;
_unitTaking removePrimaryWeaponItem _itemCN;```
but it'll work fine
i ran it in a mission with 40+ people
@tough abyss thank you a lot!
Is there something like weapons player but for grenades/throwables?
I saw functions that get a list of CfgWeapons >> "Throw" and it looked awful
was hoping for something more convenient
currentThrowable also
@tough abyss lol gonna steal that snippet, too. Need it later ๐
๐
the only thing is that array can get pretty hairy because you need to identify individual weapons
so if you wanted to you could re-write it to be all OPFOR weapons or something along those lines
but i didn't care to because i was on a time crunch when i wrote that
do you use debugger for work with scripts? Something like @still forum BI Debug Engine?
debug console on esc?
yes
I probably have the only useable interface for the debugger.. So I don't think that anyone else uses it
i see on youtube - people use your Debug Engine with Arma.Studio
no
:sad:
It will be back in alot better soonโข
very nice ๐
also @dusky pier forgot to mention but that code should be in initPlayerLocal.sqf if it wasn't obvious
is there something like isVehicle _unit or isSoldier _unit ?
You trying to do something like Example 3? - https://community.bistudio.com/wiki/objectParent
hm na