| 07-23-2004, 10:02 PM | #1 |
You need next stuff in your Custom Script Section: 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
To start it you need: Custom Script : call StartCreepCampRespawn() At map initialization. After that, all the creep camps in your map will respawn automatically after CreepRespawn_WaitTime() seconds, I mean the creep camps, not the creeps as individuals |
| 07-24-2004, 12:09 AM | #2 |
Whoa. Nice convienant code in an easy to use package. Well done. I think I'm going to go beta test your map =P |
| 07-26-2004, 04:01 PM | #3 | |
Quote:
HEY!! Okay I went into my triggers section and found out the custom script and set it to the function call StartCreepCampRespawn() and, im pretty sure that you have to set a time on the respawn so i set it to look like (CreepRespawn_WaitTime(30)) , if that'is how it's done then ive got that but how do I import or make the function for it to call? Ive been looking all around for scripts or anything related inside the events and actions,(WE) but I havent found anything related to how to import a custom script like that. I think it has something to do with importing a txt or editing the actual game script for the map im working on, all I need to know is how to get there. If you can, I was wondering how do you make a random group of monsters that increases in strength or difficulty based on your heros(average of several hero's) level. I'm trying to make a map where the 'creeps' your hero's fights will keep getting stronger. ALSO!, I have had an error with my hero's leveling(MAJOR), whenever I set the gameplay constant MaxHeroLevel to something higher than 10, MY HERO WONT LEVEL! He does at first but only to like 2 or 4 or 5, nothing higher than 5, I was beta testing a sample map I created and whenever the hero got to lvl 4 or so he just stopped gaining exp, it was pissing me off that he couldnt get any higher, BUT in the level I had a few 'level up' books that increases the level right? Well, I can use those to get him to 250 or whatever I wanted but he wont level up on the monsters. Is it becuase of the monsters level? or just becuase the game is screwed up? Please give me two posts on this1, It matters alot to me. Thanks, Zaetir. :> |
| 07-26-2004, 07:06 PM | #4 |
In TFT, you cannot creep beyond level 5 .. unfortunately i dont know how to change it =/.. its probably in gameplay constants .. |
| 07-26-2004, 07:58 PM | #5 |
Gameplay constants - Creep exp tables the first 5 are 100s or whatnot then the rest are 0s. Change them to 100s. |
| 08-11-2004, 05:30 PM | #6 |
It's no entirely correct, standard is: 80[%(Level 1)], 70[%(Level 2)], 60[%(Level 3)], 50[%(Level 4)], 00[%(Level 5+)] Just change the first value to the % of normal exp you want to get from creeps, 100% if you want normal exp, and remove the other values! |
