Forum ...::[2e]::...::[2e]::...::[2e]::... Strona Główna
FAQ Szukaj Użytkownicy Grupy Profil Zaloguj się, by sprawdzić wiadomości
Forum ...::[2e]::...::[2e]::...::[2e]::... Strona Główna  Zaloguj  Rejestracja
EQ seller

 
Napisz nowy temat   Odpowiedz do tematu    Forum ...::[2e]::...::[2e]::...::[2e]::... Strona Główna -> Publikacje do OTS'ów
Zobacz poprzedni temat :: Zobacz następny temat  
Autor Wiadomość
Adminjacek
Administrator
Administrator



Dołączył: 28 Paź 2006
Posty: 58
Przeczytał: 0 tematów

Ostrzeżeń: 0/10

PostWysłany: Czw 21:43, 09 Lis 2006    Temat postu: EQ seller

Chce wam przedstawić skrypt przed chwila ukończony przezemniejest to NPC sellujący itemy Very Happy
Kod:


A więc:
w folderze data/npc tworzymy plik Palar.xml i wklejamy do niego :
Cytat:
<?xml version="1.0"?>
<npc name="Palar" script="data/npc/scripts/eq.lua" access="3">
<look type="129" head="76" body="114" legs="124" feet="86"/>
</npc>


