Jump to content
Sign in to follow this  
norrin

Kronzky's UPS with respawning non-playable AI

Recommended Posts

Using Kronzky's UPS script with respawning non-playable AI

Let me start by saying that none of this would be possible without Kronzky's amazing urban patrol script.  All I've done is link the UPS script to some scripts of my own that allow respawning of non-playable AI groups either vehicle or foot based.  This was the idea of and done on the request of one of the forum members Deth Stryker.

These scripts combined give editors the option of creating AI patrol areas that will be repopulated once all the units of the patrolling group have been killed.   In practice this means that groups of foot soldiers will start patrol.  As units within the patrolling group are killed the remaining group members continue their patrol.  While this happens the dead group members respawn back at base and wait until the entire patrol is killed and respawns before heading off on patrol again.  For vehicles and crews once the vehicle is destroyed it respawns and then is fully recrewed before heading out on patrol.  

You can get a rar file that contains the scripts and an example mission from here: (filename: ai_ups_051108d.intro.rar updated 5th Nov 2008)

Instructions for use:

Note you will also need to check out the instructions for using Kronzky's code that are available here: http://www.kronzky.info/ups/

1. Copy the scripts folder Kronzky's UPS-f.sqf script and paste them into your mission directory.

2. Give each group a name using the group_name = group this code in the init line of the leaders of each group.  In the example mission the groups are called alpha (foot based) and beta (vehicle based).

3. Add game logic called server with this in the init line: <table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">nul=["init"] execVM "ups-f.sqf" in the editor

4. Place your units (groups) in the editor.  Also place a marker (spawnmarker) directly underneath each  foot group (called "west_A_SP1" in the example mission).  

5. Place your vehicles next to the group of units that will crew them, give them a name (Hmm1 in example) and place markers (spawnmarker) directly underneath each vehicle (called "veh1_SP1" in the example mission).

6. For the foot units you need to put this in the init line of each unit

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">s = [this, "spawnmarker", group size,  "UPS patrol marker"] execVM "scripts\Respawn_AI_foot.sqf";

You'll also need to include this in the group's leader init line to trigger the UPS

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">nul=[this, "UPS patrol marker"] execVM "ups-f.sqf";

in the example mission this has been placed in the init lines of the leader of group alpha:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">s = [this,"west_A_SP1",3, "marker_2"] execVM "scripts\Respawn_AI_foot.sqf"; nul=[this, "marker_2"] execVM "ups-f.sqf";

7. For the vehicle crew

For the leader(driver) add this in the init line:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">s = [this, "spawnmarker", UPS patrol marker] execVM "scripts\Respawn_AI_veh.sqf"; this moveInDriver vehicle_name; nul=[this, "UPS patrol marker"] execVM "ups-f.sqf";

or as in the example mission:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">s = [this,"veh1_SP1", "marker_1"] execVM "scripts\Respawn_AI_veh.sqf"; this moveInDriver Hmm1; nul=[this,"Marker_1"] execVM "ups-f.sqf";

For the gunner put this in the init line:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">s = [this, "spawnmarker", UPS patrol marker] execVM "scripts\Respawn_AI_veh.sqf"; this moveInGunner vehicle_name; nul=[this, "UPS patrol marker"] execVM "ups-f.sqf";

8. In the init line of each vehicle you'll need to put the following code;

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">v = [this,"spawnmarker","vehiclename"] execVM "scripts\vrs_AI_general.sqf";

or in the example mission

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">v = [this,"veh1_SP1","Hmm1"] execVM "scripts\vrs_AI_general.sqf";

The example I've given is for a land based vehicle crewed by two units but crew numbers can be increase and vehicle type changed by simple adjustment to some of the scripts.

Tested: Version 1.05 on a single PC running a dedicated server and two instances of ArmA. Single small group of foot units and single vehicle. Not sure how well larger groups and more vehicles will work at this point.  

Bugs:

* If the editor designated leader of the group foot soldiers is killed the next unit becomes leader eg B and the patrol continues.  However if the original leader respawns and then B is killed the AI units will make their way back to pick up the original leader again.

*in the built in weapon respawn script in the  respawn_AI_foot respawn_AI_veh if more than one player dies at the same instant there can be some mix ups concerning what the units should be carrying.

I've no doubt missed something but I hope this helps

EDIT: made a slight change to the script and uploaded an new RAR

Share this post


Link to post
Share on other sites

Hi Deth,

Here's the link for the two files you'll need for the AI crewed UH60 UPS you requested. I'm hoping I haven't made any silly syntax errors.

Just copy across the two files from the UH60_UPS folder into your scripts folder.

You'll then just need to set it up as described in my previous post. The only change is the crew of the chopper will need to execute the Respawn_AI_UH60.sqf file in there init lines rather than the Respawn_AI_veh.sqf.

This initial script will work for UH60s only, you may be able to adapt it for other choppers yourself but I'll write something more general if its OK later next week.

I must warn you this hasn't been tested and I'm not sure whether UPS works with choppers or what will happen when a waypoint is reached ie. will the chopper land before moving to the next waypoint.

Let me know how it turns out m8. smile_o.gif

Share this post


Link to post
Share on other sites

Woot! This will help lots, thanks bud!

I found these scripts you setup really add a new dimension to a mission, I'm using them for a guerrilla force and civilians for what is normally just a plain CTF mission.

Turns out they are doing exactly as planned, the guerrilla units are being a minor pain in the butt, and the civilians are getting in the way. I think it more closely represents modern age warfare than a simple CTF type mission.

Best thing about what you've made, it will provide a way for a small server (in bandwidth and speed) to "simulate" a large scale mission without a major performance impact. Or even a good server to host the mother of all battles.

