• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

[REQUEST] Action Script Request!

_Arthur

Joined
Oct 22, 2009
Messages
2,190
Reaction score
143
Okay, so I need a script where itemID which in this case itemID 1958 (grey book) has 100x charges. When you use the item, it produces 1x itemID xxxx in your BP. On each use item ID 1958 loses a charge. Once it runs out of charges, it poofs.

I hope this is specific enough.

REP++ for the solution? ;D
 
You must edit items.otb & Tibia.dat (which means players will need to have the modified Tibia.dat too, or debug :p)

IF you want it to show number of charges left on sprite, that is.
 
ye, but if he wants it stackable he still must edit both files :p

i just said 'charges' because that's what he wrote in his post :p
 
This took me a half hour.. the book must be in the player's arrow slot, I didn't know how else to make it work

Code:
function onUse(cid, item, fromPosition, itemEx, toPosition)
local charges = 101

	if getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid ~= 1958 then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "This item must be in your arrow slot to work.")
		doSendMagicEffect(fromPosition, CONST_ME_POFF)
		return true
	end
	
	if getPlayerSlotItem(cid, CONST_SLOT_AMMO).itemid == 1958 then
	if getPlayerSlotItem(cid, CONST_SLOT_AMMO).actionid < 100 then
		doItemSetAttribute(getPlayerSlotItem(cid, CONST_SLOT_AMMO).uid, "aid", (100 + charges - 1))
		doPlayerAddItem(cid, 2160, 1)
	elseif getPlayerSlotItem(cid, CONST_SLOT_AMMO).actionid > 101 then 
		doItemSetAttribute(getPlayerSlotItem(cid, CONST_SLOT_AMMO).uid, "aid", (getPlayerSlotItem(cid, CONST_SLOT_AMMO).actionid - 1))
		doPlayerAddItem(cid, 2160, 1)
	elseif getPlayerSlotItem(cid, CONST_SLOT_AMMO).actionid == 101 then 
		doRemoveItem(getPlayerSlotItem(cid, CONST_SLOT_AMMO).uid)
		doSendMagicEffect(fromPosition, CONST_ME_POFF)
	end
	end
	return true
end
local charges must be +1 more than the amount of items the book should make before it poofs
 
LUA:
local charges = 100
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	doPlayerAddItem(cid, 2160, 1)
	doItemSetAttribute(item.uid, 'aid', math.max(100, item.actionid) + 1)
	if math.max(100, item.actionid) + 1 == 100 + charges then
		doRemoveItem(item.uid)
		doSendMagicEffect(fromPosition, CONST_ME_POFF)
	end
	return true
end
 
I'll try both, and see what happens..... D:

EDIT: THEY BOTH WORK PERFECT. THANKS <33333333333333 (Even though I dislike you, Killroy.) ;D

REP++ for both. XDD
 
Last edited:
Back
Top