• 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] doesn't compile :(

Status
Not open for further replies.

ABM

ABM

Level 7
Joined
Jul 13, 2005
Messages
279
hi,
some problem in the library
[Jass=]
library Weather
globals
private group g=CreateGroup()
private integer i
private real time
private unit array ztarget
endglobals

private function Pathing takes real x, real y returns boolean
if ( not ( IsTerrainPathable( x, y, PATHING_TYPE_FLOATABILITY) == true ) ) then
return false
endif
if ( not ( IsTerrainPathable( x, y, PATHING_TYPE_WALKABILITY) == false ) ) then
return false
endif
if ( not ( IsTerrainPathable( x, y, PATHING_TYPE_BUILDABILITY) == false ) ) then
return false
endif
return true
endfunction

private function Lightning takes integer chance, integer count returns nothing
local effect lightbolt
local integer t
local real x
local real y
local real dmg
local player owner
if ( GetRandomInt(1, chance) == 1 ) then
set t = GetRandomInt(0, count)
if GetUnitState(ztarget[t], UNIT_STATE_LIFE) > 0.00 then
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUTIN, 0.10, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 100.00, 100.00, 90.00, 0 )
call TriggerSleepAction( 0.10 )
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUTIN, 0.10, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 100.00, 100.00, 90.00, 0 )
call DisplayTimedTextToPlayer( Player(0), 0, 0, 6.00, ( "Units: " + GetUnitName(ztarget[t]) ) )
set x = GetUnitX(ztarget[t])
set y = GetUnitY(ztarget[t])
set i = GetUnitTypeId(ztarget[t])
endif
else
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUTIN, 0.10, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 100.00, 100.00, 90.00, 0 )
call TriggerSleepAction( 0.10 )
call CinematicFadeBJ( bj_CINEFADETYPE_FADEOUTIN, 0.10, "ReplaceableTextures\\CameraMasks\\White_mask.blp", 100.00, 100.00, 90.00, 0 )
call TriggerExecute( gg_trg_Lightning_Tree_JASS )
endif
endfunction

private function Plants takes real x, real y returns nothing
local unit flower
set flower = CreateUnit( Player(PLAYER_NEUTRAL_PASSIVE), udg_Plants[GetRandomInt(1, 4)], x, y, bj_UNIT_FACING )
call DisplayTimedTextToPlayer(Player(0), 0., 0., 6.00, ( "a new plant was created " + (GetUnitName(flower) ) ) )
call UnitRemoveAbility( flower, 'Afir' )
call UnitRemoveAbility( flower, 'Afio' )
call UnitRemoveAbility( flower, 'Afih' )
call UnitRemoveAbility( flower, 'Afin' )
call UnitRemoveAbility( flower, 'Afiu' )
set udg_count_Plants = ( udg_count_Plants + 1 )
set flower =null
endfunction

