XGM Forum
Сайт - Статьи - Проекты - Ресурсы - Блоги

Форуме в режиме ТОЛЬКО ЧТЕНИЕ. Вы можете задать вопросы в Q/A на сайте, либо создать свой проект или ресурс.
Вернуться   XGM Forum > Warcraft> Академия: форум для вопросов> Jass
Ник
Пароль
Войти через VK в один клик
Сайт использует только имя.

Закрытая тема
 
darkowlom
Анархо-коммунизм
offline
Опыт: 31,669
Активность:
Странная ошибка
function  FindIt takes nothing returns nothing
    if t == "helmet" then
          if GetDestructableTypeId(GetEnumDestructable()) == udg_ItemHelmet[id] then
              set InvItem = GetEnumDestructable()
          endif
    else
        if t == "misc" then
            if GetDestructableTypeId(GetEnumDestructable()) == udg_ItemMisc[id] then
                set InvItem = GetEnumDestructable()
            endif
        else
             if t == "ring" then
                   if GetDestructableTypeId(GetEnumDestructable()) == udg_ItemRing[id] then
                       set InvItem = GetEnumDestructable()
                   endif
             else 
                 if t == "shield" then
                      if GetDestructableTypeId(GetEnumDestructable()) == udg_ItemShield[id] then
                          set InvItem = GetEnumDestructable()
                      endif
                 else
                     if t == "shoulder"
                           if GetDestructableTypeId(GetEnumDestructable()) == udg_ItemShoulder[id] then
                               set InvItem = GetEnumDestructable()
                            endif
                     else 
                          if t == "torso" then
                                  if GetDestructableTypeId(GetEnumDestructable()) == udg_ItemTorso[id] then
                                      set InvItem = GetEnumDestructable()
                                  endif
                          else
                               if t == "weapon"
                                      if GetDestructableTypeId(GetEnumDestructable()) == udg_ItemWeapon[id] then
                                         set InvItem = GetEnumDestructable()
                             endif
                          endif
                      endif
                  endif
              endif
          endif
      endif  
  endif
endfunction
Вот этот код в редакторе сохраняет без ошибок, а карта не запускается вылетает на главный экран вар 1.26
добавляю в кастом код
т глобальная переменная типа текст
айди глобальная типи целочисленная
[+] замечание от Nerevar: Используйте теги форматирования кода

Отредактировано darkowlom, 28.03.2013 в 18:49.
Старый 28.03.2013, 18:41
Faion
Noblesse Oblige
offline
Опыт: 30,395
Активность:
Используйте конструкцию:
if()
{
}
elseif()
{
}
elseif()
{
}
InvItem = GetEnumDestructable()
можно было сделать 1 раз, в самом начале, зачем повторяться.
И вообще, где объявление 't'
Старый 28.03.2013, 18:57
darkowlom
Анархо-коммунизм
offline
Опыт: 31,669
Активность:
сейчас проверю с такой конструкцией
I
darkowlom добавил:
globals
    real angle
    player TPlayer = Player(0)
    unit hero = udg_Geroi[1]
    boolean key_UP = false
    boolean move_up_arrow = false
    boolean move_down_arrow = false
    boolean move_left_arrow = false
    boolean move_right_arrow = false
    boolean key_DOWN = false
    boolean key_RIGHT = false
    boolean key_LEFT = false
    boolean CanMove = true
    boolean Stand = false
    string t 
    integer id
    destructable InvItem = gg_dest_B01X_4093
endglobals

 тут много разного кода
 
function  FindItemInInv takes nothing returns nothing
    if t == "helmet" then
          if GetDestructableTypeId(GetEnumDestructable()) == udg_ItemHelmet[id] then
              set InvItem = GetEnumDestructable()
          endif
    elseif t == "misc" then
            if GetDestructableTypeId(GetEnumDestructable()) == udg_ItemMisc[id] then
                set InvItem = GetEnumDestructable()
            endif
        elseif t == "ring" then
                   if GetDestructableTypeId(GetEnumDestructable()) == udg_ItemRing[id] then
                       set InvItem = GetEnumDestructable()
                   endif
             elseif t == "shield" then
                      if GetDestructableTypeId(GetEnumDestructable()) == udg_ItemShield[id] then
                          set InvItem = GetEnumDestructable()
                      endif
                 elseif t == "shoulder"
                           if GetDestructableTypeId(GetEnumDestructable()) == udg_ItemShoulder[id] then
                               set InvItem = GetEnumDestructable()
                            endif
                     elseif t == "torso" then
                                  if GetDestructableTypeId(GetEnumDestructable()) == udg_ItemTorso[id] then
                                      set InvItem = GetEnumDestructable()
                                  endif
                          elseif t == "weapon"
                                      if GetDestructableTypeId(GetEnumDestructable()) == udg_ItemWeapon[id] then
                                         set InvItem = GetEnumDestructable()
                                    endif
                                endif
             endfunction
всеравно сразу на главный экран, я даже неуспеваю ее нигде вызвать
darkowlom добавил:
т обьявляется в другой функции которая вызыввает эту функцию, она работает как надо
Старый 28.03.2013, 19:24
IceFog

offline
Опыт: 6,486
Активность:
Зачем ты проверяешь чему равна строка, если в итоге делаешь одно и тоже?
Старый 28.03.2013, 19:58
darkowlom
Анархо-коммунизм
offline
Опыт: 31,669
Активность:
if GetDestructableTypeId(GetEnumDestructable()) == udg_ItemMisc[id] then
if GetDestructableTypeId(GetEnumDestructable()) == udg_ItemRing[id] then
отличие в этих и подобных строках надо чтоб как шлем не записало кольцо и тд
Старый 28.03.2013, 20:01
Goodie

offline
Опыт: 2,825
Активность:
darkowlom, id у тебя не меняется?
Старый 28.03.2013, 20:05
darkowlom
Анархо-коммунизм
offline
Опыт: 31,669
Активность:
меняется перед вызовом этой функции указывается перменная т и переменная ид
darkowlom добавил:
путем научного тыка установмл что ошибка в этой строке
set InvItem = GetEnumDestructable()
без нее карта загружается
Старый 28.03.2013, 20:12
ScorpioT1000
Работаем
online
Опыт: отключен
function  FindIt takes nothing returns nothing
    if t == "helmet" then
говнокод-с-однобуквенной-глобалкой-детектед
Старый 28.03.2013, 20:17
Goodie

offline
Опыт: 2,825
Активность:
ScorpioT1000, Опередил меня =/
darkowlom, Называй строки не буквами, а словами, или же буквами, но с приставкой триггера хотя бы
Старый 28.03.2013, 20:23
ScorpioT1000
Работаем
online
Опыт: отключен
function FindItemInInv takes nothing returns nothing
    if GetDestructableTypeId(GetEnumDestructable()) == udg_ItemHelmet[id] then
        set InvItem = GetEnumDestructable()
    elseif GetDestructableTypeId(GetEnumDestructable()) == udg_ItemMisc[id] then
        set InvItem = GetEnumDestructable()
    elseif GetDestructableTypeId(GetEnumDestructable()) == udg_ItemRing[id] then
        set InvItem = GetEnumDestructable()
    elseif GetDestructableTypeId(GetEnumDestructable()) == udg_ItemShield[id] then
        set InvItem = GetEnumDestructable()
    elseif GetDestructableTypeId(GetEnumDestructable()) == udg_ItemShoulder[id] then
        set InvItem = GetEnumDestructable()
    elseif GetDestructableTypeId(GetEnumDestructable()) == udg_ItemTorso[id] then
        set InvItem = GetEnumDestructable()
    elseif GetDestructableTypeId(GetEnumDestructable()) == udg_ItemWeapon[id] then
        set InvItem = GetEnumDestructable()
    else
        set InvItem = null
    endif
endfunction
Старый 28.03.2013, 20:42
darkowlom
Анархо-коммунизм
offline
Опыт: 31,669
Активность:
ScorpioT1000:
function FindItemInInv takes nothing returns nothing
    if GetDestructableTypeId(GetEnumDestructable()) == udg_ItemHelmet[id] then
        set InvItem = GetEnumDestructable()
    elseif GetDestructableTypeId(GetEnumDestructable()) == udg_ItemMisc[id] then
        set InvItem = GetEnumDestructable()
    elseif GetDestructableTypeId(GetEnumDestructable()) == udg_ItemRing[id] then
        set InvItem = GetEnumDestructable()
    elseif GetDestructableTypeId(GetEnumDestructable()) == udg_ItemShield[id] then
        set InvItem = GetEnumDestructable()
    elseif GetDestructableTypeId(GetEnumDestructable()) == udg_ItemShoulder[id] then
        set InvItem = GetEnumDestructable()
    elseif GetDestructableTypeId(GetEnumDestructable()) == udg_ItemTorso[id] then
        set InvItem = GetEnumDestructable()
    elseif GetDestructableTypeId(GetEnumDestructable()) == udg_ItemWeapon[id] then
        set InvItem = GetEnumDestructable()
    else
        set InvItem = null
    endif
endfunction
все неплохо только оно опять-таки не работает и ты потерял проверку строки
Старый 28.03.2013, 20:47
ScorpioT1000
Работаем
online
Опыт: отключен
Да, я такой растеря - постоянно что-то теряю в коде. А однажды целый фремворк потерял!
Старый 28.03.2013, 20:51
darkowlom
Анархо-коммунизм
offline
Опыт: 31,669
Активность:
и как, нашел?
darkowlom добавил:
Все тему можно закрывать заменил InvItem типа разрушаемый обьект на udg_InvItem типа декорация и все заработало, всем спасибо
Старый 28.03.2013, 21:17
Закрытая тема

Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск

Ваши права в разделе
Вы не можете создавать темы
Вы не можете отвечать на сообщения
Вы не можете прикреплять файлы
Вы можете скачивать файлы

BB-коды Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход



Часовой пояс GMT +3, время: 17:12.