-
Content Count
556 -
Joined
-
Last visited
-
Medals
Posts posted by Bon
-
-
check out 07/05/2012 plus minus a day - there you have full moon and its quite shiny at night...
Then for half moon add or subtract about 7 days, and for a all dark night, add or subtract about 14 days (since a moon phase is 28 days long isn't it?)
-
edit: nvm you got it

-
I've used the Xeno script for a while now, but with one added function.hideBody.
Code as follows:=
// By Xeno while {true} do { waitUntil {!alive player}; _weapons = weapons player; _magazines = magazines player; waitUntil {alive player}; _p = player; removeAllItems _p; removeAllWeapons _p; [color="Red"]hideBody[/color] _p; {_p addMagazine _x} forEach _magazines; {_p addWeapon _x} forEach _weapons; _primw = primaryWeapon _p; if (_primw != "") then { _p selectWeapon _primw; // Fix for weapons with grenade launcher _muzzles = getArray(configFile>>"cfgWeapons" >> _primw >> "muzzles"); _p selectWeapon (_muzzles select 0); }; };This has worked fine in Arma2 until I installed OA and BAF Pack.
Now the hidebody doesn't work anymore.
Has anyone suggestions?
Take a look at which unit you are actually trying to hide.
-
Wouldn't setVehicleAmmo set to 0 be enough to empty the magazine currently used?
-
if you really want to have it random in means of not having any control of what date and time the mission will take place (like setting a mission parameter), open the mission.sqm in a text editor (like notepad), and search for the lines where date and time is defined. Could look like this:
month=6; day=24; hour=8; minute=0;
and is located somewhere at the top of the file.
Then change them to this:
month=__EVAL([1,2,3,4,5,6,7,8,9,10,11,12] select round random 11); day=__EVAL([1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30] select round random 29); hour=__EVAL([0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23] select round random 23); minute=__EVAL([0,5,10,15,20,25,30,35,40,45,50,55] select round random 11);
There's no further scripting required, that's just it. Your mission now will take place on a random day at a random daytime every time you initially load it.
EDIT:
I don't know the behaviour in Multiplayer, probably all machines will generate an own date and time setup, what, of course, is pretty ugly.
But for Singleplayer, I think this way is as neat as radical :p
-
numRespawn of course is not global to the whole network (that would be a public variable), but to the whole machine. It is independent on the scope to change its value, hence it can't be declared private.
Global variables are known to all scripts at any moment in time for the whole machine, where local variables are only known to the scope in which they are defined - that's the reason you can "privatize" them.
That the code runs still fine for you is more luck than anything else. The script in this case ignores the faulty expression and proceeds - in your arma.rpt you will still find the error.
To let script errors pop up ingame, add the startup paramater -showscripterrors to your arma shortcut.
-
numRespawn in this case is a global variable, and global variables can't be declared private. Use the BIKI: private, Local Variables
Actually, the game throws a Syntax Error when I try to run the above code, just because of this reason.
Set's numRespawn to the innermost scope. So if some variable "outside" is also called numRespawn then you won't change it. Use the BIKI: private -
what does
private "numRespawn";
do in particular? :confused:
-
This was fixed in one of the pre-1.54 beta patches. AI should detect you when you're illuminated by flashlights, streetlights, vehicle lights and so on.Really?
(shame on me for not reading all those endlessly long changelogs of patches),
however,

-
I'm thinking about creating a mission where you take out a power plant to disable all the street lights in a city.Does anyone have a good idea of how darkness affects the AI's awareness? Can it be quantified?
whether it is day or night affects the spotting ability of the AI. means, where snipers spot you from 1000m distance in bright daylight, they could pass you 5m out without noticing you at night.
on the other hand my experiences are, artificial light such as street lamps do not have any effect - it doesn't matter if you are running through a dark alley or the shine of a street lights, and AI doesn't notice you shoot out lights with silenced rifles even when they are standing close to it.
thus i believe the spotting ability is not really depending on light, but on daytime.
-
Don't know if its because you used QUOTE instead of CODE to highlight code in your post, or if your spacing is just a bit "inappropriate". However, with reformatting your code just a little bit, it took me about 2 seconds to find the missing "}":
class CfgSounds { tracks[] ={Tactical Nuke, Spawn}; class sound1 { name = "Tactical Nuke"; sound[] = {\sounds\Tactical Nuke.ogg, db+10, 0.98}; titles[] = {}; [color="Red"]};[/color] class sound2 { name = "Spawn"; sound[] = {\sounds\Spawn.ogg, db+10, 0.98}; titles[] = {}; }; };So use the CODE thingy in your posts, its the button with the hash on it... Also much easier for others to read your code.
EDIT:
I also see a problem in this line:
tracks[] ={Tactical Nuke, Spawn};
I believe this blank between Tactical and Nuke causes a problem, better to change it to, lets say, Tactical_Nuke. Just in case...
-
Hi mrcash,
I wanted to implement for off-line use in SP and I wondered could there be an option/var for limiting the amount of times you can select the option before it doesnt show anymore. I kind of wanted it so it was like Tfor mission attached to a tent at base but with say only 3 times it could be used for mission purposes (say SF units and only limited amount of members).
Also how can it be set so it will only recruit a specified size? Like in Tfor you can set server settings and limit to recruit of only 4 or 8 or 12 men size teams at a time.
Set maximum allowed group size in the bon_recruit_units\init.sqf.
For the access limitation, do the following:
In the bon_recruit_units\init.sqf you put in the line
bon_recruit_limitation = -1;
which is the number of times you can access the menu (-1 for unlimited).
In the file bon_recruit_units\open_dialog.sqf you append the following piece of code:
bon_recruit_limitation = bon_recruit_limitation - 1; if(bon_recruit_limitation == 0) then{ (_this select 0) removeAction (_this select 2); };That does the trick. But it's only supposed to be used in SP, as one only has to disconnect and connect again to "refill" his account. To make it MP suitable it becomes way more complicated.
hf.
-
Hi all,
as there were some threads started recently regarding to AI Recruitment and due to some positive feedback on my own script (used in one of my missions) to provide this functionality, I decided to extract it and share it with the rest of you.
The script handles deletion of dead AI bodies as well as cleanup in case the player disconnects.
All in all its a very simple script with no other features than that, however, simplicity is the way of the genius, and maybe it comes in handy for some of you.
Screenshot:

Download:
armaholic.com <- thx to Foxhound.
hf.
-
-
Take a look at how you can recruit units in my TFOR mission - I extracted this feature into a sample mission which can be downloaded here:
http://forums.bistudio.com/showthread.php?t=107549
(I hope you own Operation Arrowhead, otherwise all you have to change is the file recruitable_units.sqf).
It deletes dead recruit bodies after 2 minutes, kills recruited AI in case the player disconnects and deletes them afterward.
You can access the dialog by calling the script "bon_recruit_units\open_dialog.sqf", as you do it via mouse action in the sample mission.
Restricting this to be available only once per life is another story, where many different approaches exist...
-
AI often dies in buildings due to not enough room, on OA rocks, falls down from ladders or roofs, gets road killed by enemies, etc.
Hence I recommend to put in a check to the killed-Eventhandler, that makes sure it was one of your own people who killed the resp. civilian:
{_x addeventhandler ["killed",{if(side (_this select 1) == west) then {civ_casaulties = civ_casaulties + 1}}]} foreach units thislist;(or "side (_this select 1) == east" depending on the faction you are playing)
-
I found the problem, it was as small as evil.
Here's my function to retrieve all enterable houses with their maximum building index:
// by Bon_Inf* // // INPUT: position, radius // OUTPUT: array with elements [house,int], // for all houses in given radius around // given position which can be entered, and // int the max. buildingpos of the house _position = _this select 0; _radius = _this select 1; _houses = nearestObjects[_position,["House"],_radius]; _houses_enterable=[]; { _house = _x; _i = 0; While{count ((_house buildingPos _i)-[0]) > 0} do {_i = _i+1}; _maxbuildingpos = _i - 1; if(_maxbuildingpos>0) then{ _houses_enterable = _houses_enterable + [[_house,[color="Red"]_i[/color]]]; }; } foreach _houses; _houses_enterableThe highlighted _i actually should be _maxbuildingpos in order to have the line "_maxbuildingpos = _i - 1;" to have any effect.
So here is the corrected code:
// by Bon_Inf* // // INPUT: position, radius // OUTPUT: array with elements [house,int], // for all houses in given radius around // given position which can be entered, and // int the max. buildingpos of the house _position = _this select 0; _radius = _this select 1; _houses = nearestObjects[_position,["House"],_radius]; _houses_enterable=[]; { _house = _x; _i = 0; While{count ((_house buildingPos _i)-[0]) > 0} do {_i = _i+1}; _maxbuildingpos = _i - 1; if(_maxbuildingpos>0) then{ _houses_enterable = _houses_enterable + [[_house,_maxbuildingpos]]; }; } foreach _houses; _houses_enterableSituations in which this bug causes problems are seldom, but the dimension of these problems are huge, so thanks heaps for your hint which made me reconsidering the code.
-
never encountered the pilot to be placed at [0,0,0].
and the routine works fine:
_i = 0; while{building has buildingpos _i} do {_i=_i+1}; _maxbuildingposindex = _i-1;because of the last line, the result can't contain an index out of bounds.
The thing with the cache being placed at [0,0,0] in fact had its cause in the problem that
nearestObjects[..,["House"],..]
not always detects all houses around, and that the check for the routine to have found a house at all was missing.
Bon, it seems Ive found the bug why the pilot is sometimes placed at [0,0,0] (rescuepilot.sqf)!The buildingpositions are indexed from 0 to max. So when
43: _house = _houses call getRandomElement;
graps a house - eg. [12b64200# 25681: house_k_1_ep1.p3d,6] - it has 6 positions in the house, ranging from #0 to #5.
The problem is that
45: _buildingpos = 1 max (round random (_house select 1));
can grap the max of 6 in this example, which leads to an index error (theres no position #6 - #5 is the highest) and the position is resetted to [0,0,0]!
I guess its the same problem as with the searchcache, but I havent tested yet.
(confirmed - youre using the same routine to get a place for the cache!)
-
My question is...are you allowing modified versions of your mission to be released to the A2 Community, like Warfare/Domi missions?Well, I'd even LOVE to see other people/communities modify and/edit this mission. That's the reason why I tried to set it up a bit like a framework, and extracted so many things to the config file, just to make modifying easier, also by other people than me.
You even mention editing it to change the mission to EAST side inside the cfgs.. :DNot gonna make an EAST version. But tried to minimize the effort one has to spend to do it on his/her own.
Are you still working on a new version of the mission or you consider it final? More objectives would be awesome, and it would make the mission even more dynamic..
There will come new versions sooner or later. Me myself would like to have some more features (which I lack of ideas for, though), and, what I am definitely going to do is adding more tasks - my aim is to have at least 20 different tasks in this mission. But that's not gonna happen 'till next month, since I am pretty busy atm.
Anyways, glad you like it.
hf.
-
Only thing missing bon is "clear loadout" and the ability to save an older A2 style backpack.1. clear loadout:
savedloadout = nil;
2. whats an A2 style backpack? And don't you come with ACE2 backpacks... That is ACE2 style, not A2 style, and as I mentioned before, I won't provide that.
-
This script works perfect exept that if your player's default payload includes a backpack, but you saved your payload with a rocket launcher, after you respawn, you will get both, which is not possible.I changed the script to add a command :
removebackpack player;
Just after the lines :
removeAllWeapons player;
removeAllItems player;
So it also removes the default backpack when you respawn.
Thx for the hint. Updated the code in the first post.
-
Write into the M119s init line:
this addEventHandler ["Fired",{(_this select 0) setVehicleAmmo 1}];and imagine your team ordered the M119 from Hollywood, CA.
At least you get rid of the problem the cannons run out of ammo.
No, seriously, I have to confirm this from my side, I never managed to reload those guns using the ammo truck. Would like to know how it works, too.
-
That's actually a good idea, and not that difficult to implement.
Problem would be to handle the slot system tho.
However, in case someone releases such script, the WORST thing to do would be to turn it into an addon :936:
-
The following code
- parses the config file for ammo boxes known by the executing machine,
- retrieves the content of each of it and gathers it in a list,
- copies the resulting list to the clipboard.
// by Bon_Inf* _weapons = []; _magazines = []; for "_i" from 0 to (count (configFile >> "CfgVehicles") - 1) do { _current = (configFile >> "CfgVehicles") select _i; if(isClass _current) then { _class = configname _current; _vehicleclass = getText (configFile >> "CfgVehicles" >> _class >> "vehicleClass"); if(_vehicleclass == "Ammo") then { _box = _class createVehicle [0,0,0]; _weapons = (_weapons - (getWeaponCargo _box select 0)) + (getWeaponCargo _box select 0); _magazines = (_magazines - (getMagazineCargo _box select 0)) + (getMagazineCargo _box select 0); deleteVehicle _box; }; }; }; copyToClipboard str [_weapons,_magazines]; hint "done";Assuming there is for each weapon and magazine class at least one box which contains this class, this piece of code saves you lots of time gathering all equipment the game offers.
The following script, executed from within the initline of an ammobox, is a fully automated ammobox filler, which makes use of the above equipment retrieval:
// by Bon_Inf* _cache = _this select 0; _weapons = []; _magazines = []; for "_i" from 0 to (count (configFile >> "CfgVehicles") - 1) do { _current = (configFile >> "CfgVehicles") select _i; if(isClass _current) then { _class = configname _current; _vehicleclass = getText (configFile >> "CfgVehicles" >> _class >> "vehicleClass"); if(_vehicleclass == "Ammo") then { _box = _class createVehicle [0,0,0]; _weapons = (_weapons - (getWeaponCargo _box select 0)) + (getWeaponCargo _box select 0); _magazines = (_magazines - (getMagazineCargo _box select 0)) + (getMagazineCargo _box select 0); deleteVehicle _box; }; }; }; _weaponcapacity = 0 max getNumber (configFile >> "CfgVehicles" >> typeOf _cache >> "transportMaxWeapons") - 100; _magazinecapacity = 0 max getNumber (configFile >> "CfgVehicles" >> typeOf _cache >> "transportMaxMagazines") - 100; while {alive _cache} do { {deleteVehicle _x} foreach nearestObjects [position _cache,["WeaponHolder"],50]; clearMagazineCargo _cache; clearWeaponCargo _cache; { _cache addWeaponCargo [_x, floor(_weaponcapacity / (count _weapons))]; } foreach _weapons; { _cache addMagazineCargo [_x, floor(_magazinecapacity / (count _magazines))]; } foreach _magazines; // restock time. sleep 1800; };Notes:
- The script uses the commands getWeaponCargo and getMagazineCargo, which were firstly introduced in patch 1.54 for Operation Arrowhead.
- In case the ammocrate filler is executed locally on each machine, and there are players running the game with additional weapons (i.e. 3rd party addons) the script results (hence, the respective crate content) differ from player to player, what, of course, would be a problem. So I recommend not to use the crate filler script in Multiplayer unless the server settings forbid any 3rd party addons providing additional equipment or the script is executed only on the server machine.
hf.
- parses the config file for ammo boxes known by the executing machine,

Random start time/date?
in ARMA 2 & OA : MISSIONS - Editing & Scripting
Posted
It really is no work. The moon phase is 28 days long. So you chose a time setup, and whether you can see approx half of the moon, none at all or whatever you add regarding number of days to your date setup, which is then about 7 days, 14 days aso.
Then you try it again and adjust. All in all it comes down to 2, at most 4 quick steps, each consisting of about 5 mouse clicks.
When that's still too much work for you, I wonder how you could manage to register for this forum :p
And writing code that detects that for you, imao is not worth the work at all.