#arma3_scripting
1 messages ยท Page 249 of 1
Or could be incredibly lazy (if you're only executing it once), and just pass the code with remoteExec ["call"..]; Depends how tight you are on security
Please don't hurt me ๐
Ah, okay!
So what would count _opfor do for the script in this case? I understand it counts all the variables in the array, but why would it need to do that?
Also, sorry for the delayed response. I was at the gym.
count can also be used to loop through an array
Similar to forEach, without _forEachIndex (see BI Wiki)
_x refers to the particular element within the array
e.g
{
_x //1, 2 then 3
} count [1,2,3];
Oh!
So that count _opfor performs the previous string for each opfor unit in the array?
performs everything inside the scope, yep
Cool!
Okay, so, next task. I want everyone in that array to be teleported to six different areas.
What's the best way to do that? i don't have individual variables in the array.
setPos
That's what I thought, but wouldn't all the players spawn inside each other?
Oh wait!
Setpos looks for the nearest available space.
Nevermind.
heh
Does the event handler InventoryOpened work for anyone?
What's not working about it?
It literally dosent work.
dosent work: player addEventHandler ["InventoryOpened",
{
systemChat "inventory opened";
}];
works: player addEventHandler ["InventoryClosed",
{
systemChat "Inventory closed";
}];
I literally copy and pasted your code and it worked for me
Any mods? And have you tried verifying integrity of game cache?
I've figured out what it is.
Any one know how to make ai scan horizon ?
Hey guys. Does someone know if there is a way to use CustomAttributes that you can edit in the eden editor with just the descrtiption ext or so?
I want to use the attributes for some different maps and they are all 2d editor
so i search for a scripting way to get them active
To be prcise i want to use the revive feature in all its power without the eden editor based map
class Attribute1
{
property="ReviveRequiredTrait";
expression="false";
class Value
{
class data
{
class type
{
type[]=
{
"SCALAR"
};
};
value=0;
};
};
};
Something like this
ReviveRequiredTrait = 0; in description.ext does not work
Anyone know the utility of the RscFrame for GUI ?
And the ctrlCommit ? I read it on wiki but no exemple
@elfin bronze what do yu mean with 'utility'?
#include "test\myFile.txt" How does the preprocessor decides whether 'test' references a sub-folder from current location or rather an addon-folder elsewhere?
@elfin bronze RscFrame is probably a frame around "something" like a picture. ctrlCommit is used to "commit" the changes you did during runtime.
@scarlet spoke the engine will search for it through it's search paths and then use whatever it finds first.
\test\myFile.sqf
.\
..\
..\..\
..\..\..\
etc..
Until the root of A3 and then mission folders and what not
Would be fine for another addon
If you #include a non existing file and you monitor the arma3.exe with https://technet.microsoft.com/en-us/sysinternals/processmonitor.aspx you'll get a list of all the paths it will search ๐
That's pretty nifty ๐
So basically it just takes what it finds first?
yes, but there is a specific order of importance in paths and I don't know it of the top of my head
It would depend on the syntax of your path, I would imagine
So if I had a subfolder called 'test' but also an addon called 'test' there's no chance I can reference both of them?
that's what the pboprefixes are for
pboprefixes? ๐
and there's a difference between an absolute path and a relative path like @dusk sage mentioned
^^
Okay thanks! ๐
You think lot of people actually use the relative approach to reference addons?
if you want to include a file from another addon then you'll probably want to use the absolute (PBOPREFIX) path
To reference an addon as I wrote above, use a leading \
In simple terms, returning you to the Arma directory (where your addon folders are located)
Is '$PBOPREFIX$' a place holder in the wiki or is it an actual Preprocessor macro?
This was more of a general question as I'm currently writing a parser for the preprocessing stuff and I stumbled upon this... But I think I'm good to go to simply use relative paths as paths relative to the current directory without worrying about addon folders ^^
Ah okay...
what are the pros and cons of #define within an sqf script? why do some people use it instead of just normal variable declaration?
don't think there a pros and cons. And it's used to define constants.
in SQF it's mostly used to define defaults I think
you're probably better off doing a general programming google search about #define.
This is probably a hilariously dumb question, but what's the best way to make a mission end when a particular side completely dies?
i understand what #define does, but why do people use it in place of var = value? just neatness? habit from c/++?
it's not used to define macros and variables then?
as i understand it, it's used to define macros and variables. but that understanding is "obviously" wrong?
thanks, that's a great site i'd not heard of, but my question pertained to #define within .sqf specifically
There's nothing special about #define in SQF, it's pretty much the same in all the languages that support it
I'm not trying to be an ass or anything, I โค you.. ๐
mate if you cant explain how hes wrong, youre not really adding anything to the conversation
within the scope of SQF, #define is sometimes used to define constants
doesn't really add too many advantages over simply assiging the var normally
one thing would be #define A (getPos player) : the value of it wont be determined until you use it
@tough abyss i believe there may be templates for that in eden/desc.ext but it's quite easily scriptable too
its also one variable less in the dictionary but thats negligible really
I looked in the desc.ext, I couldn't find anything pertinent.
There's a billion ways to do it....holdon switching to pc
@indigo snow mate, spoon feeding is the worst kind of "helping"..
hi boguu!
i sometimes like it for stuff like if statements with a lot of conditions. I can still use lazy evaluation without having an enormous line
#define C1 (hasInterface)
#define C2 (!isNull player)
if (C1 && {C2}) then ...
The conversation so far is surrounding defining constants, but we all know that its true purpose is for ```cpp
#define SVAR setVariable
CBA ones are nice too, puts in all the tags for you. FUNC(init) , GVAR(timer), etc
Has anyone had issues with using the unitAddons command with modded items? It returns an empty array with any classname I've been giving it.
Scratch that, it's also not working with BI items either.
It's working fine for me, what is the object you are trying to use with it?
I'm trying to use it to retrieve the addon of various pieces of equipment on that player
the*
so unitAddons (vest player) etc
But even getting the classname with hint str vest player and manually entering it so unitAddons "Classname_retrieved_from_str" doesn't work either.
I think that's your issue then, it seems like it only works for CfgVehicles entries
Ah I see
Well that should probably be listed on the page
The BI page that is of course https://community.bistudio.com/wiki/unitAddons
Yeah it should, there is another command you can use
Any other way off the top of your head to get the addons I'm looking for?
Give me a moment to find it ๐
You just want it to return the CfgPatches entries right?
This should work https://community.bistudio.com/wiki/configSourceAddonList
_addons = configSourceAddonList (configFile >> "CfgWeapons" >> vest player);
hint str _addons;
Yes sir, that looks like it'll do it.
You'll just need to switch between CfgWeapons and CfgVehicles depending on what the object is
wait if the vest is CfgWeapons can I use the BIS_fnc_weaponAddon for it?
I can test that when I get back actually
Gotta run for now
Thanks for the help as usual though Pennyworth
No problem, let me know if it works out. Yeah you should be able to use that function then
I want to made custom notification, moving from the side like bis_fnc_showNotification. I found bis_fnc_showNotification but i saw nothing for moving the display :/
It's working Pennyworth, thanks again. Actually had to use a combo of yours and BIS_fnc_weaponAddon for my purposes.
What's the best way to increase the amount of damage a vehicle can take?
@tough abyss use an event handler and handle the damage by yourself
Alright, thanks.
That one should do the job
Wait that's not true
This is the one you're looking for :)
Thanks!
You're welcome
Qualcuno sa come far fare fastrope alle ia? Intendo tramite script (ace 3)
sorry
Does anyone know how to do fastrope to ia ? I mean by script ( ace 3 )
Ace3 is a mod not script. I believe there is a module in editor that activates this function
@crystal zodiac
Anyone know how to remove some ace's action on object ?
On the portable light i have drag, load, carry, and i want to disable just on this object
["myTag_notLamp", {
params ["_player", "_target"];
!(_target isKindOf "<whatever_class_name_the_lamp_is>")
}] call ace_common_fnc_addCanInteractWithCondition
Something like this?
I saw this 2 functions ace_interact_menu_fnc_removeActionFromClass
ace_interact_menu_fnc_removeActionFromObject
The exemple is : [typeOf cursorTarget, 0,["ACE_TapShoulderRight","VulcanPinch"]] call ace_interact_menu_fnc_removeActionFromClass; but i dont find how to work with Land_PortableLight_single_F
can anyone confirm that inRangeOfArtillery is broken (on stable)? inRangeOfArtillery will return true while doArtilleryFire fails to fire a round at certain ranges..
seems like the min and max are wrong somewhere
after some testing in game the max range for the 155mm is 13300m while inRangeOfArtillery returns true with 22154m and probably higher. :/
I'm not sure if this is relevant, but different "fire modes" in the artillery have different ranges. So maybe one command is using the close firing mode while the other is using the max
yup seems like it
there's a gap between the fire modes after 13300m which is why I assumed that was max
but it's actually 58000m
however inRangeOfArtillery is still returning true on higher values than that...
the 82mm mortars seem to work a bit more reliable
@UpperM
By the way I've tried removing the actions for those objects, but you can't because is checks for the variable ace_dragging_canDrag
set the variable ace_dragging_canDrag to false.
Hey guys, just wanted to say thanks to a few of you, as you know who you are, that have helped me out over the last few weeks. I've made my own very basic mission and now have it running on a server for Zeus missions.
Naturally it doesn't end there, I wanted to ask for your recommendations on allowing a certain list of mods for example. I'm not sure what's popular but do people often use a few mods that pretty much all servers should accept?
@Leon
Now that's a loaded question.
Loaded, @ebon rover? How so?
@frail trout that highly depends on what kind of players you want to address... If you're addressing more tactical/MilSim players you'll need either TFAR or ACRE and probably ACE
But if you're addressing more of the casual players you most likely want to not use any Mods as this only increases the difficulty of joining your sever
@quiet bluff You have to use the addAction command on the pilot's machine only as the effect of addAction is local
For this you can use the remoteExec command with the pilot's unit as a parameter
@scarlet spoke, appreciated.
Is anyone aware of how to create looped / periodic messages that appear somehow within the server? I could do with it as I'd like reminders about Discord / TS etc?
hah
Why does the handleDamage eventhandler even fire when the damage is 0.0 ^^
Well tested it via ```_vehicle = _this select 0;
if((alive _vehicle) && !dmgSkip) then {
_vcls = nearestObjects [getPos _vehicle, ["LandVehicle", "Air", "ship"],8];
_selection = _this select 1;
_damage = _this select 2;
_shooter = _this select 3;
_ammo = _this select 4;
_vcl = _vcls select 0;
if (_damage > 0.0) then {
...
} else { hintSilent (format ["Test Damage: %1",_damage]); };
};``` it spits out "Test Damage: 0" so..
And how did you 'damage' it?
had it in for longer. Thing is it sometimes triggers when I'm driving normally on the road without even hitting anything.
Hi guys, I've seen a few servers where they manage to split up the teams in the spawn menu.
I'be named every squad appropriately, Alpha 1-2, 1-2, Bravo 1-1, 1-2 etc etc
However they don't appear like that in the spawn menu. They're actually quite jumbled up.
I also want a few seperate spots for admins outside of the squads too so any help would be greatly appreciated.
split up fireteams*
@frail trout they will show up in the order you put in the groups/units.
So I need to delete all and carefully plan my hierarchy?
Yea
The only issue I can forsee is how, do I change from Alpha, to Bravo for example?
There is no real way AFAIK
I'm sure I've seen this in servers... damn
ohhh okay, well that's workable I suppose.
@frail trout you could always use the setcalsign module
Or use the script that sets the groupid I forget he script
@plucky beacon I believe it doesn't change the name on the lobby screen.
But might be wrong
Tried it awhile ago so might have changed.
I'm pretty sure it does. But the order they show up is the order they spawn.
Only the name can be changed that way.
Right okay, so careful order, and then setcallsugn module, I'll give that a whizz now and report back gents
@frail trout with Eden you should be able to set the call sign name by clicking the group icon as well.
Oh that's what I was doing and that didn't work
Maybe it's faulty then
@plucky beacon, @distant egret - yeah the fuction must be broken. The module nor group call sign attribute override the usual hierarcy. Odd!
it is correct that setting a custom callsign won't be visible in the lobby, only in-game
It's hardcoded and cannot be changed
tubad sosad
lol BASIX scripts just banned 5 people, all the same clan today from the server xD
Hai! This can't be checked sadly, hope anyone know: nearestObject uses what kind of point in the object to calculate distances? ASL, AGL, WorldPos, AGLS? ๐
where distance is measured in 2D space
ASL, AGL, etc are not 2D space ๐
WAIT
Returns the nearest object of given type to given position within a sphere. Hardcoded radius is 50 meters. Unlike with nearestObjects, where distance is measured in 2D space, nearestObject will be closest object in 3D space.
dammit ๐
so, no clue
^^
does it matter though?
Does anyone know if there is an easy way to raise the damage threshold/health of a single unit whilst using ACE 3?
distance should be the same between all the position methods
@halcyon crypt thanks! But its nearestObject and not (...)Objects (with "s").
yeah, I noticed. That's why I corrected myself. ^^
I see! Reading it.
@halcyon crypt i need to save map objects to the database, so i'm using that: i save the point in map that have zero distance to the object in terms of nearestObject.
so one point became one map building.
to transform the point in a building i just need to do that: _mapBuilding = nearestObject [_point,"CIV_house_V1_F"];
or even _mapBuilding = nearestObject _point; if i know the distance from the building to the point is zero.
I'd say it's save to assume that it's AGL
https://community.bistudio.com/wiki/Position mentions Most commands either take or return PositionAGL.
Thanks a lot! I will go for AGL!
Hey guys I have a question, is there a way to make a script where if you're on foot in MP you're vunerable, but if you're in a vehicle you're invincible? I made a reddit post about it and someone told me to ask here https://www.reddit.com/r/arma/comments/4wmusx/make_players_invincible_when_inside_of_vehicles/
this addEventHandler ["HandleDamage", {
_veh = _this select 0;
if(vehicle _veh != _veh) then {
if(_this select 5 < 0) then {
damage _veh;
} else {
_veh getHitIndex (_this select 5);
}
} else {
_this select 2;
};
}];
And I put this in the Unit init right or the vehicles init?
this allowDamage true;
this addEventHandler ["GetOutMan", {(_this select 0) allowDamage true;}];
this addEventHandler ["GetInMan", {(_this select 0) allowDamage false;}];
Also fixed your approach
Unit init
switched true and false with allowDamage since you want inside to be invincible
I think your script worked! My friends just hopped off so I'm not entirely certain it works for multiplayer, but it worked for me as well as AI when running it as a server. I'll let you know if it doesn't work with people, but for the meantime thanks! (I'll copy and paste this on reddit so people know that script worked)
it works because init fields in editor are global
so event handler gets added on all clients
your approach would work too, though I'd remove first allowDamage to avoid JIP problems
I'll keep that in mind for any missions I make in the future, but for now I'll just use your script. It's for a simple game of cops and robbers for me and my friends so whatever works for us is gucci. If I ever publish it I'll credit you for the script ๐
@lavish ocean any info on get/setRagdollMode ? it would be incredibly useful since you currently can't induce a ragdoll consistently.
@lone glade looked this up a few weeks ago. http://killzonekid.com/arma-scripting-tutorials-forced-ragdoll/
this method isn't effective in multiplayer and is wonky at best
I wrote a revive system, player get shot, I then use setUnconscious to force a ragdoll then turn it off 2s after and play the downed anim (in vehicles ragdoll is skipped and death anim is played).
problem being that setUnconscious being turned off try to play the "back up" anim then quickly switch to the downed anim, which doesn't look good.
Anyone know what is used to get the targeted positon for commands under the ~ key? (Ex., telling a unit to move). It can target grid locations, fortification positions on buildings, and collide with objects (such as a tower). Any help would be greatly appreciated.
Alternatively, if anyone knows where you can look at the code for the #USER: command menus, this would also give me the answer. Thank you.
screenToWorld and cursorObject
Those do not provide fortification positions and have their own limitations that the command menu seems to not have. I am ASSUMING there is another position command I am missing somewhere.
Is it buildingPos that gives those? An example is when you try to tell a unit to move next to a wall, it will have a gray line indicating where they will try to move to, often with a name like "#position 7"
don't know about those sorry, but for building positions buildingPos does return them.
It's probably buildingPos, I'll have to look. Makes me wonder even more how they have the command menu targeting works. Can't seem to find the #USER menus anywhere...
Ah, okay. So they pass bot h the cursor position, cursor target, and check if it's 3D or in the map when getting the command position. For finding buildingPos, I'd assume they update the cursor, as there is a function for that under the Support modules.
Essentially, there is no "special, 3rd command" I was hoping for, they simple use all of this to filter through what the player is trying to aim at.
http://puu.sh/qtOo4/aee7bbe5b2.jpg _vehicleInfo params [["_group",""],["_vifamily",""],["_evhID",-1],["_ownerUID",""],["_evhID1",-1],"family"];
That error message should be the other way around.
Error global variable in local space
Well, it makes some sense, though could have been worded better
am using a calltoprayer script i found online. it makes a function called "j_fnc_soundCallToPrayer" that has a say3d command in it, for the sound. It is called is through callToPrayer.sqf which contains this:
if (daytime >= 6 && daytime <= 6.05) then {
//playSound3D ["soundName.wav", soundPos];
//[[], 'j_fnc_soundCallToPrayer'] call BIS_fnc_MP;
//gl1 say3D "CTP1";
remoteExec ["j_fnc_soundCallToPrayer"];
};
if (daytime >= 12 && daytime <= 12.05) then {
//[[], 'j_fnc_soundCallToPrayer'] call BIS_fnc_MP;
//gl1 say3D "CTP1";
remoteExec ["j_fnc_soundCallToPrayer"];
};
if (daytime >= 15.5 && daytime <= 15.55) then {
//[[], 'j_fnc_soundCallToPrayer'] call BIS_fnc_MP;
//gl1 say3D "CTP1";
remoteExec ["j_fnc_soundCallToPrayer"];
};
if (daytime >= 18 && daytime <= 18.05) then {
//[[], 'j_fnc_soundCallToPrayer'] call BIS_fnc_MP;
//gl1 say3D "CTP1";
remoteExec ["j_fnc_soundCallToPrayer"];
};
if (daytime >= 20 && daytime <= 20.05) then {
//[[], 'j_fnc_soundCallToPrayer'] call BIS_fnc_MP;
//gl1 say3D "CTP1";
remoteExec ["j_fnc_soundCallToPrayer"];
};
sleep 60;
};
i changed BIS_fnc_MP to remoteexec myself
but the same problem still persists. when tested on a multipleyer game (dedicated), the sound sort of multiplies itself
so there is this echo effect since its being played multiple times.
playsound3d is a global effect.
You're hearing the sound multiple times because it's being played multiple times.
will try playsound3d
These conditions
shhhhhh matra, no tears, only shitty code
_times = [6, 12, 15.5, 18, 20];
_index = {if(daytime < _x) exitWith {_forEachIndex};} forEach _times;
if(isNil "_index") then {_index = 0};
waitUntil {
if(daytime > _times select _index) then {
_index = _index + 1;
if(_index >= count _times) then {_index = 0;};
remoteExec ["j_fnc_soundCallToPrayer"];
};
sleep 60;
false;
};
The Forums have almost all the answers to all the questions
https://community.bistudio.com/wiki/Arma_3_CfgWeapons_Weapons
Anyone having problems ejecting people from a co-pilot seat?
player action["Eject", (vehicle player)]; dosent seem to do it on a GetIn EVH.
yet it works for everything else.
@runic spoke did you set the getin EventHandler on the vehicle?
Eject action doesn't work for seats that have it disabled in config
you need moveOut to forcefully move out the unit
when defining a function in class CfgFunctions does the attribute description do anything for that function? Does it display somewhere in game? Maybe perhaps in the config browser?
Does it show in the function browser?
There is a function browser? I know there is a config browser but don't know about a Function browser
ah yes found it BIS_fnc_help
It might be called Function Viewer
I don't know I will look into it
Wherever you see a button for config browser there should also be one that says function
Scriptor needed for an Arma 2 DayZ Overpoch server
Hi, is it possible to make a custom UI for radar to show on a screen for all vehicles and such approching? instead of using the radar on the top left when you are flying or something
I guess you could. Could make UI update with a PFH that looks for nearby vehicles
Has anyone access to any good working examples of white list reserved spots on servers? I'm after reserving two spots got admin and rather than using a kick script that's widely available I'd preferably like to simply grey out the spot in the spawn lobby.
I've seen reserved spots done well in the likes of Altis/Tanoa Life.
greying out slots in the lobby is not possible AFAIK
what works is slots that return a player to the lobby when picking it
I was wondering, using the menuposition in the respawn templates, would it be possible to give a respawn point a name instead of NE of XXXX
@tough abyss yes that's possible if you add the respawn position via the function BIS_fnc_addRespawnPosition.
It can take an additional parameter as the name for this position
ah too bad then
Why too bad?
because I have default respawn points that I would like to name, marked as respawn_westBase etc
Does somebody know how I can search this channels history for keywords?
@tough abyss Well that's not a problem at all... You could simply write a script that does the work for you...
You should just use a slightly different markerName-Prefix in order to prevent doubling the positions
Do you need this for COOP or TvT?
Does anyone have a quick fix to regear units as they are spawned, regardless of how they are spawned?
I want them regeared whether editor placed, script spawned, or Zeus created. I've already got the switch cases written up, but it's been a while since I wrote anything like this and I wonder how I need to hook it in.
{
// do stuff in here
} forEach allUnits;```
@shadow sapphire Well the above would have to be executed on mission start in order to get all the units created in the editor... Dor Scripts and Zeus you have to write a function to spawn units via script in order to hook up to this and for Zeus you have to overwrite the respective Zeus-function ("BIS_fnc_curatorObjectPlaced") and perform your code in there (but make sure to copy the original function into it as well. Otherwise some odd behaviour will ocur)
@tough abyss we saw you troll on the BIS forums on the ace3 slack, I had to explain that you were a troll ๐
@shadow sapphire try adding to description.ext: class Extended_Init_EventHandlers { class Man { init = "_this execVM 'your_script.sqf'"; }; }; I believe the unit is "_this select 0" within your_script.sqf.
haven't tested if zeus-placed units are affected. if not: zeusmodule addEventHandler [ "CuratorObjectPlaced", { _zeus_obj = _this select 1; .............. } ]; give the zeus module the variable name "zeusmodule" (or whatever)
and I just learned that the extended_init_eventHandlers is a CBA thing, not native to vanilla
Yep. Extended event handlers is CBA.
Someone must have listened. That's probably where that spawn{ execVM} code on reddit came from
yes it was ๐
Weapons have a side like units?
Don't think so...
that's just retarded enough it might work
Be sure your script finishes before the thermal throttling kicks in though
how can we check the inventory of a backpack laid on the ground? I have tried using the backpackCargo command and similar ones, but i only get an object type, never the actual backpack object
Is there a global variant of setUserActionText?
No, because the action ids are all different on all machines
Ah, makes sense. Even if the action is on a AI unit?
Even AIs are local to one machine
Usually to the machine where the group leader is local
Yea I see now. Any way to remove a action from an AI for all players?
I guess not really.
of course
When adding the action
store the returned ID in a object namespace variable
private _id = _unit addAction ...
_unit seVariable ["Jasper_myActionID", _id];
Then define this function:
I'm using remoteExec to add the add action so I can't get the I'd.
Yea
But why do you remoteExec this in the first place?
Can't you execute it on every machine directly instead?
I need to add the add action for all players
It's a dynamic system spawning civilians.
So only on places where players are civilians spawn there.
I got a integration action on them and wanted it to change color if the civ was already talked to.
But I guess I need to wait for that.
Yea could have ID saved local to the player and when it needs changing have an other function called.
Exactly
Thx that should do it.
depends what type
publicVar
no need for the false in the remoteExec block
JIP flag is optional and won't be set if not specified
publicvariable is the way to go
remoteExec is slow as fuck
Whats the max size for Arrays these days in Arma 3?
I think I last tried in 1.63 dev before apex release and it was either 9,999,999 or 10,000,000
thanks
speaking of big numbers, I need help with this pseudo-random number generator. http://pastebin.com/2zXHws7v
it gets into repeating itself after not too long. maybe I'm misusing the parameters (134456, 8121, 28411)? I'd use other params but arma can't handle gigantic integers
I have a sort-of workaround: a ban-list of numbers that can get caught in that repeating loop.. but that feels like cheating, and i won't spend time trying to find them all.
Is it doing that every time? Same numbers, too?
here's results of 7 tests, each with a different starting seed. always falls into the sequence that arrives at repeating 98640 and 129448 http://pastebin.com/62U27J4v
so, yeah. if I add 98640 and 129448 to a ban list (if found, adds prime number 53 to the increment), other numbers (129480, 129512, 129544, 129576, 129608 found so far) are also guilty offenders
I feel like this wouldn't be a problem if arma could handle gigantic integers for the parameters
like 2^31-1
Probably not. I've ran into this before in another game that had a similar issue, but I'm both rusty and having trouble remembering it. Looking at the multiple tests, they actually start following the exact same number pattern for a while before it starts pumping out duplicates. Is it the math?
Working atm, can't study it too thoroughly ๐ฆ
yeah, this algorithm will always generate the same circular sequence of numbers. where you start in that sequence depends on the first seed you give it (123456 in the script pastebin).
these parameters are apparently really weak for random distribution as you can see
@tough abyss @native hemlock
Error Max array size would be reached. Current size: 9999999, wanted size: 10000000.
Guys whats the most simple way to change a specific row in an array?
A specific element?
yeah say i have _myArray = [123,124,125]; and i want to change element 2
Then i were looking in the right direction. Thanks ๐
Is there anything special I have to do for setting an object texture on a table or axe? Works for units/vehicles but not those.
@indigo oriole The object models would need a hiddenselections area defined in them. Basically a selection of the model that allows for re-texturing/hiding. It's defined in the model.cfg and the selections are named in the p3d (model) so you can't add hidden selections yourself unless you have access to the source versions of the .p3d models.
And thus setObjectTexture won't work for your table/axe ๐
Do someone know a good book, PDF, youtubechanel or tutorial for learning sqf? (german or english)
https://www.youtube.com/watch?v=WmEBN-RbK44
Thank me later ๐
@tough abyss BIKI + writing your own
haha very funny ๐ that you share svens video ๐
it also helps to read code from people who write proper stuff and comment it or at least have headers
@lone glade this video is realy good he did some basic stuff and build it up how he learned programming at the Universery so if you are realy new this video is perfect
yeah but it's in german
oh didn't saw the german or english part, mybad
no problem
It's a playlist. After watching it one should be ready to write his own scripts or use the wiki to learn from
Yep
player SetPos [(getMarkerPos _dest select 0),(getMarkerPos _dest select 1)]; with_dest being "respawn_west". Would this work or do I need to remove the "?
_MarkerPos = getMarkerPos "respawn_west";
player setPos [(_MarkerPos select 0),(_MarkerPos select 1),(_MarkerPos select 2)];
OR
_MarkerPos = getMarkerPos "respawn_west";
player setPos _MarkerPos;
or easier:
player setPos (getMarkerPos "respawn_west");
@tough abyss
*updated
alright thanks
Does anyone know, if its possible to get the ServerSetting "maxPlayers" ?
you can only get the value inside the description.ext
You can not acess arma configs without something like a dll
k
maxPlayers = XXX; in description ext header
Its not what i need, but thx.
Any way to spawn a vehicle with a other skin than his base one. Or change it after its spawning. The other skin is available in Eden in the vehicles atrobutes.
@distant egret, yes. There are a few ways to do it. I use one of them to do it for my sandbox, but I do not remember it off the top of my head and I'm unfortunately too busy to dig it up right now. First step, though.
I do remember this much. Start off by going to the virtual arsenal garage, create the thing you want, then export it to a notepad or whatever you use for scripting.
Yea did that, but it didn't give me the extra code for it for the vehicle I want to do. Tried it with a bis vehicle and it worked.
Thank you Rampage I thought there are more guides then this one from SmartTactics.
With initVehicle function it can be done. But it doesn't work for me.
@tough abyss, what's SmartTactics?
German youtuber who made tutorials about sqf.
switch (side obj) do {
case west: {};
case independent: {};
case civilian: {};
};
or just playerSide
@dusk sage, and there is no conflict having other switch cases inside of these cases, right?
Ofcourse not, aslong as they are placed into the {}
@thin pine well that makes retexturing the arma 3 tools a bit more difficult >. < but thanks for the info!
@dusk sage, thanks a ton! If I may bother you a bit more, do you know how to isolate things in these switch cases a bit further? Say for instance, if I wanted one default case for any unit starting with O_ and a different case for O_T_ units, is that possible, or must I detail every one of them?
Give me 2 mins, in a game
Take your time.
Okay, you may use code in the switch statement
Such as
switch (true) do {
case (str obj find "O_T_" > -1): {};
case (str obj find "O_G_" > -1): {};
};
Etc
Neat!! Thanks a bunch.
Oh?
Awesome help! Thanks!
Okay, also, if I want to have a random selection of things for a unit, then how do I put nothing as one of the options?
Like... I want to have civilians have a random selection of headgear, but I want the civilians to not have any hat at least half of the time.
_civhats = selectRandom ["Hat1","Hat2",Hat3","No hat","No hat","No hat"];
@shadow sapphire leave a empty string? Means don't add anything?
Or that ^
player addHeadgear "";
would do nothing, not even remove their current headgear
The civilians are population AI. Ambient AI for towns and the like for my communities framework. I think you guys are missing what I'm after. How can I phrase this?
My civilians are blank slates right now:
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;```
I want to have them be randomly clothed and hatted, but I want most of them to not get hats. I want only some to get hats and glasses, but most should not have them.
_civhats = selectRandom ["Hat1","Hat2",Hat3","","",""];
Oh! I get it now.
So, I just put blanks for every hat, and that should give me fifty-fifty shot at hats.
wont do anything
Awesome.
yep
Thanks!
Am I doing this right so far?
_unit = param [0, objNull, [objNull]];
_type = typeof _unit;
_civClothes = selectRandom [Bunch of Stuff];
_civHats = selectRandom [Bunch of Stuff];
_civGlasses = selectRandom [Bunch of Stuff];
_civFaces = selectRandom [Bunch of Stuff];
_civVoices = selectRandom [Bunch of Stuff];
Sleep 1;
removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;
switch (side obj) do {
case civilian: {
case default: {
_unit setFace _civFaces;
_unit setSpeaker _civVoices;
_unit forceAddUniform _civclothes;
_unit addHeadgear _civhats;
_unit addGoggles _civglasses;
};
};
case east: {
};
case independent: {
};
case west: {
};
};```
You can do private _unit=..., there's no reason for the sleep. What is obj?
@shadow sapphire why do you use switch?
Switch is slow and in what you are doing here so far it's not really needed.
@buoyant heath, the sleep allows things time to catch up. In the past, when I didn't have the sleep, I would spawn a group of enemies and end up with some of them missing their regear.
@distant egret, slow is okay and I understand switch cases as I've worked with them often. If there is a better way that isn't too complicated, I am totally down for switching.
Well this script will only run on civilians right?
No. It will run on anything except players... hence the east, independent, and west cases...
Every side will be regeared. Civilian, East, independent, West. Every side will be regeared.
Are you nesting cases there?
@indigo snow, yes.
you can't do that that way as far as I'm aware
I've done something like it before, but I am unsure of exactly how.
you'd need a new switch
easiest way is probably to split it up into a few functions for readability purposes
_unit = param [0, objNull, [objNull]];
_type = typeof _unit;
_civClothes = selectRandom [];
_civHats = selectRandom [];
_civGlasses = selectRandom [];
_civFaces = selectRandom [];
_civVoices = selectRandom [];
_pilotHats = selectRandom [];
Sleep 1;
removeAllWeapons _unit;
removeAllItems _unit;
removeAllAssignedItems _unit;
removeUniform _unit;
removeVest _unit;
removeBackpack _unit;
removeHeadgear _unit;
removeGoggles _unit;
switch (side obj) do {
case civilian: {
switch (_type) do {
case default: {
};
case C_journalist_F: {
};
case C_man_pilot_F: {
};
case C_man_w_worker_F: {
};
case C_Marshal_F: {
};
case C_scientist_F: {
};
};
case east: {
};
case independent: {
};
case west: {
};
};```
@indigo snow, like this?
yes, but put default last
What does it change to have it first?
switches will select the first match
Interesting.
tbh im not sure if that's actually needed
default can be anywhere, unless SQF is unique
yea not sure if it's actually needed
all other cases, first match is selected though
Yep, but shouldn't matter where default is. Atleast in C++ land and others
Okay, thanks guys!
Default was working as intended when it was at the top, but I wasn't going to question it, so I moved it to the end.
Either way, you probably want to leave the gear stripping and assignment until after the case structure. That way the unit keeps it's stuff on spawn if it isn't listed in your cases
default takes care of that
Negative. Everything will have a default and I want it to be very obvious when something is amiss.
Person in underwear means I need to look for a problem, haha.
cptnnick: depends on the desired...love it when the answer is posted halfway through typing ๐
guys how do I attach an arsenal that only contains vanilla stuff again?
i want to create a gps tracking device by attaching to AI car a marker and after a few second the car drive to a place
@tough abyss https://community.bistudio.com/wiki/BIS_fnc_arsenal
@quiet bluff you need to create a while loop, either true or alive _unit/_vehicle and setMarkerPos the marker you created before.
to the _unit/_vehicle pos
so,
_gpsMarker setMarkerPos (getPosATL _vehicle);
};```
@quiet bluff Rather use an PFH as you only need to update the position of the marker once and with a while-loop you'd change it thousands of times in one frame
addEventHandler ["EachFrame", {_gpsMarker setMarkerPos (getPosATL _vehicle);}];
or that ^
that's a lot better thinking about it now.
You have to implement some logic that will remove the EH if no longer needed (-> The respective unit is dead) and you could think about using addMissionEventHandler but the idea is the same...
@distant egret A PFH is in most cases better than a while {true} loop as most values only update each frame so there's no need to check/set themmultiple times per frame ๐
one annoying thing is you need to attach it to a object.
but if you would use a sleep in the while loop it wouldn't be as much right?
Oh yeah... missed that one.
Then just use addMissionEventHandler ["EachFrame", {...}];
also cant you get the eventhandler it self now from inside the eventhandler, Dwarden said something like that sometime ago.
_thisEventHandler
so you would be able to kill it inside the eventhandler.
@distant egret Yep just saw this one on the BIKI as well ^^
So @quiet bluff You want to do it like this:
addMissionEventHandler ["EachFrame", {
if (!alive _vehicle) then {
removeMissionEventHandler _thisEventHandler;
} else {
_gpsMarker setMarkerPos (getPosATL _vehicle);
};
];```
Or removeMissionEventHandler ["EachFrame", _thisEventHandler] depending on what exactly is stored inside of _thisEventHandler ^^
also found this function some time ago, https://community.bistudio.com/wiki/BIS_fnc_loop, you can set it to how many sec it will loop, might be a even efficiรซnter way of doing it. Dont know how good it runs.
This is all too excessive
@dusk sage With sleep it get's clunky and laggy because either you'll still update the position multiple times in one frame or you will only set it every few frames... You can never know
Apart from that the sleep performance can in no way match the one of a PFH
@distant egret Well I think that's more or less the same as using a while-loop... Just saves you a bit of code writing
The scheduler is about 7 times slower than unscheduled code...
Well if that's the only thing that will run in the background it will indeed not matter but as soon as there are multiple such small scripts they sum up...
"anti scheduler" is good for arma ๐
(freely translated xD)
if use other programming languages its fine or maybe required but in SQF you shoud not use it
@zealous solstice For updating a marker a couple of times a second ;)?
Now we're getting into a complicated solution for the problem xD
The man is just wanting a map marker from what I gather, give him a break
Haha ๐
@zealous solstice I think if you write @quiet bluff this framework he'll happily use it ๐
PRA3 ๐
Haha I knew this would come up xD
we plan to extract the Core to a Own PBO that is standalone
or some Core Submodules to be standalone
Admit it... You're only doing that for moments like this so you can simply reference this PBO and say: "Just use that. That's the master solution" ๐
with the Arma 3 Revive system how do you make everyone a medic and able to revive each other?
lol pressed the power button and then ur msg came in
I'm just going to drop off this; https://community.bistudio.com/wiki/setUnitTrait
I assume that'll work for the new revive system ๐
gnight
wow I love the new scripting commands. They are getting better and better and there are more everyday ๐
Is there a way to reload .hpp files while a mission is running (similar to BIS_fnc_recompile)?
@thin pine Do you know if that can be used with roles in the new respawn screen?
@blazing zodiac is the .hpp file being included in the description.ext?
or is it from a mod?
17244e+009 why do I get numbers like this when using numbers over 10,000,000? what does it mean
plus 9 zeros after 17244? imprecise I guess?
Being included in the description.ext @opaque topaz
There is no way @blazing zodiac
@blazing zodiac what exactly are you trying to do? With macros and other preprocessor stuff you can kind of make it dynamic
Basically for editing small tweaks without having to reload constantly @opaque topaz
hello everyone
ive got a bit of an issue here
ill just copy paste it ```hi everyone
ive gota bit of an issue here
how can i get a unit to spawn inside of a steerable parachute after activating a trigger?
im working on getting a basejump mission to work
but it'd be kinda lame for all the unit to have to pick up a prachute before they jump off a ledge
thanks @tough abyss :)
there any way to check vest camo that i made without config it to PBO?
@blazing zodiac no way around that. Everytime you start the mission in the eden editor the description.ext is reloaded which means your file is reloaded. So if you edit your .hpp file just keep going to eden then click play scenario over and over for development.
Are triggers JIP compatible?
In what way?
If the mission is running and trigger A is triggered. and afterwards a player joins the server. Will Trigger A be run on the newly joined player's client because it has been triggered before?
I'm going to say yes because triggers are global
What are you executing in the trigger?
Setting a boolean flag to true
And I'm assuming whatever that flag changes is global?
It's needed inside of a client-script
Trigger effects are local
Each client and server processes trigger themselves. JIP will have to trigger it again to have code executed on his side.
There's your answer, then
Okay thank you! That's how I expected it to be but I needed to make sure ^^
@tough abyss what spam ๐ anyone seen the spammer ? all i see is some ash on my sparky banhammer ๐
@shadow sapphire I'll PM you a script I'm using to clothe some IDF soldiers, just adapt it to your uses
@tough abyss iirc the precise form will be a 1.235e003 instead of 1,235 where 'e' stands for exponent of 10
@lavish ocean, is the simple objects selection performance boost in the new performance build suitable for objects like H-Barriers and concrete walls?
simple objects are created much faster than with createVehicle. they also cut down on network traffic usage over the course of the mission, but you lose functions that can broadcast public variables (like setVariable). for a createVehicle object with enableSimulation off, it's roughly the same burden on the server as the simple object
Hi guys. Has anyone an idea, if it is possible to get the control of the default action icon hud element. I mean the corresponding icon to an action which is displayed in the center of the screen. I know, for useractions I can use the setUserActionText command, to change the icon for an user action. But I want to detect and maybe modify an engine added action icon (e.g. Heal) when it is available as a default action. Hopefully I could explain my problem ๐
For other hud elements, I was able to find the corresponding display. But not for the action menu and the default action icon.
The init field of units is considered a scheduled field, right/
Can I use sleeps in it?
Damn, that's what I feared
you can do a _nill = [] spawn {myCode; sleep 2;};
I'll just execVM
Righ
and if you want the unit/this, you can do _nill = this spawn {_unit = _this; sleep 3;};
but execVM will do the same but you need a script file somewhere, and if the code is small it would be better to use a spawn.
Not sure if my last message went through, Discord being buggy.
Has anyone got a script for me where i can stop AI friendly firting
I mean like to stop them shooting through me at enemys
Trying to set up a mission with zombies&demons and the HMG just rails straight through me at the zombies
@buoyant heath
@distant egret Yeah they are accidentally hitting me whilst shooting at the zombies
but they are aiming through me at the zombies it seems like.
Yea AFAIK that's just the stupid AI, no real way of fixing that.
I heard there was a script to stop AI shooting whilst looking at you?
Or could i just remove freindly fire entirely (stop damage from freindly units)
add eventHandler hit, check if shooter is same side as target, then return 0?
but hit doesn't recognise in one hit kills afaik. so if its a high kaliber if you are hit you are dead.
ah, sorry mate could you write that up for me real quick?
how to check if shooter is same side
:l
(side _this select 0) isEqualTo (side _this select 1)
well anyone thats being hit by the HMGs
ah so me ๐
yea
just seen that you cant change the out come of the damage with Hit. I seen a eventHandler do it. Not sure which one...
what you could do if its not a big deal, setDamage of the unit back to 0.
ah its, HandleDamage
this addEventHandler ["HandleDamage",{if ((side _this select 0) isEqualTo (side _this select 3)) then {}}];
should do it
if the community is right ^^
this guy wrote about it, https://forums.bistudio.com/topic/108931-handledamage-eh-explained-poor-mans-gethit/
no, it doesn't add any damage
it shouldn't add any damage.
depends on what you think decent is @tough abyss
k
and you are using it with the computer system?
or manually
yep
there is a parabolic equation for that
assuming you know the angle of shot and the initial velocity
wind and elevation difference would cause some offset that might be difficult to account for
@tough abyss you need to position when the player fires? Or could it be when the projectile has landed?
Also important to note what "firing mode" it's in, because that affects the initial velocity
assuming we can neglect air resistance:
distance = ( (v_0 * cos(angle))/9.81 )*( v_0 * sin(angle) + sqrt(v_0*(sin(angle)^2))) (brackets may be off)
you can get both the angle and v_0 from a fired EH
the distance would simply be the magnitude of a vector you rotate to alight with the shot direction
offset from the mortar position and youll have a decent guess in flat country
Just track the projectile with a PFEH then
while alive projectile ...
That's a little nasty
Though, I guess the person firing it into the safezone can track it themself ๐
hey i was wondering if anyone is familiar with the way life missions spawn objects, its done by grabbing the position of the desired marker obviously, but it doesnt seem to grab the hieght. This becomes an issue while trying to have a vehicle spawn in a buildings garage that is not at ground level. Does anyone know of a work around of some sort to set a spawn height? I tryed using an invisible object but that didnt seem to work with spawning at all.
Typically, what I like to do for custom heights, is I put down a trigger with no area, grab the variables from the position, and then delete the trigger.
it's not getting the hieght info, the issue is getting it to actually spawn at a height
How are you doing this? Do you want the vehicles to randomly spawn on locations, or are you having them spawn on a specific location every time/
its done by spawning at a marker, the way life missions are done
Alright
_MARKERNAME = vehiclevariablename modelToWorld [0,0,-height-];
That should do it.
You can grab the exact height with the method I provided.
you might have to make the marker a global variable, not sure
you can always unpack a life mission and look at it
i could make it so every vehicle spawns above the ground and falls but stays in godmode until a few seconds and it would work
but what in that line should i change
my bad, this is more usefull
You could disable damage or simulation
how would i go about setting the hieght in that code?
vehicle setPos (marker modelToWorld [0,0,-height you want to change-]);
replace 'vehicle' with the vehicle's variable
when whatever spawns that in you can put that in after the createVehicle in whatever .sqf you're calling with an execVM
so
vehicle setPos (marker modelToWorld [0,0,-height you want to change-]);```
i trust you know how to make a marker
(using scripts that is)
alternatively you can just create the vehicle and then make a marker on the vehicle's position if you want it to be really accurate
in that vriable will it add an exact height or relative to the ground?
it should be from sea level
you'll have to test that yuorself, honestly it could be the other way
i found a command that does it
_vehicle setPos (getMarkerPos _spawnPoint vectorAdd [0,0,5]);
setPos is ground. setPosASL if you want sea level reference
yeah it did thanks guys
you're welcome
is there a way to get an array or similar of a vehicles class heirachy?
for a single vehicle though if it was part of a forEach vehicles loop mid mission
Why do you need hierarchy for all vehicles in the mission though?
Pretty sure there can be easier solution
What are you trying to do?
decide which icon to use in an external tool
_x isKindOf "Car" will return true wether it's a truck, ifrit, or sports car
ideally I'd want to do an "in string" search for "Heli_Attack" so I don't have to do every variation of "X_Heli_Attack_x_base_F" for example
Why not just check what icon is being used?
because I need a generic base to cover all vehicle mods
representing that vehicle class with a .png icon
but I'm quickly learning not all mod makers inherit from those base classes so that idea may not work anyway...
Why not use "icon" off vehicle config?
because no 2 icons would match
an attack heli icon in vanilla A3Air_F_BetaHeli_Attack_01DataUIMap_Heli_Attack_01_CA.paa isn't going to follow a similar naming pattern for an attack heli in RHS for example
but if they both had similar base classes I can draw comparisons that way
Why do you need naming pattern? Just display the icon and that's it.
ok I'm trying to let players burn down a building using addAction and I'm having some trouble
this is what I've got so far
/* ATTEMPT 1: CREATE VEHICLE ON THE POSITION OF THE THING
sleep {10};
mpfire2 = "test_EmptyObjectForFireBig" createVehicle position dmpfire2;
this select 0 setDamage 1;
*/
/* ATTEMPT 2: CREATE MODULE AND THEN HIDE IT AND THEN SHOW IT AGAIN
sleep 10;
((dmpfire2 getVariable "effectEmitter") select 0) hideObject 0;
((dmpfire2 getVariable "effectLight") select 0) hideObject 0;
*/
// ATTEMPT 3: CALL bis_fn_moduleEffectsFire on the thing
sleep 5;
_this setVariable["ParticleSpeed", 0.5];
_this setVariable["EffectSize", 10];
_this setVariable["ParticleDensity", 25];
_this setVariable["ParticleSize", 3];
call fn_moduleEffectsFire
sleep 10;
this select 0 setDamage 0.5;
this select 0 setDamage 1;
I have a fundamentally poor understanding of SQF and am unsure how I would call BIS_fn_moduleEffectsFire
mpfire2 = "test_EmptyObjectForFireBig" createVehicle position dmpfire2;
this select 0 setDamage 1;
Why this select 0 ?
also shouldn't you create fire and then sleep 10 seconds?
creating test_EmptyObjectForFireBig should do for you, you just did something else wrong
How are you passing building that you need to destroy into the script?
@grand cargo
Hey guys, is there anyway to disable ladder usage under certain conditions? for example by locking it? I've a little idea i'm toying with
ok I'm not sure how to pass the building into the script, but I have decided on a new approach
I want to burn the bulding and have it destroyed when an incendiary grenade is thrown into the building
@zealous arrow You can block ladder action with inGameUISetEventHandler
I'm looking for the grenade classname, and hope to look for it inside a trigger, and then make as many triggers as I need
@tough abyss You forgot different languages and instead of using inString you can find on strings in A3
In what case?
Oh wait _this select 3 is action name, not title
So localization shouldn't be an issue
inGameUISetEventHandler ['Action','(_this select 3) find "Ladder" >= 0'];
@grand cargo I don't think triggers trigger on projectiles entering them
You'll have to track thrown objects with Fired event handler and wait until they enter area of your building
@tough abyss Nope, no sudden FPS drops on KotH
You can download perf build and run profiling for slow frames to get an idea what's going on
@grand cargo Well this works too, trigger pretty much does what I said about tracking, except from the other end, not from the thrower
how would I go about getting the name of the grenade?
Thanks @meager granite & @tough abyss I'll have to set that on every client during login then ๐ a basic idea of what I'm doing is in my mod we are working on has ladders that can "fold" up and down, sorta like a attic/loft ladder, I need to disable getting/climbing on them if they're folded up and if they're down, allow it of course, I presume I could use the same UI EVH but checking passed object for matching classname instead of inString/find and then check animPhase?
is it rhs_incendenary_grenade?
@grand cargo Add
this addEventHandler ["Fired", {_c = _this select 4; systemChat _c; copyToClipboard _c;}]
into your units init field and throw grenade it should show its name in chat and copy it into clipboard
Remove the script afterwards of course
THANK YOU
@tough abyss Cheers, I'll pop it in a function my login FSM calls
I am currently working on it right now, I just thought I'd test if ladders can actually be "disabled" first before testing it all wasting time animating it etc, I was hoping it'd be as simple as locking the ladder object, might have to put that through as a suggestion to BIS
@zealous arrow I just remembered a trick with ladders, if object is dead you cannot climb ladders
@meager granite will "count" run a loop until true?
You can actually kill and repair it to disable\enable ladders in-engine
You can test with Altis office building the one with glass doors, setting damage to 1 will disable roof ladder, setting to 0 will enable it again
@grand cargo count runs through all array elements, do you need to exit the loop earlier?
I'm very concerned about performance - this is a 40-man or so co-op mission
Hmmm thats not a half bad idea but I can't kill every object when locking it or when triggering my fold up for ladder, un-needed network message to ask server to kill it instead of doing it on client
@grand cargo Ah you're refering to that code piece in the forums, count shouldn't affect performance at all there
We're pretty concerned about security and keeping network usage down where we can
@zealous arrow So ladder is part of some other object that you can't kill?
My suggested solution will work for standalone ladders only
is the on activation section of a trigger a "scheduled environment"? i.e how do I use sleep 2; ?
tried using spawn{} around it and it expected a ";" somewhere
@grand cargo show the script
spawn {sleep 2; dmpbuilding2 setDamage 0.5; sleep 2; dmpbuilding2 setDamage 1; systemChat "Boom";};
obviously the system chat is for debugging
spawn is binary command, you need left and right argument
0 spawn {
sleep 2;
dmpbuilding2 setDamage 0.5;
sleep 2;
dmpbuilding2 setDamage 1;
systemChat "Boom";
};
since you're not passing anything into spawn it can be 0
"on activation: type script, expected nothing"
_ = 0 spawn {
Keep in mind that activation field is global and will execute on each client
I used this = 0
_ is trash local variable so editor stops complaining
Oh no its a single object (http://puu.sh/qzrGU/c06b93ff18.png), we just have a single function for locking objects we add a custom lock action to, killing it probaly wouldn't be such a good idea now thinking about it in regards to it triggering MPKilled and dropping it from the database (the ladder is player built base structure)
I ticked the "evaluate trigger on sever only box" would that do anything useful?
@grand cargo I guess it should be fine then, I don't use triggers and wasn't aware there is this option, I guess its in 3DEN only
thank you very much - might come back soon with some questions on how to create a fire
"test_EmptyObjectForFireBig" was fine for fire
you actually might create several at different places for effect and then delete them after building gets destroyed
I was planning to just leave them burning. I was hoping to use bis_fn_moduleEffectsFire and bis_fn_moduleEffectsSmoke
because they have more granular control
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
oh right sorry
how would I set things like _pos in that?
or is it just not possible to use an editor module in a script?
You don't, script does it for you
You simply pass an entity which has fire parameters set to it and it creates fire on that entity
ahhhh I'll try that
right ok just syncing the editor module to the trigger works... duh
Hey @grand cargo I made this a while ago http://puu.sh/qzs92/95260be93a.txt
Will accept positions or objects and you can chose the effect you like, effects are permanent but you can remove them with
{ deleteVehicle _x; } forEach <object> getVariable ["CWS_ObjectEffects", []];
Feel free to do whatever you like with it.
Not sure if its exactly what you're after ๐
ahhh thank you man
No problem ๐
anyone here know ace medical functions?
the problem im having is the AI keeps getting killed when i call [HVT_1, true, 3600] call ace_medical_fnc_setUnconscious;
i have tried to set the AI unit to HVT_1 allowDamage false; but if the AI takes any form of damage when i make the ace function call it kills him.
omg it's beautiful thank you very much @meager granite
What's the best detain script around?
@dry egret As far as I know AI does not support an unconscious state
Okay I was wrong.... When you have a look at https://github.com/acemod/ACE3/blob/0e740f00c312ac00b0089eade208f626886666ee/addons/medical/functions/fnc_setUnconscious.sqf you'll see that it's actually a but it has to be enabled... As far as I see it there will always be a chance for the AI unit to be killed by this function... Have a look at lines 55 and following in order to see what I am referring to
I'd say that's a global setting in the medical module... You have to google If this random death chance can be disabled as well...
I believe there are 2 setting that may pertain to this question? in ace medical modules I believe there are "prevent instant death" and "enable AI unconsciousness" boolean settings - though you may not want to change them globally
Anyone here knows if its possible to have the spotlight button in the apex menu be a button that instantly joins a server? I've got it going to the direct connect page now, but i'd like it nicer ๐
what's the name of the language for scripting?
SQF
Is it something that BI come up with?
yes
and it sucks. it has virtually zero error handling
the scheduler is completely unpredictable
what language you'd recommend them to use instead?
I have no idea. SQF and very basic C/C++ is all I know
gotcha
So, if I wanted to create a custom script for my missions in a separate file I'd then have to create the .SQF file, put the functions in there and somehow include/load the functions from that file and invoke them in the triggers/actions, right?
yeah, look up the functions library on the biki. best practice is to add new secure functions that way so they can't be overwritten
well, not if you want goto or a sleep that isn't +random x I guess
I'm still getting a headhache when remembering that BI actually had a full Java implementation as a replacement for SQF but discarded it because some idiots complained about security... Use one extension and the security is gone by far more easy -.-
depends on the .dll ...
idk, I'd be fine with SQF if it had some kind of error handling
but it will never have.
so might as well use something else in A4
No I can't stand the non-object-oriented approach in SQF... But this is most likely because I'm coming from Java
On the one hand I'm really hoping that A4 will use something different but on the other hand I don't want BI to get off SQF because then my IDE for it would be useless ^^
There are ways around it. You get used to it. It's just verbose to write
Yeah I know
But in my opinion it completely destroys the readability of the code if I have to write myArray select 0 select 3 instead of something like myObject.getMyValue()
oh, the damn select command
Yep... but AAIK there's no way around it
Make myObject a location
myObject getVariable myValue
And use the actual objects already existing in the game. (players, vehicles, houses)
But that doesn't work when broadcasting 'objects' over the network, does it?
Like when having an 'object' that stores information and I want to broadcast it to all clients
well. for that you can create a dummy object with createVehicle and use setVariable public
"Building" is a good one. No physx, empty model, and no AI overhead (as opposed to "Logic")
Okay that actually looks very promising... I will definately give it a try. Thank you! ๐
If you are using CBA, then you might want to use the functions that do stuff like this... So someone else can actually understand the voodoo
Ahhh... So that's what this namespace vodoo is about ^^
@little eagle Is there a particular reason why you are defining the dummyPosition instead of simply writing it in the array?
It's a magic number. In one of the drafts for this, we had nearestLocations used on that position to report all pseudo namespaces.
No static in SQF so we used the next best thing... macros.
Ah okay
Java? omg plz no. They'd do way better with C# in terms of OOP
C# omg plz no. They'd do way better with C++ in terms of OOP
Especially that Micro$oft started open sourcing the .net core library, so native support for linux is growing.
๐
C# > C++ in readability ๐
C# + P/Invoke > C++ in power ๐
We are in arma, and there is none of what we would like to have
Yeah, I agree.
Nonetheless, I'd love some better options for scripting
But first, I need to find somewhere on the wiki the basics of the scripting language because I'm not accustomed to the more advanced SQF syntax
There is not much to it. The commands either do stuff or have return values... or both.
Unary commands have higher priority than binary commands.
Control structures are if-then-else, forEach, for-from-step-to-do and maybe switch. The rest is mostly useless.
CODE is always in curly brackets and everything in curly brackets is code
Same for Arrays and []
Always set a home scope for local variables: https://community.bistudio.com/wiki/Variables#Scope
I have a question regarding the network optimisation of remoteExec. I assume setting the target parameter to a single client is roughly 1/10 the network usage of sending to 10 targets? Basically, are the targets evaluated before any network transfer is made and then only sent to the clients that are targeted, or is it sent to all clients and then evaluated locally?
It doesn't actually state how the engine handles requests anywhere in the wiki.
Thanks @little eagle I'll look into that after a smoke brake
Clients don't know to which machine a target object belongs
My guess it that it get's sent to the server and then to the target machine from there
That's what I assumed.
If it was me creating the framework, I'd have the server mediate each request and then only send to the necessary clients (to save network usage), but I'm not sure how BI has set it up.
Looking at the arguments it takes, I'm leaning heavily towards that assumption.
If you know the target clients owner id, you could use publicVariableClient
But I'm not sure if this is sent to the server anyway...
I would prefer to use remoteExec considering the framework is pretty robust at this point, but I just wanted to make sure I understood how it was behaving to be able to optimise it as best I can (e.g. sending to only the necessary targets is more efficient that sending to the entire server).
@formal vigil Arrays are pointers. Unless you use commads that copy the array. Depends on the command really (e.g. ARRAY + ARRAY vs. ARRAY append ARRAY)
And it is very important to know if you operate in the unscheduled or scheduled environment. Using a undefined variable in the scheduled environment will throw errors, while it works in unschedued.
Also the scheduler can mess with you:
if (MyBool) then {
systemChat str MyBool;
};
can print false in scheduled env.
Interestingly, publicVariableClient does appear to work client-client though "Tested in Arma 3 v1.43, publicVariableClient works client-to-client if owner id of the targeted client is known.". But I'm not sure whether it's passed via the server, as you suggested it might be.
Who knows
Dwarden :p
Well, maybe
I'd hope that he knows!
Be aware that remoteExec has blacklisting and all that stuff
So if you make something for an addon and not a mission
the server migh break your stuff
It's a command for mission makers really...
I'm a mission maker, don't worry!
Thanks for the words of caution though ๐
Half the "fun" of Arma is trying to work out how the engine actually works.
i use "eden enhanced" remove map object ... it work after i press preview any way to make it work on "local exec" from the debug menu inside eden?
{
{
hideObject _x;
} forEach _objects;
} remoteExec ['call',[0,-2] select (isMultiplayer && isDedicated),true]; ```
https://github.com/donkeypunchepoch/Exile-Mod-Server/blob/master/Arma 3 Server/%40ExileServer/addons/exile_server/code/ExileServer_system_network_setupEventHandlers.sqf#L12-L32
How big of an asshole does one have to be.
ยฏ_(ใ)_/ยฏ
IDK. passive agressively writing shit about others in their namespace?
a public variable that changes all the time
"triggered"? what has that to do with anything. this is a really low move
i use "eden enhanced" remove map object ... it work after i press preview any way to make it work on "local exec" from the debug menu inside eden?
{
{
hideObject _x;
} forEach _objects;
} remoteExec ['call',[0,-2] select (isMultiplayer && isDedicated),true]; ```
that doesn't work, because _objects is undefined
Also, hideObject is not JIP compatible. Use hideObjectGlobal on the server instead
there is any way to make it work in the editor?
hide objects?
yes
its on all the map?
pardon?
i have a place in altis which i want to remove to building an leave only the ground
but i want to do it on the editor
remove the buildings or only hide them?
you cannot do that
they will appear again if you play the mission
and they will keep appearing if the player moves away and back to the place again
because terrain objects are streamed. they are not persistent
ohh okay so what the point to hide/remove feture?
๐ฆ
I don't know any good work around for that. I don't think it's possible to delete streamed / map objects
just hideObject(Global) it and that's it
and that is persistent now?
Yep, hideObjectGlobal on map objects is properly global and JIP compatible
won't you collide with the objects?
Works for everything from objects to full entities
Nope. You might need to make some objects invincible though
as explosive damage still damages invisible objects
and you can destroy invisible building and it will create ruins\explosion effect
You might need to make some objects invincible though
Is that persistent too?
You'll need to do it on each client though
sounds cumbersome
Well, not really, just have some sort of global array with list of objects that should be invincible and that's it
and that is persistent if the object reappears after moving to a different place? Because that wasn't either the last time I tested streamed objects
You only need to worry about objects that create ruins or do destruction effects so its not that big of a list
Hm, good question
I've been using this on Tanoa to clear out space for bases in King of the Hill and didn't see any issues so far
Thinking about it, I don't think objects get removed when you move away from them once they're streamed in
the devil's in the details
they are.
that's why all doors close and they might become desynched
if you teleport away for a second from your squad mates
I don't think its true
what is not true? that windows repair themselves if you move out of town? it certainly was the last time I tried
may i butt in with a quick off-topic question?
sure. channel is for everyone
There was a problem with streamed objects not being damaged for JIP clients, but this was two years ago and it was solved
General question -- Is there any obvious consensus on which OS works with fewest crashes for Arma3? Out of: Windows 10/32, 10/64, 7/32, 7/64
My guess is that it also affected doors and I guess it was fixed as well
my arma 3 is crashing constantly lately ๐ฆ
I don't think the OS is responsible for Arma crashing
ever since 1.62 update
I'm not sure how exactly it works but I think if client has any streamed object in variable it is streamed in right away
There is a feedback tracker where you can give them your crash files
For example if you send list of map objects in array to clients from server they get these objects streamed in and you can properly operate with these objects
I've never heard of that Sa-Matra, but I haven't played much since APEX
That would be a huge change/improvement of anything I've seen so far
yes I'm preparing to do that soon ... i just wondered if there was some widespread platform preference but probably not. Thanks gents, carry on
I don't think there is
Well, whatever the case I didn't see any issues with hiding\allowDamage false on server-created list of streamed objects in real mission scenario.
My Arma hasn't crashed in years... apart from script errors while debugging. Win 7 64 bit and 10 64 bit work fine
I think the windows or doors being closed is different though, it probably is still displaying a further LOD which wouldn't have all the same named selections and details
i guess i'll try 64 bit again
Using any mods?
no mods; but my arma 3 on win7 32, or win10 32, crashes on absolutely every bit of user-made content
it only works without crashing with no mods, no user-made stuff, totally bare vanilla
even new content that came out after 1.62
anything at all from workshop
scenarios without maps or any necessary downloads, even
Ah, "missions"
When launching, or randomly while playing?
right, 'missions' with no need to download anything except the mission .pbo itself
Well if stock missions don't crash, but 3rd party missions
then I'd say the missions are borked
it's always after 10-15 minutes of play, frame rate slows down to like 3 per second and finally game totally freezes, somethimes even locks up my OS