Potem w folderze data/npc/scripts tworzymy plik eq.lua i wklejamy do niego:
Cytat:
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 (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
selfSay('Hello ' .. creatureGetName(cid) .. '! I sell swords, clubs, axes, helmets, boots, legs, shields and armors.')
focus = cid
talk_start = os.clock()

elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')

elseif focus == cid then
talk_start = os.clock()

if msgcontains(msg, 'royal helmet') then
buy(cid,2498,1,50000)
elseif msgcontains(msg, 'warrior helmet') then
buy(cid,2475,1,6000)
elseif msgcontains(msg, 'crusader helmet') then
buy(cid,2497,1,8000)
elseif msgcontains(msg, 'crown helmet') then
buy(cid,2491,1,3000)
elseif msgcontains(msg, 'devil helmet') then
buy(cid,2462,1,2000)
elseif msgcontains(msg, 'mystic turban') then
buy(cid,2663,1,1000)
elseif msgcontains(msg, 'chain helmet') then
buy(cid,2458,1,35)
elseif msgcontains(msg, 'iron helmet') then
buy(cid,2459,1,30)
elseif msgcontains(msg, 'helmets') then
selfSay('I sell royal (50k), warrior (6k), crusader (8k), crown (3k), devil (2k), chain (35gp) and iron helmets (30gp), also mystic turbans (1k).')

elseif msgcontains(msg, 'steel boots') and focus == cid then
buy(cid,2645,1,100000)
elseif msgcontains(msg, 'boh') or msgcontains(msg, 'boots of haste') and focus == cid then
buy(cid,2195,1,50000)
elseif msgcontains(msg, 'boots') then
selfSay('I sell steel boots (100k) and boots of haste (50k).')

elseif msgcontains(msg, 'magic plate armor') or msgcontains(msg, 'mpa') then
buy(cid,2472,1,300000)
elseif msgcontains(msg, 'dragon scale mail') or msgcontains(msg, 'dsm') then
buy(cid,2492,1,90000)
elseif msgcontains(msg, 'golden armor') then
buy(cid,2466,1,50000)
elseif msgcontains(msg, 'crown armor') then
buy(cid,2487,1,15000)
elseif msgcontains(msg, 'knight armor') then
buy(cid,2476,1,5000)
elseif msgcontains(msg, 'blue robe') then
buy(cid,2656,1,12000)
elseif msgcontains(msg, 'lady armor') then
buy(cid,2500,1,1000)
elseif msgcontains(msg, 'plate armor') then
buy(cid,2463,1,500)
elseif msgcontains(msg, 'brass armor') then
buy(cid,2465,1,200)
elseif msgcontains(msg, 'chain armor') then
buy(cid,2464,1,100)
elseif msgcontains(msg, 'armors') then
selfSay('I sell golden (50k), crown (15k), knight (5k), lady (1k), plate (500gp), brass (200gp) and chain armors (100gp), also mpa (300k), dsm (90k) and blue robes (12k).')

elseif msgcontains(msg, 'golden legs') then
buy(cid,2470,1,150000)
elseif msgcontains(msg, 'crown legs') then
buy(cid,2488,1,25000)
elseif msgcontains(msg, 'knight legs') then
buy(cid,2477,1,15000)
elseif msgcontains(msg, 'plate legs') then
buy(cid,2647,1,800)
elseif msgcontains(msg, 'brass legs') then
buy(cid,2478,1,100)
elseif msgcontains(msg, 'chain legs') then
buy(cid,2478,1,50)
elseif msgcontains(msg, 'legs') then
selfSay('I sell golden (150k), crown (25k), knight (15k), plate (800gp), brass (100gp) and chain legs (50gp).')

elseif msgcontains(msg, 'shield of the mastermind') or msgcontains(msg, 'mms') then
buy(cid,2514,1,120000)
elseif msgcontains(msg, 'demon shield') then
buy(cid,2520,1,60000)
elseif msgcontains(msg, 'vampire shield') then
buy(cid,2534,1,25000)
elseif msgcontains(msg, 'medusa shield') then
buy(cid,2536,1,12000)
elseif msgcontains(msg, 'amazon shield') then
buy(cid,2537,1,10000)
elseif msgcontains(msg, 'crown shield') then
buy(cid,2519,1,8000)
elseif msgcontains(msg, 'tower shield') then
buy(cid,2528,1,5000)
elseif msgcontains(msg, 'dragon shield') then
buy(cid,2516,1,1500)
elseif msgcontains(msg, 'guardian shield') then
buy(cid,2515,1,1200)
elseif msgcontains(msg, 'beholder shield') then
buy(cid,2518,1,1000)
elseif msgcontains(msg, 'dwarven shield') then
buy(cid,2525,1,100)
elseif msgcontains(msg, 'shields') then
selfSay('I sell demon (60k), vampire (25k), medusa (12k), amazon (10k), crown (8k), tower (5k), dragon (1.5k), guardian (1.2k), beholder (1k), and dwarven shields (100gp), also mms (120k)')

elseif msgcontains(msg, 'giant sword') then
buy(cid,2393,1,15000)
elseif msgcontains(msg, 'bright sword') then
buy(cid,2407,1,20000)
elseif msgcontains(msg, 'ice rapier') then
buy(cid,2396,1,4000)
elseif msgcontains(msg, 'fire sword') then
buy(cid,2392,1,5000)
elseif msgcontains(msg, 'serpent sword') then
buy(cid,2409,1,1500)
elseif msgcontains(msg, 'spike sword') then
buy(cid,2383,1,800)
elseif msgcontains(msg, 'two handed sword') then
buy(cid,2377,1,400)
elseif msgcontains(msg, 'broad sword') then
buy(cid,2413,1,70)
elseif msgcontains(msg, 'short sword') then
buy(cid,2406,1,30)
elseif msgcontains(msg, 'sabre') then
buy(cid,2385,1,25)
elseif msgcontains(msg, 'sword') then
buy(cid,2376,1,25)
elseif msgcontains(msg, 'swords') then
selfSay('I sell giant (15k), bright (20k), fire (5k) serpent (1.5k), spike (800gp) and two handed swords (400gp), also ice rapiers (4k), broad swords (70gp), short swords (30gp), sabres (25gp) and swords (25gp).')

elseif msgcontains(msg, 'dragon lance') then
buy(cid,2414,1,25000)
elseif msgcontains(msg, 'fire axe') then
buy(cid,2432,1,10000)
elseif msgcontains(msg, 'knight axe') then
buy(cid,2430,1,2000)
elseif msgcontains(msg, 'double axe') then
buy(cid,2387,1,200)
elseif msgcontains(msg, 'halberd') then
buy(cid,2381,1,200)
elseif msgcontains(msg, 'battle axe') then
buy(cid,2378,1,100)
elseif msgcontains(msg, 'hatchet') then
buy(cid,2388,1,20)
elseif msgcontains(msg, 'axes') then
selfSay('I sell fire (10k), knight (2k), double (200gp) and battle axes (100gp), also dragon lances (25k), halberds (200gp) and hatchets (20gp).')

elseif msgcontains(msg, 'war hammer') then
buy(cid,2391,1,6000)
elseif msgcontains(msg, 'skull staff') then
buy(cid,2436,1,5000)
elseif msgcontains(msg, 'dragon hammer') then
buy(cid,2434,1,2000)
elseif msgcontains(msg, 'clerical mace') then
buy(cid,2423,1,200)
elseif msgcontains(msg, 'battle hammer') then
buy(cid,2417,1,60)
elseif msgcontains(msg, 'mace') then
buy(cid,2398,1,30)
elseif msgcontains(msg, 'clubs') then
selfSay('I sell war (6k), dragon (2k) and battle hammers (60gp), also skull staffs (5k) and clerical maces (200gp).')

elseif msgcontains(msg, 'platinum amulet') then
buy(cid,2171,1,5000)
elseif msgcontains(msg, 'scarf') then
buy(cid,2661,1,500)
elseif msgcontains(msg, 'amulets') then
selfSay('I sell platinum amulets (5k) and scarfs (500gp).')

elseif string.find(msg, '(%a*)bye(%a*)') and getDistanceToCreature(cid) < 4 then
selfSay('Good 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('Next Please...')
end
focus = 0
end
if focus ~= 0 then
if getDistanceToCreature(focus) > 5 then
selfSay('Good bye then.')
focus = 0
end
end
end


Objaśnienie:
Cytat:
elseif msgcontains(msg, 'platinum amulet') then
buy(cid,2171,1,5000)


Czerwonym ID itemu co ma NPC sprzedawać
Ilość itemów które ma sprzedać
Cena w gp

Potem na końcu otwieramy plik data/world/npc.xml przed
Cytat:
</npclist>
wklejamy :
Cytat:
<npc name="Palar" x="160" y="54" z="7"/>


Objaśnienie:

Pozycja X gdzie ma stać NPC na mapie
Pozycja Y gdzie ma stać NPC na mapie
Pozycja Z gdzie ma stać NPC na mapie

Testowany na YurOTS 0.9.4d

Myślę że się przyda :D
Comment PLZ


Post został pochwalony 0 razy
Powrót do góry
Zobacz profil autora
Wyświetl posty z ostatnich:   
Napisz nowy temat   Odpowiedz do tematu    Forum ...::[2e]::...::[2e]::...::[2e]::... Strona Główna -> Publikacje do OTS'ów Wszystkie czasy w strefie CET (Europa)
Strona 1 z 1

 
Skocz do:  
Nie możesz pisać nowych tematów
Nie możesz odpowiadać w tematach
Nie możesz zmieniać swoich postów
Nie możesz usuwać swoich postów
Nie możesz głosować w ankietach
fora.pl - załóż własne forum dyskusyjne za darmo
Powered by phpBB © 2001, 2002 phpBB Group
BBTech Template by © 2003-04 MDesign
Regulamin