// Freezing = 70-140 (hard) 30-60 (other) ( 2x 2% (0%) plants mortality + 17% (8%) plants mortality , -1 honey , bear hibernate )
public function Freezing takes nothing returns nothing
local unit u=null
local item honey=null
local real dmg
// ===== Start Freezing Weather =====
call EnableWeatherEffect( udg_Freeze_weather, true )
call DisplayTimedTextToForce( bj_FORCE_ALL_PLAYERS, 6.00, "|c009966ffOld Troll:|r |c00ffff64It'z snowin', mon. Go put some wood in the fire place, me no likez cold.|r" )
set udg_Freezing = true
set udg_MB_Weather = "Snow"
if udg_GameDiff == 3 then
set time = GetRandomReal(70.00, 140.00)
set dmg = 50.
else
set time = GetRandomReal(30.00, 60.00)
set dmg = 35.
endif
// ===== Slow plant Growth and make Bear hibernate =====
call GroupEnumUnitsInRect(g, bj_mapInitialPlayableArea, null)
loop
set u = FirstOfGroup(g)
set i = GetUnitTypeId(u)
exitwhen u == null
if i == ARIA_ID or i == BARDANE_ID or i == CORIAN_ID or i == DRAXIMOR_ID or i == BERRYSAPPLING_ID then
call SetUnitState(u, UNIT_STATE_LIFE, (GetUnitState(u, UNIT_STATE_LIFE) - GetRandomReal(5., dmg) ))
call SetUnitState(u, UNIT_STATE_MANA, (GetUnitState(u, UNIT_STATE_MANA) - GetRandomReal(5., 15.) ))
elseif i == BERRYBUSH_ID then
call SetUnitState(u, UNIT_STATE_LIFE, (GetUnitState(u, UNIT_STATE_LIFE) - GetRandomReal(5., dmg) ))
call SetUnitState(u, UNIT_STATE_MANA, (GetUnitState(u, UNIT_STATE_MANA) - GetRandomReal(5., 30.) ))
elseif i == BEEHIVE_ID then
call SetUnitState(u, UNIT_STATE_MANA, (GetUnitState(u, UNIT_STATE_MANA) - 30. ))
set honey = UnitItemInSlot(u, 1)
if honey != null and GetItemTypeId(honey) == HONEY_ID then
if GetItemCharges(honey) == 1 then
call RemoveItem(honey)
else
call SetItemCharges( honey, ( GetItemCharges(honey) - 1 ) )
endif
endif
set honey =null
elseif i == BEARCUB_ID or i == BEAR_ID or i == OLDBEAR_ID or i == CAVEBEAR_ID then
call IssueTargetOrder( u, "sleep", u )
endif
call GroupRemoveUnit(g, u)
endloop
// ===== Freeze Duration =====
call TriggerSleepAction(time)
// ===== Slow plant Growth and Remove Hibernation Mode from Bears =====
call GroupEnumUnitsInRect(g, bj_mapInitialPlayableArea, null)
loop
set u = FirstOfGroup(g)
set i = GetUnitTypeId(u)
exitwhen u == null
if i == ARIA_ID or i == BARDANE_ID or i == CORIAN_ID or i == DRAXIMOR_ID or i == BERRYSAPPLING_ID then
call SetUnitState(u, UNIT_STATE_LIFE, (GetUnitState(u, UNIT_STATE_LIFE) - GetRandomReal(1., dmg) ))
call SetUnitState(u, UNIT_STATE_MANA, (GetUnitState(u, UNIT_STATE_MANA) - GetRandomReal(5., 15.) ))
elseif i == BERRYBUSH_ID then
call SetUnitState(u, UNIT_STATE_LIFE, (GetUnitState(u, UNIT_STATE_LIFE) - GetRandomReal(1., dmg) ))
call SetUnitState(u, UNIT_STATE_MANA, (GetUnitState(u, UNIT_STATE_MANA) - GetRandomReal(5., 30.) ))
elseif i == BEEHIVE_ID then
call SetUnitState(u, UNIT_STATE_MANA, (GetUnitState(u, UNIT_STATE_MANA) - 30. ))
elseif i == BEARCUB_ID or i == BEAR_ID or i == OLDBEAR_ID or i == CAVEBEAR_ID then
call UnitWakeUp(u)
endif
call GroupRemoveUnit(g, u)
endloop
// ===== Stop Freezing Weather =====
call EnableWeatherEffect( udg_Freeze_weather, false )
set udg_Freezing = false
set udg_MB_Weather = "Clear"
endfunction

