HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Creep Respawn problem

07-02-2006, 02:06 AM#1
Holy_Human
OK well im using this script made by one of the demo maps, but this is that error i get....

function Revive_Creep takes nothing returns nothing
local integer i
set i = GetUnitUserData(GetTriggerUnit())
call TriggerSleepAction( 30.00 ) // This is the time inteveral before the unit is respawned.
call CreateUnitAtLoc( Player(PLAYER_NEUTRAL_AGGRESSIVE), udg_Creep_Types[i], udg_Creep_Positions[i], bj_UNIT_FACING ) // This respawns the creep for Neutral Hostile at it's starting location.
call SetUnitUserData( GetLastCreatedUnit(), i )
endfunction

//===========================================================================
function InitTrig_Creep_Revive takes nothing returns nothing
set gg_trg_Creep_Revive = CreateTrigger( )
call TriggerRegisterPlayerUnitEventSimple( gg_trg_Creep_Revive, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH )
call TriggerAddAction( gg_trg_Creep_Revive, function Revive_Creep )
endfunction

then the error Line:432 Expected a Name....for this line...call CreateUnitAtLoc( Player(PLAYER_NEUTRAL_AGGRESSIVE), udg_Creep_Types[i], udg_Creep_Positions[i], bj_UNIT_FACING )


ive tried many things, but idk whats wrong plz help =]
07-02-2006, 02:29 AM#2
Naakaloh
You must have the integer array Creep_Types and location array Creep_Positions in the variables section of your map.
07-02-2006, 02:32 AM#3
Holy_Human
so for location array u mean point array? if so then thx fer the help =]
07-02-2006, 02:33 AM#4
Naakaloh
Yes, a point array.
07-02-2006, 02:34 AM#5
Holy_Human
Alright thanks a lot...rep added=]
07-02-2006, 02:45 AM#6
Holy_Human
grrr ok...ive added the vars and everything saved...no errors but now nothing revives...it just dies, and stays dead...do i need to specify regions hmm any further help would be appreciated
07-02-2006, 03:08 AM#7
shadow1500
The revival trigger you used there needs to be initilized, it is a very commonly used method for creep revival.
You need a variable called IntVar which is of type integer.
Trigger:
Collapse Events
Map Initilization
Collapse Actions
set IntVar = 0
Collapse Unit Group - pick every unit in (units owned by neutral hostile) and do actions
Collapse Loop - Actions
Set IntVar = (IntVar) + 1
Unit - Set Custom Value of (Picked Unit) to IntVar
Set Creep_Positions[IntVar] = Positon of (Picked Unit)
Set Creep_Types[IntVar] = Unit Type of (Picked Unit)
07-02-2006, 03:15 AM#8
Holy_Human
intvar = interger 0(default) or is it anoter predefined integer?
07-02-2006, 03:30 AM#9
Holy_Human
and one more thing..the last part of ur trigger...i cant seem to find = unit type of picked unit...is it a unit type array var??

Edit: Nvm i had the Creep_Types set to integer arrays not unit type array...solved thx=]
07-02-2006, 03:42 AM#10
Holy_Human
ok so almost there...all the creeps respawn where they origionally were, but they only respawn once after that, they dont come back ne more...what to do?
07-02-2006, 03:51 AM#11
Naakaloh
It might help if you showed all the changes you've made to the triggers you're using for respawn. Also, use the JASS and trigger tags and don't double/triple post.
07-02-2006, 01:30 PM#12
shadow1500
Whoever made that revival system is not very expirienced as CreateUnitAtLoc is a native and therefore doesnt change the bj_lastCreatedUnit variable.
Replace your revival code with this and it will work
Collapse JASS:
function Revive_Creep takes nothing returns nothing
    local integer i = GetUnitUserData(GetTriggerUnit())
    call TriggerSleepAction(30)
    call SetUnitUserData(CreateUnitAtLoc(Player(12), udg_Creep_Types[i], udg_Creep_Positions[i],GetRandomReal(0,359)),i)
endfunction
function InitTrig_Creep_Revive takes nothing returns nothing
    set gg_trg_Creep_Revive = CreateTrigger()
    call TriggerRegisterPlayerUnitEvent(gg_trg_Creep_Revive, Player(12),EVENT_PLAYER_UNIT_DEATH,null)
    call TriggerAddAction(gg_trg_Creep_Revive,function Revive_Creep)
endfunction
07-02-2006, 02:26 PM#13
Holy_Human
kk that worked shadow...thanks for everyones help/sry for double posting. wont happen again=P
07-02-2006, 02:30 PM#14
Captain Griffen
Do not use TriggerSleepAction(30)! PolledWait is far better, even if it does have a marginal leak. TriggerSleepAction(30) could equate to anything between 0 and 60 game time seconds.