HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

I need Help with Creep Revival System

04-01-2010, 02:46 AM#1
FalkonZenX
Before 1.24 I used this code. Now the same error in the War3.

Zoom (requires log in)

Collapse JASS:
function Trig_Revive_Creeps_Actions takes nothing returns nothing
    local integer CUSTOM
    set CUSTOM = GetUnitUserData(GetDyingUnit())
    call TriggerSleepAction( 60.00 )
    call CreateNUnitsAtLoc( 1, udg_Creep_Type[CUSTOM], Player(PLAYER_NEUTRAL_AGGRESSIVE), udg_Creep_Position[CUSTOM], bj_UNIT_FACING )
    call SetUnitUserData( GetLastCreatedUnit(), CUSTOM )
    call TriggerRegisterUnitEvent( gg_trg_Display_Damage_System, GetLastCreatedUnit(), EVENT_UNIT_DAMAGED )
endfunction

//===========================================================================
function InitTrig_Revive_Creeps takes nothing returns nothing
    set gg_trg_Revive_Creeps = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Revive_Creeps, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddAction( gg_trg_Revive_Creeps, function Trig_Revive_Creeps_Actions )
endfunction
Attached Images
File type: jpgcreep.JPG (22.1 KB)
04-07-2010, 01:34 PM#2
MasterofSickness
Hi!
Quote:
Before 1.24 I used this code. Now the same error in the War3.
So, you mean:
Quote:
Before 1.24 I used this code.
Now I use the same code,
but with version 1.24 I get an error in WarcraftIII.
Right?

I tried to take care of you and rebuild your code in my "NewGen WE.exe" for WC 1.21b. (I have made a 2nd installation like it is said in the instructions for NewGen from Vexorian.)
It looks like this now (be careful, I have a german editor):
Trigger:
Init
Collapse Ereignisse
Map initialization
Zeit - Elapsed game time is 2.00 seconds
Bedingungen
Collapse Aktionen
Set loop = 0
Collapse Einheitengruppe - Pick every unit in (Units owned by Neutral feindlich) and do (Actions)
Collapse Schleifen - Aktionen
Set Creep_Type[loop] = (Unit-type of (Picked unit))
Set Creep_Position[loop] = (Position of (Picked unit))
Einheit - Set the custom value of (Picked unit) to loop
Set loop = (loop + 1)
By the way I set up 3 variables:
loop = integer
Creep_Type = UnitTypeArray
Creep_Position = LocationArray

Ok, then my jass code looks like this:
Collapse JASS:
function Trig_Revive_Creeps_Actions takes nothing returns nothing
    local integer CUSTOM
    set CUSTOM = GetUnitUserData(GetDyingUnit())
    call TriggerSleepAction( 6.00 )
    call CreateNUnitsAtLoc( 1, udg_Creep_Type[CUSTOM], Player(PLAYER_NEUTRAL_AGGRESSIVE), udg_Creep_Position[CUSTOM], bj_UNIT_FACING )
    call SetUnitUserData( GetLastCreatedUnit(), CUSTOM )
    //call TriggerRegisterUnitEvent( gg_trg_Display_Damage_System, GetLastCreatedUnit(), EVENT_UNIT_DAMAGED )
endfunction

//===========================================================================
function InitTrig_Revive_Creeps takes nothing returns nothing
    set gg_trg_Revive_Creeps = CreateTrigger(  )
    call TriggerRegisterPlayerUnitEventSimple( gg_trg_Revive_Creeps, Player(PLAYER_NEUTRAL_AGGRESSIVE), EVENT_PLAYER_UNIT_DEATH )
    call TriggerAddAction( gg_trg_Revive_Creeps, function Trig_Revive_Creeps_Actions )
endfunction

Note, that I commented out this, because I have no Display_Damage_System:
Collapse JASS:
//call TriggerRegisterUnitEvent( gg_trg_Display_Damage_System, GetLastCreatedUnit(), EVENT_UNIT_DAMAGED )

I ran into one problem.
I didn't name the trigger in the left vertical window of WE
like the trigger in your/my jass code.
After renaming the trigger to "Revive Creeps" I could save the map.
(Well, I was confused, because it's a long time since I worked in WE.)
Then I copied the map and pasted it in my WarcraftIII Version 1.24e and
there was no error, I just could play the map and the creeps that I killed respawned every 6 seconds later (set 60 to 6 for testing).

So, summary is, that your code works except for the 1 line I commented out where I don't know how your damage system looks. What error exactly do you have?