• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[vJASS] problem compiling

Status
Not open for further replies.

ABM

ABM

Level 7
Joined
Jul 13, 2005
Messages
279
hi,
this library doesn't compile...
the syntax check doesn't help a lot... if anything come to your mind about what might be wrong...i'd like to be enlightned.

[Jass=]
library Animal

globals
private group g=CreateGroup()
private group g2=CreateGroup()
constant integer MANASTONE_ID = 'I036'
endglobals

private function countplayer takes nothing returns integer
local integer np=0
local integer i=0
loop
exitwhen i > 11
if udg_Defeat == false then
set np = np + 1
endif
set i = i + 1
endloop
return np
endfunction

private function removeUnit takes unit u returns nothing
call UnitRemoveItemFromSlot( u, 0 )
call UnitRemoveItemFromSlot( u, 1 )
call UnitRemoveItemFromSlot( u, 2 )
call UnitRemoveItemFromSlot( u, 3 )
call UnitRemoveItemFromSlot( u, 4 )
call UnitRemoveItemFromSlot( u, 5 )
call RemoveUnit(u)
endfunction

private function babies takes player owner, real x, real y, integer id, integer spawn returns nothing
local integer j
local integer k
local real x1
local real y1
local real n
set k = GetRandomInt(1, 10)
if k < 7 then
set k = 1
elseif k < spawn then
set k = 2
else
set k = 3
endif
set j = 1
loop
exitwhen j > k
set n = GetRandomReal(0, 360)
set x1 = x + 200. * Cos(n * bj_DEGTORAD)
set y1 = y + 200. * Sin(n * bj_DEGTORAD)
call CreateUnit( owner, id, x1, y1, bj_UNIT_FACING )
set j = j + 1
endloop
endfunction

private function sprout takes player owner, real x, real y, integer id returns nothing
local real x1
local real y1
local real n
local unit beast
set n = GetRandomReal(0, 360)
set x1 = x + 400. * Cos(n * bj_DEGTORAD)
set y1 = y + 400. * Sin(n * bj_DEGTORAD)
set beast = CreateUnit( owner, id, x1, y1, bj_UNIT_FACING )
call UnitRemoveAbility( beast,'Afir' )
call UnitRemoveAbility( beast,'Afio' )
call UnitRemoveAbility( beast,'Afih' )
call UnitRemoveAbility( beast,'Afin' )
call UnitRemoveAbility( beast,'Afiu' )
endfunction

