Creep respawn

Status
Not open for further replies.

ufo

New Member
The well-known creep respawn trigger. Did it half a year ago.. BEFORE MY COMPUTER BROKE DOWN!

So, can anyone please tell me it on new? I remember it to be quite simple, thanks in advance.
 
Werbung:

Xeridanus

New Member
Code:
function CreepRespawn_CampLength takes nothing returns real
????return 500.0
endfunction
 
function CreepRespawn_WaitTime takes nothing returns real
????return 60.0
endfunction
 
function CreepRespawn takes nothing returns gamecache
????return InitGameCache("CreepRespawn.c")
endfunction
 
function CreepRespawn_H2I takes handle h returns integer
????return h
????return 0
endfunction
 
function CreepRespawn_GetCamp takes gamecache g, string k returns group
????return GetStoredInteger(g,k,"camp")
????return null
endfunction
 
 function RespawnCreepCamp takes nothing returns nothing
????local unit u=GetTriggerUnit()
????local string k=I2S(CreepRespawn_H2I(u))
????local integer typeid = GetUnitTypeId(u)
????local gamecache g=CreepRespawn()
????local group camp=CreepRespawn_GetCamp(g,k)
????local real x=GetStoredReal(g,k,"sx")
????local real y=GetStoredReal(g,k,"sy")
????local real f=GetStoredReal(g,k,"sf")
????local rect r=bj_mapInitialPlayableArea
????if not( HaveStoredReal(g,k,"sx") ) then
????else
????????call GroupRemoveUnit(camp,u)
????????loop
????????????exitwhen FirstOfGroup(camp)==null
????????????call TriggerSleepAction(1)
????????endloop
????????call PolledWait(CreepRespawn_WaitTime())
????????if IsUnitType(GetTriggerUnit(), UNIT_TYPE_HERO) then
????????????call SetUnitOwner( u, Player(1), false)
????????????call ReviveHero( u, x, y, true)
????????????call SetUnitOwner( u, Player(12), false)
????????????call GroupAddUnit(camp,u)
????????else
????????????call FlushStoredMission(g,k)
????????????set u=CreateUnit( Player(12), typeid, x,y,f )
????????????set k=I2S(CreepRespawn_H2I(u))
????????????call DestroyEffect( AddSpecialEffectTarget( "Abilities\\Spells\\Human\\MassTeleport\\MassTeleportCaster.mdl", u, "origin"))
????????????call StoreReal( g ,k,"sx", x )
????????????call StoreReal( g ,k,"sy", y )
????????????call StoreReal( g ,k,"sf", f )
????????????call StoreInteger(g,k,"camp",CreepRespawn_H2I(camp) )
????????????call GroupAddUnit(camp,u)
????????endif
????endif
????set camp=null
????set u=null
????set g=null
????set r=null
endfunction
 
function StartCreepCampRespawn_Filter takes nothing returns boolean
????return IsUnitOwnedByPlayer( GetFilterUnit(), Player(12) ) and IsUnitInGroup(GetFilterUnit(),bj_groupRemoveGroupDest)
endfunction
 
function StartCreepCampRespawn takes nothing returns trigger
????local trigger t = CreateTrigger()
????local gamecache g=CreepRespawn()
????local boolexpr B=Condition(function StartCreepCampRespawn_Filter)
????local group r=CreateGroup()
????local group aux=CreateGroup()
????local group aux2=CreateGroup()
????local group c
????local unit u
????local string k
????call GroupEnumUnitsOfPlayer(r,Player(12), null)
????set bj_groupRemoveGroupDest=r
????loop
????????set u=FirstOfGroup(r)
????????exitwhen u==null
????????call GroupRemoveUnit(r,u)
????????set c=CreateGroup()
????????set bj_groupAddGroupDest=c
????????call GroupClear(aux)
????????loop
????????????call GroupClear(aux2)
????????????call GroupEnumUnitsInRange(aux2,GetUnitX(u),GetUnitY(u),CreepRespawn_CampLength(),B)
????????????call GroupAddGroup(aux2,aux)
????????????call GroupRemoveUnit(aux,u)
????????????call GroupRemoveUnit(r,u)
????????????call GroupAddUnit(c,u)
????????????set k=I2S(CreepRespawn_H2I(u))
????????????call StoreReal( g ,k,"sx", GetUnitX(u) )
????????????call StoreReal( g ,k,"sy", GetUnitY(u) )
????????????call StoreReal( g ,k,"sf", GetUnitFacing(u) )
????????????call StoreInteger(g,k,"camp",CreepRespawn_H2I(c) )
????????????set u=FirstOfGroup(aux)
????????????exitwhen u==null
????????endloop
????endloop
????call DestroyGroup(r)
????call DestroyGroup(aux)
????call DestroyGroup(aux2)
????call DestroyBoolExpr(B)
????set B=null
????set r=null
????set aux=null
????set aux2=null
????call TriggerRegisterPlayerUnitEvent( t, Player(12), EVENT_PLAYER_UNIT_DEATH,null )
????call TriggerAddAction( t, function RespawnCreepCamp )
????return t
endfunction

Is that what you're looking for? this is from sear.ch and it's by Vexorian.
 

Xeridanus

New Member
I've next to no expirence in JASS so don't qutoe me on this but... I think cos it uses handle vars you can't do it in GUI. Secndly, it was done by Vexorian, as far as I know, so this would be the wrong place to ask. Unless of course someone here can interpret what he's done.
 

Undead_Lives

New Member
Couldn't you make a trigger in GUI that was something like this:
Event
No units in ___<gen>
Conditions
Actions
Wait ____
Spawn your units...
?
 

Xeridanus

New Member
Yeah, but you would have to have some way of detecting what units are there and storing them so you can use it on any map, like this one does.
 

Undead_Lives

New Member
I see your point. You want to make more of a universal trigger. Mine is more...one time basis. You could always use seperate triggers for seperate creep respawns, if you didn't have that many :p
 

-=GhosT=-

New Member
i've got WORKING very good respawn trigger in my map, but im bit lazy to write it down etc. just download my map and copy paste trigger with variables, for map go to download section and search for Star Wars Aspiration, when u open map ''creep respawn' or something like that
 

Undead_Lives

New Member
I might just do that...........and when I do I'll copy it here to make up for Ghost's laziness.

EDIT: Here's the trigger.

Creep Respawn
Events
Unit - A unit owned by Player 9 (Gray) Dies
Conditions
Actions
For each (Integer A) from 1 to creep_count, do (Actions)
Loop - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
creep_dead[(Integer A)] Equal to True
(Remaining time for creep_timer[(Integer A)]) Less than or equal to 0.00
Then - Actions
Unit - Create 1 creep_type[(Integer A)] for Player 9 (Gray) at creep_pos[(Integer A)] facing (Random angle) degrees
Unit - Set the custom value of (Last created unit) to (Integer A)
Set creep_dead[(Integer A)] = False
Else - Actions
Do nothing

If you need any explanation, ask Ghost. He can stop being lazy to help you a little bit.
 

Fladian

New Member
I don't delete posts just for the heck of it. Think twice before you post in this case then.

I would like to say: "Great to know how to make this trigger too", but I usually don't understand a thing when triggers are explained :p I used to be a terrainer after all...
 
Werbung:

-=GhosT=-

New Member
fladin, delet my post plz :)
Note by Fladian: Done. Mind that my name is Fladian.

btw. Undead, if im rite u forgot about trigger that start timer, cuz it respawns it after unit dies, or not?
 
Status
Not open for further replies.
Top