Kryss013
Active User
- Dołączył
- Kwiecień 6, 2008
- Posty
- 65
- Liczba reakcji
- 10
Witam! Zamieszczam wam pet system, czyli program do robienia sobie zwierzaczka
Odrazu m?wie ?e scrypt jest zrobiony przez FedeVI:
Pierwszy Krok
Tworzymy kolejno pliki w glownym folderze OTS'a (tam gdzie znajduje sie Config.Lua)
petConfig.Lua
tutaj wybierasz ile pet bedzie mogl miec naraz itemow w BP
Tutaj dajesz jak ma sie nazywac pet w miejscu wokacjii(na dole najslabszy, a na gorze najsilniejszy)
!petinfo.lua
!petsay.lua
!petcarry.lua

Pierwszy Krok
Tworzymy kolejno pliki w glownym folderze OTS'a (tam gdzie znajduje sie Config.Lua)
petConfig.Lua
frases = {"Men, im still exhausted!", "Ok, in one momment", "afff, again?!", "meh, one second"}
lenght = 39 -- maximun lenght the !petsay can have...
manaGainTicks = 3000 --\\
--how fast the pet gains mana
manaGainAmmount = 10 --//
manaGainPerLevel = 20 -- mana that gains the pet for each level the player gain
magicLevelRate = 0.25 -- how faster the pet will gain mlvl compared to real tibia, 0.5 = 2 times faster, 0.25 = 4 times faster and soo...
base = 2000 --base storage. All storages will depend of this number
storages = {
petMag = base+1,
petUid = base+2,
petExha = base+3,
petDamage = base+4,
petManaSpent = base+5,
petIsOnline = base+6,
petMana = base+7,
petIsHealing = base+8,
petCap = base+9
}
petItems = {}
maxItems = 20 --Max items the pet can carry
for i = 1, maxItems do
petItems = base+9+i
end
--Pets, dependiong on the level
pets = {{level = 100, name = "GoD Demon"},
{level = 60, name = "Demon Lord"},
{level = 50, name = "Dark Demon"},
{level = 40, name = "Fire Demon"},
{level = 30, name = "Demon Senior"},
{level = 20, name = "Black Demon"},
{level = 10, name = "Demon Junior"},
{level = 0, name = "Demonek"}
}
--attacks of the pet. !petattack "param
--It's pretty easy how to config, I think it doesn't need an extra explanation.
attacks = {{param = "energy", offensive = 1, needLevel = 20, self = 0, needMag = 10, manaSpent = 60exhausted = 1, range = 6,
combatType = COMBAT_ENERGYDAMAGE, combatAni = CONST_ME_ENERGYAREA, area = 2,
formula = {maxb = 0.4, maxa = 30, minb = 0.5, mina = 0},
},
{param = "exori", offensive = 1, needLevel = 40, self = 0, needMag = 5, manaSpent = 145,
exhausted = 1, range = 0, combatType = COMBAT_PHYSICALDAMAGE, combatAni = CONST_ME_HITAREA, area = 2,
formula = {maxb = 0.6, maxa = 30, minb = 1.2, mina = 0},
},
{param = "fireball", offensive = 1, needLevel = 50, self = 0, needMag = 15, manaSpent = 100,
exhausted = 1, range = 3, combatType = COMBAT_FIREDAMAGE, combatAni = CONST_ME_FIREAREA, area = 6,
formula = {maxb = 0.6, maxa = 30, minb = 1.2, mina = 0}
},
{param = "mini energy", offensive = 1, needLevel = 0, self = 0, needMag = 0, manaSpent = 20,
exhausted = 1, range = 1, combatType = COMBAT_ENERGYDAMAGE, combatAni = CONST_ME_ENERGYAREA, area = 1,
formula = {maxb = 0.13, maxa = 0, minb = 0.262, mina = 0}
},
{param = "health", offensive = -1, needLevel = 10, self = 1, needMag = 0, manaSpent = 100,
exhausted = 2, range = 0, combatType = COMBAT_HEALING, combatAni = CONST_ME_MAGIC_BLUE, area = 1,
formula = {maxb = 0.4, maxa = 20, minb = 0.7, mina = 0}
}
}
function addMana(a)
local cid = a.cid
local petManaMax = getPlayerLevel(cid)*manaGainPerLevel
if getPlayerStorageValue(cid, storages.petMana) < petManaMax then
if petManaMax - getPlayerStorageValue(cid, storages.petMana) < 10 then
setPlayerStorageValue(cid, storages.petMana, getPlayerStorageValue(cid, storages.petMana) + petManaMax -
getPlayerStorageValue(cid, storages.petMana))
else
setPlayerStorageValue(cid, storages.petMana, getPlayerStorageValue(cid, storages.petMana) + 10)
end
addEvent(addMana, manaGainTicks, {cid = cid})
else
setPlayerStorageValue(cid, storages.petIsHealing, 0)
end
end
tutaj wybierasz ile pet bedzie mogl miec naraz itemow w BP
Tutaj dajesz jak ma sie nazywac pet w miejscu wokacjii(na dole najslabszy, a na gorze najsilniejszy)
!petinfo.lua
dofile("./petConfig.lua")
function onSay(cid, words, param)
local request = 0
local daPet = getPlayerStorageValue(cid, storages.petUid)
if isCreature(daPet) == 1 then
param = string.lower(param)
if param == "magic level" then
request = getPlayerStorageValue(cid, storages.petMag)
elseif param == "mana" then
request = getPlayerStorageValue(cid, storages.petMana)
elseif param == "health" then
request = getCreatureHealth(daPet)
end
if request ~= 0 then
doPlayerSendTextMessage(cid, 19, 'Pet ' .. param .. ': ' .. request .. '.')
end
else
doPlayerSendCancel(cid, 'You haven\'t call your pet!')
end
return FALSE
end
!petsay.lua
dofile("./petConfig.lua")
function onSay(cid, words, param)
local daPet = getPlayerStorageValue(cid, storages.petUid)
if isCreature(daPet) == 1 then
if param ~= nil then
if string.len(param) < lenght then
doCreatureSay(daPet, '' .. param .. '', TALKTYPE_ORANGE_1)
else
doPlayerSendCancel(cid, 'No more than ' .. lenght .. ' character. ')
end
else
doPlayerSendCancel(cid, 'You must enter a text')
end
else
doPlayerSendCancel(cid, 'You haven\'t call your pet!')
end
return FALSE
end
!petcarry.lua
dofile("./petConfig.lua")
function onSay(cid, words, param)
local mySto = 0
local daPet = getPlayerStorageValue(cid, storages.petUid)
if param == "clear" then
for i = 1, table.maxn(petItems) do
doCreatureSay(daPet, '' .. petItems .. '', TALKTYPE_ORANGE_1)
end
end
if isCreature(daPet) == 1 then
local pos = getCreaturePosition(daPet)
local a = 1
while a < 10 do
if getItemWeight(getThingfromPos({x = pos.x, y = pos.y, z = pos.z, stackpos = a}).itemid, 1) ~= 0 then
break
end
a = a + 1
end
local carryingItem = getThingfromPos({x = pos.x, y = pos.y, z = pos.z, stackpos = a})
if getItemWeight(carryingItem.itemid, 1) ~= 0 then
if isContainer(carryingItem.uid) == 0 then
for b = 1, table.maxn(petItems) do
if getPlayerStorageValue(cid, petItems) == 0 or getPlayerStorageValue(cid, petItems) == -1 then
mySto = b
break
end
end
if mySto ~= 0 then
local theID = carryingItem.itemid
if isItemStackable(theID) == 1 then
doRemoveItem(carryingItem.uid, carryingItem.type)
else
doRemoveItem(carryingItem.uid, 1)
end
setPlayerStorageValue(cid, petItems[mySto], theID)
doCreatureSay(daPet, 'Hmm, ' .. getItemName(theID) .. ', I\'ll save it on my ' .. mySto .. ' bag!', TALKTYPE_ORANGE_1)
else
doCreatureSay(daPet, 'I have no space!', TALKTYPE_ORANGE_1)
end
else
doCreatureSay(daPet, 'I can\'t take containers!', TALKTYPE_ORANGE_1)
end
else
doCreatureSay(daPet, 'I can\'t see any item!', TALKTYPE_ORANGE_1)
end
else
doPlayerSendCancel(cid, 'You haven\'t call your pet!')
end
return FALSE
end
Ostatnia edycja: