• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

Promotion Doll And Shoot/Fight Sword?

Teddy

SweStream.se
Joined
Oct 2, 2008
Messages
3,797
Reaction score
10
Location
Sweden 172
Hello guys i have 2 Request's
First i have a npc that promot you do tex Elite Kniht but a have a new promotion that "Epic"
and i have a quest that you get a promotion doll and i wanna have it so if you Use it you get promoted to tex Epic Elite Knight..
and number 2
i have a sword that i want to shoot wans shoots and you can fight whit it
tex if knight use it it can shoot and you can fight melee whit it :thumbup:
 
Code:
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

local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})
	node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, promotion = 1, text = 'Congratulations! You are now promoted.'})
	node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
[B]--[[
local node2 = keywordHandler:addKeyword({'epic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can epicize you for 200000 gold coins. Do you want me to epicize you?'})
	node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 200000, level = 120, promotion = 2, text = 'Congratulations! You are now epicized.'})
	node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})
]]--[/B]

npcHandler:addModule(FocusModule:new())
 
data/npc/lib/modules.lua
search&add:
Code:
elseif(not doPlayerRemoveMoney(cid, parameters.cost)) then
     npcHandler:say('You do not have enough money!', cid)
[COLOR=red]elseif(parameters.storage ~= nil and getPlayerStorageValue(cid, parameters.storage) <= 0) then
     npcHandler:say(parameters.storageInfo or 'You have not completed the required quest.', cid)[/COLOR]
else
     setPlayerPromotionLevel(cid, parameters.promotion)
     npcHandler:say(parameters.text, cid)
end

set questStorage to required quest:
LUA:
local questStorage = 1234
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

local node1 = keywordHandler:addKeyword({'promot'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can promote you for 20000 gold coins. Do you want me to promote you?'})
    node1:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, cost = 20000, level = 20, promotion = 1, text = 'Congratulations! You are now promoted.'})
    node1:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})

local node2 = keywordHandler:addKeyword({'epic'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'I can epicize you for 200000 gold coins. Do you want me to epicize you?'})
    node2:addChildKeyword({'yes'}, StdModule.promotePlayer, {npcHandler = npcHandler, storage = questStorage, cost = 200000, level = 120, promotion = 2, text = 'Congratulations! You are now epicized.'})
    node2:addChildKeyword({'no'}, StdModule.say, {npcHandler = npcHandler, onlyFocus = true, text = 'Alright then, come back when you are ready.', reset = true})


npcHandler:addModule(FocusModule:new())
 
XML:
<action itemid="2345" event="script" value="doll.lua"/>
LUA:
function onUse(cid, item, fromPosition, itemEx, toPosition)    
    if getPlayerPromotionLevel(cid) ~= 1 then
        doPlayerSendCancel(cid, 'You can not use this item.')
        return true
    end 
 
    doRemoveItem(item.uid, 1)
    doSendMagicEffect(fromPosition, CONST_ME_FIREWORK_RED)
    doPlayerSetPromotionLevel(cid, 2)
    doPlayerSave(cid)
    doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations! You have been promoted to '.. getPlayerVocationName(cid)..'!!')    
 
    local pos = getThingPos(cid)
    for i = 1, 15 do
        doSendDistanceShoot({x = pos.x + math.random(-4, 4), y = pos.y + math.random(-4, 4), z = pos.z}, pos, CONST_ANI_SMALLHOLY)
    end
    return true
end
 
function onUse(cid, item, fromPosition, itemEx, toPosition)


doRemoveItem(item.uid, 1)
doSendMagicEffect(fromPosition, CONST_ME_FIREWORK_RED)
doPlayerSetPromotionLevel(cid, 2)
doPlayerSave(cid)
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, 'Congratulations! You have been promoted to '.. getPlayerVocationName(cid)..'!!')

local pos = getThingPos(cid)
for i = 1, 15 do
doSendDistanceShoot({x = pos.x + math.random(-4, 4), y = pos.y + math.random(-4, 4), z = pos.z}, pos, CONST_ANI_SMALLHOLY)
end
return true
end
now its work
 
Back
Top