Jump to content
Sign in to follow this  
tpw

How to spwan units to patrol a randomly placed UPS zone

Recommended Posts

I'm a big fan of Kronzky's UPS system. It's super easy to define a patrol zone around a town, get some OPFOR patrolling it, and have a mission in a couple of minutes.

I'm currently working on a system where I move the patrol zone named "town" (already definted in the editor), to a random location on a given map using the following code in the init.sqf:

_nearest = nearestlocations [getpos player ,["namevillage","namecity","namelocal","NameCityCapital"],15000];
_nearestcity = _nearest select (floor random count _nearest);
_citypos = locationPosition _nearestcity;
"town" setmarkerpos _citypos;

This works very nicely. The problem is that I have no idea how to get OPFOR to actually patrol the moved zone.

If I don't move the zone using the above code, then any editor placed units with the following in their init will patrol just fine

nul=[this,"town","random"] execVM "ups.sqf"

If I have no units with the above init, then the zone will randomly move just fine.

However if I try to randomly move the zone and have editor placed units patrol, the zone actually disappears off the edge of the map somewhere!

So it appears that I need to spawn the OPFOR units with inits that will allow them to patrol. Problem is, I cannot get it to work!

I tried spawning a single OPFOR unit thusly:

_pos = getpos player;
_ob = "TK_INS_Soldier_AR_EP1" createvehicle _pos;
_ob SetVehicleVarName "xman";
xman setVehicleInit "nul=[this,""town"",""random""] execVM ""ups.sqf""";
processInitCommands;

If this works, the unit should spawn near the player then teleport off to patrol the zone. But it never moves from the player.

Does anyone have any ideas? Thanks in advance if you do!

Share this post


Link to post
Share on other sites

The original UPS Script is not made for moving the markers. I took a look into the script and saw that the marker position is "saved" in the script at the beginning and the movement of the soldiers is handled in a later loop of script. So the script makes a position request of the markers only once... :plain:

With the Dynamic AI Creator it would be easier to handle i guess..

:raisebrow:

Share this post


Link to post
Share on other sites

Thanks Buliwyf. I already use DAC and it's certainly more "zone" friendly. I like the "intelligence" of the AI in UPS though. Ah well, have to keep thinking about it...

Share this post


Link to post
Share on other sites

from the current version (UPS 2.1.0) readme and my previous experiences with kronzkys UPS:

• The marker position and size can be changed anytime during the mission.

Units will automatically update their patrol area.

Kronskys website

Edit:

One issue could be the need for setMarkerAlpha and use the showmarker parameter in UPS execute line.

That will fix the [0,0,0] error position, (far down left)

Edited by Demonized

Share this post


Link to post
Share on other sites

Thanks so much Demonized, that absolutely did the trick. Now I have instant random UPS missions on any map.

One issue could be the need for setMarkerAlpha and use the showmarker parameter in UPS execute line.

That will fix the [0,0,0] error position, (far down left)

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  

×