Jump to content
Sign in to follow this  
Monsada

UPSMON - Urban Patrol Script Mon

Recommended Posts

Hello!

I'm making a siege mission, and I'm using 3 fortified positions for players. They will start on the first line, and if they are overruned they can retreat to a second line, and again to the third. The problem is that I need AI to move through the three different objectives, and spawn closer when player retreats.

I thought I could simply use a trigger to spawn a template when players were not present (A1) and the AI occupied the area (A2). So, when A1 AND A2, a trigger would spawn template 1 at a given marker with a new patrol area. This works perfectly, but all AI squads spawns at the center of the marker, making them an easy target in their path.

There is any way to spawn them randomly inside a determined area?

Thank you for your time!

Share this post


Link to post
Share on other sites

This will do what you need, just change the _dis to what distance you are looking for

_dis = 250;
_ang = random 360;
_dx = sin(_ang)*_dis;
_dy = cos(_ang)*_dis;
_positionToSpawnIn = [((getmarkerpos "yourmakername") select 0) + _dx, ((getmarkerpos "yourmarkername") select 1) + _dy, 0];
_upsgrp1 = [1,_positionToSpawnIn,1,["yourmarkername","spawned","showmarker","delete:",120]] execVM "SCRIPTS\UPSMON\MON_SPAWN.SQF";

Share this post


Link to post
Share on other sites

Thank you for your help! I tried this, but seems not work. Since I have no idea of scripting, I don't know what I did wrong. The units simply won't spawn.

I have a trigger that activates when A1 and A1 are true. On Ac: this exec "spawnr.sqs"

spawnr.sqs:

_dis = 250;
_ang = random 360;
_dx = sin(_ang)*_dis;
_dy = cos(_ang)*_dis;
_positionToSpawnIn = [((getmarkerpos "r1") select 0) + _dx, ((getmarkerpos "r1") select 1) + _dy, 0];
_upsgrp1 = [1,_positionToSpawnIn,1,["obj2","spawned","aware","delete:",900]] execVM "SCRIPTS\UPSMON\MON_SPAWN.SQF";

Share this post


Link to post
Share on other sites
Thank you for your help! I tried this, but seems not work. Since I have no idea of scripting, I don't know what I did wrong. The units simply won't spawn.

I have a trigger that activates when A1 and A1 are true. On Ac: this exec "spawnr.sqs"

spawnr.sqs:

_dis = 250;
_ang = random 360;
_dx = sin(_ang)*_dis;
_dy = cos(_ang)*_dis;
_positionToSpawnIn = [((getmarkerpos "r1") select 0) + _dx, ((getmarkerpos "r1") select 1) + _dy, 0];
_upsgrp1 = [1,_positionToSpawnIn,1,["obj2","spawned","aware","delete:",900]] execVM "SCRIPTS\UPSMON\MON_SPAWN.SQF";

this is an sqf file not sqs. should be -- execVM "filename.sqf";

Share this post


Link to post
Share on other sites

I tried:

triggername execVM "spawnr.sqf"

_handle = triggername execVM "spawnr.sqf"

nul = triggername execVM "spawnr.sqf"

[triggername] execVM "spawnr.sqf"

But it is still not working.

I don't know if this has something to do with the problem, but the upsmon template 1 is executed via trigger. For testing purposes, radio alpha activates:

nul=[unitname,"obj1","respawn","noveh","combat","delete:",900,"template:",1] execVM "scripts\upsmon.sqf";

on units already placed in the editor. (When the mission is fisnished, the activator will be a timeout). It seems to work fine, but maybe it prevents "spawnr.sqf" to find the template 1?

Share this post


Link to post
Share on other sites
I tried:

triggername execVM "spawnr.sqf"

_handle = triggername execVM "spawnr.sqf"

nul = triggername execVM "spawnr.sqf"

[triggername] execVM "spawnr.sqf"

But it is still not working.

I don't know if this has something to do with the problem, but the upsmon template 1 is executed via trigger. For testing purposes, radio alpha activates:

nul=[unitname,"obj1","respawn","noveh","combat","delete:",900,"template:",1] execVM "scripts\upsmon.sqf";

on units already placed in the editor. (When the mission is fisnished, the activator will be a timeout). It seems to work fine, but maybe it prevents "spawnr.sqf" to find the template 1?

this should help out.. https://dev-heaven.net/projects/upsmon/wiki/MON_spawn

Share this post


Link to post
Share on other sites

This is probably obvious, but how do you exit a group from upsmon? I just assumed grpNull would work, but it didn't.

Also, does anyone know if it's possible to increase or lower morale?

Share this post


Link to post
Share on other sites

I am using UPSMON (with ACE) and the UPSMON artillery script on a Podnos2B14 mortar. The problem I have is that the gunner keeps killing himself with the mortar. He is positioned on a hill and is firing on units at a lower elevation. When he gets the order to fire, he lines up in the direction of the enemy, and *kaboom!* Gets one shell off and dies in the process. When I watch him fire, it looks like the blast from the tube is coming out at a very low angle, almost like he's trying to fire the weapon directly at the enemy rather than in a high arc. I tried moving the mortar to flatter ground, which solved the problem of the gunner dying while firing. This further leads me to believe that he's not using a very high-angle firing solution and that the blast of the tube is reflecting off the terrain and killing him. But I'd really like to be able to have the mortar up on the hill again. Is there a way to make the artillery script calculate a higher angle at which to fire? Or will I have to resort to using the default artillery module?

Edit: I found a workaround for this if nobody comes up with a more elegant solution. In the scripts\UPSMON\common\MON_functions file, I commented out the following:

_arti fire (weapons _arti select 0);

It's not very nice, because the artillery piece doesn't "fire" anymore, but it solves the problem of the mortar gunner being killed by the blast from his own tube.

Edited by tharawdeal
Workaround found.

Share this post


Link to post
Share on other sites

This "May" be in this thread somewhere but ive keyword searched the thread itself but didn't spot any examples.

I notice that when I set a min/max spawn setting to a units init to make random amount of clones on mission start they dont carry over equipment. IE: if I set a unit removeallweapons and add a weapon, and completely remove night vision, that unit will be fine, but the say 2 other clones will default back to its original kit and ignore the init from source unit.

So I notice that we have: init:string = Custom init string for created clones

Does anyone have an example of such a string, where I can force night vision goggles from all the clone units as well (and force different kit to the clones)? Just unsure the syntax and couldn't see an example, unless you can point me in the right direction.

Share this post


Link to post
Share on other sites
This "May" be in this thread somewhere but ive keyword searched the thread itself but didn't spot any examples.

I notice that when I set a min/max spawn setting to a units init to make random amount of clones on mission start they dont carry over equipment. IE: if I set a unit removeallweapons and add a weapon, and completely remove night vision, that unit will be fine, but the say 2 other clones will default back to its original kit and ignore the init from source unit.

So I notice that we have: init:string = Custom init string for created clones

Does anyone have an example of such a string, where I can force night vision goggles from all the clone units as well (and force different kit to the clones)? Just unsure the syntax and couldn't see an example, unless you can point me in the right direction.

nul=[this,"area1","AWARE","respawn","random","noveh","delete:",180,"init:","{nul=[_x] execVM ""service_weps.sqf""} foreach units this","track"] execVM "scripts\upsmon.sqf";

Share this post


Link to post
Share on other sites

Hi Nimrod_Z,

thanks for that, gives the thing I need to "see" it.

I am using the following:

nul=[this,"area1","random","nofollow","noai","init:","{nul=[_x] execVM ""loadout.sqf""} foreach units this","min:",2,"max:",4] execVM "scripts\upsmon.sqf";

Using "loadout.sqf"

removeallweapons this;

this addWeapon "ACE_AK74M_SD";

this addWeapon "ACE_MugLite";

this addMagazine "ACE_30Rnd_545x39_S_AK";

this addMagazine "ACE_30Rnd_545x39_S_AK";

this addMagazine "ACE_30Rnd_545x39_S_AK";

this addMagazine "SmokeShell";

