• 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.

[JASS] Where is the mistake??? pls help

Status
Not open for further replies.
Level 2
Joined
Oct 2, 2007
Messages
8
Hi
pls help me to find the mistake. Even Jasscraft doesnt find anything but the we shuts down when i try to test the map.
thx

JASS:
globals 
    integer array playertierlvl
endglobals  
function settierlvl takes player pl returns nothing
  if GetUnitName(GetTriggerUnit()) == "custom_O005" then
  set playertierlvl[GetPlayerId(pl)] = 1
  endif
  if GetUnitName(GetTriggerUnit()) == "custom_H000" then
  set playertierlvl[GetPlayerId(pl)] = 0
  endif
endfunction
function gettierlvl takes player pl returns string
  local string tierlvlu
  if playertierlvl[GetPlayerId(pl)] == 1 then
  set tierlvlu = "custom_O000"
  endif
  if playertierlvl[GetPlayerId(pl)] == 0 then
  set tierlvlu = "custom_H002"
  endif
  return tierlvlu
endfunction  
function tier1spawn takes player pl returns nothing
   if IsPlayerSlotState(pl, PLAYER_SLOT_STATE_PLAYING) == true then 
   call CreateNUnitsAtLoc( 1, UnitId(gettierlvl(pl)),pl, GetPlayerStartLocationLoc(pl), bj_UNIT_FACING )
   endif
endfunction
function spawn takes nothing returns nothing
  call tier1spawn(Player(0))
  call tier1spawn(Player(1))
  call tier1spawn(Player(2))
  call tier1spawn(Player(3))
  call tier1spawn(Player(4))
  call tier1spawn(Player(5))
  call tier1spawn(Player(6))
  call tier1spawn(Player(7))
  call tier1spawn(Player(8))
  call tier1spawn(Player(9))
  call tier1spawn(Player(10))
  call tier1spawn(Player(11)) 
endfunction

glhf
 
Level 2
Joined
Oct 2, 2007
Messages
8
i dont know how to get the ids from custom units and there should spawn several units not only footys(e.g) so i thougt this should be the best idea
 
Level 2
Joined
Oct 2, 2007
Messages
8
when i use the unitid instead of the name the we doestn shut off and load the game but it doesnt start the map.
Here i made a screen of the errors(sry 4 german version)
my.php
 
Level 2
Joined
Oct 2, 2007
Messages
8
Ok i found all mistakes.
first where the map triggers(gui) not correct.
i wrote 'O000' istead of 'o000'
and the thing with the global was not working so i made the variable with gui.
now it looks like this
JASS:
function settierlvl takes nothing returns nothing
    local unit u1 = GetTriggerUnit()
    local integer uid1 = GetUnitTypeId(u1) 
    local player pl = GetOwningPlayer(u1)
    if GetUnitTypeId(u1) == 'h001' then
    set udg_playertierlvl[GetPlayerId(pl)] = 0
    endif
    if uid1 == 'o005' then//goomba tier 1
    set udg_playertierlvl[GetPlayerId(pl)] = 1
    endif
    if uid1 == 'o006' then//goomba tier 2
    set udg_playertierlvl[GetPlayerId(pl)] = 2
    endif
    if uid1 == 'o007' then//goomba tier3
    set udg_playertierlvl[GetPlayerId(pl)] = 3
    endif
    if uid1 == 'o001' then//goomba tier 4
    set udg_playertierlvl[GetPlayerId(pl)] = 4
    endif
    if uid1 == 'u005' then//BOO tier 1
    set udg_playertierlvl[GetPlayerId(pl)] = 5
    endif
    if uid1 == 'u006' then//BOO tier 2
    set udg_playertierlvl[GetPlayerId(pl)] = 6
    endif
    if uid1 == 'u007' then//BOO tier3
    set udg_playertierlvl[GetPlayerId(pl)] = 7
    endif
    if uid1 == 'u004' then//BOO tier 4
    set udg_playertierlvl[GetPlayerId(pl)] = 8
    endif
endfunction
function gettierlvl takes player pl returns string
    local string tierlvlu
    if udg_playertierlvl[GetPlayerId(pl)] == 0 then
    set tierlvlu = "custom_H002"
    endif
    if udg_playertierlvl[GetPlayerId(pl)] == 1 then
    set tierlvlu = "custom_O000"//gommba lvl1
    endif
    if udg_playertierlvl[GetPlayerId(pl)] == 2 then
    set tierlvlu = "custom_O002"//gommba lvl2
    endif
    if udg_playertierlvl[GetPlayerId(pl)] == 3 then
    set tierlvlu = "custom_O003"//gommba lvl3
    endif
    if udg_playertierlvl[GetPlayerId(pl)] == 4 then
    set tierlvlu = "custom_O004"//gommba lvl4
    endif
    if udg_playertierlvl[GetPlayerId(pl)] == 5 then
    set tierlvlu = "custom_u001"//boo lvl1
    endif
    if udg_playertierlvl[GetPlayerId(pl)] == 6 then
    set tierlvlu = "custom_u002"//boo lvl2
    endif
    if udg_playertierlvl[GetPlayerId(pl)] == 7 then
    set tierlvlu = "custom_u003"//boo lvl3
    endif
    if udg_playertierlvl[GetPlayerId(pl)] == 8 then
    set tierlvlu = "custom_u000"//boo lvl4
    endif
    return tierlvlu
endfunction
function unitspawn takes player pl returns nothing
    local string unitstrr 
    if IsPlayerSlotState(pl, PLAYER_SLOT_STATE_PLAYING) == true then
    set unitstrr = gettierlvl(pl)
    call CreateNUnitsAtLoc( 1,String2UnitIdBJ(unitstrr) ,pl, GetPlayerStartLocationLoc(pl), 234 )
    endif