// Rain = 80-180 (hard) 35-85 (other) ( 4 lightning , 4 plants )
public function Rain takes nothing returns nothing
local real x
local real y
local unit u=null
local rect area
local integer count=0
local integer chance
// ===== Start Rain Weather =====
if udg_GameDiff == 3 then
set chance = 2
set time = GetRandomReal(60.00, 120.00)
else
set chance = 3
set time = GetRandomReal(15.00, 25.00)
endif
call EnableWeatherEffect( udg_Rain_day, true )
call DisplayTimedTextToForce( bj_FORCE_ALL_PLAYERS, 6.00, "|c009966ffOld Troll:|r|c00ffff64Oh, It'z rainin'. That'z good for the herbz and iz bad for me old bonez...|r" )
set udg_Rain = true
set udg_MB_Weather = "Rain"
// ===== Rain Change the Fishes in the Water Area =====
set udg_FishCaught[1] = 'nska'
set udg_FishCaught[4] = 'n00B'
set udg_FishCaught[23] = 'nska'
set udg_FishCaught[26] = 'n00B'
set udg_FishCaught[43] = 'nska'
set udg_FishCaught[49] = 'n00B'
set udg_FishCaught[61] = 'nska'
set udg_FishCaught[64] = 'n00B'
set udg_FishCaught[81] = 'nska'
set udg_FishCaught[85] = 'n00B'
// ========== Rain makes plants grow ==========
call GroupEnumUnitsInRect(g, bj_mapInitialPlayableArea, null)
loop
set u = FirstOfGroup(g)
set i = GetUnitTypeId(u)
exitwhen u == null
if i == ARIA_ID or i == BARDANE_ID or i == CORIAN_ID or i == DRAXIMOR_ID or i == BERRYSAPPLING_ID then
call SetUnitState(u, UNIT_STATE_LIFE, (GetUnitState(u, UNIT_STATE_LIFE) + GetRandomReal(5.00, 10.00) ))
call SetUnitState(u, UNIT_STATE_MANA, (GetUnitState(u, UNIT_STATE_MANA) + GetRandomReal(5.00, 20.00) ))
elseif i == BERRYBUSH_ID then
call SetUnitState(u, UNIT_STATE_LIFE, (GetUnitState(u, UNIT_STATE_LIFE) + GetRandomReal(10.00, 20.00) ))
call SetUnitState(u, UNIT_STATE_MANA, (GetUnitState(u, UNIT_STATE_MANA) + GetRandomReal(5.00, 20.00) ))
elseif i == BEEHIVE_ID then
call SetUnitState(u, UNIT_STATE_MANA, (GetUnitState(u, UNIT_STATE_MANA) - GetRandomReal(25.00, 50.00) ))
elseif i == CARNIVORPLANT_ID then
call SetUnitState(u, UNIT_STATE_MANA, (GetUnitState(u, UNIT_STATE_MANA) * 0.90 ))
elseif i == INVENTOR_ID or i == HUNTER_ID or i == SHAMAN_ID or i == WARRIOR_ID or i == TOTEM_ID or i == TOWER_A_ID or i == TOWER_B_ID or i == TOWER_C_ID or i == TOWER_D_ID or i == HUTT_ID or i == ARMORY_A_ID or i == ARMORY_B_ID or i == MERCHANT_A_ID or i == MERCHANT_B_ID or i == MERCHANT_C_ID or i == VOODOO_A_ID or i == VOODOO_B_ID or i == VOODOO_C_ID or i == WORKSHOP_A_ID or i == WORKSHOP_B_ID or i == TANNER_A_ID or i == TANNER_B_ID or i == FORGE_A_ID or i == FORGE_S_ID or i == CAULDRON_A_ID or i == CAULDRON_C_ID or i == TENTB_ID or i == TENTHB_ID or i == TENTS_ID or i == TENTHS_ID or i == TENTP_ID or i == TENTHP_ID or i == PIGLET_ID or i == BOAR_ID or i == FATHOG_ID or i == ANTELOPEFAWN_ID or i == ANTELOPE_ID or i == ANTELOPESTAG_ID or i == BEARCUB_ID or i == BEAR_ID or i == OLDBEAR_ID or i == SABERKITTEN_ID or i == SABERCAT_ID or i == OLDSABERCAT_ID or i == RACOONCUB_ID or i == RACOON_ID or i == FATRACOON_ID or i == BUNNY_ID or i == RABBIT_ID or i == FATRABBIT_ID or i == HERMITCRAB_ID or i == RIVERCRAB_ID or i == IMPERCRAB_ID or i == ALLIGATORHATCHLING_ID or i == ALLIGATOR_ID or i == GIANTALLIGATOR_ID or i == FROG_ID or i == BULLFROG_ID or i == TORTOISE_ID or i == GIANTTORTOISE_ID or i == ANCIENTTORTOISE_ID or i == FROLL_ID or i == JUNGLEBIRD_ID or i == BIGJUNGLEBIRD_ID or i == VULTURE_ID or i == GRIFFONVULTURE_ID or i == RAT_ID or i == MANGYRAT_ID or i == JUNGLEASPIC_ID or i == JUNGLEVIPER_ID or i == ANACONDA_ID or i == BLACKWIDOW_ID or i == TARENTULA_ID or i == TARENTULAQUEEN_ID or i == DOG1_ID or i == DOG2_ID or i == DOG3_ID or i == DOG4_ID or i == DOG5_ID or i == DOG6_ID or i == HAWK1_ID or i == HAWK2_ID or i == HAWK3_ID or i == HAWK4_ID or i == FROLLHUTT_ID or i == FROLLVILLAGE_ID then
set ztarget[count] = u
set count = count + 1
endif
call GroupRemoveUnit(g, u)
endloop
call DisplayTimedTextToPlayer( Player(0), 0, 0, 6.00, ( "Units: " + I2S(count) ) )
call TriggerSleepAction( GetRandomReal(5.00, 15.00) )
// ===== Lightning 1 =====
call Lightning(chance,count)
// ===== Create New Plants =====
set area = udg_Area[GetRandomInt(1, 9)]
set x = GetRandomReal(GetRectMinX(area), GetRectMaxX(area))
set y = GetRandomReal(GetRectMinY(area), GetRectMaxY(area))
if Pathing(x,y) then
call Plants(x,y)
endif
call TriggerSleepAction( GetRandomReal(5.00, 15.00) )
// ===== Lightning 2 =====
call Lightning(chance,count)
// ===== Create New Plants =====
set area = udg_Area[GetRandomInt(1, 9)]
set x = GetRandomReal(GetRectMinX(area), GetRectMaxX(area))
set y = GetRandomReal(GetRectMinY(area), GetRectMaxY(area))
if Pathing(x,y) then
call Plants(x,y)
endif
call TriggerSleepAction( GetRandomReal(5.00, 15.00) )
// ===== Lightning 3 =====
call Lightning(chance,count)
// ===== Create New Plants =====
set area = udg_Area[GetRandomInt(1, 9)]
set x = GetRandomReal(GetRectMinX(area), GetRectMaxX(area))
set y = GetRandomReal(GetRectMinY(area), GetRectMaxY(area))
if Pathing(x,y) then
call Plants(x,y)
endif
call TriggerSleepAction( GetRandomReal(5.00, 15.00) )
// ===== Lightning 4 =====
call Lightning(chance,count)
// ===== Create New Plants =====
set area = udg_Area[GetRandomInt(1, 9)]
set x = GetRandomReal(GetRectMinX(area), GetRectMaxX(area))
set y = GetRandomReal(GetRectMinY(area), GetRectMaxY(area))
if Pathing(x,y) then
call Plants(x,y)
endif
// ===== Variable cleaning =====
set t = 0
loop
exitwhen t > count
set ztarget[t] = null
set t = t + 1
endloop
set flower=null
set u=null
// ===== Rain Duration =====
call TriggerSleepAction(time)
// ===== Reset the Fishes chance for Water Area =====
set udg_FishCaught[1] = 'n00A'
set udg_FishCaught[4] = 'n018'
set udg_FishCaught[23] = 'n00A'
set udg_FishCaught[26] = 'n018'
set udg_FishCaught[43] = 'n00A'
set udg_FishCaught[49] = 'n018'
set udg_FishCaught[61] = 'n018'
set udg_FishCaught[64] = 'n00A'
set udg_FishCaught[81] = 'n00A'
set udg_FishCaught[85] = 'n018'
// ===== Stop Rain Weather =====
call EnableWeatherEffect( udg_Rain_day, false )
set udg_Rain = false
set udg_MB_Weather = "Clear"
endfunction
endlibrary
[/code]