When I start the mission, all the units and clones still default to their own weapons and night vision goggles (its a night mission).

So I can only think my load-out is wrong? Can anyone just list a loadout for this that works ok, thanks in advance. I tested the code with no SQF file and I get the missing error, so I know the init line is ok.

I notice your example doesn't use the min/max clone elements from UPSMON, if you do use it, does it work for you with a loadout?

Edited by mrcash2009

Share this post


Link to post
Share on other sites

your code is fine. remember that the init that you put in upsmon call is run on respawn for units.. so it not only goes where you have it but also before you call upsmon..

{nul=[_x] execVM ""service_weps.sqf""} foreach units this; nul=[this,"area1","AWARE","respawn","random","noveh","delete:",180,"init:","{nul=[_x] execVM ""service_weps.sqf""} foreach units this","track"] execVM "scripts\upsmon.sqf";

make it look like this example and script runs with upsmon on start, the exec in upsmon line takes over after/if your units respawn. if you not using respawn just call whatever script before or after calling upsmon.

Share this post


Link to post
Share on other sites

Hi,

Thanks, I tried pasting that line only into the units init field, but I just get a blank box with ok button (the usual syntax error pop up) the box doesnt report what the issue is. So this wont get accepted into the init field. I also just tried:

{nul=[_x] execVM ""service_weps.sqf""} foreach units this;

This wont get accepted either.

I just wonder if thats the issue here with this line as its whats included for the "init:" of UPSMON line.

Also, to clarify im not "re"spawning any units. All im doing is adding 1 unit onto the map, placing the UPSMON line into its init using the "min/max" feature, so UPSMON at mission start simply clones this unit between 2 or 4 versions of itself (random per mission start). And all im trying to do it make sure the original and its clones have no night vision and change of weapon, which seems to be difficult to fathom at the moment.

Have you actually got this working in-game (using my init line I posted)? If so (or anyone) do you have a mission example or the clone feature of UPSMON and using loud-outs to make all clones change from default unit gear? Im head scratching still at the moment.

Basicly these features:

// min:n/max:n = Create a random number (between min and max) of 'clones'.

// init:string = Custom init string for created clones.

Edited by mrcash2009

Share this post


Link to post
Share on other sites

the line i posted is 1 that i actually have and use in a mission of mine and works fine. (when i type it right, sorry..)

{nul=[_x] execVM "service_weps.sqf"} foreach units this; 

thats just normal code outside of upsmon ofcourse.

but it basically gives them a random weapon from start and everytime they respawn. now , i dont think that will work using the min/max feature. i think i tried that before and only the 1 guy got the random weapon all others were default weapons. if your not to determined on using the min/max feature, you could place a normal group then adjust the probability of presence slider in each unit. thats actually what im doing to get a random changing effect. never know if the group will be 6 of them or just 2.

Share this post


Link to post
Share on other sites

Hi Nimrod,

Yes I think the min/max does have its issues with cloning gear, so your right, best way is alternate way and probability will do the job well enough.

Thanks for posting and responding, appreciate it, im no coding vet so its always baby steps.

I am being a tad OCD about random, Im wanting random spawn to marker location, but now Im trying to get markers to spawn random before units spawn to the markers place ... etc, etc, randomising the randomness or randomly randomising.

As regards random weapon, im trying to set something where the units that spawn (or uing the probability slider) I wanted to set something where the random kit means that theres a random chance a man in unit or team will have NV goggles or not, to make a night stealth mission more interesting, any help on that would be good via PM as this is a bit off topic here.

Thanks again anwyay,

Edited by mrcash2009

Share this post


Link to post
Share on other sites

Is anyone still maintaining UPSMON ?