endfunction
function spawn takes nothing returns nothing
    call unitspawn(Player(0))
    call unitspawn(Player(1))
    call unitspawn(Player(2))
    call unitspawn(Player(3))
    call unitspawn(Player(4))
    call unitspawn(Player(5))
    call unitspawn(Player(6))
    call unitspawn(Player(7))
    call unitspawn(Player(8))
    call unitspawn(Player(9))
    call unitspawn(Player(10))
    call unitspawn(Player(11))
endfunction

thx for ur help
 
Level 40
Joined
Dec 14, 2005
Messages
10,532
Here's a cleaner version for you;

JASS:
function settierlvl takes nothing returns nothing
    local integer uid = GetUnitTypeId(GetTriggerUnit()) 
    local integer id = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
    if uid == 'h001' then
        set udg_playertierlvl[id] = 0
    elseif uid == 'o005' then//goomba tier 1
        set udg_playertierlvl[id] = 1
    elseif uid == 'o006' then//goomba tier 2
        set udg_playertierlvl[id] = 2
    elseif uid == 'o007' then//goomba tier3
        set udg_playertierlvl[id] = 3
    elseif uid == 'o001' then//goomba tier 4
        set udg_playertierlvl[id] = 4
    elseif uid == 'u005' then//BOO tier 1
        set udg_playertierlvl[id] = 5
    elseif uid == 'u006' then//BOO tier 2
        set udg_playertierlvl[id] = 6
    elseif uid == 'u007' then//BOO tier3
        set udg_playertierlvl[id] = 7
    elseif uid == 'u004' then//BOO tier 4
        set udg_playertierlvl[id] = 8
    endif
endfunction
function gettierlvl takes integer id returns integer
    if udg_playertierlvl[id] == 0 then
        return 'H002'
    elseif udg_playertierlvl[id] == 1 then
        return 'O000'
    elseif udg_playertierlvl[id] == 2 then
        return 'O002'
    elseif udg_playertierlvl[id] == 3 then
        return 'O003'
    elseif udg_playertierlvl[id] == 4 then
        return 'O004'
    elseif udg_playertierlvl[id] == 5 then
        return 'u001'
    elseif udg_playertierlvl[id] == 6 then
        return 'u002'
    elseif udg_playertierlvl[id] == 7 then
        return 'u003'
    elseif udg_playertierlvl[id] == 8 then
        return 'u000'
    endif
    return 0
endfunction
function unitspawn takes player p returns nothing
    if IsPlayerSlotState(p, PLAYER_SLOT_STATE_PLAYING) then
        call CreateUnit( p, gettierlvl(GetPlayerId(p)), GetPlayerStartLocationX(p),GetPlayerStartLocationY(p), 234 )
    endif
endfunction
function spawn takes nothing returns nothing
    local integer i = 0
    loop
        exitwhen i > 11
        call unitspawn(Player(i))
        set i = i + 1
    endloop
endfunction

JASS:
function settierlvl takes nothing returns nothing
    local integer uid = GetUnitTypeId(GetTriggerUnit()) 
    local integer id = GetPlayerId(GetOwningPlayer(GetTriggerUnit()))
    if uid == 'h001' then
        set udg_playertierlvl[id] = 0
    elseif uid == 'o005' then//goomba tier 1
        set udg_playertierlvl[id] = 1
    elseif uid == 'o006' then//goomba tier 2
        set udg_playertierlvl[id] = 2
    elseif uid == 'o007' then//goomba tier3
        set udg_playertierlvl[id] = 3
    elseif uid == 'o001' then//goomba tier 4
        set udg_playertierlvl[id] = 4
    elseif uid == 'u005' then//BOO tier 1
        set udg_playertierlvl[id] = 5
    elseif uid == 'u006' then//BOO tier 2
        set udg_playertierlvl[id] = 6
    elseif uid == 'u007' then//BOO tier3
        set udg_playertierlvl[id] = 7
    elseif uid == 'u004' then//BOO tier 4
        set udg_playertierlvl[id] = 8
    endif
endfunction
function gettierlvl takes integer id returns integer
    if udg_playertierlvl[id] == 0 then
        return 'H002'
    elseif udg_playertierlvl[id] == 1 then
        return 'O000'
    elseif udg_playertierlvl[id] == 2 then
        return 'O002'
    elseif udg_playertierlvl[id] == 3 then
        return 'O003'
    elseif udg_playertierlvl[id] == 4 then
        return 'O004'
    elseif udg_playertierlvl[id] == 5 then
        return 'u001'
    elseif udg_playertierlvl[id] == 6 then
        return 'u002'
    elseif udg_playertierlvl[id] == 7 then
        return 'u003'
    elseif udg_playertierlvl[id] == 8 then
        return 'u000'
    endif
    return 0
endfunction
function spawn takes nothing returns nothing
    local integer i = 0
    local player p
    loop
        exitwhen i > 11
        set p = Player(i)
        if IsPlayerSlotState(p, PLAYER_SLOT_STATE_PLAYING) then
            call CreateUnit(p, gettierlvl(GetPlayerId(p)), GetPlayerStartLocationX(p),GetPlayerStartLocationY(p), 234)
        endif
        set i = i + 1
    endloop
    set p = null
endfunction
 
Level 2
Joined
Oct 2, 2007
Messages
8
wow thx. since this was my first script i was very happy when it run and i dont even had the idea to make it better.
thx
 
Status
Not open for further replies.
Top