Jump to content
Sign in to follow this  
Monsada

UPSMON - Urban Patrol Script Mon

Recommended Posts

I have another question, when I spawn some infantry into a location I would then like them to follow some waypoints, how would I do that?

Try this with bis call BIS_fnc_spawngroup: as fatty86 told me

_units = []; //ready an aempty array
_side = east; // what side of units is spawned
waituntil {BIS_fnc_init}; //you need a function module placed on map, and script will wait until its ready

if (isServer) then
{
   _units = ["TK_INS_Soldier_Sniper_EP1", "TK_INS_Soldier_TL_EP1", "TK_INS_Warlord_EP1"];}; //this is the list wich random or all units will be spawned from

   _spawngroup = [getpos _spawn, _side, _units, [],[],[0.5,0.8],[],[1,0.45]] call BIS_fnc_spawnGroup; //this calls the group //(0.5,0.8) = random skill between 05 and 08 //(1,0.45) 1 means at least one unit will spawn and rest has 45% probability to be spawned, set to 1.00 for all to spawn, or set 1 to the number of units you want to spawn, for all set to 3 as there are 3 units in array.

   _wp0 = _spawngroup addWaypoint [getMarkerPos "wp1_marker", 0]; //waypoints ("wp1marker") = marker to place waypint on, 0 is radius of wp, can set to 100 to have more randomness in wp.
   _wp0 setWaypointType "MOVE";
   _wp0 setWaypointSpeed "FULL";
   _wp0 setWaypointBehaviour "AWARE";
   _wp0 setWaypointFormation "LINE";

   _wp1 = _spawngroup addWaypoint [getpos any_unit_or_item_name, 0]; //waypoints
   _wp1 setWaypointType "MOVE";
   _wp1 setWaypointSpeed "FULL";
   _wp1 setWaypointBehaviour "AWARE";
   _wp1 setWaypointFormation "LINE";
   [_spawngroup,1] setWaypointStatements ["true", "nul=[this,'NNDL_ao','spawned','RANDOMDN','reinforcement'] execvm 'scripts\UPSMON.sqf'"]; //this is initline in _spawngroup waypoint note that " inside script is changed to ' exaample: "spawned" is now 'spawned'
};
hint "end";

or this with create unit command:


if (isServer) then {
_grp = _this select 0;

_grp= Creategroup EAST;

_Unit1= _grp createUnit ["RU_Soldier_Officer",[(getMarkerPos "Itest") select 0,(getMarkerPos "Itest") select 1,0],[],0,"FORM"];

_Unit2= _grp createUnit ["MVD_Soldier_GL",[(getMarkerPos "Itest") select 0,(getMarkerPos "Itest") select 1,0],[],0,"FORM"];

_Unit3= _grp createUnit ["MVD_Soldier_GL",[(getMarkerPos "Itest") select 0,(getMarkerPos "Itest") select 1,0],[],0,"FORM"];

_unit1 setunitrank "MAJOR";
_unit1=leader _grp;

_waypoint0 = _grp addWaypoint [getmarkerpos "wp0",0]; 
_waypoint0 setWaypointType "Move";
_waypoint0 setWaypointBehaviour "COMBAT";
_waypoint0 setwaypointcombatmode "RED"; 
_waypoint0 setWaypointSpeed "NORMAL"; 


_waypoint1 = _grp addWaypoint [getmarkerpos "wp1",0];
_waypoint1 setWaypointType "Move";
_waypoint1 setWaypointBehaviour "UNCHANGED";
_waypoint1 setwaypointcombatmode "NO CHANGE"; 
_waypoint1 setWaypointSpeed "UNCHANGED"; 


_waypoint2 = _grp addWaypoint [getmarkerpos "wp2",0]; 
_waypoint2 setWaypointType "Move";
_waypoint2 setWaypointBehaviour "UNCHANGED";
_waypoint2 setwaypointcombatmode "NO CHANGE"; 
_waypoint2 setWaypointSpeed "UNCHANGED";


_waypoint3 = _grp addWaypoint [getmarkerpos "wp3",0]; 
_waypoint3 setWaypointType "Cycle";
_waypoint3 setWaypointBehaviour "UNCHANGED";
_waypoint3 setwaypointcombatmode "NO CHANGE"; 
_waypoint3 setWaypointSpeed "UNCHANGED";
_waypoint3 setWaypointStatements ["true", "nul=[this,"NNDL_ao","spawned","RANDOMDN","reinforcement"] execvm "scripts\UPSMON.sqf"; //this is initline in _spawngroup waypoint ////not sure if you maybe need [_grp ,1] instead of _waypoint3 in this line.
};
hint "end of script";

also i dont think this will work with respawn or template spawn, so youll have to manually creatunits or call BIS_fnc_spawngroup every time trigger detects less enemys or any set trigger condition is met.

Edited by Demonized
added info

Share this post


Link to post
Share on other sites

Many thanks for that great help , sorry to keep asking but it is the only way I will learn !

How would I create a group of Infantry then place them in the truck using BIS_fnc_spawngroup so i can send a truck full ogf them into a town ?

Cheers again

Share this post


Link to post
Share on other sites
Many thanks for that great help , sorry to keep asking but it is the only way I will learn !

How would I create a group of Infantry then place them in the truck using BIS_fnc_spawngroup so i can send a truck full ogf them into a town ?

Cheers again

Simply use :

_units = []; //ready an aempty array
_side = east; // what side of units is spawned
_spawn = getPos any_item_name;  //also you can use   getMarkerPos "any_marker_name"  //just remember to switch out getpos down in script with getmarkerpos "_spawn" if you use markers.
waituntil {BIS_fnc_init}; //you need a function module placed on map, and script will wait until its ready

if (isServer) then
{
   _units = ["TK_INS_Soldier_Sniper_EP1", "TK_INS_Soldier_TL_EP1", "TK_INS_Warlord_EP1"];}; //this is the list wich random or all units will be spawned from

   _spawngroup = [getpos _spawn, _side, _units, [],[],[0.5,0.8],[],[1,0.45]] call BIS_fnc_spawnGroup; //this calls the group //(0.5,0.8) = random skill between 05 and 08 //(1,0.45) 1 means at least one unit will spawn and rest has 45% probability to be spawned, set to 1.00 for all to spawn, or set 1 to the number of units you want to spawn, for all set to 3 as there are 3 units in array.
   _vehicle = [getPos _spawn, 180, "V3S_Open_TK_EP1", _spawngroup] call bis_fnc_spawnvehicle; // this calls a vehicle with full crew, if only driver seat and no guns, it only has driver, for tanks etc, with commanders and gunners, these positions are filled by  bis_fnc_spawnvehicle, passenger seats always empty.

   _wp0 = _spawngroup addWaypoint [getPos _vehicle, 0]; //waypoints ("wp1marker") = marker to place waypint on, 0 is radius of wp, can set to 100 to have more randomness in wp.
   _wp0 setWaypointType "GETIN";
   _wp0 setWaypointSpeed "FULL";
   _wp0 setWaypointBehaviour "AWARE";
   _wp0 setWaypointFormation "LINE";

   _wp1 = _spawngroup addWaypoint [getpos any_unit_or_item_name, 0]; //waypoints
   _wp1 setWaypointType "MOVE";
   _wp1 setWaypointSpeed "FULL";
   _wp1 setWaypointBehaviour "AWARE";
   _wp1 setWaypointFormation "LINE";
   [_spawngroup,1] setWaypointStatements ["true", "nul=[this,'NNDL_ao','spawned','RANDOMDN','reinforcement'] execvm 'scripts\UPSMON.sqf'"]; //this is initline in _spawngroup waypoint note that " inside script is changed to ' exaample: "spawned" is now 'spawned'
};
hint "end";

And this is a site with all class names, and config groups you ever want:

http://browser.dev-heaven.net/cfg_vehicles/classlist?=A2+OA+%28Only%29%3A+1.54&version=23&commit=Change&options[group_by]=vehicleclass&options[sort_by]=name&options[faction]=&options[vehicleclass]=Car

also take a look at this site:

http://community.bistudio.com/wiki/BIS_fnc_help