I made a couple of fixes (e.g. reimplemented the possibility to disable UPSMON on a group, as well as temporarily suspend the UPSMON logic. Same applies to the loadout issue, thats an easy fix in the code.

Is there a github that is being maintained?

thx & cheers

Sarge

Share this post


Link to post
Share on other sites

@ mrcash

i tried a lil to mess with random markers, did'nt have much luck. the only thing i didnt really try was spawning markers in like you said, but putting a small delay before upsmon starts so the markers had time to set before upsmon runs. if that doesnt work, im all out of ideas : )

as far as your random weapon stuff for your units you can try what im using. hopefully it'll help. i picked it up from a post kylania made a while back.

private ["_muzzles","_weapon","_pw","_item","_unit","_weaponChance","_itemChance","_clearAll","_weaponRoll","_itemRoll","_weaponList","_itemList","_defaultItems"];

// Called via: nul = [this] execVM "randomWeapons.sqf";
// Default 60% chance for weapons and items and clears previous items replacing them with Map, Watch, Compass and Radio.  Adjust _defaultItems to change that.
// Optional fields: nul = [this, 100, 30, false] execVM "randomWeapons.sqf" would always give a weapon, 30% give items and let you keep items you had before.
// from kylania
// Code based on ideas from SuMatra and Xeno.

// Declare unit and options from input arguments.
_unit = _this select 0;
_weaponChance = if (count _this > 1) then {_this select 1} else {100};
_itemChance = if (count _this > 2) then {_this select 2} else {5}; // orginal 60.
_clearAll = if (count _this > 3) then {_this select 3} else {true};

// clear weapons - then do it again later. // found ai units sometimes have weapons/mags (mainly grenades) that are not in weapon pool.
removeAllWeapons _unit;

// Make the rolls to see if an item is given.
_weaponRoll = ceil (random 100);
_itemRoll = ceil (random 100);


// List of weapons matched up with their ammo.
_weaponList = [
   ["Sa58V_EP1", "30Rnd_762x39_SA58"],
   ["ACE_AKM", "30Rnd_762x39_AK47"],
   ["LeeEnfield", "10x_303"],
   ["ACE_SKS", "ACE_10Rnd_762x39_B_SKS"],
   ["ACE_RPK", "30Rnd_762x39_AK47"],
   ["ACE_TT", "ACE_8Rnd_762x25_B_Tokarev"],
   ["ACE_AK74M_FL_F", "ACE_30Rnd_545x39_AP_AK"],
   ["Sa61_EP1", "20Rnd_B_765x17_Ball"],
   ["ACE_G3A3", "ACE_20Rnd_762x51_B_G3"],
   ["ACE_AKMS_SD", "ACE_30Rnd_762x39_SD_AK47"],
   ["ACE_M3A1", "ACE_30Rnd_1143x23_B_M3"],
   ["ACE_M4_C", "30Rnd_556x45_Stanag"],
   ["ACE_oc14", "ACE_20Rnd_9x39_B_OC14"],
   ["FN_FAL", "ACE_20Rnd_762x51_B_FAL"],
   ["bizon", "64Rnd_9x19_Bizon"],
   ["M1014", "8Rnd_B_Beneli_Pellets"],
   ["M16A2", "ACE_30Rnd_556x45_SB_Stanag"],
   ["Saiga12K", "8Rnd_B_Saiga12_Pellets"],
   ["huntingrifle", "5x_22_LR_17_HMR"],
   ["PK", "100Rnd_762x54_PK"],
   ["Colt1911", "7Rnd_45ACP_1911"],
   ["UZI_EP1", "30Rnd_9x19_UZI"],
   ["SVD", "10Rnd_762x54_SVD"],
   ["VSS_vintorez", "20Rnd_9x39_SP5_VSS"]
];

// List of possible reward items.
_itemList = ["ACE_Earplugs","ACE_GlassesTactical","ItemWatch","ACE_GlassesBalaklavaGray","ACE_GlassesGasMask_RU","ItemCompass","ACE_GlassesBalaklava","ItemMap"];

// List of default items to always have.
//_defaultItems = ["ItemMap"];

// Clear weapons and backpack from the unit.
removeBackpack _unit;
removeAllWeapons _unit;

// By default we'll remove all items as well to clear previous reward items and give back _defaultItems.
if (_clearAll) then { 
   removeAllItems _unit;
//    {_unit addWeapon _x} forEach _defaultItems;
};

// If we're less than or equal to the weapon chance
if (_weaponRoll <= _weaponChance) then {
   // Pick a random weapon/mag pair from _weaponList.
   _weapon = _weaponList select floor(random(count _weaponList));


   // Add two of the selected mags
   for "_i" from 0 to 3 do {
       _unit addMagazine (_weapon select 1);
   };  

   // Add the selected weapon
   _unit addWeapon (_weapon select 0);

   // Ready weapon if it's got a GL muzzle.
   _pw = primaryWeapon _unit;
   if (_pw != "") then {
       _unit selectWeapon _pw;
       // Fix for weapons with grenade launcher
       _muzzles = getArray(configFile>>"cfgWeapons" >> _pw >> "muzzles");
       _unit selectWeapon (_muzzles select 0);
   } else {
       // If all they have is a pistol ready that.
       _unit selectWeapon (_weapon select 0);
   };
};

// If we're less than or equal to the item chance
if (_itemRoll <= _itemChance) then {
//     Pick a random item from the _itemList.
   _item = _itemList select floor(random(count _itemList));


   // Give the item
   _unit addWeapon _item;
};

Share this post


Link to post
Share on other sites

Thanks im digging in hard with scripts at the moment, I will look at that for some help. BTW I just bumped an old thread "SHK_pos" http://forums.bistudio.com/showthread.php?89376-SHK_pos so now im using one maker to spawn the item, then SHK grabs it to place it within an area randomly with a second marker zone area (a bit like how UPSMON works with a marked area) and job done.

The solution for all things random (well for me anyway) now I can remove overuse of markers all over my map :) Still have issues but that thread says all.

