Jump to content
Sign in to follow this  
Zmurik

Фея проверка слота

Recommended Posts

Кто поможет объяснить как сделать проверку феи,  что бы фею можно было только апать во втором слоте?

Share this post


Link to post
Share on other sites
local item_elf = GetChaItem(role, 2, 1) 
local Item_ID = GetItemID ( item_elf )

if id == blablabla then
	blablabla
else
	SystemNotice(role, "фея не во втором слоте")
	return 
end

Получаем предмет в слоте для феи, затем получаем ID и далее смотрим что нам нужно.


Делай добро и бросай его в воду

Share this post


Link to post
Share on other sites
local item = GetChaItem(role, 2, 1) 
local item_type = GetItemType(item)

if item_type == 59 then
	Notice("Во втором слоте есть фея.")
else
	Notice("Во втором слоте нет феи.")
end

 

@NMS3RR, проверять ID каждой феи не очень рационально. У всех фей есть общий тип предмета - 59, можно проверять его.

  • Like 2

Share this post


Link to post
Share on other sites
В 29.12.2017 в 04:46, V3ct0r сказал:

local item = GetChaItem(role, 2, 1) 
local item_type = GetItemType(item)

if item_type == 59 then
	Notice("Во втором слоте есть фея.")
else
	Notice("Во втором слоте нет феи.")
end

 

@NMS3RR, проверять ID каждой феи не очень рационально. У всех фей есть общий тип предмета - 59, можно проверять его.

А как сделать что бы если она не во втором слоте, то фрукт невозможно использовать? большое спасибо за помощь

Share this post


Link to post
Share on other sites
50 minutes ago, Zmurik said:

А как сделать что бы если она не во втором слоте, то фрукт невозможно использовать? большое спасибо за помощь

    local Item_bg = GetChaItem ( role , 2 , 1 )
    if Item_bg ~= Item_Traget then
        SystemNotice(role , "Item on second slot is a not fairy type. Cannot feed" ) 
        UseItemFailed ( role )
    end

OR

local item = GetChaItem(role, 2, 1) 
local item_type = GetItemType(item)

if item_type == 59 then
	Notice("Во втором слоте есть фея.")
else
	Notice("Во втором слоте нет феи.")
    UseItemFailed ( role )
end

 

  • Like 1

Share this post


Link to post
Share on other sites
22 часа назад, DangThao сказал:

    local Item_bg = GetChaItem ( role , 2 , 1 )
    if Item_bg ~= Item_Traget then
        SystemNotice(role , "Item on second slot is a not fairy type. Cannot feed" ) 
        UseItemFailed ( role )
    end

OR


local item = GetChaItem(role, 2, 1) 
local item_type = GetItemType(item)

if item_type == 59 then
	Notice("Во втором слоте есть фея.")
else
	Notice("Во втором слоте нет феи.")
    UseItemFailed ( role )
end

А куда нужно вставить этот скрипт?

Share this post


Link to post
Share on other sites
16 часов назад, Zmurik сказал:

А куда нужно вставить этот скрипт?

в функцию фрукта кормления естественно

в ItemEffect.lua добавь ограничитель этот ограничитель к каждому фрукту который используется на сервере, в начало функции

 

Share this post


Link to post
Share on other sites
2 часа назад, RedMAN сказал:

в функцию фрукта кормления естественно

в ItemEffect.lua добавь ограничитель этот ограничитель к каждому фрукту который используется на сервере, в начало функции

 

Ну я так и делал, но он просто пишет в систему Фея во втором слоте, фея не во втором слоте, скрипт V3ct0r, а кормит он в любому слоте

Share this post


Link to post
Share on other sites
В 29.12.2017 в 04:46, V3ct0r сказал:

local item = GetChaItem(role, 2, 1) 
local item_type = GetItemType(item)

if item_type == 59 then
	Notice("Во втором слоте есть фея.")
else
	Notice("Во втором слоте нет феи.")
end

 

@NMS3RR, проверять ID каждой феи не очень рационально. У всех фей есть общий тип предмета - 59, можно проверять его.

--Огромный Фрукт снежного дракона (ID 0276)
function ItemUse_CJ_longguo( role , Item , Item_Traget ) 
    local Cha_Boat = 0
    Cha_Boat = GetCtrlBoat ( role )
    if Cha_Boat ~= nil then 
        SystemNotice( role , "\205\229 \236\238\230\229\242 \225\251\242\252 \232\241\239\238\235\252\231\238\226\224\237\238, \234\238\227\228\224 \194\251 \226 \236\238\240\229" )
        UseItemFailed ( role ) 
        return 
    end
    
    local Item_type = GetItemType ( Item )
    local Item_Traget_Type = GetItemType ( Item_Traget )
    local Item_Num = GetItemID ( Item )
    local Check_Exp = 0
    local Elf_MaxEXP = GetItemAttr(Item_Traget,ITEMATTR_MAXENERGY)
    local item = GetChaItem(role, 2, 1) 
    local item_type = GetItemType(item)

    if item_type == 59 then
        Notice("Во втором слоте есть фея.")
    else
        Notice("Во втором слоте нет феи.")
    end
    
        local str = GetItemAttr(Item_Traget,ITEMATTR_VAL_STR)
        local con = GetItemAttr(Item_Traget,ITEMATTR_VAL_CON)
        local dex = GetItemAttr(Item_Traget,ITEMATTR_VAL_DEX)
        local agi = GetItemAttr(Item_Traget,ITEMATTR_VAL_AGI)
        local sta = GetItemAttr(Item_Traget,ITEMATTR_VAL_STA)
        local elf_lvl = str + con + agi + dex + sta
        if elf_lvl >= 100 and elf_lvl <= 99999999999 then
            SystemNotice(role , "\221\242\238\242 \244\240\243\234\242 \236\238\230\237\238 \232\241\239\238\235\252\231\238\226\224\242\252 \242\238\235\252\234\238 \228\235\255 \244\229\233 \236\229\237\252\248\229 101 \243\240\238\226\237\255." )
            UseItemFailed ( role )
            return
        end

    if Item_type == 58 and Item_Traget_Type == 59 then
            Check_Exp = CheckElf_EXP ( role , Item_Traget )
            if Check_Exp == 0 then
                SystemNotice(role , "\208\238\241\242 \244\229\232 \237\229 \228\238\241\242\232\227 \236\224\234\241\232\236\243\236\224. \205\229\226\238\231\236\238\230\237\238 \239\238\234\238\240\236\232\242\252 \244\229\254 \212\240\243\234\242\238\236 \209\237\229\230\237\238\227\238 \196\240\224\234\238\237\224" ) 
                UseItemFailed ( role )
            else
            Lvup_Str_1 ( role , Item_Num , Item_Traget )
            end 
    end 
end

 

Share this post


Link to post
Share on other sites

Помог скрипт V3ct0r

 

Добавить после строк, в файле в ItemEffect.lua в каждый фрукт в который вам нужно, что бы апал фею только во втором слоте.
local Elf_MaxEXP = GetItemAttr(Item_Traget,ITEMATTR_MAXENERGY)

local item = GetChaItem(role, 2, 1)

if (item ~= Item_Traget ) then
 UseItemFailed(role)
 return
end

 

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