• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Advanced Weapon Enchantion System

Evil Hero

Legacy Member
TFS Developer
Joined
Dec 12, 2007
Messages
1,281
Solutions
29
Reaction score
837
Location
Germany
Hello dear Otlanders~

Colandus and Me are going to release our Advanced Weapon Enchantion System now.

It works like this....

You have to put your Weapon which you want to Enchante in your Arrow Slot. (It's important that the weapon is in the arrow slot, else it wont work)
You'll need like in RL Tibia the Required Gems. (id from 7759 - 7762)
Now you just have to say !enchante "fire (it although works with ice, earth and energy)

Make a new file called "weapon system" into your data/talkactions/scripts folder

Script:

PHP:
------------------------------------------------------------------------
--#/-- Advanced Weapon Enchantion System by Evil Hero & Colandus --\#--
-------------------------------------------------------------------------
--#/---------- Visit www.Otland.net for more informations -----------\#--
-------------------------------------------------------------------------

local weapons = {
	-- {earth, fire, energy, ice}
	gems = {7761, 7760, 7762, 7759},
	[2430] = {7860, 7750, 7875, 7769},
	[2423] = {7864, 7754, 7879, 7773},
	[7406] = {7857, 7747, 7872, 7766},
	[7383] = {7855, 7745, 7870, 7764},
	[7384] = {7856, 7746, 7871, 7765},
	[7415] = {7866, 7756, 7881, 7775},
	[7380] = {7862, 7752, 7877, 7771},
	[7402] = {7858, 7784, 7873, 7767},
	[2391] = {7868, 7758, 7883, 7777},
	[7389] = {7861, 7751, 7876, 7770},
	[2383] = {7854, 7744, 7869, 7763},
	[7392] = {7867, 7757, 7882, 7776},
	[2429] = {7859, 7749, 7874, 7768},
	[2445] = {7865, 7755, 7880, 7774},
	[2454] = {7863, 7753, 7878, 7772}
}

-- No touchz0r
local weaponTypes = {
	["earth"] = 1,
	["fire"] = 2,
	["energy"] = 3,
	["ice"] = 4
}

function onSay(cid,words,param)
	local weapon = getPlayerSlotItem(cid, CONST_SLOT_AMMO)
	if weaponTypes[param] then
		if weapons[weapon.itemid] then
			local enchantWeap = weapons[weapon.itemid][weaponTypes[param]]
			if doPlayerRemoveItem(cid, weapons.gems[weaponTypes[param]], 1) == TRUE then
				doTransformItem(weapon.uid, enchantWeap)
				doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
			else
				doPlayerSendCancel(cid, "You don't have the required gem or weapon, for the enchantion.")
			end
		else
			doPlayerSendCancel(cid, "You have to put your weapon into the ammo slot, for the enchantion.")
		end
	else
		doPlayerSendCancel(cid, "There is no existing element like that.")
	end
	return TRUE
end

Talkactions.xml:

PHP:
<talkaction words="!enchante" script="weapon system.lua" />

We are going to Update this soon, we will make a function that you can get your normal weapon back within a Talkaction to :p

kind regards, Evil Hero & Colandus
 
Wonderful looking script and it really would come in handy. What do you think of having other requirements also to it? Such as only druids, or sorcerer and druids being able to use the talk action.
 
great one but i prefer npc system.
gonna use it for Admins only :P
 
Doing it wrong?

I cant make it work..

Code:
<?xml version="1.0"?>

<talkactions>

<talkaction words="open" script="example.lua" />
<talkaction words="henge" script="henge.lua" />
<talkaction words="!enchante" script="weapon system.lua" /> 

</talkactions>
Code:
local weapons = {
    -- {earth, fire, energy, ice}
    gems = {7761, 7760, 7762, 7759},
    [2430] = {7860, 7750, 7875, 7769},
    [2423] = {7864, 7754, 7879, 7773},
    [7406] = {7857, 7747, 7872, 7766},
    [7383] = {7855, 7745, 7870, 7764},
    [7384] = {7856, 7746, 7871, 7765},
    [7415] = {7866, 7756, 7881, 7775},
    [7380] = {7862, 7752, 7877, 7771},
    [7402] = {7858, 7784, 7873, 7767},
    [2391] = {7868, 7758, 7883, 7777},
    [7389] = {7861, 7751, 7876, 7770},
    [2383] = {7854, 7744, 7869, 7763},
    [7392] = {7867, 7757, 7882, 7776},
    [2429] = {7859, 7749, 7874, 7768},
    [2445] = {7865, 7755, 7880, 7774},
    [2454] = {7863, 7753, 7878, 7772}
}

-- No touchz0r
local weaponTypes = {
    ["earth"] = 1,
    ["fire"] = 2,
    ["energy"] = 3,
    ["ice"] = 4
}

function onSay(cid,words,param)
    local weapon = getPlayerSlotItem(cid, CONST_SLOT_AMMO)
    if weaponTypes[param] then
        if weapons[weapon.itemid] then
            local enchantWeap = weapons[weapon.itemid][weaponTypes[param]]
            if doPlayerRemoveItem(cid, weapons.gems[weaponTypes[param]], 1) == TRUE then
                doTransformItem(weapon.uid, enchantWeap)
                doSendMagicEffect(getPlayerPosition(cid), CONST_ME_MAGIC_BLUE)
            else
                doPlayerSendCancel(cid, "You don't have the required gem or weapon, for the enchantion.")
            end
        else
            doPlayerSendCancel(cid, "You have to put your weapon into the ammo slot, for the enchantion.")
        end
    else
        doPlayerSendCancel(cid, "There is no existing element like that.")
    end
    return TRUE
end
And i have the item in the arrow slots and the gems read.., do you need to have its saying "You see 100 enchanted small sapphires"? Becouse mines says only Enchanted jewlers...

Please help <33
 
Last edited by a moderator:
Yes nice script but now it doesn't work charges:

change:
PHP:
doTransformItem(weapon.uid, enchantWeap)

to:
PHP:
doTransformItem(weapon.uid, enchantWeap, 1000)

then now weapon have 1000 charges :)

end say !enchate fire not !enchante "fire
 
Back
Top