Warth
Gaduła+
Dołączył: 07 Lip 2006
Posty: 103
Przeczytał: 0 tematów
Ostrzeżeń: 0/3 Skąd: Wroclaw
|
Wysłany: Sob 9:17, 08 Lip 2006 Temat postu: NPC Temple by KILLAVUS |
|
|
Od razu mówie ze to nie jest mój NPC
Ale przyd sie ludziom posiadajacym rozbudowana mapqe gdzie maja kilka miast :]
Otoz NPC zmienia mijesce naszego zmieszkania
tworzymy plik city.lua z zawartoscia
Kod: | focus = 0
talk_start = 0
target = 0
following = false
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 msgcontains(txt, str)
return (string.find(txt, str) and not string.find(txt, '(%w+)' .. str) and not string.find(txt, str .. '(%w+)'))
end
function onCreatureSay(cid, type, msg)
msg = string.lower(msg)
if ((string.find(msg, '(%a*)hi(%a*)')) and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Welcome ' .. creatureGetName(cid) .. '! Do you want to be citizen of The this city?')
selfLook(cid)
focus = cid
talk_start = os.clock()
end
if string.find(msg, '(%a*)hi(%a*)') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! I am talking now.')
end
if msgcontains(msg, 'yes') and focus == cid then
selfSay('Now you are the citizen of this city, ' .. creatureGetName(cid) .. ' gratulations!')
selfSay('/send ' .. creatureGetName(cid) .. ', 160 54 7')
setPlayerMasterPos(cid,160,54,7)
focus = 0
talk_start = 0
end
if string.find(msg, '(%a*)bye(%a*)') and focus == cid and getDistanceToCreature(cid) < 4 then
selfSay('See you, ' .. creatureGetName(cid) .. '!')
focus = 0
talk_start = 0
end
end
function onCreatureChangeOutfit(creature)
end
function onThink()
if (os.clock() - talk_start) > 30 then
if focus > 0 then
selfSay('Next please...')
end
focus=0
end
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('See you later.')
focus = 0
end
end |
Kod: | selfSay('/send ' .. creatureGetName(cid) .. ', 160 54 7') |
Wy wpiszcie tu TEMPLE tego miasta do ktorego mze zaczac przynalezec
A w data/npc
Cito.xml
Kod: | <?xml version="1.0"?>
<npc name="Cito" script="data/npc/scripts/city.lua" access="3" monster="1" speed="50" level="100" maglevel="100" exp="0" pushable="0" lookdir="0">
<mana now="100" max="100"/>
<health now="100" max="100"/>
<look type="57" head="78" body="61" legs="52" feet="114" corpse="2276"/>
<attack type="melee" damage="10"/>
</npc> |
Post został pochwalony 0 razy
|
|