public function Reproduction takes nothing returns nothing
local real x
local real y
local unit u
local unit beast
local integer i
local integer t
local integer p
local player owner
set p = countplayer()
call GroupEnumUnitsInRect(g, bj_mapInitialPlayableArea, null)
loop
set u = FirstOfGroup(g)
set i = GetUnitTypeId(u)
set x = GetUnitX(u)
set y = GetUnitY(u)
set owner = GetOwningPlayer(u)
exitwhen u == null
if IsUnitType(u, UNIT_TYPE_DEAD) == false then
// beast behaviour when full mana (evolve, spawn babies)
if GetUnitState(u, UNIT_STATE_MANA) == GetUnitState(u, UNIT_STATE_MAX_MANA) then
if i == CARNIVORBUSH_ID then
call removeUnit(u)
set udg_Eat_count = ( udg_Eat_count + 1 )
set udg_Bush[udg_Eat_count] = CreateDestructable( 'B003', x, y, 0., 1.60, 0 )
set udg_MonsterBush[udg_Eat_count] = true
call TriggerRegisterDeathEvent( gg_trg_DropItemDestructible__JASS, udg_Bush[udg_Eat_count] )
call SetUnitUserData( CreateUnit( Player(PLAYER_NEUTRAL_AGGRESSIVE), CARNIVORPLANT_ID, x, y, bj_UNIT_FACING ), udg_Eat_count )
set udg_Eat_Current = ( udg_Eat_Current + 1 )
set udg_Eat_DataStore[udg_Eat_Current] = udg_Eat_count
elseif i == MONSTER_2_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, MONSTER_3_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_AQUA )
elseif i == MONSTER_1_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, MONSTER_2_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_AQUA )
elseif i == BOAR_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, FATHOG_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_BROWN )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call babies(owner,x,y,PIGLET_ID,9)
endif
elseif i == PIGLET_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, BOAR_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_BROWN )
elseif i == RABBIT_ID then
call removeUnit(u)
call CreateUnit( owner, FATRABBIT_ID, x, y, bj_UNIT_FACING )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call babies(owner,x,y,BUNNY_ID,9)
endif
elseif i == BUNNY_ID then
call removeUnit(u)
call CreateUnit( owner, RABBIT_ID, x, y, bj_UNIT_FACING )
elseif i == ALLIGATOR_ID then
call removeUnit(u)
call CreateUnit( owner, GIANTALLIGATOR_ID, x, y, bj_UNIT_FACING )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call babies(owner,x,y,ALLIGATOR_EGG_ID,10)
endif
elseif i == ALLIGATORHATCHLING_ID then
call removeUnit(u)
call CreateUnit( owner, ALLIGATOR_ID, x, y, bj_UNIT_FACING )
elseif i == ALLIGATOR_EGG_ID then
call removeUnit(u)
call CreateUnit( owner, ALLIGATORHATCHLING_ID, x, y, bj_UNIT_FACING )
elseif i == RACOON_ID then
call removeUnit(u)
call CreateUnit( owner, FATRACOON_ID, x, y, bj_UNIT_FACING )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call babies(owner,x,y,RACOONCUB_ID,9)
endif
elseif i == RACOONCUB_ID then
call removeUnit(u)
call CreateUnit( owner, RACOON_ID, x, y, bj_UNIT_FACING )
elseif i == SABERCAT_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, OLDSABERCAT_ID, x, y, bj_UNIT_FACING ), ConvertPlayerColor(12) )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call babies(owner,x,y,SABERKITTEN_ID,9)
endif
elseif i == SABERKITTEN_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, SABERCAT_ID, x, y, bj_UNIT_FACING ), ConvertPlayerColor(12) )
elseif i == SNAKE_EGG_ID then
call removeUnit(u)
call babies(owner,x,y,JUNGLEASPIC_ID,10)
elseif i == JUNGLEASPIC_ID then
call removeUnit(u)
call CreateUnit( owner, JUNGLEVIPER_ID, x, y, bj_UNIT_FACING )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call CreateUnit( owner, SNAKE_EGG_ID, x, y, bj_UNIT_FACING )
call CreateItem('I00A', x, y)
endif
elseif i == SPIDER_EGGBAG_ID then
call removeUnit(u)
call babies(owner,x,y,BLACKWIDOW_ID,11)
elseif i == BLACKWIDOW_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, TARENTULA_ID, x, y, bj_UNIT_FACING ), ConvertPlayerColor(12) )
elseif i == TARENTULA_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, TARENTULAQUEEN_ID, x, y, bj_UNIT_FACING ), ConvertPlayerColor(12) )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call CreateUnit( owner, SPIDER_EGGBAG_ID, x, y, bj_UNIT_FACING )
call CreateUnit( owner, WEBLAIR_ID, x, y, bj_UNIT_FACING )
endif
elseif i == TORTOISE_EGG_ID then
call removeUnit(u)
call babies(owner,x,y,TORTOISE_ID,11)
elseif i == TORTOISE_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, GIANTTORTOISE_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_BROWN )
elseif i == GIANTTORTOISE_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, ANCIENTTORTOISE_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_BROWN )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call CreateUnit( owner, TORTOISE_EGG_ID, x, y, bj_UNIT_FACING )
endif
elseif i == RIVERCRAB_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, IMPERCRAB_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_ORANGE )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call babies(owner,x,y,HERMITCRAB_ID,9)
endif
elseif i == HERMITCRAB_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, RIVERCRAB_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_BROWN )
elseif i == FROG_ID then
call removeUnit(u)
call CreateUnit( owner, BULLFROG_ID, x, y, bj_UNIT_FACING )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call babies(owner,x,y,FROG_ID,10)
endif
elseif i == UGLYFROG_EGG_ID then
call removeUnit(u)
call CreateUnit( owner, FROLL_ID, x, y, bj_UNIT_FACING )
elseif i == BIRDNEST_A_ID or i == BIRDNEST_G_ID then
call removeUnit(u)
call babies(owner,x,y,JUNGLEBIRD_ID,11)
elseif i == JUNGLEBIRD_ID then
call removeUnit(u)
call CreateUnit( owner, BIGJUNGLEBIRD_ID, x, y, bj_UNIT_FACING )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
set t = GetRandomInt(1,udg_Tree_count)
if GetDestructableLife(udg_Tree[t]) > 0.5 then
set udg_NestNumber = udg_NestNumber + 1
set udg_NestTree[udg_NestNumber] = udg_Tree[t]
set x = GetDestructableX(udg_NestTree[udg_NestNumber])
set y = GetDestructableY(udg_NestTree[udg_NestNumber])
set udg_BirdNest[udg_NestNumber] = CreateUnit( owner, BIRDNEST_A_ID, x, y, bj_UNIT_FACING )
call TriggerRegisterDeathEvent( gg_trg_NestingBirds, udg_NestTree[udg_NestNumber] )
endif
endif
elseif i == VULTURENEST_A_ID or i == VULTURENEST_G_ID then
call removeUnit(u)
call babies(owner,x,y,VULTURE_ID,11)
elseif i == VULTURE_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, GRIFFONVULTURE_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_LIGHT_GRAY )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
set t = GetRandomInt(1,udg_Tree_count)
if GetDestructableLife(udg_Tree[t]) > 0.5 then
set udg_NestNumber = udg_NestNumber + 1
set udg_NestTree[udg_NestNumber] = udg_Tree[t]
set x = GetDestructableX(udg_NestTree[udg_NestNumber])
set y = GetDestructableY(udg_NestTree[udg_NestNumber])
set udg_BirdNest[udg_NestNumber] = CreateUnit( owner, VULTURENEST_A_ID, x, y, bj_UNIT_FACING )
call TriggerRegisterDeathEvent( gg_trg_NestingBirds, udg_NestTree[udg_NestNumber] )
endif
endif
elseif i == ANTELOPE_ID then
call removeUnit(u)
set beast = CreateUnit( owner, ANTELOPESTAG_ID, x, y, bj_UNIT_FACING )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) then
call UnitAddAbility( beast ,'A007' )
endif
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call babies(owner,x,y,ANTELOPEFAWN_ID,9)
endif
elseif i == ANTELOPEFAWN_ID then
call removeUnit(u)
set beast = CreateUnit( owner, ANTELOPE_ID, x, y, bj_UNIT_FACING )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) then
call UnitAddAbility( beast ,'A007' )
endif
elseif i == BEAR_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, OLDBEAR_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_BROWN )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call babies(owner,x,y,BEARCUB_ID,9)
endif
elseif i == BEARCUB_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, BEAR_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_BROWN )
elseif i == RAT_ID then
call removeUnit(u)
call SetUnitAbilityLevel( CreateUnit( owner, MANGYRAT_ID, x, y, bj_UNIT_FACING ),'A0E0', 2 )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call babies(owner,x,y,RAT_ID,9)
endif
elseif i == BERRYSAPPLING_ID then
call removeUnit(u)
call CreateUnit( owner, BERRYBUSH_ID, x, y, bj_UNIT_FACING )
call UnitRemoveAbility( beast,'Afir' )
call UnitRemoveAbility( beast,'Afio' )
call UnitRemoveAbility( beast,'Afih' )
call UnitRemoveAbility( beast,'Afin' )
call UnitRemoveAbility( beast,'Afiu' )
elseif i == BERRYBUSH_ID then
call SetUnitState(u, UNIT_STATE_MANA, 0.)
call UnitAddItemById( u, BERRY_ID )
if GetRandomInt(1, 100) == 100 then
call sprout(owner,x,y,BERRYBUSH_ID)
endif
elseif i == ARIA_ID then
call SetUnitState(u, UNIT_STATE_MANA, 0.)
call SetItemCharges( UnitAddItemById( u, ARIA_BLOSSOM_ID ), GetRandomInt(1, 3) )
if GetRandomInt(1, 100) == 100 then
call sprout(owner,x,y,ARIA_ID)
endif
elseif i == BARDANE_ID then
call SetUnitState(u, UNIT_STATE_MANA, 0.)
call SetItemCharges( UnitAddItemById( u, BARDANE_PETAL_ID ), GetRandomInt(1, 3) )
if GetRandomInt(1, 100) == 100 then
call sprout(owner,x,y,BARDANE_ID)
endif
elseif i == CORIAN_ID then
call SetUnitState(u, UNIT_STATE_MANA, 0.)
call SetItemCharges( UnitAddItemById( u, CORIAN_LEAVE_ID ), GetRandomInt(1, 3) )
if GetRandomInt(1, 100) == 100 then
call sprout(owner,x,y,CORIAN_ID)
endif
elseif i == DRAXIMOR_ID then
call SetUnitState(u, UNIT_STATE_MANA, 0.)
call SetItemCharges( UnitAddItemById( u, DRAXIMOR_BELL_ID ), GetRandomInt(1, 3) )
if GetRandomInt(1, 100) == 100 then
call sprout(owner,x,y,DRAXIMOR_ID)
endif
elseif i == BEEHIVE_ID then
call SetUnitState(u, UNIT_STATE_MANA, 0.)
call UnitAddItemById( u, HONEY_ID )
elseif i == DOG1_ID then
call removeUnit(u)
set udg_Pet[GetPlayerId(owner)+1] = CreateUnit( owner, DOG2_ID, x, y, bj_UNIT_FACING )
elseif i == DOG2_ID then
call removeUnit(u)
set udg_Pet[GetPlayerId(owner)+1] = CreateUnit( owner, DOG3_ID, x, y, bj_UNIT_FACING )
elseif i == DOG3_ID then
call removeUnit(u)
set udg_Pet[GetPlayerId(owner)+1] = CreateUnit( owner, DOG4_ID, x, y, bj_UNIT_FACING )
elseif i == DOG4_ID then
call removeUnit(u)
set udg_Pet[GetPlayerId(owner)+1] = CreateUnit( owner, DOG5_ID, x, y, bj_UNIT_FACING )
elseif i == DOG5_ID then
call removeUnit(u)
set udg_Pet[GetPlayerId(owner)+1] = CreateUnit( owner, DOG6_ID, x, y, bj_UNIT_FACING )
elseif i == HAWK1_ID then
call removeUnit(u)
set udg_Pet[GetPlayerId(owner)+1] = CreateUnit( owner, DOG2_ID, x, y, bj_UNIT_FACING )
call SetUnitColor( udg_Pet[GetPlayerId(owner)+1], PLAYER_COLOR_BROWN )
elseif i == HAWK2_ID then
call removeUnit(u)
set udg_Pet[GetPlayerId(owner)+1] = CreateUnit( owner, DOG3_ID, x, y, bj_UNIT_FACING )
call SetUnitColor( udg_Pet[GetPlayerId(owner)+1], PLAYER_COLOR_BROWN )
elseif i == HAWK3_ID then
call removeUnit(u)
set udg_Pet[GetPlayerId(owner)+1] = CreateUnit( owner, DOG4_ID, x, y, bj_UNIT_FACING )
call SetUnitColor( udg_Pet[GetPlayerId(owner)+1], PLAYER_COLOR_BROWN )
elseif i == FROLLHUTT_ID or i == FROLLVILLAGE_ID then
elseif i == FROLL_ID then
endif
// beast behaviour when 0 mana (evolve, die)
elseif GetUnitState(u, UNIT_STATE_MANA) == 0. then
if i == WARFROLL_ID then
call UnitAddAbility( u, 'S00Y' )
// some old beast instead of dying have 10% chance to evolve into a rare beast type
elseif GetRandomInt(1, 10) == 1 then
if i == ANTELOPESTAG_ID then
call removeUnit(u)
call CreateUnit( owner, ROYALSTAG_ID, x, y, bj_UNIT_FACING )
elseif i == GIANTALLIGATOR_ID then
call removeUnit(u)
call CreateUnit( owner, CROCODILE_ID, x, y, bj_UNIT_FACING )
elseif i == FATHOG_ID then
call removeUnit(u)
call CreateUnit( owner, RAZORBACK_ID, x, y, bj_UNIT_FACING )
elseif i == OLDSABERCAT_ID then
call removeUnit(u)
call CreateUnit( owner, SABERLION_ID, x, y, bj_UNIT_FACING )
elseif i == OLDBEAR_ID then
call removeUnit(u)
call CreateUnit( owner, CAVEBEAR_ID, x, y, bj_UNIT_FACING )
elseif i == BULLFROG_ID then
call removeUnit(u)
call CreateUnit( owner, POISONFROG_ID, x, y, bj_UNIT_FACING )
endif
// old beast die (everybeast here has failed the 10% chance)
elseif i == BULLFROG_ID or i == FATRABBIT_ID or i == TARENTULAQUEEN_ID or i == ANCIENTTORTOISE_ID or i == IMPERCRAB_ID or i == PIRANHA_ID or i == MANGYRAT_ID or i == FATRACOON_ID or i == JUNGLEVIPER_ID or i == BIGJUNGLEBIRD_ID or i == GRIFFONVULTURE_ID or i == FATUGLYFROG_ID or i == ANTELOPESTAG_ID or i == GIANTALLIGATOR_ID or i == FATHOG_ID or i == OLDSABERCAT_ID or i == OLDBEAR_ID then
call removeUnit(u)
endif
// beast ordinary behaviour when mana is between 0 and full
else
elseif i == CROCODILE_ID or i == GIANTALLIGATOR_ID or i == ALLIGATOR_ID or i == ALLIGATORHATCHLING_ID or i == ANCIENTTORTOISE_ID or i == GIANTTORTOISE_ID or i == TORTOISE_ID or i == JUNGLEASPIC_ID or i == ANACONDA_ID or i == JUNGLEVIPER_ID or i == COMODODRAGON_ID or i == GIANTTORTOISE_Z_ID_ID or i == TORTOISE_Z_ID_ID or i == SNAKE_Z_ID or i == ALLIGATOR_Z_ID then
if GetRandomInt(1, 4) == 1 then
call UnitRemoveAbility( u, 'SCae' )
elseif GetUnitAbilityLevel(u, 'SCae') == 0 then
call UnitAddAbility( u, 'SCae' )
endif
elseif i == BULLFROG_ID or i == FROG_ID or i == POISONFROG_ID or i == UGLYFROG_ID or i == FATUGLYFROG_ID then
if GetRandomInt(1, 2) == 1 then
call UnitRemoveAbility( u, 'SCae' )
elseif GetUnitAbilityLevel(u, 'SCae') == 0 then
call UnitAddAbility( u, 'SCae' )
endif
elseif i == SABERLION_ID or i == OLDSABERCAT_ID or i == SABERCAT_ID or i == SABERKITTEN_ID or SABERCAT_Z_ID then
if GetRandomInt(1, 3) < 3 then
call UnitRemoveAbility( u, 'A0DY' )
call UnitRemoveAbility( u, 'S00W' )
elseif GetUnitAbilityLevel(u, 'A0DY') == 0 then
call UnitAddAbility( u, 'A0DY' )
call UnitAddAbility( u, 'S00W' )
endif
endif
endif
endif
call GroupRemoveUnit(g, u)
endloop
endfunction
endlibrary
[/code]
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
I spotted:

JASS:
/ beast ordinary behaviour when mana is between 0 and full
                else
                    elseif i == CROCODILE_ID or i == GIANTALLIGATOR_ID or i == ALLIGATOR_ID or i == ALLIGATORHATCHLING_ID or i == ANCIENTTORTOISE_ID or i == GIANTTORTOISE_ID or i == TORTOISE_ID or i == JUNGLEASPIC_ID or i == ANACONDA_ID or i == JUNGLEVIPER_ID or i == COMODODRAGON_ID or i == GIANTTORTOISE_Z_ID_ID or i == TORTOISE_Z_ID_ID or i == SNAKE_Z_ID or i == ALLIGATOR_Z_ID then
                        if GetRandomInt(1, 4) == 1 then
                            call UnitRemoveAbility( u, 'SCae' )
                        elseif GetUnitAbilityLevel(u, 'SCae') == 0 then
...

->

JASS:
/ beast ordinary behaviour when mana is between 0 and full
                else
                    if i == CROCODILE_ID or i == GIANTALLIGATOR_ID or i == ALLIGATOR_ID or i == ALLIGATORHATCHLING_ID or i == ANCIENTTORTOISE_ID or i == GIANTTORTOISE_ID or i == TORTOISE_ID or i == JUNGLEASPIC_ID or i == ANACONDA_ID or i == JUNGLEVIPER_ID or i == COMODODRAGON_ID or i == GIANTTORTOISE_Z_ID_ID or i == TORTOISE_Z_ID_ID or i == SNAKE_Z_ID or i == ALLIGATOR_Z_ID then
                        if GetRandomInt(1, 4) == 1 then
                            call UnitRemoveAbility( u, 'SCae' )
                        elseif GetUnitAbilityLevel(u, 'SCae') == 0 then
