Lithium
Ex-TFS Developer
- Joined
- Jun 2, 2007
- Messages
- 334
- Reaction score
- 0
Hello people
I post here one script of Addon NPC for Forgotten Server
gogogo to script
Please update the NPC
Changelog
Create a file named Varkhal.xml in data/npc/ and put inside it:
Then create a file named addon.lua in data/npc/scripts/ and copy this into it:
Credits: Original Lithium
Remade Jiddo
Coments Please
I post here one script of Addon NPC for Forgotten Server
gogogo to script
Please update the NPC
Changelog
18/06/07 improvement of NPC using loop
18/06/07 Fixed minor bug and removed some blank lines
13/08/07 Remade by Jiddo
13/08/07 Added Support to Norseman Outfit and Changesex Command (Lithium)
Create a file named Varkhal.xml in data/npc/ and put inside it:
Code:
<?xml version="1.0"?>
<npc name="Varkhal" script="data/npc/scripts/addon.lua" autowalk="1" floorchange="0">
<health now="100" max="100"/>
<look type="134" head="78" body="88" legs="0" feet="88" addons="3" />
</npc>
Then create a file named addon.lua in data/npc/scripts/ and copy this into it:
PHP:
------------------------------------------------------------------------
---------------- Addon NPC for Forgotten Server ------------------------
---------------- Script by originally by Lithium -----------------------
---------------------- Remade by Jiddo ---------------------------------
------------------------------------------------------------------------
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
-- OTServ event handling functions start
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
-- OTServ event handling functions end
function doPlayerGiveAddons(cid, addon)
for x = 128, 134 do
doPlayerAddOutfit(cid, x, addon)
end
for y = 143, 146 do
doPlayerAddOutfit(cid, y, addon)
end
for z = 151, 154 do
doPlayerAddOutfit(cid, z, addon)
end
doPlayerAddOutfit(cid, 251, addon)
for x = 136, 142 do
doPlayerAddOutfit(cid, x, addon)
end
for y = 147, 150 do
doPlayerAddOutfit(cid, y, addon)
end
for z = 155, 158 do
doPlayerAddOutfit(cid, z, addon)
end
doPlayerAddOutfit(cid, 252, addon)
end
function confirmBuyAddons(cid, message, keywords, parameters, node)
if(cid ~= npcHandler.focus) then
return false
end
local addon = parameters.addon
local cost = parameters.cost
local premium = (parameters.premium ~= nil and parameters.premium ~= false)
if(isPlayerPremiumCallback == nil or isPlayerPremiumCallback(cid) == true or premium == false) then
if doPlayerRemoveMoney(cid, cost) then
doPlayerGiveAddons(cid, addon)
npcHandler:say('Here you go! Enjoy your addons.')
else
npcHandler:say('Sorry, you do not have enough money.')
end
else
npcHandler:say('I only serve customers with premium accounts.')
end
keywordHandler:moveUp(1)
return true
end
local nodeFirst = keywordHandler:addKeyword({'first addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the first addon for 5000 gold coins?.'})
nodeFirst:addChildKeyword({'yes'}, confirmBuyAddons, {addon = 1, cost = 5000, premium = true})
nodeFirst:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Too expensive, eh?'})
local nodeSecond = keywordHandler:addKeyword({'second addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Do you want to buy the second addon for 10000 gold coins?.'})
nodeSecond:addChildKeyword({'yes'}, confirmBuyAddons, {addon = 2, cost = 10000, premium = true})
nodeSecond:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, moveup = 1, text = 'Too expensive, eh?'})
keywordHandler:addKeyword({'addon'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I sell the first addon for 5000 gold coins and the second one for 10000 gold coins.'})
npcHandler:addModule(FocusModule:new())
Credits: Original Lithium
Remade Jiddo
Coments Please
Last edited: