Jump to content
Sign in to follow this  
Monsada

UPSMON - Urban Patrol Script Mon

Recommended Posts

Versión 5.0.7

Project Space for Monsadas UPSMON at Dev-Heaven now available!

Please Register for an account at Dev-heaven.net and post all your suggestions, bug-reports, support-request, etc. in the UPSMON Project Space under "Issues"

Please open one Ticket for Feature-Request/Bug-Report/Support-Request only!

Wiki:http://dev-heaven.net/projects/upsmon/wiki

FAQ

To turn of messages and marks on map edit init_upsmon.sqf and set debug to 0

KRON_UPS_Debug = 0;

Changes in version:

// Added:

// nowp = No waypoints will be created for this squad UNTIL ENEMY DETECTED

// nowp2 = No waypoints will be created for this squad UNTIL ENEMY DETECTED AND DAMAGED

// nowp3 = No waypoints will be created for this squad in any way.

// Ambush2 Same as ambush but without using mines

// Added spawn support for vehicles in squad

// Modified:

// FORTIFY moves leader too and prevents from moving when hurt

// Solved bug in targetting of resistance

// Solved bug when respawning a template squad were creating a new template

// Solved bug that did exiting AI form vehicle when upsmon begins

// Solved bug of squads loosing group and gets stucked

// Avoid to take same position on buildings

This is a personal projet to enhance IA in combat and making easier mission edition. I have used the version 2.0.3 of Urban Patrol Script de Kronzky. I have to congratulate Kromzky for his script UPS.sqf that has inspired me for doing UPSMON.

With upsmon I don´t need to put any waypoints. My work area is in CHS Comunity so I will be pleased to meet you there

http://www.simulacion-esp.com/v3/topic/18360-urban-patrol-script-version-monsada/page__gopid__60687entry60687

//AI improvements

* There is a General commander that organize the attack and defence of all UPSMON squads in the same side:

o Squads of AI fights together as an army, so they comunicate each other by radio the enemy known positions.

o flanking manauvers are taken depending on friendly position.

o General commander can order to surrender entire side if army is seriously damaged

* AI has enhanced actions and movements in combat:

o AI can use smoke grenades.

o AI run crouched when enemy is near or under fire.

o AI does fire suppression and squad movement can be supressed by fire too.

o AI moves are influenced by morale, so in low morale they can retreat.

o AI can lay mines if enemy tanks are near.

o AI avoid snipers when fired by uknown enemy.

o AI paratroop near objectives if they take an hely.

* AI take use of enviroment:

o AI may use static weapons you place on map.

o AI may use empty land vehicles for moving and or to attack.

o AI may use empty helys for moving and or to attack.

o AI uses buildings to take defence position and patrol them when leader thinks than enemy is near or using it.

// Performance

UPSMON Script runs 1 time every 20 seconds for every group of IA, new movements calculates every 60 s or less depending of under fire, enemy knowns...

I have been implementing some functions in spawn mode to exploit the multithread of processors with very fast results.

UPSMON has been tested in CHS comunity with more than 30 people and more than 25 groups of IA with UPSMON and the conclusion was perfect performance.

//Download

Dev-heaven

//Installation

Copy folder "scripts" into your folder mission.

//How to Implement

In init.sqf you need to load init_upsmon.sqf

//Init UPSMON scritp
call compile preprocessFileLineNumbers "scripts\Init_UPSMON.sqf";

In the mission editor run UPSMON script in the lider of each group exec UPSMON, sample:

nul=[this,"town", "move","reinforcement", "delete:",600] execVM "scripts\upsmon.sqf";

//Global variables of Init_UPSMON.sqf

//1=Enable or 0=disable debug. in debug could see a mark positioning de leader and another mark of the destinity of movement, very useful for editing mision
KRON_UPS_Debug = 1;

//Time that lider wait until doing another movement, this time reduced dinamically under fire, and on new targets
KRON_UPS_react = 60;

//Min time to wait for doing another reaction
KRON_UPS_minreact = 30;

//Max waiting is the maximum time patrol groups will wait when arrived to target for doing another target.
KRON_UPS_maxwaiting = 30;

// how long AI units should be in alert mode after initially spotting an enemy
KRON_UPS_alerttime = 90;

// how far opfors should move away if they're under attack
KRON_UPS_safedist = 300;

// how close unit has to be to target to generate a new one target or to enter stealth mode
KRON_UPS_closeenough = 300;

// how close units have to be to each other to share information, over this, will lose target
KRON_UPS_sharedist = 800;

//If enabled IA comunicating between them with radio defined sharedist distance, 
KRON_UPS_comradio = 2;

//Sides that are enemies of resistance
KRON_UPS_Res_enemy = [east];

//Frequency for doin calculations for each squad.
KRON_UPS_Cycle = 20;

//Height that heli will fly this input will be randomiced in a 10%
KRON_UPS_flyInHeight = 100;

//Max distance to target for doing paradrop, will be randomiced between 0 and 100% of this value.
KRON_UPS_paradropdist = 250;

//Enables or disables AI to use static weapons
KRON_UPS_useStatics = true;

//Enables or disables AI to put mines if armored enemies near
KRON_UPS_useMines = true;

//Distance from destination for seraching vehicles
KRON_UPS_searchVehicledist = 500;

//Percentage of units to surrender.
KRON_UPS_EAST_SURRENDER = 10;
KRON_UPS_WEST_SURRENDER = 10;
KRON_UPS_GUER_SURRENDER = 15;

//Efective distance for doing perfect ambush (max distance is this x2)
KRON_UPS_ambushdist = 50;

//Enable it to send reinforcements, better done it in a trigger inside your mission.
KRON_UPS_reinforcement = false; 

//Artillery support, better control if set in trigger
KRON_UPS_ARTILLERY_EAST_FIRE = false; //set to true for doing east to fire
KRON_UPS_ARTILLERY_WEST_FIRE = false; //set to true for doing west to fire
KRON_UPS_ARTILLERY_GUER_FIRE = false; //set to true for doing resistance to fire

//Parámeters of UPSMON.sqf

The same as UPS of Kronzky, only new "reinforcement" for allowing a group to go where is called for.

//  Required parameters:
//    unit        = Unit to patrol area (1st argument)
//    markername  = Name of marker that covers the active area. (2nd argument)
//    (e.g. nul=[this,"town"] execVM "ups.sqf")
//
//  Optional parameters: //    random      = Place unit at random start position.
//    randomdn    = Only use random positions on ground level.
//    randomup    = Only use random positions at top building positions. 
//    min:n/max:n = Create a random number (between min and max) of 'clones'.
//    init:string = Custom init string for created clones.
//    nomove      = Unit will stay at start position until enemy is spotted.
//    nofollow    = Unit will only follow an enemy within the marker area.
//    delete:n    = Delete dead units after 'n' seconds.
//    nowait      = Do not wait at patrol end points.
//    noslow      = Keep default behaviour of unit (don't change to "safe" and "limited").
//    noai        = Don't use enhanced AI for evasive and flanking maneuvers.
//    showmarker  = Display the area marker.
//    trigger     = Display a message when no more units are left in sector.
//    empty:n     = Consider area empty, even if 'n' units are left.
//    track       = Display a position and destination marker for each unit.
//    reinforcement  = Makes squad as reinforcement, when alarm KRON_UPS_reinforcement==true this squad will go where enemy were.
//    reinforcement:x  = Makes squad as reinforcement id, when alarm KRON_UPS_reinforcementx==true this squad will go where enemy were.
//    fortify = makes leader order to take positions on nearly buildings at distance 200 meters, squad fortified moves less than "nomove"
//	spawned = use only with squads created in runtime, this feature will add squad to UPSMON correctly.
//	nowp	= No waypoints will be created for this squad, so this squad will comunicate enemies but will not be moved, so you can do what you want with them using waypoints.
//	ambush	= Ambush squad will not move until in combat, will wait for incoming enemies stealth and ambush when near or discovered.
//	ambush:n	= Creates an anbush and wait maximun the especified time n in seconds. you can put 0 seconds for putting mines and go away if combined with "move" for example
//	aware,combat,stealth,careless defines default behaviour of squad
//	respawn = allow squad to respawn when all members are dead and no targets near
//	respawn:x = allows to define the number of times squad may respawn.

videos of youtube:

5.0.4 Ambush:

fortify and reinforcement:

Getin:

Building Patrol:

paradrop:

combat:

Edited by Monsada
Change version to 5.0.7

Share this post


Link to post
Share on other sites

Thanks! The new reinforcement parameter is very very nice :>

And its cool that the AI uses vehicles if they are called for reinforcement :)

But one question: Do I have to give the reinforcement troop a patrol marker also?

Share this post


Link to post
Share on other sites
Versión 4.1.1

In the mission editor run UPSMON script in the lider of each group exec UPSMON, sample:

nul=[this,"town", "move","reinforcement", "delete:",600] execVM "scripts\upsmon.sqf";

Hi Monsada,

Excellent script! I have tried it in a SP mission I'm creating and it is AWESOME! :yay:

One questions though.

I'm creating a lot of squads and teams, and it occurred to me that instead of having to read and execute the upsmon script (execVM "scripts\upsmon.sqf"), it would be more efficient to use either the call or spawn command to do so.

So in the init.sqf script I added the following code:

MyPatrol = compile preprocessFile "scripts\upsmon.sqf"

and in the leader use the following code:

nul=[this,"town", "move","reinforcement", "delete:",600] spwan MyPatrol;

However, so far this doesn't work. It only works using execVM "scripts\upsmon.sqf"

Could you or anybody give me a hand here and tell me what I am missing/doing wrong? :pray:

Thanks much. Splicer.

Share this post


Link to post
Share on other sites

Unit init lines are run before init.sqf afaik, which means that a script precompiled in init.sqf won't be compiled when you try to spawn it.

Just name the leaders of the squads, like "cityPat1" and then run the script from init.sqf by nul=[cityPat1,"town","move","reinforcement","delete",600] spawn MyPatrol;

Share this post


Link to post
Share on other sites
Unit init lines are run before init.sqf afaik, which means that a script precompiled in init.sqf won't be compiled when you try to spawn it.

Just name the leaders of the squads, like "cityPat1" and then run the script from init.sqf by nul=[cityPat1,"town","move","reinforcement","delete",600] spawn MyPatrol;

Hi Inkompetent,

Thanks for that intel. Since it is not 100% clear that unit's init lines will be processed before the mission's init.sqf, I wonder if it would be possible to compile and load the script by placing a game logic in the map?

And if so, what code line would you enter in the game logic?

The point is to avoid the overhead of having to have a list of all units to be used in the mission.

Thanks much. Best, Splicer.

Edited by Splicer
Mention "overhead".

Share this post


Link to post
Share on other sites

Same here, I cant really sign up or navigate there since I don't know spanish, anyone able to put up a mirror if the creator will allow it? Thanks

Share this post


Link to post
Share on other sites

Hmm... Just checked and the links don't work anymore.

Bummer. I speak Spanish. I'll try to get a hold of Monsada to find out if a new hyperlink could be provided or get an official "blessing" about placing/mirroring his script somewhere else.

Hey Monsada , que paso con los links de tu script?

Splicer.

Share this post


Link to post
Share on other sites
Thanks splicer!

I figured that's what it said but my Spanish is rusty. ;)

U R Welcome Sen~or Manzilla. ;)

Hasta pronto, Splicer.

Share this post


Link to post
Share on other sites
Hi Inkompetent,

Thanks for that intel. Since it is not 100% clear that unit's init lines will be processed before the mission's init.sqf, I wonder if it would be possible to compile and load the script by placing a game logic in the map?

And if so, what code line would you enter in the game logic?

The point is to avoid the overhead of having to have a list of all units to be used in the mission.

Thanks much. Best, Splicer.

Init_upsmon.sqf and upsmon.sqf are sincroniced, upsmon.sqf waits until init_ups has been executed, then this will not be the problem.

I think may be spawn that executes in a new thread but i don't really know the way with the global variables.

Put in init_upsmon.sqf KRON_UPS_DEBUG = 1 and saw the messages executing it in normal mode, in call mode and in spawn mode, this will report you if any problem find.

Added some traslations in main post, may be not good english but I espect wil be mor readable than google translator

Edited by Monsada

Share this post


Link to post
Share on other sites

Hi Monsada,

Thanks for the update! :D

However, the hyperlink you posted shows v4.1.1 and not 4.1.2. :confused:

Best, Splicer.

Share this post


Link to post
Share on other sites

Hi Monsada,

How long does it take for these guys to start moving?

I think I have set it up correctly, but the groups stay motionless in there original formation - I have been using Kronski's version without a problem.

The only difference I can see from your set-up amd mine is that my .ini is a .sqs file and that I do not use a scripts folder - I do not get any errors.

