What's new

Skrypty & Kody Summon !!! Pomoc

dake123

Active User
Joined
Apr 7, 2009
Messages
53
Reaction score
0
Witam mam taki problem ze chce stworzyc pet system i wszystko jest fajnie tylko chce zrobi? 2 rodzaje pet?w jedne walcz?ce a drugie pomocne i teraz tak te walczace umiem zorbic a te pomocne juz nie chce zeby np pet rat dawa? dla playera cos np skile czy tam mlvl , hp/s ,mp/s i takie tam bajerki pomo?e kto? ??

Dzi?ki za Pomoc z g?ry :)
 

Ciamciaj Bigos

ก้้้้้้&
Joined
Jun 6, 2013
Messages
2,081
Reaction score
192
Odp: Summon !!! Pomoc

Jesli te twoje pety przywoluje sie zakladajac jakis item na postac (tak jak to jest na paru naruto otsach) to mozesz wykorzystac
[xml] <attribute key="healthGain" value="1" />
<attribute key="healthTicks" value="3000" />[/xml] w items.xml, a jesli tez bys chcial dodac postaci 20 sword fightingu to w funkcji onEquip doPlayerAddSkill(cid, SKILL_SWORD, 20), onDeEquip doPlayerAddSkill(cid, SKILL_SWORD, -20)
 

buchaLL

bez spiny, luźno
Joined
Aug 2, 2011
Messages
1,013
Reaction score
68
Age
27
Odp: Summon !!! Pomoc

Je?li u?ywasz tego http://tibia.net.pl/threads/587517-Pet-System-!!-Przerobienie
To co do regeneracji hp/many ?ap:

creaturescripts.xml
[xml]<event type="think" name="hpmanaregen" script="script.lua"/>[/xml]

login.lua
[lua]registerCreatureEvent(cid, "hpmanaregen")[/lua]

script.lua
[lua]local config = {healthPercent = 15.0, manaPercent = 15.0}

function onThink(cid, interval)
if getPlayerStorageValue(cid, 12345) == 1 and #getCreatureSummons(cid) == 0 then
doPlayerAddItem(cid,11256,1)
setPlayerStorageValue(cid, 12345, 0)
end
if getPlayerStorageValue(cid, 12345) == 1 then
if isPlayer(cid) == true then
hp = config.healthPercent
mp = config.manaPercent

local hpheal, mpheal = getCreatureMaxHealth(cid)*(hp/100), getPlayerMaxMana(cid) * (mp / 100)

if hpheal >= 1 and getCreatureHealth(cid) < getCreatureMaxHealth(cid) then
doCreatureAddHealth(cid, hpheal)
end
if getPlayerMana(cid) < getPlayerMaxMana(cid) then
if mpheal >= 1 then
doPlayerAddMana(cid, mpheal)
end
end
end
end
return true
end[/lua]

A je?li chcia?by? bonus do skilla, magic lvl'a to potrzebujesz tak?e edycji tamtych plik?w.
 
Last edited:

dake123

Active User
Joined
Apr 7, 2009
Messages
53
Reaction score
0
Odp: Summon !!! Pomoc

Dzi?ki

Ciamciaj Bigos : nie po kliku znika item

buchaLL : Ty jak zawsze kozak :) dzia?a tylko nie ma tutaj chyba funkcji do szybkosci dawania hp i mp bo teraz to za szybko leczy heh ja chce zeby dawalo tak mniej wiecej co 5 sec :)

I jeszcze mam takie pytyanie jak zrobic zeby ten sumon teleportowal sie do ciebie bo na schodach czy drabinie on stoi
 

buchaLL

bez spiny, luźno
Joined
Aug 2, 2011
Messages
1,013
Reaction score
68
Age
27
Odp: Summon !!! Pomoc

Dopatrzy?em si? tak?e b??du w pliku script.lua z action(radz? zmieni?):
[lua]function onUse(cid, item, frompos, item2, topos)

local pet_name = "rat"

if item.itemid == 11256 then
if not getTilePzInfo(getPlayerPosition(cid)) then
if #getCreatureSummons(cid) < 1 then
doRemoveItem(item.uid, 11256)
setPlayerStorageValue(cid, 12345, 1)
local summon = doSummonCreature(pet_name, getThingPos(cid))
doConvinceCreature(cid, summon)
doSendMagicEffect(getCreaturePosition(summon), 67)
doCreatureSay(cid, "Pomoz mi, ".. pet_name .. "!", TALKTYPE_SAY)
else
doPlayerSendCancel(cid, "Mozesz przywolac tylko jednego pomocnika na raz.")
end
else
doPlayerSendCancel(cid, "Nie mozesz przywolac pomocnika w strefie bezpiecznej.")
end
end
return true
end[/lua]


Co do czasu to trzymaj, podajesz w sekundach:
[lua]local config = {healthPercent = 15.0, manaPercent = 15.0, time = 1}

function onThink(cid, interval)

if last_interval == nil then last_interval= os.clock() end

if getPlayerStorageValue(cid, 12345) == 1 and #getCreatureSummons(cid) == 0 then
doPlayerAddItem(cid,11256,1)
setPlayerStorageValue(cid, 12345, 0)
end
if getPlayerStorageValue(cid, 12345) == 1 then
if isPlayer(cid) == true then
hp = config.healthPercent
mp = config.manaPercent

local hpheal, mpheal = getCreatureMaxHealth(cid)*(hp/100), getPlayerMaxMana(cid) * (mp / 100)
if (os.clock() - last_interval) > config.time then
if hpheal >= 1 and getCreatureHealth(cid) < getCreatureMaxHealth(cid) then
doCreatureAddHealth(cid, hpheal)
end
if getPlayerMana(cid) < getPlayerMaxMana(cid) then
if mpheal >= 1 then
doPlayerAddMana(cid, mpheal)
end
end
last_interval= os.clock()
end
end
end
return true
end[/lua]
 
Top