Edit: Also with upsmon if where the group has to go for patrol is more than 500 m away (can be changed in upsmon_init or something) they will automatically use a empty vehicle near them.

Edited by Demonized
added info and changed script with getin wp

Share this post


Link to post
Share on other sites

The AI seem to know more then they should and very quickly to does anyone find that killing ai with silenced weapons the other AI react before they should also I placed a trigger for a reinforcement group to reinforce after blufor was detected and a trigger to sound an alarm at the same time the reinforcements are always in the chopper and flying before the alarm sounds usually jumping out of it as the alarm sounds,

Share this post


Link to post
Share on other sites
The AI seem to know more then they should, and very quickly too. Does anyone find that [when] killing AI with silenced weapons, the other AI react before they should?

Also, I placed a trigger for a reinforcement group to reinforce after blufor was detected, and a trigger to sound an alarm at the same time. The reinforcements are always in the chopper and flying before the alarm sounds, usually jumping out of it as [it does].

Edited for readability.

Share this post


Link to post
Share on other sites
The AI seem to know more then they should and very quickly to does anyone find that killing ai with silenced weapons the other AI react before they should also I placed a trigger for a reinforcement group to reinforce after blufor was detected and a trigger to sound an alarm at the same time the reinforcements are always in the chopper and flying before the alarm sounds usually jumping out of it as the alarm sounds,

Reinforcements should start to move at once the alarm sounds, because its the trigger that sends them to reinforce, sounds like something else might be the issue. set the same trigger wich activates reinforcement to play the alarm, then you get accurate time of when they start to move.

Silenced weapons... havent tried so cant actually say, i usually set my enemys at setSkill 0.5 + (random 0.5) having them higher might cause unwanted terminator like beheavour.

Share this post


Link to post
Share on other sites

Guys, if you have questions that are not related to UPSMON (recent example: spawning a group and giving it waypoints or questions about AI detection abilities) you'll probably have much better luck posting them in a new thread with an appropriate title, and an additional benefit would be that people that are looking for questions/answers regarding UPSMON will have an easier time finding them here.

In any case, UPSMON reacts to known enemies if they are within the sharedist defined in init_upsmon.sqf - If they are known or not is actually up to Arma 2 and not UPSMON. You might want to consider ACE and/or Zeus AI to get a bit more realistic AI detection abilities.

Regarding your alarm trigger, make sure it actually works as you intend it to... If enemies are coming for you then you were detected! Notice though that if they are in the helicopter flying it doesn't necessarily mean that they are flying to attack you, they could just be on their regular patrol on whatever zone you set them to.

Share this post


Link to post
Share on other sites
also I placed a trigger for a reinforcement group to reinforce after blufor was detected and a trigger to sound an alarm at the same time the reinforcements are always in the chopper and flying before the alarm sounds usually jumping out of it as the alarm sounds,

"detected" is shyte - i dont know what detected means to AI exactly but they will "detect" you from 400 meters away running crouched while walking in the opposite direction.

you are better off to use a "Fired" eventhandler - I'll dig the code up later or do a search for it. it means that unless the groups linked to this event fire their weapon the trigger will not activate. much better for stealth ops.

---------- Post added at 07:13 PM ---------- Previous post was at 06:53 PM ----------

while im here - is there a way to make AI not follow - 'nofollow' dont seem to work so well - i dont want all the patrolling AI to abandon their patrols everytime - just hold patrol zone until the action gets closer.

ty

Share this post


Link to post
Share on other sites

here is the eventhandler - fired

place this into init line of leader of each group you to trigger the fired eventhandler in this case 'group4' -

{_x addEventHandler['Fired',{shotIsFired = true}]} forEach (units patrol4)

in your trigger the condition is -

shotIsFired

Activation: Sound the alarm.

I'm pretty sure that's all you need - if any member of the groups who have the code in the init line fire their weapon - then you are detected in a realistic way (if they know you are there they fire at you) and the alarm sounds.

Share this post


Link to post
Share on other sites

Is there any way to force an UPSMON group to stay in they're patrol area even when the enemy is spotted?

Share this post


Link to post
Share on other sites
Is there any way to force an UPSMON group to stay in they're patrol area even when the enemy is spotted?

in UPSMON.sqf there is info on a parameter used

// nofollow = Unit will only follow an enemy within the marker area.

example:

nul=[grpname,"patrolmarker","nofollow"] execVM "scripts\upsmon.sqf";

or in leader init:

nul=[this,"patrolmarker","nofollow"] execVM "scripts\upsmon.sqf";

Remember that if you use the reinforce param, group will leave marker no matter to help out where its being called to reinforce.

Share this post


Link to post
Share on other sites

If you want more realistic AI detection try Zeus AI. Otherwise I wouldn't really mess with changing your trigger conditions. It would be pretty stupid if you were detected and USPMON started bringing in all patrols on your position but the alarm wouldn't start because your trigger condition is still false.

Share this post


Link to post
Share on other sites

Alright then, the damned AI is still leaving it's patrol zone no matter what I do, I want them to patrol but I wish I could take a shot without every patrol, even those with nofollow and fortify rushing towards me. It is ruining the mission pacing.

Share this post


Link to post
Share on other sites

Lightspeed thanks I will try that, that looks like an awesome way to go. I will definately be trying that, I am trying new AI addons now Glazohar I think I am going to try them independantly before adding in the UPSMON at this point.

I am seriously thinking about just testing AI for a couple of months to really get down the features I like and understand how they will react with this script and on their own before trying to make a mission

Getting AI to react realistically and look good doing it is an accomplishment worth waiting for.

My questions on this patroling script though still kind of stand using UPSMON do the AI detect you to quickly???

I care about this mostly for making missions in the stealth kills, using silenced weapons I shouldnt have to shoot a guy 2 miles away we should hav a realistic idea of what we can kill and from how far away to be able to achieve these types of missions.

Share this post


Link to post
Share on other sites

The AI detect you just as well as without UPSMON... But it will share its detection with other groups and react accordingly, unlike without UPSMON where only the group that detected you will react and even that is rather limited.

Share this post


Link to post
Share on other sites

I have no idea what to put in the int line of the group leader. Can someone please help me out?

Share this post


Link to post
Share on other sites

Would it be difficult to implement a switch patrol-mechanism? Like cycle : a : t - change Area after Time? Eg. nul=[this,"Marker1","Move","cycle:","Marker2","2500"] execVM etc

I was also wondering if it is possible to create a systematic naming of leaders or groups, so that we can assign waypoints or specific tasks to new respawns.

Can anyone explain to me the CLONE feature, and if it might do this?

Share this post


Link to post
Share on other sites
BittleRyan I have no idea what to put in the int line of the group leader. Can someone please help me out?

BittleRyan look in UPSMON.sqf

At beginning you find all relevant info. example:

Patrol squad samples in init of leader

nul=[this,"anyRectanglemarker"] execVM "scripts\upsmon.sqf";

defensive squad samples in init of leader:

nul=[this,"anyRectanglemarker","nomove"] execVM "scripts\upsmon.sqf";

Always have

nul=[this_or_ leader/group_name,"any_rectangular marker","then_any_of_the_other_commands_in_upsmon.sqf","then_any_of_the_other_commands_in_upsmon.sqf"] execVM "scripts\upsmon.sqf"

example for more options: will patrol town_marker,will be placed at randomdown position inside marker when script is launched or mission start, will also respawn to same position as in editor and do same script command again.

