Jump to content
Sign in to follow this  
Sharshabel

Chest Scrtipts

Recommended Posts

any one have chest script  function

(this chest need spesific item on inventory to open) ? 

for example if i have 3 kals i can open the chest 

 


i tryed to study fairy coin chest but it`s hard a bit 

 

any hand here ! 

 

 

Edited by Sharshabel

Share this post


Link to post
Share on other sites

just add this line in ur script

local i= CheckBagItem( role, RequiredItemID )                                                
	if i <=0 then
		SystemNotice(  role , "ANY FAIL MESSAGE")
		UseItemFailed ( role )
		return LUA_FALSE
	end

and don't forget add line with Deleting required item after open

local s = DelBagItem ( role , ITEMTO_DELETE , 1 ) 

 

Edited by NabSlayer
  • Thanks 1

Share this post


Link to post
Share on other sites

try this

function ItemUse_TryChest ( role , Item )
	local Item_CanGet = GetChaFreeBagGridNum ( role )
	if Item_CanGet < 4 then
		SystemNotice(role , "you need at least 4 slots to open Fairy Coin Chest")
		UseItemFailed ( role )
		return
	end
	
	local Kals_Num = 0
	if Kals_Num == 3 then
		local j = TakeItem ( role , 0 , 3457 , Kals_Num )
		if j == 1 then
			GiveItem ( role , 0 , 1872 , 1 , 4 )
		else
			UseItemFailed ( role )
			SystemNotice( role, "Not enough Kal Runestone.")
		end
	else
		SystemNotice( role , "Not enough kal Runestone.")
		UseItemFailed ( role )
	end
end

 

  • Thanks 1

Share this post


Link to post
Share on other sites
5 hours ago, Sharshabel said:

@NabSlayer can i know if i want make 3 diffrent items required ? 

i have tryed to double the line also tryed to make comma but not work

local first= CheckBagItem( role, RequiredItemID )       
local second= CheckBagItem( role, RequiredSecondItemID )      
local third= CheckBagItem( role, RequiredThirdItemID )      
	if first >=1 and second >= 1 and third >=1 then
	//success open chest

	else
	SystemNotice( role , "You don't have all required items" )
		UseItemFailed ( role )
	end
	

didn't tested but should work, i said it using mobile phone 

  • Thanks 1

Share this post


Link to post
Share on other sites

its works but you need to edit the full triggers example 

 

local first= CheckBagItem( role, RequiredItemID )

if first >=1 first

//success open chest else SystemNotice( role , "You don't have all required items" )

UseItemFailed ( role ) end

 

local second= CheckBagItem( role, RequiredItemID )

if second>=1 

//success open chest else SystemNotice( role , "You don't have all required items" )

UseItemFailed ( role ) end

 

local third = CheckBagItem( role, RequiredItemID )

if third>=1 

//success open chest else SystemNotice( role , "You don't have all required items" )

UseItemFailed ( role ) end

 

its works on this way 

 

if first >=1 and second >= 1 and third >=1 then << this not working 

thank you bro ❤️ Insert other media

 

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