Jump to content
Sign in to follow this  
Graf

Авто-фрукты?

Recommended Posts

Наверняка эта тема уже где-то появлялась, но толкового ответа я нигде не нашел. Как сделать автоматическое питание фруктами?

Share this post


Link to post
Share on other sites

Необходимо написать функцию, и поместить её в cha_timer(), сама функция должна выглядеть примерно так:

  1. Проверяем, фея ли находится во втором слоте;
    *Можно ещё вставить проверку на выносливость феи, за это отвечает параметр ITEMATTR_URE
  2. Проверяем, есть ли необходимый фрукт;
  3. В условии необходимо указать параметры: 
    TakeItem() - необходимо забрать один фрукт - за один ап феи
    Lvup_ТИП - функция апает 1 лвл феи, вместо типа необходимо указывать параметр (str, con, dex, sta, agi)
    Lvup_ТИП_1 - полная аналогия фрукта +1 (см. выше), только апает сразу 2 лвл фее.

Примерно так, только напиши это все на языке lua, и будет тебе счастье (если что: http://www.lua.ru/doc/). :smile:

 

  • Like 1

Share this post


Link to post
Share on other sites

В Cha_timer после 

function cha_timer(role, freq, time)
 
	local resume_freq = 5 
	local now_tick = GetChaParam(role, 1) 
	local is_role_living = -1
	SetChaParam(role, 1, now_tick + freq * time)

вставь 

local Item_bg1 = GetChaItem ( role , 2 , 1  ) 
		local Get_Item_Type1 = GetItemType ( Item_bg1 ) 
		local ItemUse_siliao1 = GetChaItem ( role , 2 , 2  ) -- 3-ий слот
		local ItemUse_siliao_ID1 = GetItemID ( ItemUse_siliao1 ) 

   if Get_Item_Type1 == 59 then 
        local Elf_MEXP = GetItemAttr( Item_bg1 ,ITEMATTR_MAXENERGY ) 
        local Elf_EXP = GetItemAttr( Item_bg1 ,ITEMATTR_ENERGY ) 
        local Num_JLone = GetItemForgeParam ( Item_bg1 , 1 ) 
        local Part1_JLone = GetNum_Part1 ( Num_JLone ) 
        if Elf_EXP>=Elf_MEXP and ItemUse_siliao_ID1==276 then --ID Fruit STR 
         local j = TakeItem(  role,0,276,1) 
         if j==0 then 
          SystemNotice ( role , "Deleting of Fruit failed!" ) 
         else 
          SystemNotice ( role , "Automatic Pet Lv Up successful." ) 
          Lvup_Str_1 ( role , Item_Num , Item_bg1 ) --Great STR 
         end 
        elseif  Elf_EXP>=Elf_MEXP and ItemUse_siliao_ID1==277 then --ID Fruit AGI 
         local j = TakeItem(  role,0,277,1) 
         if j==0 then 
          SystemNotice ( role , "Deleting of Fruit failed!" ) 
         else 
          SystemNotice ( role , "Automatic Pet Lv Up successful." ) 
          Lvup_Agi_1 ( role , Item_Num , Item_bg1 ) --Great AGI 
         end 
        elseif  Elf_EXP>=Elf_MEXP and ItemUse_siliao_ID1==278 then --ID Fruit DEX 
         local j = TakeItem(  role,0,278,1) 
         if j==0 then 
          SystemNotice ( role , "Deleting of Fruit failed!" ) 
         else 
          SystemNotice ( role , "Automatic Pet Lv Up successful." ) 
          Lvup_Dex_1 ( role , Item_Num , Item_bg1 ) --Great DEX(Auto Great Zephyr Fish Floss) 
         end 
        elseif  Elf_EXP>=Elf_MEXP and ItemUse_siliao_ID1==279 then --ID Fruit CON 
         local j = TakeItem(  role,0,279,1) 
         if j==0 then 
          SystemNotice ( role , "Deleting of Fruit failed!" ) 
         else 
          SystemNotice ( role , "Automatic Pet Lv Up successful." ) 
          Lvup_Con_1 ( role , Item_Num , Item_bg1 ) --Great CON 
         end 
        elseif  Elf_EXP>=Elf_MEXP and ItemUse_siliao_ID1==280 then --ID Fruit STA 
         local j = TakeItem(  role,0,280,1) 
         if j==0 then 
          SystemNotice ( role , "Deleting of Fruit failed!" ) 
         else 
          SystemNotice ( role , "Automatic Pet Lv Up successful." ) 
          Lvup_Sta_1 ( role , Item_Num , Item_bg1 ) --Great STA 
         end 
        end 
   end 

и будет счастье

  • Like 1

Share this post


Link to post
Share on other sites

В целом и сам разобрался))

Вот еще +1 фрукты

        elseif  Elf_EXP>=Elf_MEXP and ItemUse_siliao_ID1==222 then --ID Fruit STR
         local j = TakeItem(  role,0,222,1) 
         if j==0 then 
          SystemNotice ( role , "Не удалось использвать фрукт! " ) 
         else 
          SystemNotice ( role , "Уровень феи автоматически увеличен. " ) 
          Lvup_Str ( role , Item_Num , Item_bg1 ) --STR 
         end 
		 elseif  Elf_EXP>=Elf_MEXP and ItemUse_siliao_ID1==223 then --ID Fruit AGI 
         local j = TakeItem(  role,0,223,1) 
         if j==0 then 
          SystemNotice ( role , "Не удалось использвать фрукт! " ) 
         else 
          SystemNotice ( role , "Уровень феи автоматически увеличен. " ) 
          Lvup_Agi ( role , Item_Num , Item_bg1 ) --AGI 
         end 
		 elseif  Elf_EXP>=Elf_MEXP and ItemUse_siliao_ID1==224 then --ID Fruit ACC 
         local j = TakeItem(  role,0,224,1) 
         if j==0 then 
          SystemNotice ( role , "Не удалось использвать фрукт! " ) 
         else 
          SystemNotice ( role , "Уровень феи автоматически увеличен. " ) 
          Lvup_Dex ( role , Item_Num , Item_bg1 ) --ACC
         end 
		 elseif  Elf_EXP>=Elf_MEXP and ItemUse_siliao_ID1==225 then --ID Fruit CON 
         local j = TakeItem(  role,0,225,1) 
         if j==0 then 
          SystemNotice ( role , "Не удалось использвать фрукт! " ) 
         else 
          SystemNotice ( role , "Уровень феи автоматически увеличен. " ) 
          Lvup_Con ( role , Item_Num , Item_bg1 ) --CON 
         end 
		 elseif  Elf_EXP>=Elf_MEXP and ItemUse_siliao_ID1==226 then --ID Fruit STA 
         local j = TakeItem(  role,0,226,1) 
         if j==0 then 
          SystemNotice ( role , "Не удалось использвать фрукт! " ) 
         else 
          SystemNotice ( role , "Уровень феи автоматически увеличен. " ) 
          Lvup_Sta ( role , Item_Num , Item_bg1 ) --STA 
         end 

 

Edited by Graf
  • Like 1

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Sign in to follow this  

×
×
  • Create New...