HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Need help making respawning creeps

08-15-2003, 04:47 PM#1
junbin
I am making a map where experience is very important. Therefore, I need to make creep camps that will respawn after they are killed. Say, one day after a creep camp has been cleared, I need the entire camp to respawn. Is there a constant I can change or a trigger I can add?
08-15-2003, 07:00 PM#2
MarSara
If you want the entire map to respawn at all at once, just create two arrays one of tyep Point (CreepPoint) and the other of type Unit-Type (CreepType). Also create a varaible of type integer (CreepIndex) Next on map init. just do:
Code:
set CreepIndex = 1
PickEveryUnitOwnedBy NeutralHostile AndDo
    set CreepPoint[CreepIndex] = PositonOf(PickedUnit)
    set CreepType[CreepIndex] = UnitTypeOf(PickedUnit)
    set CreepIndex = CreepIndex + 1
then whenever you need to respawn all the creeps, just do:
Code:
PickEveryUnitOwnedBy NeutralHostile AndDo
    Remove (PickedUnit)
For (IntegerA) = 1 to CreepIndex
    Create 1 CreepType[IntegerA] for NeutralHostile at CreepPoint[IntegerA]
if you need a specific creep to respawn so many seconds after it died just do:
(there is no need for the first two triggers if this is all you need)
Code:
Events:
    A unit owned by NeutralHostile Dies
Conditons:
    None
Actions:
    CustomScript Local integer udg_cType
    CustomScript Local point udg_cPoint
    Set cType = UnitTypeOf(DieingUnit)
    Set cPoint = PositionOf(DieingUnit)
    Wait X game-time seconds
    Create 1 cType for NeutralHostile at cPoint