Any ideas?

Edited by Arkon2

Share this post


Link to post
Share on other sites

Hey,

really cool, was pretty excited when reading about all these AI enhancements.

Then started to test it on Utes, Strelka village by placing an infantry group at center of town, a marker called "testmarker" (ellipse, 100x100m) covering the area:

upsmon_setup.jpg

I then wrote into the init line of the leader:

_nul = [this,"testmarker"] execVM "scripts\upsmon.sqf";

The result was that all 5 to 10m the group changed their direction, i.e. got another waypoint, which then resulted in a way less structured patrol route as I know it from Kronzkys original. Made a video of it, you can download it here:

http://10th-community.com/arma2/misc/upsmon.wmv

As you can see, it took the group about 2 minutes to finally leave the camera range.

I did run this setup about 10 times, and it was always the same picture. Possible I made a mistake or that there a parameter that can be set to change this kind of behavior? If not, any chance this gets improved someday?

Kind Regards.

Share this post


Link to post
Share on other sites
Hi Monsada,

How long does it take for these guys to start moving?

I think I have set it up correctly, but the groups stay motionless in there original formation - I have been using Kronski's version without a problem.

The only difference I can see from your set-up amd mine is that my .ini is a .sqs file and that I do not use a scripts folder - I do not get any errors.

Any ideas?

I'm using this script for patrols for a mission I'm putting together and it works like a charm!

It takes about 20 sec or so for the units to get moving, but do get going.

If you post the exact code you're entering in the unit's init field I can take a look at it. :)

Best, Splicer.

Share this post


Link to post
Share on other sites
I'm using this script for patrols for a mission I'm putting together and it works like a charm!

It takes about 20 sec or so for the units to get moving, but do get going.

If you post the exact code you're entering in the unit's init field I can take a look at it. :)

Best, Splicer.

Hi Splicer

I'm doing a mission too, what's yours about?

This is what I'm using:

nul=[this,"Alpha"] execVM "UPSMON.sq";

I just changed Kronski's "UPS.sqf" for Monsada's "UPSMON.sqf".

As i said I have been using Kronski's one up till now.

Monsada's seems more or less the same set-up as Kronski's except the call in the .ini file the "Init_UPSMON.sqf" file itself and the MON_functions.sqf file which Monsada does not seem to mention.

Thanks

Edited by Arkon2

Share this post


Link to post
Share on other sites
What am I suppose to do with the functions file? I keep getting an error that it is missing. Where do I put it?

Hi,

I think it goes with the other files in your mission folder.

Monsada said:

Copy content of rar into your folder mission

Share this post


Link to post
Share on other sites
Hi Splicer

I'm doing a mission too, what's yours about?

Hi Arkon2,

My mission is a very ambitious project for noob like me. Nonetheless, it's a dynamic mission inspired by Cipher where there will be 3 tasks and each choice you choose to go about it (e.g., accomplish task 1 first) will impact on how you go about going for the other 2 tasks.

Realism is key, so when you engage an enemy unit there is a chance (if things turn grim for them) that they call for air support to come and get you. And they can also alert other units within certain radius IF they have radio communication. So if you attack at one place other units may know you're in the area and be on alert... or come after you!

Number of AIs, type/speciality, whether they have an armed vehicle or car and the type they ALL change dynamically every time you start a mission... and they are all over the map.

Major cities will be guarded more than a minor town (logistically that makes sense), and since each target in each task will also be randomly selected, placed on the map, and guarded... well... I want this game to be the mother of all dynamic games. And so far I'm making progress. :D

This is what I'm using:

nul=[this,"Alpha"] execVM "UPSMON.sq";

I just changed Kronski's "UPS.sqf" for Monsada's "UPSMON.sqf".

Hmmm... In my case I'm using more specific data in the array for the script ( Monsada's "UPSMON.sqf").

Example:

nul=[this,"MyMarker", "move", "delete:",600] execVM "scripts\upsmon.sqf";

Don't know if that makes a difference, but I can tell you that now that I have units in almost every town and city on the map (yes... TONS OF UNITS!) it can take at times almost a minute for a patrol to get their marching orders and move out... But the DO get their orders and go on patrolling. :D

Try giving more data in the array and see if that actually makes a difference.

I can tell you that the script does work and works very nice!

Best, Splicer.

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  

×