...
 

ABM

ABM

Level 7
Joined
Jul 13, 2005
Messages
279
maker the last endif goes with the first unit is alive check so it should be fine.

nice spot edo494...

but still doesn't compile i am afraid it might come from constante, i hope not...
 

ABM

ABM

Level 7
Joined
Jul 13, 2005
Messages
279
well it is the name i given the function in the library that drop item from unit and then remove the unit.
the replace unit bj is an horror, i so basically do the replace by removing the unit and creating the new one at location of the old one.
is there something wrong with the custom function?
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
debug message in library that doesnt compile is useless tbh

I would try to compile it but all the rawcode values would pop error and Im not going to spend 30 minutes replacing them so if you provide me with those values I can try compile it and find what ... up
 

ABM

ABM

Level 7
Joined
Jul 13, 2005
Messages
279
ok i added all constant to the library

[Jass=]
library Animal

globals
private group g=CreateGroup()
private group g2=CreateGroup()
constant integer MANASTONE_ID = 'I036'
constant integer ALLIGATOR_EGG_ID = 'h01Q'
constant integer BIRDNEST_G_ID = 'h032'
constant integer BIRDNEST_A_ID = 'h02U'
constant integer VULTURENEST_G_ID = 'h033'
constant integer VULTURENEST_A_ID = 'h02V'
constant integer TORTOISE_EGG_ID = 'h02I'
constant integer SNAKE_EGG_ID = 'h019'
constant integer UGLYFROG_EGG_ID = 'h02X'
constant integer SPIDER_EGGBAG_ID = 'h01C'
constant integer WEBLAIR_ID = 'h018'
// Pest
constant integer BLACKPIRANHA_ID = 'n01Y'
constant integer PIRANHA_ID = 'n018'
constant integer MOSQUITOES_ID = 'h02F'
constant integer CARNIVORPLANT_ID = 'hMEP'
constant integer RAT_ID = 'h02H'
constant integer MANGYRAT_ID = 'h01O'
constant integer ANACONDA_ID = 'n00J'
constant integer JUNGLEASPIC_ID = 'n00D'
constant integer JUNGLEVIPER_ID = 'n00F'
constant integer BLACKWIDOW_ID = 'n004'
constant integer TARENTULA_ID = 'n01A'
constant integer TARENTULAQUEEN_ID = 'n02P'
constant integer MONSTER_1_ID = 'n00U'
constant integer MONSTER_2_ID = 'n00X'
constant integer MONSTER_3_ID = 'n015'
// rock
constant integer ROCK1_ID = 'h028'
constant integer ROCK2_ID = 'h029'
constant integer ROCK3_ID = 'h02A'
constant integer ROCK4_ID = 'h02B'
constant integer ROCK5_ID = 'h02C'
constant integer ROCK6_ID = 'h02D'
constant integer ROCK7_ID = 'h00W'
constant integer ROCK8_ID = 'h01J'
constant integer ROCK9_ID = 'h01N'
constant integer ROCK10_ID = 'h01W'
constant integer ROCK11_ID = 'h025'
constant integer ROCK12_ID = 'h026'
// building
constant integer TENTB_ID = 'h016'
constant integer TENTS_ID = 'h00K'
constant integer TENTP_ID = 'h015'
constant integer TENTHB_ID = 'h00Z'
constant integer TENTHS_ID = 'h00G'
constant integer TENTHP_ID = 'h00Y'
constant integer CAULDRON_A_ID = 'h00I'
constant integer CAULDRON_C_ID = 'h02J'
constant integer FORGE_A_ID = 'h00H'
constant integer FORGE_S_ID = 'h02Y'
constant integer TANNER_A_ID = 'h021'
constant integer TANNER_B_ID = 'h022'
constant integer WORKSHOP_A_ID = 'h00O'
constant integer WORKSHOP_B_ID = 'h02G'
constant integer VOODOO_A_ID = 'h006'
constant integer VOODOO_B_ID = 'h024'
constant integer VOODOO_C_ID = 'h00C'
constant integer TOTEM_ID = 'h004'
constant integer HUTT_ID = 'h005'
constant integer MERCHANT_A_ID = 'h013'
constant integer MERCHANT_B_ID = 'h01Z'
constant integer MERCHANT_C_ID = 'h02M'
constant integer ARMORY_A_ID = 'h008'
constant integer ARMORY_B_ID = 'h023'
constant integer TOWER_A_ID = 'h01I'
constant integer TOWER_B_ID = 'h01K'
constant integer TOWER_C_ID = 'h01M'
constant integer TOWER_D_ID = 'h01L'
// heroes
constant integer WARRIOR_ID = 'H003'
constant integer HUNTER_ID = 'H001'
constant integer SHAMAN_ID = 'H002'
constant integer INVENTOR_ID = 'H000'
// hunter pets
constant integer DOG1_ID = 'n00Y'
constant integer DOG2_ID = 'n01R'
constant integer DOG3_ID = 'n01Q'
constant integer DOG4_ID = 'n01P'
constant integer DOG5_ID = 'n01S'
constant integer DOG6_ID = 'n00V'
constant integer HAWK1_ID = 'n01H'
constant integer HAWK2_ID = 'n01U'
constant integer HAWK3_ID = 'n01T'
constant integer HAWK4_ID = 'n01I'
// birds and Froll
constant integer JUNGLEBIRD_ID = 'n02G'
constant integer BIGJUNGLEBIRD_ID = 'n00O'
constant integer VULTURE_ID = 'n00E'
constant integer GRIFFONVULTURE_ID = 'n00H'
constant integer FROLL_ID = 'u001'
constant integer WARFROLL_ID = 'u002'
constant integer FROLLHUTT_ID = 'nmg1'
constant integer FROLLVILLAGE_ID = 'nfr2'
constant integer UGLYFROG_ID = 'n01B'
constant integer FATUGLYFROG_ID = 'n01D'
constant integer HARPOON_ID = 'I0AG'
// Boss and zombies
constant integer BIGBADWOLF_ID = 'n01E'
constant integer GIANTVULTURE_ID = 'n01L'
constant integer GRIZZLI_ID = 'n01C'
constant integer COMODODRAGON_ID = 'n010'
constant integer ANTELOPE_Z_ID = 'n01X'
constant integer RIVERCRAB_Z_ID = 'n021'
constant integer SABERCAT_Z_ID = 'n02S'
constant integer ALLIGATOR_Z_ID = 'n01V'
constant integer TARENTULA_Z_ID = 'n024'
constant integer SNAKE_Z_ID = 'n020'
constant integer BLACKWIDOW_Z_ID = 'n02T'
constant integer VULTURE_Z_ID = 'n029'
constant integer RACOON_Z_ID = 'n023'
constant integer BOAR_Z_ID = 'n02I'
constant integer TORTOISE_Z_ID = 'n026'
constant integer GIANTTORTOISE_Z_ID = 'n01Z'
constant integer RABBIT_Z_ID = 'n022'
constant integer BEAR_Z_ID = 'n01W'
constant integer STAG_Z_ID = 'n00I'
constant integer TROLL_Z_ID = 'u000'
// animals water
constant integer HERMITCRAB_ID = 'n001'
constant integer RIVERCRAB_ID = 'n016'
constant integer IMPERCRAB_ID = 'n02N'
constant integer ALLIGATORHATCHLING_ID = 'n02C'
constant integer ALLIGATOR_ID = 'n009'
constant integer GIANTALLIGATOR_ID = 'n02K'
constant integer CROCODILE_ID = 'ntrg'
constant integer FROG_ID = 'n007'
constant integer BULLFROG_ID = 'n017'
constant integer POISONFROG_ID = 'nskg'
constant integer TORTOISE_ID = 'n00C'
constant integer GIANTTORTOISE_ID = 'n014'
constant integer ANCIENTTORTOISE_ID = 'n02M'
// animals ground
constant integer PIGLET_ID = 'n02A'
constant integer BOAR_ID = 'n002'
constant integer FATHOG_ID = 'n02R'
constant integer RAZORBACK_ID = 'nwen'
constant integer ANTELOPEFAWN_ID = 'n01K'
constant integer ANTELOPE_ID = 'n01J'
constant integer ANTELOPESTAG_ID = 'n01M'
constant integer ROYALSTAG_ID = 'njg1'
constant integer RACOONCUB_ID = 'n02E'
constant integer RACOON_ID = 'n006'
constant integer FATRACOON_ID = 'n02O'
constant integer BUNNY_ID = 'n02D'
constant integer RABBIT_ID = 'n005'
constant integer FATRABBIT_ID = 'n02J'
constant integer SABERKITTEN_ID = 'n02F'
constant integer SABERCAT_ID = 'n003'
constant integer OLDSABERCAT_ID = 'n02Q'
constant integer SABERLION_ID = 'nwwg'
constant integer BEARCUB_ID = 'n02B'
constant integer BEAR_ID = 'n008'
constant integer OLDBEAR_ID = 'n02L'
constant integer CAVEBEAR_ID = 'nwlg'
// plants and bees
constant integer BEEHIVE_ID = 'h036'
constant integer BEEQUEEN_ID = 'h035'
constant integer ARIA_ID = 'h00E'
constant integer BARDANE_ID = 'h00S'
constant integer CORIAN_ID = 'h00T'
constant integer DRAXIMOR_ID = 'h00U'
constant integer BERRYBUSH_ID = 'h00M'
constant integer BERRYSAPPLING_ID = 'h02S'
constant integer CARNIVORBUSH_ID = 'h02O'
endglobals

private function countplayer takes nothing returns integer
local integer np=0
local integer i=0
loop
exitwhen i > 11
if udg_Defeat == false then
set np = np + 1
endif
set i = i + 1
endloop
return np
endfunction

private function removeUnit takes unit u returns nothing
call UnitRemoveItemFromSlot( u, 0 )
call UnitRemoveItemFromSlot( u, 1 )
call UnitRemoveItemFromSlot( u, 2 )
call UnitRemoveItemFromSlot( u, 3 )
call UnitRemoveItemFromSlot( u, 4 )
call UnitRemoveItemFromSlot( u, 5 )
call RemoveUnit(u)
endfunction

