OFPEC Forum

Editors Depot - Mission Editing and Scripting => OFP - Editing/Scripting General => Topic started by: TerranAce007 on 20 Jan 2003, 06:19:09

Title: How to make AI's continually respawn?
Post by: TerranAce007 on 20 Jan 2003, 06:19:09
Im making a mission where I have a bunch of enemy AI groups, and they all attack the player's group, and I need a constant flood of them.

I want the whole group to respawn when all its memebers are dead. I need them to respawn in a certain location, and would it be possible for them to follow their old waypoints again? I've tried all the respawning scripts, but I cant get any of them to work for this mission. I have to use a script because I will have respawning set to group for human players in MP.
Title: Re:How to make AI's continually respawn?
Post by: _hammy_ on 20 Jan 2003, 08:33:05
Code: [Select]
; made by HAMMY
;[number_of_guys_per_wave] exec "spawn.sqs"


;how many guys do you want in each wave
_cre = _this select 0

#restart
_n = 0

#create
_n = _n + 1
_n >= _cre:goto "stop"
~0.3
'SoldierWB' createUnit [getmarkerpos 'barracks',groupAlpha]
groupAlpha move getpos player
~0.1
groupAlpha setbehaviour "COMBAT"
groupAlpha setcombatmode "RED"
~0.1
goto "create"

#stop
;waits 30 seconds between sending the next wave of guys
;change this number to change delay between each wave
~30
goto "restart"

exit

well, i think this is what u said u wanted...

i think this should work, i would test it, but its 3:00 in the morning and im freakin tired.
Title: Re:How to make AI's continually respawn?
Post by: Ottie on 20 Jan 2003, 13:03:03
I dont think the script will work because you dont have a check on how many units are still alive in groupalpha and you cant add more then 12 units to a group

If you have a groupAlpha and you have given waypoints to groupAlpha the newly created troops will automatically follow the waypoints
Title: Re:How to make AI's continually respawn?
Post by: TerranAce007 on 20 Jan 2003, 16:02:26
I have lots of enemy groups in my mission. The first 6 are kinda like 4-8 men scout patrols, and Im not gonna have them respawn. The next 6 main groups of 12 start in the enemy base, and will respawn.

'SoldierWB' createUnit [getmarkerpos 'barracks',groupAlpha]

First of all is there a way to get the script to recreate the same unit as before? Wouldn't this script create a group of all SoldierWB's? I want them to respawn as what they were before.

'_unit' createUnit [getmarkerpos 'respawn', _group]