nul=[this,"town_marker","move",""RANDOMDN","respawn"] execVM "scripts\upsmon.sqf";

Also try out demo mission, all examples are ready there so just copy and paste to your own mission, copy with ctrl + c and paste with ctrl + v.

And you can duplicate as many units you want, atleast as your computer can handle it.

Would it be difficult to implement a switch patrol-mechanism? Like cycle : a : t - change Area after Time? Eg. nul=[this,"Marker1","Move","cycle:","Marker2","2500"] execVM etc

I was also wondering if it is possible to create a systematic naming of leaders or groups, so that we can assign waypoints or specific tasks to new respawns.

Can anyone explain to me the CLONE feature, and if it might do this?

SCAJolly ill try and answer:

Edit, misunderstood question at first, you can just set a uniqe param and create a second script, to be launched at beginning of upsmon, i wouldnt touch the upsmon script itself, if you dont have extensive knowledge of scripting. edit done.

1: first thing i think of is just moving marker ("town"setMarkerPos getPos any_object/unit_name;)

with either a trigger on random/specified time, or in a script, with:

Place 2 empty markers named town1 and town2 in editor at your 2 towns of choise, also place a rectangular marker of your choosen size named patrol_marker on first town.

Then make a script and save as

reroute.sqf

switchpatrols = true;

while {switchpatrols} do
{
     sleep 500;
     "patrol_marker" setMarkerPos getMarkerPos "town2";
     sleep 500;
     "patrol_marker" setMarkerPos getMarkerPos "town1";
};

You can also change patrol marker size and rotation if one town is big and other small:

switchpatrols = true;

while {switchpatrols} do
{
     sleep 500;
     "patrol_marker" setMarkerPos getMarkerPos "town2";
     "patrol_marker" setMarkerSize [150, 300];  //  150 is x axis, 300 is y
     "patrol_marker" setMarkerDir 180;
     sleep 500;
     "patrol_marker" setMarkerPos getMarkerPos "town1";
     "patrol_marker" setMarkerSize [500, 850];
     "patrol_marker" setMarkerDir 90;  // degrees marker is rotated, same as in editor, 0 -360 degrees.
};

add several instances if you have more than 2 patrol areas, also names is just an example.

For the naming,

not sure what you mean, if its upsmon units, im pretty sure you cant give them waypoints or tasks since upsmon overides them, you can only change beheaviour, like safe, combat full speed etc. by using "Named" parameter, not totally sure how, read in upsmon.sqf for info.

For the clones:

nul=[this,"Alpha_marker","MIN:",3,"MAX:",6] execVM "scripts\upsmon.sqf"

Wich makes at least 3 clones of group and max 6 cloned groups, not sure if it works with vehicles, i think not. but infantery yes.

Edited by Demonized
corrected error spacing in {switchpatrols } to {switchpatrols}

Share this post


Link to post
Share on other sites

Good one, Demon! I didn't think about the obvious thing - moving the marker.

I have one question, though: For all of my life, so to speak, I've used ELLIPSE markers, not rectangular markers. Is there any difference?

Share this post


Link to post
Share on other sites
Good one, Demon! I didn't think about the obvious thing - moving the marker.

I have one question, though: For all of my life, so to speak, I've used ELLIPSE markers, not rectangular markers. Is there any difference?

I remember when

Kronzky first released ups.sqf wich upsmon is based on, in ups readme file there was instructions on NOT using elipse, only rectangle, so i stuck to that, tho i have tested with elipse in the past and it seems to make no difference, i think upsmon uses a rectangular area defined by height and with of marker no matter the shape..

so if you have a elipse 500 500 size, i think they may just patrol a square equal to that, Only guessing :)

But proof of that other markers can be used: done a few weeks ago with current upsmon:

Example, i forgot i could hide the markers in script for players, as for markers not to be seen in login screen prior to mission start.

I didnt want to give away the enemys zones, so i made every marker an empty icon with same size and direction as my patrol markers where in that exact spot, then had a script running 2 minutes out in mission to change them back to rectangle just incase.

Ran mission with groups with Randomdn param and debug on and all spawned in correct places.

All groups spawned and started their patrols before 2 min trigger changed markers.

With debug on in UPSMON_init.sqf you can see pos of group and that groups wp, and if they are flanking and where if in combat or reinforce.

Also there is some kind of tracking param you can eneable together with debug so you can actually see how and where they go, think it makes a marker for group every second or so, createing a marked path of previous movement

Share this post


Link to post
Share on other sites

Ok here is another problem i found. When i put the marker down. They will stand exactly where i put that marker when they are patrolling. I have to make the marker bigger for them to actually patrol. so for example this is what my markers look like:

http://s294.photobucket.com/albums/mm113/gobigred5/?action=view&current=arma2oa2010-11-2500-07-14-40.jpg

How do I make it them patrol without the marker being HUGE?

Edited by BittleRyan
Spelling Error

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  

×