What's new

-Tibia 8.60 Transform System

Frosbite

Active User
Joined
Dec 20, 2014
Messages
99
Reaction score
8
Witam, przedstawiam wam skrypt z mojego silnika DBRelated na transform <nast?pny na forum> Skrypt dzia?a na 8.54 jak i 8.6. Konfiguracja sprowadza si? do pliku function.lua w libie.
A wi?c zaczynamy:
lib>function.lua

[LUA]c = {
mana_cost = 5, -- ilosc many na transform
textColor = 25, -- kolor tekstu
blockedvoc = {7,14}, -- voce, ktore nie moga juz uzyc transformu
stor = 73840,
hp_stor = 73841,
mana_stor = 73842,
out_stor = 73843,
out_stor2 = 73844,
}

transformsLib = { -- lvl wymagany na transform, jaki voc zostanie ustawiony, jaki outfit zostanie ustawiony, czy bedzie efekt (jaki efekt i co ile), ile gracz dostanie hp, ile gracz dostanie many
[1] = {level = 30, tovoc = 2, out = 2, efekt = false, extra_hp = 1000, extra_mana = 1000}, -- forma podstawowa
[2] = {level = 50, tovoc = 3, out = 3, efekt = false, extra_hp = 1000, extra_mana = 1000}, -- trans 1
[3] = {level = 100, tovoc = 4, out = 4, efekt = false, extra_hp = 1000, extra_mana = 1000}, -- trans 2
[4] = {level = 150, tovoc = 5, out = 5, efekt = true, id = 13, t = 2, extra_hp = 1000, extra_mana = 1000}, -- trans 3
[5] = {level = 170, tovoc = 6, out = 7, efekt = false, extra_hp = 1000, extra_mana = 1000}, -- trans 4
[6] = {level = 200, tovoc = 7, out = 46, efekt = false, extra_hp = 1000, extra_mana = 1000}, -- trans 5
-- voc Goku, 7 to maksymalny transform pierwszej klasy, wiec nie ma linijki
[8] = {level = 30, tovoc = 9, out = 57, efekt = false, extra_hp = 0, extra_mana = 0}, -- forma podstawowa
[9] = {level = 50, tovoc = 10, out = 51, efekt = false, extra_hp = 0, extra_mana = 0}, -- trans 1
[10] = {level = 100, tovoc = 11, out = 144, efekt = false, extra_hp = 0, extra_mana = 0}, -- trans 2
[11] = {level = 150, tovoc = 12, out = 146, efekt = false, extra_hp = 0, extra_mana = 0}, -- trans 3
[12] = {level = 170, tovoc = 13, out = 12, efekt = true, id = 13, t = 2, extra_hp = 0, extra_mana = 0}, -- trans 4
[13] = {level = 200, tovoc = 14, out = 38, efekt = true, id = 35, t = 2, extra_hp = 0, extra_mana = 0}, -- trans 5
-- voc Vegeta, 14 to maksymalny transform pierwszej klasy, wiec nie ma linijki
}

function transformEffect(cid,id,del,voco)
if isPlayer(cid) then
local voc = getPlayerVocation(cid)
if voc == voco then
doSendMagicEffect(getThingPos(cid), id)
addEvent(transformEffect, del, cid, id, del, voco)
end
end
return true
end

