• logo_cipsoft
    Nowe serwery zostały otwarte 19 Lut 2025:
    Noctalia (Open PvP) Ignitera (Open PvP) us_logo Xybra (Open PvP)

NPC Bless Seller (Alice) [7.x,8.x]

Status
Zamknięty.

Don Muha

Advanced User
Dołączył
Sierpień 27, 2008
Posty
403
Liczba reakcji
34
Witam. Odrazu m?wi? ,?e skrypt nie m?j. Znalaz?em go na innym forum (czeskie czy jakie? tam :P). A wiec zaczynamy w data/npc tworzymy plik: Alice.xml Pami?tajcie! musi by? na ko?cu jak piszemy .xml ! A wiec to wklejamy w Alice.xml:

Kod:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Alice" script="data/npc/scripts/bless.lua" walkinterval="2000" floorchange="0">
<health now="100" max="100"/>
<look type="139" head="20" body="39" legs="45" feet="7" addons="0"/>
</npc>

A potem w data/npc/scripts tworzymy plik bless.lua
(na koncu musi byc .lua) A wiec wklejamy to w plik bless.lua:

Kod:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid) npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) npcHandler:onCreatureSay(cid, type, msg) end
function onThink() npcHandler:onThink() end

function buyBlessing(cid, message, keywords, parameters, node)
if(not npcHandler:isFocused(cid)) then
return false
end

if getPlayerBlessing(cid, parameters.blessing) then
npcHandler:say("A god has already blessed you with this blessing.", cid)
elseif isPremium(cid) == TRUE then
if doPlayerRemoveMoney(cid, 10000) == TRUE then
doPlayerAddBlessing(cid, parameters.blessing)
npcHandler:say("You have been blessed by one of the five gods!", cid)
else
npcHandler:say("You don't have enough money.", cid)
end
else
npcHandler:say("You need a premium account to buy blessings.", cid)
end

keywordHandler:moveUp(1)
return true
end

local node1 = keywordHandler:addKeyword({'first bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the first blessing for 10000 gold coins?'})
node1:addChildKeyword({'yes'}, buyBlessing, {blessing = 1})
node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Then not.'})

local node2 = keywordHandler:addKeyword({'second bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the second blessing for 10000 gold coins?'})
node2:addChildKeyword({'yes'}, buyBlessing, {blessing = 2})
node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Then not.'})

local node3 = keywordHandler:addKeyword({'third bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the third blessing for 10000 gold coins?'})
node3:addChildKeyword({'yes'}, buyBlessing, {blessing = 3})
node3:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Then not.'})

local node4 = keywordHandler:addKeyword({'fourth bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the fourth blessing for 10000 gold coins?'})
node4:addChildKeyword({'yes'}, buyBlessing, {blessing = 4})
node4:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Then not.'})

local node5 = keywordHandler:addKeyword({'fifth bless'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the fifth blessing for 10000 gold coins?'})
node5:addChildKeyword({'yes'}, buyBlessing, {blessing = 5})
node5:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Then not.'})

keywordHandler:addKeyword({'blessing'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can provide you with five blessings... the 'first bless', 'second bless', 'third bless', 'fourth bless' and the 'fifth bless', they cost 10000 gold coins each."})
keywordHandler:addKeyword({'blessings'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can provide you with five blessings... the 'first bless', 'second bless', 'third bless', 'fourth bless' and the 'fifth bless', they cost 10000 gold coins each."})
keywordHandler:addKeyword({'offer'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can provide you with five blessings... the 'first bless', 'second bless', 'third bless', 'fourth bless' and the 'fifth bless', they cost 10000 gold coins each."})
keywordHandler:addKeyword({'help'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = "I can provide you with five blessings... the 'first bless', 'second bless', 'third bless', 'fourth bless' and the 'fifth bless', they cost 10000 gold coins each."})

npcHandler:addModule(FocusModule:new())

Skrypt na 100% dzia?a na silniku TFS (sprawdza?em na r?znych TFSach)

Jesli taki temat juz by? prosze o zamkniecie tematu
-- Pozdrawiam i prosze o mi?e komentarze. :)
 
Odp: [7.x,8.x] NPC Bless Seller (Alice)

Odp: [7.x,8.x] NPC Bless Seller (Alice)

|| << || Odswizam || >> ||
Prosze o Komentarze !
 
Odp: [7.x,8.x] NPC Bless Seller (Alice)

Odp: [7.x,8.x] NPC Bless Seller (Alice)

mnie sie wydaje ze to jakas b?jda xd
 
Odp: [7.x,8.x] NPC Bless Seller (Alice)

Odp: [7.x,8.x] NPC Bless Seller (Alice)

Czyli?? -.- Wez sie nie odzywaj ja tu nie pytam tych co dopiero konto stworzyli tylko lepszych :/
 
Odp: [7.x,8.x] NPC Bless Seller (Alice)

Odp: [7.x,8.x] NPC Bless Seller (Alice)

Dzia?a na YurOts pod 8.22 SQL. A pod TFS to niewiem ale wydaje mi sie ze tez :)
 
Odp: [7.x,8.x] NPC Bless Seller (Alice)

Odp: [7.x,8.x] NPC Bless Seller (Alice)

je?eli komu? potrzebne to dzia?a r?wnie? na evo by aciek 8.1
 
Odp: [7.x,8.x] NPC Bless Seller (Alice)

Odp: [7.x,8.x] NPC Bless Seller (Alice)

@UP
Nie dzia?a na evo by aciek 8.1. Pojawia si? taki b??d:
Kod:
Lua Script Error: [Npc interface]
data/npc/scripts/bless.lua:onCreatureSay
data/npc/script/bless.lua:9: attempt to call method 'isFocused' <a nil value>
 
Odp: [7.x,8.x] NPC Bless Seller (Alice)

Odp: [7.x,8.x] NPC Bless Seller (Alice)

a dzi?a na your ots 7.6 ??
 
Odp: [7.x,8.x] NPC Bless Seller (Alice)

Odp: [7.x,8.x] NPC Bless Seller (Alice)

Pomocy musze miec blesy na evo by sentil help me ;/ !!! pisac na gg 7507372
 
Odp: NPC Bless Seller (Alice) [7.x,8.x]

E do czego jest ten bless??
Plz odpiszcie :/ tylko tego nie wiem ;/
 
Status
Zamknięty.
Do góry