• 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!

Weapon charging like real tibia

Massen

Masserv RPG
Joined
Jul 23, 2007
Messages
324
Reaction score
1
Location
Sweden
First of all i found these Scripts on ******

Made by Smoczek Leon and Svira and some editing to work for TFS


First of all, my charges aint showing. Second i choiced 10 charges and the weapon don't seem to loose any charges..


Here's all my files if anyone wants to help... I use TFS latest.

Actions.xml (data/actions/actions.xml)

Code:
	<!-- enchant wep -->
	<action itemid="2146" script="enchanted.lua" />
	<action itemid="2147" script="enchanted.lua" />
	<action itemid="2150" script="enchanted.lua" />
	<action itemid="2149" script="enchanted.lua" />
	<action itemid="7759" script="enchanted.lua" />
	<action itemid="7760" script="enchanted.lua" />
	<action itemid="7761" script="enchanted.lua" />
	<action itemid="7762" script="enchanted.lua" />

Enchanted.lua (data/actions/scripts/enchanted.xml)

Code:
local gems = {2146, 2147, 2149, 2150}
local egems = {7759, 7760, 7761, 7762}
local altars = 
{
	{7508, 7509, 7510, 7511},
	{7504, 7505, 7506, 7507},
	{7516, 7517, 7518, 7519},
	{7512, 7513, 7514, 7515}
}
local weapons = {2383, 7384, 7406, 7402, 2429, 2430, 2435, 7380, 2454, 2423, 2445, 7415, 7392, 2391, 2544, 7389, 7383}
local eweapons = 
{
	{7763, 7744, 7854, 7869},
	{7764, 7745, 7855, 7870},
	{7765, 7746, 7856, 7871},
	{7766, 7747, 7857, 7872},
	{7768, 7748, 7858, 7873},
	{7769, 7749, 7859, 7874},
	{7770, 7750, 7860, 7875},
	{7771, 7751, 7861, 7876},
	{7772, 7752, 7862, 7877},
	{7773, 7753, 7863, 7878},
	{7774, 7754, 7864, 7879},
	{7775, 7755, 7865, 7880},
	{7776, 7756, 7866, 7881},
	{7777, 7757, 7867, 7882},
	{7778, 7758, 7868, 7883},
	{7839, 7840, 7838, 7850}
}
 
function onUse(cid, item, fromPosition, itemEx, toPosition)
	local type = math.max(item.type, 1) 
	local mana = 300 * type
	local soul = 2 * type	
	if isInArray(gems, item.itemid)== TRUE then
		for aa=1, #gems do
			if item.itemid == gems[aa] then
				a=aa
				break
			end
		end
		if isInArray(altars[a], itemEx.itemid)== TRUE then
			if getPlayerMana(cid) >= mana and getPlayerSoul(cid) >= soul then
				doTransformItem(item.uid,egems[a])
				doPlayerAddMana(cid,-mana)
				doPlayerAddSoul(cid,-soul)
				doSendMagicEffect(fromPosition,39)
			else
				doPlayerSendCancel(cid,"You dont have mana or soul points.")
			end
		end
	elseif isInArray(egems, item.itemid)== TRUE then
		for bb=1, #egems do
			if item.itemid == egems[bb] then
				b=bb
				break
			end
		end
		if isInArray(weapons, itemEx.itemid)== TRUE then
			for cc=1, #weapons do
				if itemEx.itemid == weapons[cc] then
					c=cc
					break
				end
			end
			doTransformItem(itemEx.uid,eweapons[c][b],1000)
			doSendMagicEffect(fromPosition,39)
			doRemoveItem(item.uid,1)
		else
			doPlayerSendCancel(cid,"You can't enchant this.")
		end
	else
		return 0
	end
	return 1
end


Weapons.xml (data/weapons/weapons.xml)

Code:
	<!-- Enchant weapons -->
	<melee id="7768" range="2" enabled="1" exhaustion="0" hitchance="90" script="barbarian axe1.lua">
	</melee>

Barbarian axe1.lua (data/weapons/scripts/barbarian axe1.lua)

Code:
local combat = createCombatObject()
setCombatParam(combat, COMBAT_PARAM_BLOCKARMOR, 1)
setCombatParam(combat, COMBAT_PARAM_BLOCKSHIELD, 1)
setCombatParam(combat, COMBAT_PARAM_TYPE, COMBAT_ICEDAMAGE)
setCombatParam(combat, COMBAT_PARAM_EFFECT, CONST_ME_ZZZ)
setCombatFormula(combat, COMBAT_FORMULA_SKILL, 0.7, 0, 2.2, 0)

local condition = createConditionObject(CONDITION_ENERGY)
setConditionParam(condition, CONDITION_PARAM_DELAYED, 1)
addDamageCondition(condition, 1, 2000, -50)
setCombatCondition(combat, condition)

function onUseWeapon(cid, var)
return doCombat(cid, combat, var)
end

And last

Items.xml (data/items/items.xml)

Code:
	<item id="7768" article="a" name="barbarian axe">
		<attribute key="weight" value="5100"/>
		<attribute key="defense" value="18"/>
		<attribute key="attack" value="28"/>
		<attribute key="weaponType" value="axe"/>
		<attribute key="extradef" value="1"/>
		<attribute key="decayTo" value="2429"/>
		<attribute key="charges" value="10"/>
		<attribute key="showduration" value="1"/>
		<attribute key="description" value="It is temporarily enchanted with ice"/>
	</item>

If anyone is kind enough to help i'd really apreciate it...

With deep respect

//Massen
 
Back
Top