Jump to content
Sign in to follow this  
Fixed

Changing site modules options from script

Recommended Posts

Probably a very simple question, but I couldn't find it anywhere so here I ask.

How do I change site modules options from script?

I've a opfor site called site1 and I want to change the condition value.

I guess it would look something like this:

site1 siteCondition true;

Share this post


Link to post
Share on other sites

Looks like it's a hard question after all.

Share this post


Link to post
Share on other sites
site1 setvariable ["conditionOfPresence",{true}];

Share this post


Link to post
Share on other sites
site1 setvariable ["conditionOfPresence",{true}];

Thanks!:)

Share this post


Link to post
Share on other sites

is it also possible to set the aiskill of a site module...either in the editor (for existing sites placed on map) or in a script?...and how about the amount of ai you want the module to spawn, can that be controlled by us as well?

Share this post


Link to post
Share on other sites
is it also possible to set the aiskill of a site module...either in the editor (for existing sites placed on map) or in a script?
A quick flick through the scripts shows that BIS_fnc_spawnGroup is used with a hard coded skill range of [0.2, 0.5].

Although this value is hard coded, all groups of a site are held in the "garrison" variable on the site module. So you could loop through this array and change the skills yourself. (I can not see seperate arrays for the main force and patrols , everything seems to be lumped into this one array)

_newSkillValue = 0.5 //change to what ever you need
_siteGroups = MySite getVariable "garrison";  //MySite being the name of your site module
{
{
	_x setUnitAbility _newSkillValue;
}forEach (units _x);
}forEach _siteGroups;

and how about the amount of ai you want the module to spawn, can that be controlled by us as well?
The module uses hard coded values from CFGGroups dependant on site type and whether its spawning the main group or patrols. It is possible you could feed a group into the site by adding them to the garrison variable
//group types accepted by BIS_pickSiteGroup "sentry", "fireteam", "squad", "motorized"
//being, "BUS_InfSentry", "BUS_InfTeam", "BUS_InfSquad", "BUS_MotInf_Team"
//of course you could use anything you want this is just to show sites internal workings
_myNewGroup = [position MySite, MySite call BIS_getCorrectSiteSide;, [MySite getVariable "faction", "fireteam"] call BIS_pickSiteGroup, [], [], [0.2, 0.5]] call BIS_fnc_spawnGroup;
//_myNewGroup = [position MySite, west, configFile >> "CfgGroups" >> "West" >> "BLU_F" >> "Infantry" >> "BUS_InfSentry", [], [], [0.2, 0.5]] call BIS_fnc_spawnGroup;
//Add new group to garrison array
MySite setVariable ["garrison", (MySite getVariable "garrison") + [_myNewGroup]];
//Run garrison FSM so they react when any of the other site groups come under combat
[_myNewGroup, MySite] execFSM "A3\modules_f\sites\behaviour\military_garrison.fsm";

If you wish to add a patrol to the site you can inject them into the garrison list with something like..

[MySite, "sentry", 2] call BIS_spawnSitePatrol  //site, group type, number of

Here you are limited to the predifined group types ("sentry") that can be used (see above script) as this BIS script spawns the group, sets up the waypoints and adds the group to the garrison list for you.

DISCLAIMER: Non of this is test and is from a quick read through of the script of a blufor op site.

Edited by Larrow

Share this post


Link to post
Share on other sites

this sounds all very good, Larrow thank you!!...will check some of this out later tonight after work...

...know any good dynamic ai scripts around yet for A3 (I mean ones that dont have thousands of rpt errors)?...I've tried DAC and EOS so far but they both give off way too many rpt errors...are you aware of any available right now that run fairly clean?

Share this post


Link to post
Share on other sites

What do you want from a 'dynamic ai script' ??

Just something that hides/disable things that you are not near?

Share this post


Link to post
Share on other sites

not sure if you're being sarcastic or serious...sounds sarcastic though :-) If you havent tried utilizing Dac to make a mission in Arma2 you SHOULD. There's just something great fun about a mission which you can replay 100 times over and each time you play it you have no idea when,if or from which direction an attack may ocurr...it's different everytime. For me that is the most important addon/script/mod you can have in ANY shooter game...but then again...I dont do scripting myself so I must rely on other peoples skills for this.

Share this post


Link to post
Share on other sites

No was not being sarcastic was just curious of the functionality you were after.

I saw your comments in the EOS thread and your comment here of '(I mean ones that dont have thousands of rpt errors)' and just wondered if you were trying to get sites to dynamically spawn and despawn units on distance from players/playableUnits.

Anyway if your interested i found an FSM in the sites folder that does not seem to be used (by BIS, yet?), yet the above is exactly what it does, it hides and disables (simulation) any units initialised or handled by sites (contained in the garrison variable) by distance to any playable units.

Share this post


Link to post
Share on other sites

Hi ok hehe...I do happen to be working on a mission right now that uses the sites module and so yes it would be nice from a performance perspective to despawn/reduce the site's AI when our squad is far away...but I don't want to put you to work, lol! Also I should probably first get my head around some of the stuff you posted earlier and get it into my mission. Once Im happy with that then the reducing would be a great idea. Right now my biggest issue in the mission is the lack of a good dynamic AI patrol script which doesnt throw off a ton of errors....seems A3 still has a log way to go before it's really ready for prime time IMO...im wondering if i should walk away and come back maybe after the holidays...but I keep searching for answers anyway as Im eager to be able to create some missions.

Share this post


Link to post
Share on other sites

No bother ill just put what i found so far

fsmID = [] execFSM "\a3\modules_f\sites\procedures\fpsManager.fsm";

Will start it up. It automatically grabs all sites and adds all 'garrison' units/vehicles to its list of stuff to hide, things are hidden from playableUnits + switchableUnits at a distance of 2000m. Units are not hidden if a player is in an AIR vehicle, Units are re-evaluated every 10 seconds or if the player has moved more than 250m since last update.

BIS_fps_rescanNewObjects is a global variable if set to true the FSM will remake its list of things that need to be hidden. Handy for what i posted above if your injecting stuff into the sites garrison list.

BIS_persistent is a global array holding a list of things you dont wish to be hidden.

Think that was about it, gave it a quick test in the editor, on placing the player > 2000m away from the site and then going to look at the area via the camera all units and vehicles of the site were hidden and via checking in the debug console all had their simulation disabled.

Share this post


Link to post
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×