Jump to content
Sign in to follow this  
wizel1

item usage

Recommended Posts

any know how can prevent item usage again if already used?

example:

i want use roll and i accidently use it again it waste item

i want prevent accident use

 

so if use roll cannot use again until time up and display

 

(you already use roll, please wait)

Edited by wizel1

Share this post


Link to post
Share on other sites

@wizel1you can create a script that checks if the character has the state already or not, for the item that you use.

 

such as heaven berry have state_xxxxx, then do a check if state == 1, and if it does, prompt a message and return, end, before the consumption of the item.

Share this post


Link to post
Share on other sites

Well, since u said Rolls, I tought u mean something like prevent using 2 hp recovery items. Those arent used with states, instead they just add hp to your attrs. 

 

If u want to avoid using twice an item that give states, as inuarashi said, take a look at Amplifiers itemeffect script.

 

Share this post


Link to post
Share on other sites

Hello, @wizel1!

 

ItemEffect.lua

function ItemUse_wizel(role, Item)

	-- Check if item is already used
	if ( GetChaStateLv(role, <STATE_ID>) > 0) then
		
		SystemNotice(
        		role,
			string.format(
				"%s is already used!", 
				GetItemName(GetItemID(Item))
			)
		)
		
		UseItemFailed(role)
   	 	return
	end
	
	-- Item script
	-- . . .
	-- . . .
	-- . . .
	
	-- Add state <STATE_ID> for 60 seconds
	local statetime = 60
	AddState(role, role, <STATE_ID>, 1, statetime)

end

 

skilleff.txt

<STATE_ID>	Item State	-1	0	0	0	1	0	1	1	1	1	1	1	1	1	1	1	1	1	0	0	0	-1	0	0	0	0	-1	0	0	0	0	0	0	0

 

<STATE_ID> is your ID for item state.

  • Like 1

Share this post


Link to post
Share on other sites

was wrong here? anyone know, the item work perfect. but this keep show in error

is because it is duplicate and saying same thing? if so how can fix so remove from lua_err

 

 

1.PNG

2.PNG

 

3.PNG

Edited by wizel1

Share this post


Link to post
Share on other sites

@wizel1 

Check SetCharaAttr() call in function State_XUEYU_Add(). The first argument of SetCharaAttr() is nil, should be number.


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