Thanks again!

Share this post


Link to post
Share on other sites

The combination of scripts is just fantastic and really opens up a whole new set of options for mission makers.

However I have come across one issue. I’m creating a rescue mission but the captives once freed don’t join group and I get a whole host of errors cropping up. Is there anything I can do to amend this?

Share this post


Link to post
Share on other sites

Is one of the errors this?

'|#| <NULL -object>'

Error Invalid number in expression

If you can post exactly your error, I'm confident Norrin will address it as soon as it is convenient.

Share this post


Link to post
Share on other sites

Sorry guys I've been away for a few days. Talyn could you email your mission to norrins_nook @iprimus.com.au and I'll take a look at it. This is the easiest way for me to replicate the error and find a solution.

Share this post


Link to post
Share on other sites

this is a very nice script but i have trouble using it with a lot of other scripts sad_o.gif

the error that is always generated is:

_unit [#]disableAI "Target"

Error disableai type bool: expected object

ive tryed to make sure no public variables overlap but i still cant see the problem. It seems like using triggers might be causing it but im not really sure huh.gif

Share this post


Link to post
Share on other sites

I haven't tried this yet on version 1.08 but if you like send me your mission to norrins_nook@iprimus.com.au and I'll take a look at it. Also if your mission uses any addons could you send me the links to where I can find them.

There's a chance that we may need to substitute the disableAI command with the stop command.

Share this post


Link to post
Share on other sites

I have a question. I want them to respawn, but in random places in their patrol zone. What would be the easiest way to do this?

Share this post


Link to post
Share on other sites

I've never tried this but it should work- just make the spawn marker a rectangle or an ellipse and the unit should appear anywhere within that area of the marker. If you do this you may be better off using groups within only one unit in them because when ever a unit spawns its going to spawn some where completely differently within the area of the spawn marker.

Another way to do this and that would avoid this problem would be to create for example three respawn markers and then have the group created at one of these randomly each time they are killed but this is going to take a lot more work and thought to set up.

Share this post


Link to post
Share on other sites

Any chance we could incorporate limited amounts of respawns into this system?

Share this post


Link to post
Share on other sites

Using Kronzky's UPS script with respawning non-playable AI Update

As per nubbin77’s request just updated this so you can now specify how often you want the units to respawn.  I’ve also made some minor changes to several of the scripts.

You can get the new version from here

Updated implementation notes (see original thread post and then replace 6 onwards with the following)

6. For the foot units you need to put this in the init line of each unit

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">s = [this, "spawnmarker", group size,  "UPS patrol marker", no_of_unit_respawns] execVM "scripts\Respawn_AI_foot.sqf";

You'll also need to include this in the group's leader init line to trigger the UPS

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">nul=[this, "UPS patrol marker"] execVM "ups-f.sqf";

in the example mission this has been placed in the init lines of the leader of group alpha:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">s = [this,"west_A_SP1",3, "marker_2", 1] execVM "scripts\Respawn_AI_foot.sqf"; nul=[this, "marker_2"] execVM "ups-f.sqf";

7. For the vehicle crew

For the leader(driver) add this in the init line:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">s = [this, "spawnmarker", UPS patrol marker, no_of_unit_respawns] execVM "scripts\Respawn_AI_veh.sqf"; this moveInDriver vehicle_name; nul=[this, "UPS patrol marker"] execVM "ups-f.sqf";

or as in the example mission:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">s = [this,"veh1_SP1", "marker_1", 1] execVM "scripts\Respawn_AI_veh.sqf"; this moveInDriver Hmm1; nul=[this,"Marker_1"] execVM "ups-f.sqf";

For the gunner put this in the init line:

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">s = [this, "spawnmarker", UPS patrol marker, no_of_unit_respawns] execVM "scripts\Respawn_AI_veh.sqf"; this moveInGunner vehicle_name; nul=[this, "UPS patrol marker"] execVM "ups-f.sqf";

8. In the init line of each vehicle you'll need to put the following code;

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">v = [this,"spawnmarker","vehiclename", no_of_vehicle_respawns] execVM "scripts\vrs_AI_general.sqf";

or in the example mission

<table border="0" align="center" width="95%" cellpadding="0" cellspacing="0"><tr><td>Code Sample </td></tr><tr><td id="CODE">v = [this,"veh1_SP1","Hmm1",1] execVM "scripts\vrs_AI_general.sqf";

Tested: Version 1.08 Single small group of foot units and single vehicle. Not sure how well larger groups and more vehicles will work at this point.

Share this post


Link to post
Share on other sites

Wow, now that's service.

Thanks. LOL I spent most of last night developing work arounds for this issue.

Share this post


Link to post
Share on other sites
Is one of the errors this?

'|#| <NULL -object>'

Error Invalid number in expression

If you can post exactly your error, I'm confident Norrin will address it as soon as it is convenient.

I am getting this same error message, was a fix ever found for this?

Share this post


Link to post
Share on other sites

I'd completely forgotten about this one. These scripts were written some time ago and I'm not even sure they are compatible with the current version of ArmA. I did rewrite the AI respawn code a little while ago for something I was doing recently and there's a new version of UPS. So if you send me your mission and links to any addons to norrin@iinet.net.au I'll take a look at it and if its not too much work I'll update the script.

Share this post


Link to post
Share on other sites

Hi Norrin.

I guess you might be busy all the time, but I have just noticed that the armaholic.com web page for your script offers for download an older version of your script :

http://www.armaholic.com/page.php?id=1086

I think it could be worth informing them about this new version you are offering for download here.

Bye smile_o.gif

Share this post


Link to post
Share on other sites
And it seems that all your links in the first post are dead.

Thanks for the heads-up mate. Will do.

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  

×