it started to bug, after i took off the lightning part from rain, and plants part from rain to put it into a private function to save repetition...
i am not sure why it doesn't want to work...
 
Level 19
Joined
Aug 8, 2007
Messages
2,765
first of all,

if (not ( == true)) then return false
->
if ( == false) then return false

Whats the compile error your getting?

also, you dont need the "public" prefix
 

ABM

ABM

Level 7
Joined
Jul 13, 2005
Messages
279
i just succeded it compiling,
there was many local that i transfered but didn't remove, and other stupid stuff like this...

about the error message maybe you can help me...
before i was using a version of jngp older wich was great, the back screen was black i think, and the error worked great...but i had to reinstall my computer

and i dled the new version of jngp the one they updated for jass class, the back screen is white... it is good to see the Bj, because red on white flash a lot...
but it doesn't support vjass anymore, library name get error, udg_variable get error, it is like an ocean of error, and in the middle of this i have to find the true error....
almost impossible, so i have to check myself without the help of syntax checker...
other problem is jass helper block each time he find an error while compiling...
search forever...so i have to close it manually, i don't know if it bug because of WEU, but the older version was working fine.

so basically i am blind and have to search manually for error.
i don't know if i didn't set the thing properly... but it is very annoying.
 
Status
Not open for further replies.
Top