Share this post


Link to post
Share on other sites

Could someone quickly explain to me how to set up the artillery module? I can't get the AI to fire at me no matter how much I try.

IGNORE PLEASE, I WORKED IT OUT.

Love the Dr. Feelgood avatar Mrcash2009.

Edited by ckolonko

Share this post


Link to post
Share on other sites
Is there a github that is being maintained?

If there is no maintainer left, maybe start a project on devhaven ?

Share this post


Link to post
Share on other sites
Could someone quickly explain to me how to set up the artillery module? I can't get the AI to fire at me no matter how much I try.

IGNORE PLEASE, I WORKED IT OUT.

Love the Dr. Feelgood avatar Mrcash2009.

Can you maybe explain. I can't manage to get the mortar to fire. I have done everything the wiki told me.

Pls help. Thanks

Share this post


Link to post
Share on other sites
If there is no maintainer left, maybe start a project on devhaven ?

Tbh i don't have the time for it. By now i heavily modded UPSMON, fixed a ton of bugs in there (try to run the UPSMON files through squint - you will have a real laugh ...), and have it mostly doing what i want.

What i need to say is that the original UPS from Kronzky is a splendid piece of code ... It's the MON that is severely screwed up.

cheers

Sarge

Share this post


Link to post
Share on other sites

Looks like the original author hasn't been online since 2011 so probably not involved with Arma. There is already a devheaven project but perhaps a new one should be started as suggested and a few devs can contribute their changes.

Share this post


Link to post
Share on other sites

Original project by Monsada, was taken over by another guy at some point. I don't remember his name though... Rafalsky? Anyway, the script runs well enough for many of us. I don't see the point in bashing it now, when it was every one's hero not too long ago. If someone has an improved version of it, then by all means release it. I believe Monsada was/is a heck of scripter, no matter how many bugs the project may have. The changes it brings to AI behaviour are simply amazing. Anything that makes you wonder whether that was a bot or a human player, deserves credit, and UPSMON certainly does that.

Share this post


Link to post
Share on other sites
Tbh i don't have the time for it. By now i heavily modded UPSMON, fixed a ton of bugs in there (try to run the UPSMON files through squint - you will have a real laugh ...), and have it mostly doing what i want.

What i need to say is that the original UPS from Kronzky is a splendid piece of code ... It's the MON that is severely screwed up.

cheers

Sarge

if you think your fixes are good then you really should slap it on devheaven as UPSMON fork ...

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  

×