World Of Tibia

Zapraszamy do rejestracji !

  • Nie jesteś zalogowany.
  • Polecamy: Moda

#1 2008-12-27 14:44:00

Kappy

http://img79.imageshack.us/img79/7087/administratormk4.png

10784211
Zarejestrowany: 2008-12-26
Posty: 46

[8.1]Potiony

Witam w tym temacie dam wam skrypt na potiony i npc sprzedający backpackami =)
to zaczynamy:
wchodzisz w data\actions\actions.xml i wspisujesz na koncu :

<action itemid="7588" script="potions.lua" />
<action itemid="7589" script="potions.lua" />
<action itemid="7590" script="potions.lua" />
<action itemid="7591" script="potions.lua" />
<action itemid="7618" script="potions.lua" />
<action itemid="7620" script="potions.lua" />

następnie wchodzisz w data\actions\scripts i tam twożysz plik potions.lua i wpisujesz w nim:

local greatHealthPot = 7591
local greatManaPot = 7590
local strongHealthPot = 7588
local strongManaPot = 7589
local healthPot = 7618
local manaPot = 7620
local greatEmptyPot = 7635
local strongEmptyPot = 7634
local emptyPot = 7636

function onUse(cid, item, frompos, item2, topos)
if(item.itemid == healthPot) then
doSendAnimatedText(getPlayerPosition(cid), "Aaaah...", TEXTCOLOR_ORANGE)
if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 170, 230, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doTransformItem(item.uid, emptyPot)
elseif(item.itemid == manaPot) then
doSendAnimatedText(getPlayerPosition(cid), "Aaaah...", TEXTCOLOR_ORANGE)
if(doTargetCombatMana(0, cid, 80, 150, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doTransformItem(item.uid, emptyPot)
elseif(item.itemid == strongHealthPot) then
if getPlayerVocation(cid) == 3 or getPlayerVocation(cid) == 7 or getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8 then
if getPlayerLevel(cid) > 50 then
doSendAnimatedText(getPlayerPosition(cid), "Aaaah...", TEXTCOLOR_ORANGE)
if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 350, 450, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doTransformItem(item.uid, strongEmptyPot)
else
doPlayerSendTextMessage(cid, 21, "Your level is too low.")
end
else
doPlayerSendTextMessage(cid, 21, "You do not have the required vocation.")
end
elseif(item.itemid == strongManaPot) then
if getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 5 or getPlayerVocation(cid) == 6 or getPlayerVocation(cid) == 3 or getPlayerVocation(cid) == 7 then
if getPlayerLevel(cid) > 50 then
doSendAnimatedText(getPlayerPosition(cid), "Aaaah...", TEXTCOLOR_ORANGE)
if(doTargetCombatMana(0, cid, 150, 250, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doTransformItem(item.uid, strongEmptyPot)
else
doPlayerSendTextMessage(cid, 21, "Your level is too low.")
end
else
doPlayerSendTextMessage(cid, 21, "You do not have the required vocation.")
end
elseif(item.itemid == greatHealthPot) then
if getPlayerVocation(cid) == 4 or getPlayerVocation(cid) == 8 then
if getPlayerLevel(cid) > 80 then
doSendAnimatedText(getPlayerPosition(cid), "Aaaah...", TEXTCOLOR_ORANGE)
if(doTargetCombatHealth(0, cid, COMBAT_HEALING, 550, 650, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doTransformItem(item.uid, greatEmptyPot)
else
doPlayerSendTextMessage(cid, 21, "Your level is too low.")
end
else
doPlayerSendTextMessage(cid, 21, "You do not have the required vocation.")
end
elseif(item.itemid == greatManaPot) then
if getPlayerVocation(cid) == 1 or getPlayerVocation(cid) == 2 or getPlayerVocation(cid) == 5 or getPlayerVocation(cid) == 6 then
if getPlayerLevel(cid) > 80 then
doSendAnimatedText(getPlayerPosition(cid), "Aaaah...", TEXTCOLOR_ORANGE)
if(doTargetCombatMana(0, cid, 250, 350, CONST_ME_MAGIC_BLUE) == LUA_ERROR) then
return FALSE
end
doTransformItem(item.uid, greatEmptyPot)
else
doPlayerSendTextMessage(cid, 21, "Your level is too low.")
end
else
doPlayerSendTextMessage(cid, 21, "You do not have the required vocation.")
end
end

return TRUE
end

na koniec wchodzisz w data\items\items.xml i na końcu dodajesz :

<item id="7588" article="a" name="strong health potion">
<attribute key="weight" value="200"/>
<attribute key="description" value="This potion can only be consumed by paladins and knights of level 50 or higher."/>
</item>
<item id="7589" article="a" name="strong mana potion">
<attribute key="weight" value="200"/>
<attribute key="description" value="This potion can only be consumed by sorcerers, druids and paladins of level 50 or higher."/>
</item>
<item id="7590" article="a" name="great mana potion">
<attribute key="weight" value="220"/>
<attribute key="description" value="This potion can only be consumed by sorcerers and druids of level 80 or higher."/>
</item>
<item id="7591" article="a" name="great health potion">
<attribute key="weight" value="220"/>
<attribute key="description" value="It can only be wielded properly by knights of level 80 or higher."/>
</item>

teraz NPC zaczynajmy:

wchodzisz w data\npc\scripts i tworzysz plik o nazwie runki.lua:

local focus = 0
local talk_start = 0
local target = 0
local following = false
local attacking = false
function onThingMove(creature, thing, oldpos, oldstackpos)
end
function onCreatureAppear(creature)
end
function onCreatureDisappear(cid, pos)
if focus == cid then
selfSay('Good bye then.')
focus = 0
talk_start = 0
end
end
function onCreatureTurn(creature)
end
function onCreatureSay(cid, type, msg)
local msg = string.lower(msg)
if msgcontains(msg, 'hi') and focus == 0 and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. creatureGetName(cid) .. '! Sellam backpacki run i potionow.')
focus = cid
talk_start = os.clock()
elseif msgcontains(msg, 'hi') and focus ~= cid and getDistanceToCreature(cid) < 4 then
selfSay('Przepraszam, ' .. creatureGetName(cid) .. '! czekaj chwile!.')
elseif focus == cid then
talk_start = os.clock()
if msgcontains(msg, 'backpacks') or msgcontains(msg, 'bp runes') then
selfSay('Selluje bp hmm , bp uh , bp gfb , bp explosion , bp sd , bp mwall, bp mana potion, health potion, strong mana potion, great mana potion, great health potion, strong health potion')
elseif msgcontains(msg, 'bp sd') then
buyContainer(cid,2003,2268,10,10000)
elseif msgcontains(msg, 'bp hmm') then
buyContainer(cid,1998,2311,100,10000)
elseif msgcontains(msg, 'bp uh') then
buyContainer(cid,2002,2273,10,10000)
elseif msgcontains(msg, 'bp gfb') then
buyContainer(cid,2000,2304,100,10000)
elseif msgcontains(msg, 'bp explosion') or msgcontains(msg, 'bp explo') then
buyContainer(cid,2001,2313,100,10000)
elseif msgcontains(msg, 'bp mwall') then
buyContainer(cid,1999,2293,100,10000)
buyContainer(cid,2000,2300,20,100000)
elseif msgcontains(msg, 'bp shp') then
buyContainer(cid,1999,7588,1,20000)
elseif msgcontains(msg, 'bp smp') then
buyContainer(cid,1999,7589,1,20000)
elseif msgcontains(msg, 'bp mp') then
buyContainer(cid,1999,7620,1,10000)
elseif msgcontains(msg, 'bp hp') then
buyContainer(cid,1999,7618,1,10000)
elseif msgcontains(msg, 'bp gmp') then
buyContainer(cid,1999,7590,1,30000)
elseif msgcontains(msg, 'bp ghp') then
buyContainer(cid,1999,7591,1,30000)
elseif msgcontains(msg, 'bp ManaUh') or msgcontains(msg, 'bp mu') then
buyContainer(cid,2004,2281,10,30000)
elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
selfSay('bye, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Nastepny...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('No narka.')
focus = 0
end
end
end

teraz wchodzimy w data\npc tworzymy plik o nazwie Maxim w wklijamy to:

<?xml version="1.0"?>
<npc name="Maxim" script="data/npc/scripts/runki.lua" access="3" lookdir="2" autowalk="25">
<mana now="666" max="666"/>
<health now="200" max="200"/>
<look type="134" head="114" body="113" legs="113" feet="113"/>
</npc>

Powinno działać.
Pozdrawiam


http://img.userbars.pl/40/7841.gif
http://www.virtuadopt.unl.pl/adoptimages/56394.gif

Offline

 

Stopka forum

RSS
Powered by PunBB 1.2.23
© Copyright 2002–2008 PunBB
Polityka cookies - Wersja Lo-Fi


Darmowe Forum | Ciekawe Fora | Darmowe Fora
www.sherwood-dungeon.pun.pl www.allgoals.pun.pl www.showa.pun.pl www.dobra-tv.pun.pl www.tibiamaster.pun.pl