Сейчас 19:29:54 Четверг, 28 марта, 2024 год
[ x ] Главная ⇒ Форум ⇐ RSS Файлы Cтатьи Картинки В о й т и   или   з а р е г и с т р и р о в а т ь с я


[ Новые сообщения · Участники · Правила форума · Поиск · RSS ]
  • Страница 1 из 1
  • 1
Модератор форума: PUVer, SirNikolas, Ty3uK  
Форум о Warcraft 3 » Раздел для картостроителей » GUI / Jass » Вопрос.
Вопрос.
YaponeZzZДата: Воскресенье, 15 Мая 2011, 22:28:49 | Сообщение # 1
SW Hero
Группа: Проверенные
Сообщений: 658
Награды: 2
Репутация: 193
Блокировки:
Почему не запускается карта с этим кодом, когда он в коде карты?
Code

function H2I takes handle h returns integer
      return h
      return 0
endfunction

function LocalVars takes nothing returns gamecache
      if udg_RSCache == null then
          set udg_RSCache = InitGameCache("jasslocalvars.w3v")
      endif
      return udg_RSCache
endfunction

function SetHandleInt takes handle subject, string name, integer value returns nothing
      if value==0 then
          call FlushStoredInteger(LocalVars(),I2S(H2I(subject)),name)
      else
          call StoreInteger(LocalVars(), I2S(H2I(subject)), name, value)
      endif
endfunction

function SetHandleString takes handle subject, string name, string value returns nothing
      if value==null then
          call FlushStoredString(LocalVars(), I2S(H2I(subject)), name)
      else
          call StoreString(LocalVars(), I2S(H2I(subject)), name, value)
      endif
endfunction

function GetHandleInt takes handle subject, string name returns integer
      return GetStoredInteger(LocalVars(), I2S(H2I(subject)), name)
endfunction

function GetHandleString takes handle subject, string name returns string
      return GetStoredString(LocalVars(), I2S(H2I(subject)), name)
endfunction

function FlushHandleLocals takes handle subject returns nothing
      call FlushStoredMission(LocalVars(), I2S(H2I(subject)) )
endfunction

function RecipeSysCon takes nothing returns boolean
      local trigger RecipeSysExe = GetTriggeringTrigger()
      local unit triggerer = GetTriggerUnit()
      local integer r = GetHandleInt(RecipeSysExe,"r")
      local integer a = GetHandleInt(RecipeSysExe,"a")
      local integer b = GetHandleInt(RecipeSysExe,"b")
      local integer c = GetHandleInt(RecipeSysExe,"c")
      local integer d = GetHandleInt(RecipeSysExe,"d")
      local integer e = GetHandleInt(RecipeSysExe,"e")
      local integer f = GetHandleInt(RecipeSysExe,"f")
      local string p = GetHandleString(RecipeSysExe,"p")
      local string t = GetHandleString(RecipeSysExe,"t")
      local integer pickedSlot = 0
      local item pickedItem
      local integer sum = GetHandleInt(RecipeSysExe,"sum")
      local integer count = 0
        
      loop
          exitwhen pickedSlot > 5
          set pickedItem = UnitItemInSlot(triggerer,pickedSlot)
          if GetItemTypeId(pickedItem) == a and pickedItem != null then
              set count = count + 1
              exitwhen true
          endif
          set pickedSlot= pickedSlot + 1
      endloop
        
      set pickedSlot = 0
      loop
          exitwhen pickedSlot > 5
          set pickedItem = UnitItemInSlot(triggerer,pickedSlot)
          if GetItemTypeId(pickedItem) == b and pickedItem != null then
              set count = count + 1
              exitwhen true
          endif
          set pickedSlot= pickedSlot + 1
      endloop
        
      set pickedSlot = 0
      loop
          exitwhen pickedSlot > 5
          set pickedItem = UnitItemInSlot(triggerer,pickedSlot)
          if GetItemTypeId(pickedItem) == c and pickedItem != null then
              set count = count + 1
              exitwhen true
          endif
          set pickedSlot= pickedSlot + 1
      endloop
        
      set pickedSlot = 0
      loop
          exitwhen pickedSlot > 5
          set pickedItem = UnitItemInSlot(triggerer,pickedSlot)
          if GetItemTypeId(pickedItem) == d and pickedItem != null then
              set count = count + 1
              exitwhen true
          endif
          set pickedSlot= pickedSlot + 1
      endloop
        
      set pickedSlot = 0
      loop
          exitwhen pickedSlot > 5
          set pickedItem = UnitItemInSlot(triggerer,pickedSlot)
          if GetItemTypeId(pickedItem) == e and pickedItem != null then
              set count = count + 1
              exitwhen true
          endif
          set pickedSlot= pickedSlot + 1
      endloop
        
      set pickedSlot = 0
      loop
          exitwhen pickedSlot > 5
          set pickedItem = UnitItemInSlot(triggerer,pickedSlot)
          if GetItemTypeId(pickedItem) == f and pickedItem != null then
              set count = count + 1
              exitwhen true
          endif
          set pickedSlot= pickedSlot + 1
      endloop
        
      if count == sum then
          set pickedSlot = 0
          loop
              exitwhen pickedSlot > 5
              set pickedItem = UnitItemInSlot(triggerer,pickedSlot)
              if GetItemTypeId(pickedItem) == a and pickedItem != null then
                 call UnitRemoveItem(triggerer,pickedItem)
                 call RemoveItem(pickedItem)
                 exitwhen true
              endif
              set pickedSlot= pickedSlot + 1
          endloop
        
          set pickedSlot = 0
          loop
              exitwhen pickedSlot > 5
              set pickedItem = UnitItemInSlot(triggerer,pickedSlot)
              if GetItemTypeId(pickedItem) == b and pickedItem != null then
                 call UnitRemoveItem(triggerer,pickedItem)
                 call RemoveItem(pickedItem)
                  exitwhen true
              endif
              set pickedSlot= pickedSlot + 1
          endloop
        
          set pickedSlot = 0
          loop
              exitwhen pickedSlot > 5
              set pickedItem = UnitItemInSlot(triggerer,pickedSlot)
              if GetItemTypeId(pickedItem) == c and pickedItem != null then
                 call UnitRemoveItem(triggerer,pickedItem)
                 call RemoveItem(pickedItem)
                  exitwhen true
              endif
              set pickedSlot= pickedSlot + 1
          endloop
        
          set pickedSlot = 0
          loop
             exitwhen pickedSlot > 5
              set pickedItem = UnitItemInSlot(triggerer,pickedSlot)
              if GetItemTypeId(pickedItem) == d and pickedItem != null then
                 call UnitRemoveItem(triggerer,pickedItem)
                 call RemoveItem(pickedItem)
                  exitwhen true
              endif
              set pickedSlot= pickedSlot + 1
          endloop
        
          set pickedSlot = 0
          loop
              exitwhen pickedSlot > 5
              set pickedItem = UnitItemInSlot(triggerer,pickedSlot)
              if GetItemTypeId(pickedItem) == e and pickedItem != null then
                 call UnitRemoveItem(triggerer,pickedItem)
                 call RemoveItem(pickedItem)
                  exitwhen true
              endif
              set pickedSlot= pickedSlot + 1
          endloop
        
          set pickedSlot = 0
          loop
              exitwhen pickedSlot > 5
              set pickedItem = UnitItemInSlot(triggerer,pickedSlot)
              if GetItemTypeId(pickedItem) == f and pickedItem != null then
                  call UnitRemoveItem(triggerer,pickedItem)
                  call RemoveItem(pickedItem)
                  exitwhen true
              endif
              set pickedSlot= pickedSlot + 1
          endloop
          call UnitAddItemById(triggerer,r)   
          call DestroyEffect(AddSpecialEffectTarget(t,triggerer,p))
      endif

          set pickedItem = null
          set triggerer = null
          set RecipeSysExe = null

          return true
