Home   Help Search Login Register  

Author Topic: Re-Spawning enemy units  (Read 1297 times)

0 Members and 1 Guest are viewing this topic.

Offline mcnorth

  • Members
  • *
Re-Spawning enemy units
« on: 10 Mar 2007, 20:57:11 »
It's been a long time since I've visited this forum. Since it was always the premiere source for editing help it's good to be back.

I'm working on populating the entire map with randomly patrolling enemy units. When the player squad gets within a certain range the units are created by script. When the player squad gets out of that range I want to delete the units.

My primary question is what would be the best way to keep track of the units that were deleted so that they can be re-spawned if the player squad comes within the range again? Let's say, for example, player engages a 10 man squad of enemy, kills 3 and then retreats. I want to leave the dead where they lay, delete the others, keep track of what kind of units they were (rifleman, grenadier, machinegunner, etc.) and re-spawn them if the player comes back within a distance that he might re-engage.

I have no problem sorting out who's dead, who's alive or what type of unit they are. I just don't know where to store that information for re-use. At this point I'm thinking of a constantly running script but wondering if there is a better way.

Second question - For each of the enemy squads I'm creating the leader on the map and defining his patrol area. The enemy forces that I spawn are assigned to, and deleted from, the various leaders. I did it this way so that the leader could continue the group's patrol and his underlings would be created at whatever location they would have been at had they not been deleted. So... there will be at least one unit for each group on the map at all times. My question is whether or not there is a more efficient way. Perhaps a way to delete the leader also in an effort to be kind to resources.

Any tips, ideas or insights are greatly appreciated.

Thanks

Offline satexas69

  • Members
  • *
Re: Re-Spawning enemy units
« Reply #1 on: 11 Mar 2007, 02:01:56 »
I don't know if you've seen this from Myke yet, but this is a very nice script that's "up your alley".

http://www.ofpec.com/forum/index.php?topic=28721.0

Welcome back.  :D

Offline mcnorth

  • Members
  • *
Re: Re-Spawning enemy units
« Reply #2 on: 11 Mar 2007, 04:29:10 »
Thank you satexas69. That looks really interesting. I'll dive into it and see how it works.