private function babies takes player owner, real x, real y, integer id, integer spawn returns nothing
local integer j
local integer k
local real x1
local real y1
local real n
set k = GetRandomInt(1, 10)
if k < 7 then
set k = 1
elseif k < spawn then
set k = 2
else
set k = 3
endif
set j = 1
loop
exitwhen j > k
set n = GetRandomReal(0, 360)
set x1 = x + 200. * Cos(n * bj_DEGTORAD)
set y1 = y + 200. * Sin(n * bj_DEGTORAD)
call CreateUnit( owner, id, x1, y1, bj_UNIT_FACING )
set j = j + 1
endloop
endfunction

private function sprout takes player owner, real x, real y, integer id returns nothing
local real x1
local real y1
local real n
local unit beast
set n = GetRandomReal(0, 360)
set x1 = x + 400. * Cos(n * bj_DEGTORAD)
set y1 = y + 400. * Sin(n * bj_DEGTORAD)
set beast = CreateUnit( owner, id, x1, y1, bj_UNIT_FACING )
call UnitRemoveAbility( beast,'Afir' )
call UnitRemoveAbility( beast,'Afio' )
call UnitRemoveAbility( beast,'Afih' )
call UnitRemoveAbility( beast,'Afin' )
call UnitRemoveAbility( beast,'Afiu' )
endfunction

