Jump to content
Java Hacker

Help Reset Pet Card

Recommended Posts

When I'm going to use a card to reboot my system normally but somehow the cap I'm using.

what could it be?

I'll leave the script down:

-----------------------------------------------

-- ItemEffect.lua

 

function Item_Use_respet(role,Item)

    local Cha_Boat = 0
    Cha_Boat = GetCtrlBoat ( role )
    if Cha_Boat ~=  nil then
        SystemNotice( role , "Cannot use while sailing!" )
        UseItemFailed ( role )
        return
    end

    local Item_CanGet = GetChaFreeBagGridNum ( role )
     if Item_CanGet < 1 then
        SystemNotice(role ,"You need at least 1 empty inventory slots!")
        UseItemFailed ( role )
        return
    end

    local Pet_Card = GetChaItem(role, 2, 0)
    local Pet_Name = GetItemName(GetItemID(Pet_Card))
    local Pet_ID   = GetItemType2(GetItemID(Pet_Card))
    local Item_ID  = GetItemID(Item)
    if(Pet_Card == nil)then
        SystemNotice(role,"Pet should be in the 1st Inventory Slot for reset.")
        UseItemFailed ( role )
        return
    end
    if Item_ID == 8560 then

        if(Pet_ID == 59)then

            GiveItem(role, 0,GetItemID(Pet_Card),1,4)            
            RemoveChaItem(role ,GetItemID(Pet_Card),0,0,0,2,1 )    
            SystemNotice(role,"Successfully Reset this Pet "..Pet_Name.."!")

        else
                    SystemNotice(role,"Only for Pet can be used the Pet Card Reset!")
                    UseItemFailed ( role )
            return
        end

        end

end

 

-- ItemInfo.txt

 

8560    Reset Pet Card    n0184    10130005    0    0    0    0    0    0    0    0    0    0    0    0    1    1    1    1    99    0    500000    -1,-2,-2,-2    0    -1,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2,-2    0    0    -1,-2,-2,-2,-2,-2,-2,-2,-2,-2    -1,-2,-2,-2,-2,-2,-2,-2,-2,-2    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0,0    0    0,0    0,0    0    0    0    0    0    0    0    0    0    Item_Use_respet    0    0    0    0,0    0,0    0,0    To restore your pet to level zero you need to put the pet in the first slot of the bag and double-click the Resest Pet Card!    0                                                                                                                                                                                                                                                                                                                                                                                    

  • Thanks 1

Share this post


Link to post
Share on other sites

Hello @Java Hacker!

 

First thing, before posting your scripts we have a option to add a code to topics, just click the red mark i showed on picture on text box and select programming language.

About your scripts, we got wrong params on RemoveChaItem that's why your helm (slot 0) being removed when using the item. I've fixed it for u, take comparision between mine codes and ur and see what u did wrong.

 

function ItemUse_respet(role,Item)
    local Cha_Boat          = 0
    Cha_Boat                = GetCtrlBoat(role)
    if Cha_Boat ~= nil then
        SystemNotice(role, "Cannot use while sailing!")
        UseItemFailed(role)
        return
    end

    local fairy             = GetChaItem(role, 2, 1)
    if fairy == nil then
        SystemNotice(role, "Your fairy must be in 2nd Inventory Slot in order.")
        UseItemFailed(role)
        return
    end

    if GetItemType(fairy) == 59 then
		local fairyId		= GetItemID(fairy)
		local fairyName		= GetItemName(fairyId)
		BickerNotice(role, "Your fairy was succesfully reseted to Lv0!")
		GiveItem(role, 0, fairyId, 1, 4)
		local takeFairy		= RemoveChaItem(role, fairyID, 1, 2, 1, 2, 1, 1)
		if takeFairy ~= 1 then
			SystemNotice(role, "Failed to remove fairy!")
			UseItemFailed(role)
			return
		end		
	else
		SystemNotice(role, "Item on 2nd Inventory Slot is not a fairy.")
		UseItemFailed(role)
		return
    end
end

 

Screenshot_2.png

  • Thanks 1

lelouch_signature_by_vahntheknight-d4uafwj.png

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.


×
×
  • Create New...