function doTransformsLib(cid)
local voc = getPlayerVocation(cid)
local tc = transformsLib[voc]
local outfit = {lookType = tc.out , lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0}
if getPlayerStorageValue(cid,c.out_stor) ~= 1 then
setPlayerStorageValue(cid,c.out_stor,1)
setPlayerStorageValue(cid,c.out_stor2,getCreatureOutfit(cid).lookType)
end
doSetCreatureOutfit(cid,outfit,-1)
doPlayerSetVocation(cid,tc.tovoc)
local ghp = getPlayerStorageValue(cid,c.hp_stor)
local gmp = getPlayerStorageValue(cid,c.mana_stor)
setPlayerStorageValue(cid,c.hp_stor,ghp + tc.extra_hp)
setPlayerStorageValue(cid,c.mana_stor,gmp + tc.extra_mana)
setCreatureMaxMana(cid,getCreatureMaxMana(cid) + tc.extra_mana)
setCreatureMaxHealth(cid,getCreatureMaxHealth(cid) + tc.extra_hp)
doPlayerAddMana(cid,1)
doCreatureAddHealth(cid,1)
if tc.efekt == true then
local tm = tc.t * 1000
doSendMagicEffect(getThingPos(cid), tc.id)
addEvent(transformEffect,1000,cid,tc.id,tm,getPlayerVocation(cid))
end
doSendMagicEffect(getThingPos(cid), 26)
return true
end
function doRevert(cid)
if getPlayerStorageValue(cid,c.stor) > 0 then
local ghp = getPlayerStorageValue(cid,c.hp_stor)
local gmp = getPlayerStorageValue(cid,c.mana_stor)
setCreatureMaxMana(cid,getCreatureMaxMana(cid) - gmp)
setCreatureMaxHealth(cid,getCreatureMaxHealth(cid) - ghp)
setPlayerStorageValue(cid,c.hp_stor,0)
setPlayerStorageValue(cid,c.mana_stor,0)
doPlayerSetVocation(cid,getPlayerStorageValue(cid,c.stor))
setPlayerStorageValue(cid,c.stor,-1)
setPlayerStorageValue(cid,c.out_stor,-1)
local outfit = {lookType = getPlayerStorageValue(cid,c.out_stor2) , lookHead = 0, lookBody = 0, lookLegs = 0, lookFeet = 0, lookAddons = 0}
doSetCreatureOutfit(cid,outfit,-1)
setPlayerStorageValue(cid,c.out_stor2,0)
end
return true
end[/LUA]

Konfiguracja sama w sobie jest ?atwa i nie powinna hm stwarza? problemu osobie kt?ra ma podstawow? wiedz? na temat skrypt?w.
Teraz przechodzimy do creautescritps>scripts>logout.lua
Po
function onLogout(cid)
Dodajemy:
doRevert(cid)

Teraz przechodzimy do Talkactions>Talkactions.xml i dodajemy 2 linijki:
<talkaction words="transform;Transform" event="script" value="transform.lua"/>
<talkaction words="revert;Revert" event="script" value="transform.lua"/>
w Talkactions>scripts tworzymy plik transform.lua i wrzucamy do niego :
[LUA]
function onSay(cid, words, param)
if (exhaust(cid, storevalue, exhausttime) == 1) then
if words == 'transform' then

local voc = getPlayerVocation(cid)
if isInArray(c.blockedvoc, voc) then
doPlayerSendTextMessage(cid, c.textColor, "You can not transform.")
doSendMagicEffect(getPlayerPosition(cid), 2)
return true
end
if getCreatureMana(cid) < c.mana_cost then
doPlayerSendTextMessage(cid, c.textColor, "You do not have enough mana.")
doSendMagicEffect(getPlayerPosition(cid), 2)
return true
end
local tc = transformsLib[voc]
if getPlayerLevel(cid) < tc.level then
doPlayerSendTextMessage(cid, c.textColor, "You do not have enough level to transform.")
doSendMagicEffect(getPlayerPosition(cid), 2)
return true
end

if getPlayerStorageValue(cid,c.stor) == -1 then
setPlayerStorageValue(cid,c.stor,voc)
end
doTransformsLib(cid)
elseif words == 'revert' then
doRevert(cid)
end
else
doPlayerSendCancel(cid, "You are exhausted.")
doSendMagicEffect(getPlayerPosition(cid),CONST_ME_POFF)
end
return true
end[/LUA]

W razie pyta? prosz? pisa? pod tematem lub pw!


Dragon Ball Related v2.0 Coming Soon!​
 
Top