endfunction

function RecipeSysSet takes integer r,integer a,integer b,integer c,integer d,integer e,integer f, string p, string t returns nothing
      local trigger RecipeSysExe = CreateTrigger()
      local boolexpr RecipeSysCondition = Condition(function RecipeSysCon)
      local integer sum = 0

      call TriggerRegisterAnyUnitEventBJ(RecipeSysExe,EVENT_PLAYER_UNIT_PICKUP_ITEM)
        
      if r != 0 then   
          call SetHandleInt(RecipeSysExe,"r",r)
          if a != 0 then
              call SetHandleInt(RecipeSysExe,"a",a)
              set sum = sum + 1
          endif
          if b != 0 then
              call SetHandleInt(RecipeSysExe,"b",b)
              set sum = sum + 1
          endif
          if c != 0 then
              call SetHandleInt(RecipeSysExe,"c",c)
              set sum = sum + 1
          endif
          if d != 0 then
              call SetHandleInt(RecipeSysExe,"d",d)
              set sum = sum + 1
          endif
          if e != 0 then
              call SetHandleInt(RecipeSysExe,"e",e)
              set sum = sum + 1
          endif
          if f != 0 then
              call SetHandleInt(RecipeSysExe,"f",f)
              set sum = sum + 1
          endif
          call SetHandleInt(RecipeSysExe,"sum",sum)
          call SetHandleString(RecipeSysExe,"p",p)
          call SetHandleString(RecipeSysExe,"t",t)
          call TriggerAddCondition(RecipeSysExe,RecipeSysCondition)
      else
          call DisableTrigger(RecipeSysExe)
          call DestroyTrigger(RecipeSysExe)
      endif
      set RecipeSysExe = null
      set RecipeSysCondition = null
endfunction




Сообщение отредактировал YaponeZzZ - Воскресенье, 15 Мая 2011, 22:29:16
 

KartohaДата: Воскресенье, 15 Мая 2011, 23:42:09 | Сообщение # 2
10 уровень
Группа: Ветераны
Сообщений: 2851
Награды: 1
Блокировки:
YaponeZzZ, потому что в нем используется RB (ретурн баг), который пофиксин близзами в версиях варкрафта начиная с 1.24. Иными словами, карта с этим кодом будет запускаться только в варике версии ниже 1.24.

Сообщение отредактировал Kartoha - Воскресенье, 15 Мая 2011, 23:48:27
 

YaponeZzZДата: Понедельник, 16 Мая 2011, 00:06:06 | Сообщение # 3
SW Hero
Группа: Проверенные
Сообщений: 658
Награды: 2
Репутация: 193
Блокировки:
Ок, спасибо. +rep.
Уже нашёл как раз другую систему. Тему можно закрыть.


 

Форум о Warcraft 3 » Раздел для картостроителей » GUI / Jass » Вопрос.
  • Страница 1 из 1
  • 1
Поиск:

Copyright © 2006 - 2024 Warcraft3FT.info При копировании материалов c сайта ставьте, пожалуйста, активную обратную ссылку на нас • Design by gReeB04ki ©
Хостинг от uCoz