• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Creep Respawns (nothing usefull found via search)

Status
Not open for further replies.
Level 1
Joined
Mar 7, 2006
Messages
3
Hi everyone,

first of all, yes i have used the search option and found several things and answers for creep respawning but nothing has been usefull.

what i need:

i want creep respawn in a fixed location but from a custom selfmade creep pool.

ex:

in location A i have creep x,y and z. xx seconds after the last of these creeps died i want 3 new random creeps in location A (NOT at the dying position via create unit at position of dying unit). these 3 new random creeps should be picked from a unit cage with unit x,y,z,w,v,u in it.
if i now visit location A again after xx seconds there are for example creep x,w and y. next time i do this there are creeps of type u,u and y or any other posible combination of units from the unit cage x,y,z,w,v,u.

all suggestion's i've found so far are about respawning the dying unit and not a random unit from a pre-designed unit cage or group.

hope someone has any idea.

thanks in advance :)
 
Level 2
Joined
Mar 5, 2006
Messages
16
I got it kinda working with these triggers

Initialize Unit Pool
Events
Map initialization
Conditions
Actions
Set UnitPoolUnits[0] = Chicken
Set UnitPoolUnits[1] = Frog
Set UnitPoolUnits[2] = Rabbit
Set UnitPoolUnits[3] = Raccoon
Set UnitPoolUnits[4] = Stag
Set UnitPoolUnits[5] = Pit Lord



spawn units
Events
Time - TimerRegion1 expires
Time - Elapsed game time is 5.00 seconds
Conditions
Actions
For each (Integer A) from 0 to 2, do (Actions)
Loop - Actions
Unit - Create 1 UnitPoolUnits[(Random integer number between 0 and 5)] for Neutral Hostile at (Random point in Spawn Region <gen>) facing Default building facing degrees
Set UnitsInSpawnArea1[(Integer A)] = (Last created unit)
Set UnitsLeftRegion1 = (UnitsLeftRegion1 + 1)



unit deaths
Events
Unit - A unit owned by Neutral Hostile Dies
Conditions
Actions
If ((Triggering unit) Equal to UnitsInSpawnArea1[0]) then do (Set UnitsLeftRegion1 = (UnitsLeftRegion1 - 1)) else do (Do nothing)
If ((Triggering unit) Equal to UnitsInSpawnArea1[1]) then do (Set UnitsLeftRegion1 = (UnitsLeftRegion1 - 1)) else do (Do nothing)
If ((Triggering unit) Equal to UnitsInSpawnArea1[2]) then do (Set UnitsLeftRegion1 = (UnitsLeftRegion1 - 1)) else do (Do nothing)
If (UnitsLeftRegion1 Equal to 0) then do (Countdown Timer - Start TimerRegion1 as a One-shot timer that will expire in 5.00 seconds) else do (Do nothing)

and the variables in this are

UnitsLeftRegion1 Integer
This is the number of units remaining that belongs to this spawn area


TimerRegion1 Timer
This is just the timer used to create a delay between when the last units has been killed and when all units are reborn

UnitsInSpawnArea1 Unit Array
This is just an array to hold the units that are created by the loop in spawn units

UnitPoolUnits Unit-Type Array
This is just an array of unit types which will be selected from at random. If you made it so as the position in the array increased, the strength of the spawn increased, you could change the loop in spawn units from 0 to x to something like from x to y to create spawns of varying difficulty

Basically this just initializes the unit types that are going to be chosen from randomly to be spawned at map initialization, then spawns 3 random units from unit pool (that can be the same). It then waits until a unit belonging to neutral passive is kills then it checks if it is from the spawn region. if it is it takes 1 away from the unitsleftregion1 variable, and also checks if that variable is 0. If it is, a timer is started. The spawn units trigger will be triggered when this timer expires, starting a cycle. I hope you can use this
 
Level 1
Joined
Mar 7, 2006
Messages
3
thanks alot, it works just fine :)
i only changed the timer thing a bit using a wait command instead and unitleftregion variable as an event if it hits zero.

thanks again :)
 
Status
Not open for further replies.
Top