Jump to content
Sign in to follow this  
majorpain1588

AI Respawn w/ waypoints

Recommended Posts

Hey guys. I am new to Arma2 and to scripting.

I have seen how to respawn the player with the whole description.ext, but not sure how it can be applied to AI.

Is there a way the have an AI unit respawn after it dies and then have it follow waypoints after it has respawned? I would like to make a mission that spawns killed OPFOR back at their base and then when they respawn they travel back to the battle to create a kind of continuous battle.

Thanks:)

Share this post


Link to post
Share on other sites

Hi majorpain,

I haven't tested this in ARmA2 yet but I did write a script for ArmA that created respawning AI units that could be used in conjunction with Kronzky's fabulous UPS script to patrol dynamically created waypoints within areas specified by the mission editor which might work. See: http://www.norrin.org/downloads/misc_scripts/ai_ups_051108d.intro.rar

The instructions for its use are contained in the zip file. Also you'll want to replace the old ArmA UPS script used in this mission with Kronzky's newer ArmA2 one available here: http://kronzky.info/ups/index.htm

I seem to remember that I also have written another script that respawns AI and then gets them to move to waypoints (which sounds exactly what you after) but its on my PC at home so I'll try to find it and post it a bit later.

norrin

Share this post


Link to post
Share on other sites

That would be awsome if you could find that AI respawn script. Thanks for the kronzky link. That UPS script will come in handy.

Share this post


Link to post
Share on other sites

AI respawn and move to map position script

© JULY 2009 - norrin

Download

http://norrin.org/downloads/ArmA2/AI_respawn/AI_respawn_WP_test.utes.rar

To implement:

1. Copy the AI_respawn folder to your mission directory

2. Create and name the AI units that will respawn in the editor eg. e1

3. in the init line of the AI units put:

nul = [this, 3, 10, "east_spawn","East_WP.sqf"] execVM "AI_respawn\AI_respawn_init.sqf";

where:

3 - is the number of times you want the AI unit to respawn;

10 - is the delay in seconds after the unit dies that you want it to respawn in

"east_spawn" - is the marker postion wher you want the AI units to respawn

"East_WP.sqf" - is the name of the script that will give the AI unit is moveTo commands.

In the test mission I have put the moveTo script in the mission directory it is called

"East_WP.sqf"

It commands the units to moveTo a marker on the map then when the unit gets near that

marker it is commanded to moveTo the next marker. In the test mission the moveTo markers

for AI units are called:"East_WP1" and "East_WP2" and the code looks like this:


_unit = _this select 0;

// add 1st move to postion and wait until near it before adding second moveTo position
_unit doMove (getMarkerPos "East_WP1");
waitUntil {!alive _unit || _unit distance (getMarkerPos "East_WP1") < 10}; 

_unit doMove (getMarkerPos "East_WP2");
waitUntil {!alive _unit || _unit distance (getMarkerPos "East_WP2") < 10}; 


sleep 2;

// etc

Adapt this script to your own purposes. For instance you can add additional moveTo

markers or you could have several of these scripts in the mission so different units

moveTo different positions. An alternative method would be to create waypoints for the

units in this script.

Share this post


Link to post
Share on other sites

Perfect. Thanks a bunch. Also, thanks for including the directions on how it works. It makes understanding scripting much easier.

Share this post


Link to post
Share on other sites

Just found this script! Thank you norrin, this is just what I was looking for, works great! :thumbsup:

Edit, I was just going to ask about Vehicles, but it looks like you have yet another excellent tutorial here

Edited by starstreams

Share this post


Link to post
Share on other sites

does any one still have that rar file? or have any better ideas for the same concept in this thread "spawning ai, a certain amount of times, with the same way points before death" ive searched but this seemed like the best solution to me only the rar file norrin posted was 404.

Share this post


Link to post
Share on other sites

funny thing is i just found that on armaholic like 2 seconds ago, thanks

Share this post


Link to post
Share on other sites

The script seems not to work anymore...

I fixed it and posted the quickfix in this thread.

Maybe you edit your version or was there a usage 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  

×