public function Reproduction takes nothing returns nothing
local real x
local real y
local unit u
local unit beast
local integer i
local integer t
local integer p
local player owner
set p = countplayer()
call GroupEnumUnitsInRect(g, bj_mapInitialPlayableArea, null)
loop
set u = FirstOfGroup(g)
set i = GetUnitTypeId(u)
set x = GetUnitX(u)
set y = GetUnitY(u)
set owner = GetOwningPlayer(u)
exitwhen u == null
if IsUnitType(u, UNIT_TYPE_DEAD) == false then
// beast behaviour when full mana (evolve, spawn babies)
if GetUnitState(u, UNIT_STATE_MANA) == GetUnitState(u, UNIT_STATE_MAX_MANA) then
if i == CARNIVORBUSH_ID then
call removeUnit(u)
set udg_Eat_count = ( udg_Eat_count + 1 )
set udg_Bush[udg_Eat_count] = CreateDestructable( 'B003', x, y, 0., 1.60, 0 )
set udg_MonsterBush[udg_Eat_count] = true
call TriggerRegisterDeathEvent( gg_trg_DropItemDestructible__JASS, udg_Bush[udg_Eat_count] )
call SetUnitUserData( CreateUnit( Player(PLAYER_NEUTRAL_AGGRESSIVE), CARNIVORPLANT_ID, x, y, bj_UNIT_FACING ), udg_Eat_count )
set udg_Eat_Current = ( udg_Eat_Current + 1 )
set udg_Eat_DataStore[udg_Eat_Current] = udg_Eat_count
elseif i == MONSTER_2_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, MONSTER_3_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_AQUA )
elseif i == MONSTER_1_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, MONSTER_2_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_AQUA )
elseif i == BOAR_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, FATHOG_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_BROWN )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call babies(owner,x,y,PIGLET_ID,9)
endif
elseif i == PIGLET_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, BOAR_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_BROWN )
elseif i == RABBIT_ID then
call removeUnit(u)
call CreateUnit( owner, FATRABBIT_ID, x, y, bj_UNIT_FACING )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call babies(owner,x,y,BUNNY_ID,9)
endif
elseif i == BUNNY_ID then
call removeUnit(u)
call CreateUnit( owner, RABBIT_ID, x, y, bj_UNIT_FACING )
elseif i == ALLIGATOR_ID then
call removeUnit(u)
call CreateUnit( owner, GIANTALLIGATOR_ID, x, y, bj_UNIT_FACING )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call babies(owner,x,y,ALLIGATOR_EGG_ID,10)
endif
elseif i == ALLIGATORHATCHLING_ID then
call removeUnit(u)
call CreateUnit( owner, ALLIGATOR_ID, x, y, bj_UNIT_FACING )
elseif i == ALLIGATOR_EGG_ID then
call removeUnit(u)
call CreateUnit( owner, ALLIGATORHATCHLING_ID, x, y, bj_UNIT_FACING )
elseif i == RACOON_ID then
call removeUnit(u)
call CreateUnit( owner, FATRACOON_ID, x, y, bj_UNIT_FACING )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call babies(owner,x,y,RACOONCUB_ID,9)
endif
elseif i == RACOONCUB_ID then
call removeUnit(u)
call CreateUnit( owner, RACOON_ID, x, y, bj_UNIT_FACING )
elseif i == SABERCAT_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, OLDSABERCAT_ID, x, y, bj_UNIT_FACING ), ConvertPlayerColor(12) )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call babies(owner,x,y,SABERKITTEN_ID,9)
endif
elseif i == SABERKITTEN_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, SABERCAT_ID, x, y, bj_UNIT_FACING ), ConvertPlayerColor(12) )
elseif i == SNAKE_EGG_ID then
call removeUnit(u)
call babies(owner,x,y,JUNGLEASPIC_ID,10)
elseif i == JUNGLEASPIC_ID then
call removeUnit(u)
call CreateUnit( owner, JUNGLEVIPER_ID, x, y, bj_UNIT_FACING )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call CreateUnit( owner, SNAKE_EGG_ID, x, y, bj_UNIT_FACING )
call CreateItem('I00A', x, y)
endif
elseif i == SPIDER_EGGBAG_ID then
call removeUnit(u)
call babies(owner,x,y,BLACKWIDOW_ID,11)
elseif i == BLACKWIDOW_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, TARENTULA_ID, x, y, bj_UNIT_FACING ), ConvertPlayerColor(12) )
elseif i == TARENTULA_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, TARENTULAQUEEN_ID, x, y, bj_UNIT_FACING ), ConvertPlayerColor(12) )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call CreateUnit( owner, SPIDER_EGGBAG_ID, x, y, bj_UNIT_FACING )
call CreateUnit( owner, WEBLAIR_ID, x, y, bj_UNIT_FACING )
endif
elseif i == TORTOISE_EGG_ID then
call removeUnit(u)
call babies(owner,x,y,TORTOISE_ID,11)
elseif i == TORTOISE_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, GIANTTORTOISE_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_BROWN )
elseif i == GIANTTORTOISE_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, ANCIENTTORTOISE_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_BROWN )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call CreateUnit( owner, TORTOISE_EGG_ID, x, y, bj_UNIT_FACING )
endif
elseif i == RIVERCRAB_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, IMPERCRAB_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_ORANGE )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call babies(owner,x,y,HERMITCRAB_ID,9)
endif
elseif i == HERMITCRAB_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, RIVERCRAB_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_BROWN )
elseif i == FROG_ID then
call removeUnit(u)
call CreateUnit( owner, BULLFROG_ID, x, y, bj_UNIT_FACING )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call babies(owner,x,y,FROG_ID,10)
endif
elseif i == UGLYFROG_EGG_ID then
call removeUnit(u)
call CreateUnit( owner, FROLL_ID, x, y, bj_UNIT_FACING )
elseif i == BIRDNEST_A_ID or i == BIRDNEST_G_ID then
call removeUnit(u)
call babies(owner,x,y,JUNGLEBIRD_ID,11)
elseif i == JUNGLEBIRD_ID then
call removeUnit(u)
call CreateUnit( owner, BIGJUNGLEBIRD_ID, x, y, bj_UNIT_FACING )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
set t = GetRandomInt(1,udg_Tree_count)
if GetDestructableLife(udg_Tree[t]) > 0.5 then
set udg_NestNumber = udg_NestNumber + 1
set udg_NestTree[udg_NestNumber] = udg_Tree[t]
set x = GetDestructableX(udg_NestTree[udg_NestNumber])
set y = GetDestructableY(udg_NestTree[udg_NestNumber])
set udg_BirdNest[udg_NestNumber] = CreateUnit( owner, BIRDNEST_A_ID, x, y, bj_UNIT_FACING )
call TriggerRegisterDeathEvent( gg_trg_NestingBirds, udg_NestTree[udg_NestNumber] )
endif
endif
elseif i == VULTURENEST_A_ID or i == VULTURENEST_G_ID then
call removeUnit(u)
call babies(owner,x,y,VULTURE_ID,11)
elseif i == VULTURE_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, GRIFFONVULTURE_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_LIGHT_GRAY )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
set t = GetRandomInt(1,udg_Tree_count)
if GetDestructableLife(udg_Tree[t]) > 0.5 then
set udg_NestNumber = udg_NestNumber + 1
set udg_NestTree[udg_NestNumber] = udg_Tree[t]
set x = GetDestructableX(udg_NestTree[udg_NestNumber])
set y = GetDestructableY(udg_NestTree[udg_NestNumber])
set udg_BirdNest[udg_NestNumber] = CreateUnit( owner, VULTURENEST_A_ID, x, y, bj_UNIT_FACING )
call TriggerRegisterDeathEvent( gg_trg_NestingBirds, udg_NestTree[udg_NestNumber] )
endif
endif
elseif i == ANTELOPE_ID then
call removeUnit(u)
set beast = CreateUnit( owner, ANTELOPESTAG_ID, x, y, bj_UNIT_FACING )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) then
call UnitAddAbility( beast ,'A007' )
endif
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call babies(owner,x,y,ANTELOPEFAWN_ID,9)
endif
elseif i == ANTELOPEFAWN_ID then
call removeUnit(u)
set beast = CreateUnit( owner, ANTELOPE_ID, x, y, bj_UNIT_FACING )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) then
call UnitAddAbility( beast ,'A007' )
endif
elseif i == BEAR_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, OLDBEAR_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_BROWN )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call babies(owner,x,y,BEARCUB_ID,9)
endif
elseif i == BEARCUB_ID then
call removeUnit(u)
call SetUnitColor( CreateUnit( owner, BEAR_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_BROWN )
elseif i == RAT_ID then
call removeUnit(u)
call SetUnitAbilityLevel( CreateUnit( owner, MANGYRAT_ID, x, y, bj_UNIT_FACING ),'A0E0', 2 )
if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - udg_Day then
call babies(owner,x,y,RAT_ID,9)
endif
elseif i == BERRYSAPPLING_ID then
call removeUnit(u)
call CreateUnit( owner, BERRYBUSH_ID, x, y, bj_UNIT_FACING )
call UnitRemoveAbility( beast,'Afir' )
call UnitRemoveAbility( beast,'Afio' )
call UnitRemoveAbility( beast,'Afih' )
call UnitRemoveAbility( beast,'Afin' )
call UnitRemoveAbility( beast,'Afiu' )
elseif i == BERRYBUSH_ID then
call SetUnitState(u, UNIT_STATE_MANA, 0.)
call UnitAddItemById( u, BERRY_ID )
if GetRandomInt(1, 100) == 100 then
call sprout(owner,x,y,BERRYBUSH_ID)
endif
elseif i == ARIA_ID then
call SetUnitState(u, UNIT_STATE_MANA, 0.)
call SetItemCharges( UnitAddItemById( u, ARIA_BLOSSOM_ID ), GetRandomInt(1, 3) )
if GetRandomInt(1, 100) == 100 then
call sprout(owner,x,y,ARIA_ID)
endif
elseif i == BARDANE_ID then
call SetUnitState(u, UNIT_STATE_MANA, 0.)
call SetItemCharges( UnitAddItemById( u, BARDANE_PETAL_ID ), GetRandomInt(1, 3) )
if GetRandomInt(1, 100) == 100 then
call sprout(owner,x,y,BARDANE_ID)
endif
elseif i == CORIAN_ID then
call SetUnitState(u, UNIT_STATE_MANA, 0.)
call SetItemCharges( UnitAddItemById( u, CORIAN_LEAVE_ID ), GetRandomInt(1, 3) )
if GetRandomInt(1, 100) == 100 then
call sprout(owner,x,y,CORIAN_ID)
endif
elseif i == DRAXIMOR_ID then
call SetUnitState(u, UNIT_STATE_MANA, 0.)
call SetItemCharges( UnitAddItemById( u, DRAXIMOR_BELL_ID ), GetRandomInt(1, 3) )
if GetRandomInt(1, 100) == 100 then
call sprout(owner,x,y,DRAXIMOR_ID)
endif
elseif i == BEEHIVE_ID then
call SetUnitState(u, UNIT_STATE_MANA, 0.)
call UnitAddItemById( u, HONEY_ID )
elseif i == DOG1_ID then
call removeUnit(u)
set udg_Pet[GetPlayerId(owner)+1] = CreateUnit( owner, DOG2_ID, x, y, bj_UNIT_FACING )
elseif i == DOG2_ID then
call removeUnit(u)
set udg_Pet[GetPlayerId(owner)+1] = CreateUnit( owner, DOG3_ID, x, y, bj_UNIT_FACING )
elseif i == DOG3_ID then
call removeUnit(u)
set udg_Pet[GetPlayerId(owner)+1] = CreateUnit( owner, DOG4_ID, x, y, bj_UNIT_FACING )
elseif i == DOG4_ID then
call removeUnit(u)
set udg_Pet[GetPlayerId(owner)+1] = CreateUnit( owner, DOG5_ID, x, y, bj_UNIT_FACING )
elseif i == DOG5_ID then
call removeUnit(u)
set udg_Pet[GetPlayerId(owner)+1] = CreateUnit( owner, DOG6_ID, x, y, bj_UNIT_FACING )
elseif i == HAWK1_ID then
call removeUnit(u)
set udg_Pet[GetPlayerId(owner)+1] = CreateUnit( owner, DOG2_ID, x, y, bj_UNIT_FACING )
call SetUnitColor( udg_Pet[GetPlayerId(owner)+1], PLAYER_COLOR_BROWN )
elseif i == HAWK2_ID then
call removeUnit(u)
set udg_Pet[GetPlayerId(owner)+1] = CreateUnit( owner, DOG3_ID, x, y, bj_UNIT_FACING )
call SetUnitColor( udg_Pet[GetPlayerId(owner)+1], PLAYER_COLOR_BROWN )
elseif i == HAWK3_ID then
call removeUnit(u)
set udg_Pet[GetPlayerId(owner)+1] = CreateUnit( owner, DOG4_ID, x, y, bj_UNIT_FACING )
call SetUnitColor( udg_Pet[GetPlayerId(owner)+1], PLAYER_COLOR_BROWN )
elseif i == FROLLHUTT_ID or i == FROLLVILLAGE_ID then
elseif i == FROLL_ID then
endif
// beast behaviour when 0 mana (evolve, die)
elseif GetUnitState(u, UNIT_STATE_MANA) == 0. then
if i == WARFROLL_ID then
call UnitAddAbility( u, 'S00Y' )
// some old beast instead of dying have 10% chance to evolve into a rare beast type
elseif GetRandomInt(1, 10) == 1 then
if i == ANTELOPESTAG_ID then
call removeUnit(u)
call CreateUnit( owner, ROYALSTAG_ID, x, y, bj_UNIT_FACING )
elseif i == GIANTALLIGATOR_ID then
call removeUnit(u)
call CreateUnit( owner, CROCODILE_ID, x, y, bj_UNIT_FACING )
elseif i == FATHOG_ID then
call removeUnit(u)
call CreateUnit( owner, RAZORBACK_ID, x, y, bj_UNIT_FACING )
elseif i == OLDSABERCAT_ID then
call removeUnit(u)
call CreateUnit( owner, SABERLION_ID, x, y, bj_UNIT_FACING )
elseif i == OLDBEAR_ID then
call removeUnit(u)
call CreateUnit( owner, CAVEBEAR_ID, x, y, bj_UNIT_FACING )
elseif i == BULLFROG_ID then
call removeUnit(u)
call CreateUnit( owner, POISONFROG_ID, x, y, bj_UNIT_FACING )
endif
// old beast die (everybeast here has failed the 10% chance)
elseif i == BULLFROG_ID or i == FATRABBIT_ID or i == TARENTULAQUEEN_ID or i == ANCIENTTORTOISE_ID or i == IMPERCRAB_ID or i == PIRANHA_ID or i == MANGYRAT_ID or i == FATRACOON_ID or i == JUNGLEVIPER_ID or i == BIGJUNGLEBIRD_ID or i == GRIFFONVULTURE_ID or i == FATUGLYFROG_ID or i == ANTELOPESTAG_ID or i == GIANTALLIGATOR_ID or i == FATHOG_ID or i == OLDSABERCAT_ID or i == OLDBEAR_ID then
call removeUnit(u)
endif
// beast ordinary behaviour when mana is between 0 and full
else
if i == CROCODILE_ID or i == GIANTALLIGATOR_ID or i == ALLIGATOR_ID or i == ALLIGATORHATCHLING_ID or i == ANCIENTTORTOISE_ID or i == GIANTTORTOISE_ID or i == TORTOISE_ID or i == JUNGLEASPIC_ID or i == ANACONDA_ID or i == JUNGLEVIPER_ID or i == COMODODRAGON_ID or i == GIANTTORTOISE_Z_ID_ID or i == TORTOISE_Z_ID_ID or i == SNAKE_Z_ID or i == ALLIGATOR_Z_ID then
if GetRandomInt(1, 4) == 1 then
call UnitRemoveAbility( u, 'SCae' )
elseif GetUnitAbilityLevel(u, 'SCae') == 0 then
call UnitAddAbility( u, 'SCae' )
endif
elseif i == BULLFROG_ID or i == FROG_ID or i == POISONFROG_ID or i == UGLYFROG_ID or i == FATUGLYFROG_ID then
if GetRandomInt(1, 2) == 1 then
call UnitRemoveAbility( u, 'SCae' )
elseif GetUnitAbilityLevel(u, 'SCae') == 0 then
call UnitAddAbility( u, 'SCae' )
endif
elseif i == SABERLION_ID or i == OLDSABERCAT_ID or i == SABERCAT_ID or i == SABERKITTEN_ID or SABERCAT_Z_ID then
if GetRandomInt(1, 3) < 3 then
call UnitRemoveAbility( u, 'A0DY' )
call UnitRemoveAbility( u, 'S00W' )
elseif GetUnitAbilityLevel(u, 'A0DY') == 0 then
call UnitAddAbility( u, 'A0DY' )
call UnitAddAbility( u, 'S00W' )
endif
endif
endif
endif
call GroupRemoveUnit(g, u)
endloop
endfunction
endlibrary
[/code]

about the function it is in the library death is my friend....

[Jass=]
private function removeUnit takes unit u returns nothing
call UnitRemoveItemFromSlot( u, 0 )
call UnitRemoveItemFromSlot( u, 1 )
call UnitRemoveItemFromSlot( u, 2 )
call UnitRemoveItemFromSlot( u, 3 )
call UnitRemoveItemFromSlot( u, 4 )
call UnitRemoveItemFromSlot( u, 5 )
call RemoveUnit(u)
endfunction
[/code]

edo since all the constante are in you should get error message about them...
 
Level 23
Joined
Apr 16, 2012
Messages
4,041
double posting but to get ABM's attention

I made some of the globals missing
JASS:
    constant integer BERRY_ID = 0
    constant integer ARIA_BLOSSOM_ID = 0
    constant integer BARDANE_PETAL_ID = 0
    constant integer CORIAN_LEAVE_ID = 0
    constant integer DRAXIMOR_BELL_ID = 0
    constant integer HONEY_ID=0
    constant integer GIANTTORTOISE_Z_ID_ID = 0
    constant integer TORTOISE_Z_ID_ID = 0
    constant boolean SABERCAT_Z_ID = false
By the way you have defined SABERCAT_Z_ID a little bit upper of type integer but you use it as boolean in one if block

and here is code(udg_s were excluded from code either set to null(trees) or commented out
and it compiled fine:

JASS:
library Animal
   
    globals
    private group g=CreateGroup()
    private group g2=CreateGroup()
    constant integer MANASTONE_ID = 'I036'
    constant integer ALLIGATOR_EGG_ID = 'h01Q'
    constant integer BIRDNEST_G_ID = 'h032'
    constant integer BIRDNEST_A_ID = 'h02U'
    constant integer VULTURENEST_G_ID = 'h033'
    constant integer VULTURENEST_A_ID = 'h02V'
    constant integer TORTOISE_EGG_ID = 'h02I'
    constant integer SNAKE_EGG_ID = 'h019'
    constant integer UGLYFROG_EGG_ID = 'h02X'
    constant integer SPIDER_EGGBAG_ID = 'h01C'
    constant integer WEBLAIR_ID = 'h018'
    // Pest
    constant integer BLACKPIRANHA_ID = 'n01Y'
    constant integer PIRANHA_ID = 'n018'
    constant integer MOSQUITOES_ID = 'h02F'
    constant integer CARNIVORPLANT_ID = 'hMEP'
    constant integer RAT_ID = 'h02H'
    constant integer MANGYRAT_ID = 'h01O'
    constant integer ANACONDA_ID = 'n00J'
    constant integer JUNGLEASPIC_ID = 'n00D'
    constant integer JUNGLEVIPER_ID = 'n00F'
    constant integer BLACKWIDOW_ID = 'n004'
    constant integer TARENTULA_ID = 'n01A'
    constant integer TARENTULAQUEEN_ID = 'n02P'
    constant integer MONSTER_1_ID = 'n00U'
    constant integer MONSTER_2_ID = 'n00X'
    constant integer MONSTER_3_ID = 'n015'
    // rock
    constant integer ROCK1_ID = 'h028'
    constant integer ROCK2_ID = 'h029'
    constant integer ROCK3_ID = 'h02A'
    constant integer ROCK4_ID = 'h02B'
    constant integer ROCK5_ID = 'h02C'
    constant integer ROCK6_ID = 'h02D'
    constant integer ROCK7_ID = 'h00W'
    constant integer ROCK8_ID = 'h01J'
    constant integer ROCK9_ID = 'h01N'
    constant integer ROCK10_ID = 'h01W'
    constant integer ROCK11_ID = 'h025'
    constant integer ROCK12_ID = 'h026'
    // building
    constant integer TENTB_ID = 'h016'
    constant integer TENTS_ID = 'h00K'
    constant integer TENTP_ID = 'h015'
    constant integer TENTHB_ID = 'h00Z'
    constant integer TENTHS_ID = 'h00G'
    constant integer TENTHP_ID = 'h00Y'
    constant integer CAULDRON_A_ID = 'h00I'
    constant integer CAULDRON_C_ID = 'h02J'
    constant integer FORGE_A_ID = 'h00H'
    constant integer FORGE_S_ID = 'h02Y'
    constant integer TANNER_A_ID = 'h021'
    constant integer TANNER_B_ID = 'h022'
    constant integer WORKSHOP_A_ID = 'h00O'
    constant integer WORKSHOP_B_ID = 'h02G'
    constant integer VOODOO_A_ID = 'h006'
    constant integer VOODOO_B_ID = 'h024'
    constant integer VOODOO_C_ID = 'h00C'
    constant integer TOTEM_ID = 'h004'
    constant integer HUTT_ID = 'h005'
    constant integer MERCHANT_A_ID = 'h013'
    constant integer MERCHANT_B_ID = 'h01Z'
    constant integer MERCHANT_C_ID = 'h02M'
    constant integer ARMORY_A_ID = 'h008'
    constant integer ARMORY_B_ID = 'h023'
    constant integer TOWER_A_ID = 'h01I'
    constant integer TOWER_B_ID = 'h01K'
    constant integer TOWER_C_ID = 'h01M'
    constant integer TOWER_D_ID = 'h01L'
    // heroes
    constant integer WARRIOR_ID = 'H003'
    constant integer HUNTER_ID = 'H001'
    constant integer SHAMAN_ID = 'H002'
    constant integer INVENTOR_ID = 'H000'
    // hunter pets
    constant integer DOG1_ID = 'n00Y'
    constant integer DOG2_ID = 'n01R'
    constant integer DOG3_ID = 'n01Q'
    constant integer DOG4_ID = 'n01P'
    constant integer DOG5_ID = 'n01S'
    constant integer DOG6_ID = 'n00V'
    constant integer HAWK1_ID = 'n01H'
    constant integer HAWK2_ID = 'n01U'
    constant integer HAWK3_ID = 'n01T'
    constant integer HAWK4_ID = 'n01I'
    // birds and Froll
    constant integer JUNGLEBIRD_ID = 'n02G'
    constant integer BIGJUNGLEBIRD_ID = 'n00O'
    constant integer VULTURE_ID = 'n00E'
    constant integer GRIFFONVULTURE_ID = 'n00H'
    constant integer FROLL_ID = 'u001'
    constant integer WARFROLL_ID = 'u002'
    constant integer FROLLHUTT_ID = 'nmg1'
    constant integer FROLLVILLAGE_ID = 'nfr2'
    constant integer UGLYFROG_ID = 'n01B'
    constant integer FATUGLYFROG_ID = 'n01D'
    constant integer HARPOON_ID = 'I0AG'
    //  Boss and zombies
    constant integer BIGBADWOLF_ID = 'n01E'
    constant integer GIANTVULTURE_ID = 'n01L'
    constant integer GRIZZLI_ID = 'n01C'
    constant integer COMODODRAGON_ID = 'n010'
    constant integer ANTELOPE_Z_ID = 'n01X'
    constant integer RIVERCRAB_Z_ID = 'n021'
 //   constant integer SABERCAT_Z_ID = 'n02S'
    constant integer ALLIGATOR_Z_ID = 'n01V'
    constant integer TARENTULA_Z_ID = 'n024'
    constant integer SNAKE_Z_ID = 'n020'
    constant integer BLACKWIDOW_Z_ID = 'n02T'
    constant integer VULTURE_Z_ID = 'n029'
    constant integer RACOON_Z_ID = 'n023'
    constant integer BOAR_Z_ID = 'n02I'
    constant integer TORTOISE_Z_ID = 'n026'
    constant integer GIANTTORTOISE_Z_ID = 'n01Z'
    constant integer RABBIT_Z_ID = 'n022'
    constant integer BEAR_Z_ID = 'n01W'
    constant integer STAG_Z_ID = 'n00I'
    constant integer TROLL_Z_ID = 'u000'
    // animals water
    constant integer HERMITCRAB_ID = 'n001'
    constant integer RIVERCRAB_ID = 'n016'
    constant integer IMPERCRAB_ID = 'n02N'
    constant integer ALLIGATORHATCHLING_ID = 'n02C'
    constant integer ALLIGATOR_ID = 'n009'
    constant integer GIANTALLIGATOR_ID = 'n02K'
    constant integer CROCODILE_ID = 'ntrg'
    constant integer FROG_ID = 'n007'
    constant integer BULLFROG_ID = 'n017'
    constant integer POISONFROG_ID = 'nskg'
    constant integer TORTOISE_ID = 'n00C'
    constant integer GIANTTORTOISE_ID = 'n014'
    constant integer ANCIENTTORTOISE_ID = 'n02M'
    // animals ground
    constant integer PIGLET_ID = 'n02A'
    constant integer BOAR_ID = 'n002'
    constant integer FATHOG_ID = 'n02R'
    constant integer RAZORBACK_ID = 'nwen'
    constant integer ANTELOPEFAWN_ID = 'n01K'
    constant integer ANTELOPE_ID = 'n01J'
    constant integer ANTELOPESTAG_ID = 'n01M'
    constant integer ROYALSTAG_ID = 'njg1'
    constant integer RACOONCUB_ID = 'n02E'
    constant integer RACOON_ID = 'n006'
    constant integer FATRACOON_ID = 'n02O'
    constant integer BUNNY_ID = 'n02D'
    constant integer RABBIT_ID = 'n005'
    constant integer FATRABBIT_ID = 'n02J'
    constant integer SABERKITTEN_ID = 'n02F'
    constant integer SABERCAT_ID = 'n003'
    constant integer OLDSABERCAT_ID = 'n02Q'
    constant integer SABERLION_ID = 'nwwg'
    constant integer BEARCUB_ID = 'n02B'
    constant integer BEAR_ID = 'n008'
    constant integer OLDBEAR_ID = 'n02L'
    constant integer CAVEBEAR_ID = 'nwlg'
    // plants and bees
    constant integer BEEHIVE_ID = 'h036'
    constant integer BEEQUEEN_ID = 'h035'
    constant integer ARIA_ID = 'h00E'
    constant integer BARDANE_ID = 'h00S'
    constant integer CORIAN_ID = 'h00T'
    constant integer DRAXIMOR_ID = 'h00U'
    constant integer BERRYBUSH_ID = 'h00M'
    constant integer BERRYSAPPLING_ID = 'h02S'
    constant integer CARNIVORBUSH_ID = 'h02O'
    constant integer BERRY_ID = 0
    constant integer ARIA_BLOSSOM_ID = 0
    constant integer BARDANE_PETAL_ID = 0
    constant integer CORIAN_LEAVE_ID = 0
    constant integer DRAXIMOR_BELL_ID = 0
    constant integer HONEY_ID=0
    constant integer GIANTTORTOISE_Z_ID_ID = 0
    constant integer TORTOISE_Z_ID_ID = 0
    constant boolean SABERCAT_Z_ID = false
    endglobals
   
    private function countplayer takes nothing returns integer
        local integer np=0
        local integer i=0
        loop
            exitwhen i > 11
            if false == false then
                set np = np + 1
            endif
            set i = i + 1
        endloop
        return np
    endfunction
   
    private function removeUnit takes unit u returns nothing
        call UnitRemoveItemFromSlot( u, 0 )
        call UnitRemoveItemFromSlot( u, 1 )
        call UnitRemoveItemFromSlot( u, 2 )
        call UnitRemoveItemFromSlot( u, 3 )
        call UnitRemoveItemFromSlot( u, 4 )
        call UnitRemoveItemFromSlot( u, 5 )
        call RemoveUnit(u)
    endfunction
   
    private function babies takes player owner, real x, real y, integer id, integer spawn returns nothing
        local integer j
        local integer k
        local real x1
        local real y1
        local real n
        set k = GetRandomInt(1, 10)
        if k < 7 then
            set k = 1
        elseif k < spawn then
            set k = 2
        else
            set k = 3
        endif
        set j = 1
        loop
            exitwhen j > k
            set n = GetRandomReal(0, 360)
            set x1 = x + 200. * Cos(n * bj_DEGTORAD)
            set y1 = y + 200. * Sin(n * bj_DEGTORAD)
            call CreateUnit( owner, id, x1, y1, bj_UNIT_FACING )
            set j = j + 1
        endloop
    endfunction
   
    private function sprout takes player owner, real x, real y, integer id returns nothing
        local real x1
        local real y1
        local real n
        local unit beast
        set n = GetRandomReal(0, 360)
        set x1 = x + 400. * Cos(n * bj_DEGTORAD)
        set y1 = y + 400. * Sin(n * bj_DEGTORAD)
        set beast = CreateUnit( owner, id, x1, y1, bj_UNIT_FACING )
        call UnitRemoveAbility( beast,'Afir' )
        call UnitRemoveAbility( beast,'Afio' )
        call UnitRemoveAbility( beast,'Afih' )
        call UnitRemoveAbility( beast,'Afin' )
        call UnitRemoveAbility( beast,'Afiu' )
    endfunction
   
    public function Reproduction takes nothing returns nothing
        local real x
        local real y
        local unit u
        local unit beast
        local integer i
        local integer t
        local integer p
        local player owner
        set p = countplayer()
        call GroupEnumUnitsInRect(g, bj_mapInitialPlayableArea, null)
        loop
            set u = FirstOfGroup(g)
            set i = GetUnitTypeId(u)
            set x = GetUnitX(u)
            set y = GetUnitY(u)
            set owner = GetOwningPlayer(u)
            exitwhen u == null
            if IsUnitType(u, UNIT_TYPE_DEAD) == false then
            // beast behaviour when full mana  (evolve, spawn babies)
                if GetUnitState(u, UNIT_STATE_MANA) == GetUnitState(u, UNIT_STATE_MAX_MANA) then
                    if i == CARNIVORBUSH_ID then
                        call removeUnit(u)
                       // set udg_Eat_count = ( udg_Eat_count + 1 )
                        call CreateDestructable( 'B003', x, y, 0., 1.60, 0 )
                       // set udg_MonsterBush[udg_Eat_count] = true
                     //   call TriggerRegisterDeathEvent( gg_trg_DropItemDestructible__JASS, udg_Bush[udg_Eat_count] )
               //         call SetUnitUserData( CreateUnit( Player(PLAYER_NEUTRAL_AGGRESSIVE), CARNIVORPLANT_ID, x, y, bj_UNIT_FACING ), udg_Eat_count )
                     //   set udg_Eat_Current = ( udg_Eat_Current + 1 )
                     //   set udg_Eat_DataStore[udg_Eat_Current] = udg_Eat_count
                    elseif i == MONSTER_2_ID then
                        call removeUnit(u)
                        call SetUnitColor( CreateUnit( owner, MONSTER_3_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_AQUA )
                    elseif i == MONSTER_1_ID then
                        call removeUnit(u)
                        call SetUnitColor( CreateUnit( owner, MONSTER_2_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_AQUA )
                    elseif i == BOAR_ID then
                        call removeUnit(u)
                        call SetUnitColor( CreateUnit( owner, FATHOG_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_BROWN )
                        if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - 0 then
                            call babies(owner,x,y,PIGLET_ID,9)
                        endif
                    elseif i == PIGLET_ID then
                        call removeUnit(u)
                        call SetUnitColor( CreateUnit( owner, BOAR_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_BROWN )
                    elseif i == RABBIT_ID then
                        call removeUnit(u)
                        call CreateUnit( owner, FATRABBIT_ID, x, y, bj_UNIT_FACING )
                        if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - 0 then
                            call babies(owner,x,y,BUNNY_ID,9)
                        endif
                    elseif i == BUNNY_ID then
                        call removeUnit(u)
                        call CreateUnit( owner, RABBIT_ID, x, y, bj_UNIT_FACING )
                    elseif i == ALLIGATOR_ID then
                        call removeUnit(u)
                        call CreateUnit( owner, GIANTALLIGATOR_ID, x, y, bj_UNIT_FACING )
                        if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - 0 then
                            call babies(owner,x,y,ALLIGATOR_EGG_ID,10)
                        endif
                    elseif i == ALLIGATORHATCHLING_ID then
                        call removeUnit(u)
                        call CreateUnit( owner, ALLIGATOR_ID, x, y, bj_UNIT_FACING )
                    elseif i == ALLIGATOR_EGG_ID then
                        call removeUnit(u)
                        call CreateUnit( owner, ALLIGATORHATCHLING_ID, x, y, bj_UNIT_FACING )
                    elseif i == RACOON_ID then
                        call removeUnit(u)
                        call CreateUnit( owner, FATRACOON_ID, x, y, bj_UNIT_FACING )
                        if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - 0 then
                            call babies(owner,x,y,RACOONCUB_ID,9)
                        endif
                    elseif i == RACOONCUB_ID then
                        call removeUnit(u)
                        call CreateUnit( owner, RACOON_ID, x, y, bj_UNIT_FACING )
                    elseif i == SABERCAT_ID then
                        call removeUnit(u)
                        call SetUnitColor( CreateUnit( owner, OLDSABERCAT_ID, x, y, bj_UNIT_FACING ), ConvertPlayerColor(12) )
                        if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - 0 then
                            call babies(owner,x,y,SABERKITTEN_ID,9)
                        endif
                    elseif i == SABERKITTEN_ID then
                        call removeUnit(u)
                        call SetUnitColor( CreateUnit( owner, SABERCAT_ID, x, y, bj_UNIT_FACING ), ConvertPlayerColor(12) )
                    elseif i == SNAKE_EGG_ID then
                        call removeUnit(u)
                        call babies(owner,x,y,JUNGLEASPIC_ID,10)
                    elseif i == JUNGLEASPIC_ID then
                        call removeUnit(u)
                        call CreateUnit( owner, JUNGLEVIPER_ID, x, y, bj_UNIT_FACING )
                        if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - 0 then
                            call CreateUnit( owner, SNAKE_EGG_ID, x, y, bj_UNIT_FACING )
                            call CreateItem('I00A', x, y)
                        endif
                    elseif i == SPIDER_EGGBAG_ID then
                        call removeUnit(u)
                        call babies(owner,x,y,BLACKWIDOW_ID,11)
                    elseif i == BLACKWIDOW_ID then
                        call removeUnit(u)
                        call SetUnitColor( CreateUnit( owner, TARENTULA_ID, x, y, bj_UNIT_FACING ), ConvertPlayerColor(12) )
                    elseif i == TARENTULA_ID then
                        call removeUnit(u)
                        call SetUnitColor( CreateUnit( owner, TARENTULAQUEEN_ID, x, y, bj_UNIT_FACING ), ConvertPlayerColor(12) )
                        if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - 0 then
                            call CreateUnit( owner, SPIDER_EGGBAG_ID, x, y, bj_UNIT_FACING )
                            call CreateUnit( owner, WEBLAIR_ID, x, y, bj_UNIT_FACING )
                        endif
                    elseif i == TORTOISE_EGG_ID then
                        call removeUnit(u)
                        call babies(owner,x,y,TORTOISE_ID,11)
                    elseif i == TORTOISE_ID then
                        call removeUnit(u)
                        call SetUnitColor( CreateUnit( owner, GIANTTORTOISE_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_BROWN )
                    elseif i == GIANTTORTOISE_ID then
                        call removeUnit(u)
                        call SetUnitColor( CreateUnit( owner, ANCIENTTORTOISE_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_BROWN )
                        if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - 0 then
                            call CreateUnit( owner, TORTOISE_EGG_ID, x, y, bj_UNIT_FACING )
                        endif
                    elseif i == RIVERCRAB_ID then
                        call removeUnit(u)
                        call SetUnitColor( CreateUnit( owner, IMPERCRAB_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_ORANGE )
                        if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - 0 then
                            call babies(owner,x,y,HERMITCRAB_ID,9)
                        endif
                    elseif i == HERMITCRAB_ID then
                        call removeUnit(u)
                        call SetUnitColor( CreateUnit( owner, RIVERCRAB_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_BROWN )
                    elseif i == FROG_ID then
                        call removeUnit(u)
                        call CreateUnit( owner, BULLFROG_ID, x, y, bj_UNIT_FACING )
                        if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - 0 then
                            call babies(owner,x,y,FROG_ID,10)
                        endif
                    elseif i == UGLYFROG_EGG_ID then
                        call removeUnit(u)
                        call CreateUnit( owner, FROLL_ID, x, y, bj_UNIT_FACING )
                    elseif i == BIRDNEST_A_ID or i == BIRDNEST_G_ID then
                        call removeUnit(u)
                        call babies(owner,x,y,JUNGLEBIRD_ID,11)
                    elseif i == JUNGLEBIRD_ID then
                        call removeUnit(u)
                        call CreateUnit( owner, BIGJUNGLEBIRD_ID, x, y, bj_UNIT_FACING )
                        if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - 0 then
                            set t = GetRandomInt(1,10)
                            if GetDestructableLife(null) > 0.5 then
                               // set udg_NestNumber = udg_NestNumber + 1
                               // set udg_NestTree[udg_NestNumber] = udg_Tree[t]
                                set x = GetDestructableX(null)
                                set y = GetDestructableY(null)
                              //  set udg_BirdNest[udg_NestNumber] = CreateUnit( owner, BIRDNEST_A_ID, x, y, bj_UNIT_FACING )
                              //  call TriggerRegisterDeathEvent( gg_trg_NestingBirds, udg_NestTree[udg_NestNumber] )
                            endif
                        endif
                    elseif i == VULTURENEST_A_ID or i == VULTURENEST_G_ID then
                        call removeUnit(u)
                        call babies(owner,x,y,VULTURE_ID,11)
                    elseif i == VULTURE_ID then
                        call removeUnit(u)
                        call SetUnitColor( CreateUnit( owner, GRIFFONVULTURE_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_LIGHT_GRAY )
                        if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - 0 then
                            set t = GetRandomInt(1,10)
                            if GetDestructableLife(null) > 0.5 then
                               // set udg_NestNumber = udg_NestNumber + 1
                               // set udg_NestTree[udg_NestNumber] = udg_Tree[t]
                                set x = GetDestructableX(null)
                                set y = GetDestructableY(null)
                              //  set udg_BirdNest[udg_NestNumber] = CreateUnit( owner, VULTURENEST_A_ID, x, y, bj_UNIT_FACING )
                            //    call TriggerRegisterDeathEvent( gg_trg_NestingBirds, udg_NestTree[udg_NestNumber] )
                            endif
                        endif
                    elseif i == ANTELOPE_ID then
                        call removeUnit(u)
                        set beast = CreateUnit( owner, ANTELOPESTAG_ID, x, y, bj_UNIT_FACING )
                        if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) then
                            call UnitAddAbility( beast ,'A007' )
                        endif
                        if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - 0 then
                            call babies(owner,x,y,ANTELOPEFAWN_ID,9)
                        endif
                    elseif i == ANTELOPEFAWN_ID then
                        call removeUnit(u)
                        set beast = CreateUnit( owner, ANTELOPE_ID, x, y, bj_UNIT_FACING )
                        if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) then
                            call UnitAddAbility( beast ,'A007' )
                        endif
                    elseif i == BEAR_ID then
                        call removeUnit(u)
                        call SetUnitColor( CreateUnit( owner, OLDBEAR_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_BROWN )
                        if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - 0 then
                            call babies(owner,x,y,BEARCUB_ID,9)
                        endif
                    elseif i == BEARCUB_ID then
                        call removeUnit(u)
                        call SetUnitColor( CreateUnit( owner, BEAR_ID, x, y, bj_UNIT_FACING ), PLAYER_COLOR_BROWN )
                    elseif i == RAT_ID then
                        call removeUnit(u)
                        call SetUnitAbilityLevel( CreateUnit( owner, MANGYRAT_ID, x, y, bj_UNIT_FACING ),'A0E0', 2 )
                        if owner != Player(PLAYER_NEUTRAL_AGGRESSIVE) or GetRandomInt(1, 12) + p >= 12 - 0 then
                            call babies(owner,x,y,RAT_ID,9)
                        endif
                    elseif i == BERRYSAPPLING_ID then
                        call removeUnit(u)
                        call CreateUnit( owner, BERRYBUSH_ID, x, y, bj_UNIT_FACING )
                        call UnitRemoveAbility( beast,'Afir' )
                        call UnitRemoveAbility( beast,'Afio' )
                        call UnitRemoveAbility( beast,'Afih' )
                        call UnitRemoveAbility( beast,'Afin' )
                        call UnitRemoveAbility( beast,'Afiu' )
                    elseif i == BERRYBUSH_ID then
                        call SetUnitState(u, UNIT_STATE_MANA, 0.)
                        call UnitAddItemById( u, BERRY_ID )
                        if GetRandomInt(1, 100) == 100 then
                            call sprout(owner,x,y,BERRYBUSH_ID)
                        endif
                    elseif i == ARIA_ID then
                        call SetUnitState(u, UNIT_STATE_MANA, 0.)
                        call SetItemCharges( UnitAddItemById( u, ARIA_BLOSSOM_ID ), GetRandomInt(1, 3) )
                        if GetRandomInt(1, 100) == 100 then
                            call sprout(owner,x,y,ARIA_ID)
                        endif
                    elseif i == BARDANE_ID then
                        call SetUnitState(u, UNIT_STATE_MANA, 0.)
                        call SetItemCharges( UnitAddItemById( u, BARDANE_PETAL_ID ), GetRandomInt(1, 3) )
                        if GetRandomInt(1, 100) == 100 then
                            call sprout(owner,x,y,BARDANE_ID)
                        endif
                    elseif i == CORIAN_ID then
                        call SetUnitState(u, UNIT_STATE_MANA, 0.)
                        call SetItemCharges( UnitAddItemById( u, CORIAN_LEAVE_ID ), GetRandomInt(1, 3) )
                        if GetRandomInt(1, 100) == 100 then
                            call sprout(owner,x,y,CORIAN_ID)
                        endif
                    elseif i == DRAXIMOR_ID then
                        call SetUnitState(u, UNIT_STATE_MANA, 0.)
                        call SetItemCharges( UnitAddItemById( u, DRAXIMOR_BELL_ID ), GetRandomInt(1, 3) )
                        if GetRandomInt(1, 100) == 100 then
                            call sprout(owner,x,y,DRAXIMOR_ID)
                        endif
                    elseif i == BEEHIVE_ID then
                        call SetUnitState(u, UNIT_STATE_MANA, 0.)
                        call UnitAddItemById( u, HONEY_ID )
                    elseif i == DOG1_ID then
                        call removeUnit(u)
                      //  set udg_Pet[GetPlayerId(owner)+1] = CreateUnit( owner, DOG2_ID, x, y, bj_UNIT_FACING )
                    elseif i == DOG2_ID then
                        call removeUnit(u)
                       // set udg_Pet[GetPlayerId(owner)+1] = CreateUnit( owner, DOG3_ID, x, y, bj_UNIT_FACING )
                    elseif i == DOG3_ID then
                        call removeUnit(u)
                        //set Pet[GetPlayerId(owner)+1] = CreateUnit( owner, DOG4_ID, x, y, bj_UNIT_FACING )
                    elseif i == DOG4_ID then
                        call removeUnit(u)
                        //set udg_Pet[GetPlayerId(owner)+1] = CreateUnit( owner, DOG5_ID, x, y, bj_UNIT_FACING )
                    elseif i == DOG5_ID then
                        call removeUnit(u)
                       // set udg_Pet[GetPlayerId(owner)+1] = CreateUnit( owner, DOG6_ID, x, y, bj_UNIT_FACING )
                    elseif i == HAWK1_ID then
                        call removeUnit(u)
                       // set udg_Pet[GetPlayerId(owner)+1] = CreateUnit( owner, DOG2_ID, x, y, bj_UNIT_FACING )
                       // call SetUnitColor( udg_Pet[GetPlayerId(owner)+1], PLAYER_COLOR_BROWN )
                    elseif i == HAWK2_ID then
                        call removeUnit(u)
                       // set udg_Pet[GetPlayerId(owner)+1] = CreateUnit( owner, DOG3_ID, x, y, bj_UNIT_FACING )
                       // call SetUnitColor( udg_Pet[GetPlayerId(owner)+1], PLAYER_COLOR_BROWN )
                    elseif i == HAWK3_ID then
                        call removeUnit(u)
                       // set Pet[GetPlayerId(owner)+1] = CreateUnit( owner, DOG4_ID, x, y, bj_UNIT_FACING )
                       // call SetUnitColor( udg_Pet[GetPlayerId(owner)+1], PLAYER_COLOR_BROWN )
                    elseif i == FROLLHUTT_ID or i == FROLLVILLAGE_ID then
                    elseif i == FROLL_ID then
                    endif
            // beast behaviour when 0 mana  (evolve, die)
                elseif GetUnitState(u, UNIT_STATE_MANA) == 0. then
                    if i == WARFROLL_ID then
                        call UnitAddAbility( u, 'S00Y' )
                    // some old beast instead of dying have 10% chance to evolve into a rare beast type
                    elseif GetRandomInt(1, 10) == 1 then
                        if i == ANTELOPESTAG_ID then
                            call removeUnit(u)
                            call CreateUnit( owner, ROYALSTAG_ID, x, y, bj_UNIT_FACING )
                        elseif i == GIANTALLIGATOR_ID then
                            call removeUnit(u)
                            call CreateUnit( owner, CROCODILE_ID, x, y, bj_UNIT_FACING )
                        elseif i == FATHOG_ID then
                            call removeUnit(u)
                            call CreateUnit( owner, RAZORBACK_ID, x, y, bj_UNIT_FACING )
                        elseif i == OLDSABERCAT_ID then
                            call removeUnit(u)
                            call CreateUnit( owner, SABERLION_ID, x, y, bj_UNIT_FACING )
                        elseif i == OLDBEAR_ID then
                            call removeUnit(u)
                            call CreateUnit( owner, CAVEBEAR_ID, x, y, bj_UNIT_FACING )
                        elseif i == BULLFROG_ID then
                            call removeUnit(u)
                            call CreateUnit( owner, POISONFROG_ID, x, y, bj_UNIT_FACING )
                        endif
                    // old beast die (everybeast here has failed the 10% chance)
                    elseif i == BULLFROG_ID or i == FATRABBIT_ID or i == TARENTULAQUEEN_ID or i == ANCIENTTORTOISE_ID or i == IMPERCRAB_ID or i == PIRANHA_ID or i == MANGYRAT_ID or i == FATRACOON_ID or i == JUNGLEVIPER_ID or i == BIGJUNGLEBIRD_ID or i == GRIFFONVULTURE_ID or i == FATUGLYFROG_ID or i == ANTELOPESTAG_ID or i == GIANTALLIGATOR_ID or i == FATHOG_ID or i == OLDSABERCAT_ID or i == OLDBEAR_ID then
                        call removeUnit(u)
                    endif
            // beast ordinary behaviour when mana is between 0 and full
                else
                    if i == CROCODILE_ID or i == GIANTALLIGATOR_ID or i == ALLIGATOR_ID or i == ALLIGATORHATCHLING_ID or i == ANCIENTTORTOISE_ID or i == GIANTTORTOISE_ID or i == TORTOISE_ID or i == JUNGLEASPIC_ID or i == ANACONDA_ID or i == JUNGLEVIPER_ID or i == COMODODRAGON_ID or i == GIANTTORTOISE_Z_ID_ID or i == TORTOISE_Z_ID_ID or i == SNAKE_Z_ID or i == ALLIGATOR_Z_ID then
                        if GetRandomInt(1, 4) == 1 then
                            call UnitRemoveAbility( u, 'SCae' )
                        elseif GetUnitAbilityLevel(u, 'SCae') == 0 then
                            call UnitAddAbility( u, 'SCae' )
                        endif
                    elseif i == BULLFROG_ID or i == FROG_ID or i == POISONFROG_ID or i == UGLYFROG_ID or i == FATUGLYFROG_ID then
                        if GetRandomInt(1, 2) == 1 then
                            call UnitRemoveAbility( u, 'SCae' )
                        elseif GetUnitAbilityLevel(u, 'SCae') == 0 then
                            call UnitAddAbility( u, 'SCae' )
                        endif
                    elseif i == SABERLION_ID or i == OLDSABERCAT_ID or i == SABERCAT_ID or i == SABERKITTEN_ID or SABERCAT_Z_ID then
                        if GetRandomInt(1, 3) < 3 then
                            call UnitRemoveAbility( u, 'A0DY' )
                            call UnitRemoveAbility( u, 'S00W' )
                        elseif GetUnitAbilityLevel(u, 'A0DY') == 0 then
                            call UnitAddAbility( u, 'A0DY' )
                            call UnitAddAbility( u, 'S00W' )
                        endif
                    endif
                endif
            endif
            call GroupRemoveUnit(g, u)
        endloop
    endfunction
endlibrary

Be aware that in GetDestructableLife and SetDestructableX and Y(or it was Get, i dont know) and the first boolean check were set to null

also I changed the udg_tree_count or what the hell to 10 in GetRandomInt(1, ...)
 

ABM

ABM

Level 7
Joined
Jul 13, 2005
Messages
279
thanks a lot, normally udg should have mistake...
here is what these udg are:
udg_Eat_count = integer
udg_Bush[array] = destructable
udg_MonsterBush[array] = boolean
udg_Eat_Current = integer
udg_Eat_DataStore[array] = integer
udg_Day = integer
udg_NestNumber = integer
udg_NestTree[array] = destructable
udg_Tree[array] = destructable
udg_BirdNest[array] = unit
udg_Tree_count = integer
udg_Pet[array] = unit

Thanks a lot....
i will look at the modification you made, try to save them, then try to modify them to work as it was intended, and hope that it will compile...
sorry about tha constant i forgot....
and really thanks a lot for your help...i am so tired working on jass, it is really tiring...fighting with map compilation...
 
Status
Not open for further replies.
Top