• 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!

[NPC] (easy edit) rep++ // edit npc options

E

Evil Puncker

Guest
Hi ppl, can someone rewrite this NPC, so I can choose if I wanna do greenhorn, scrapper or warlord... And so i can do how much times I want :)


IE:

Player: hi
NPC: Want to fight today?
Player: yes
NPC: Greenhorn, Scrapper or Warlord?
Player: Scrapper
(Then set the storages)

And remove the level restriction please ^_^
here goes the script

Lua:
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 enterArena(cid, message, keywords, parameters, node)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
	local cost = 0
	local levelname = ''
	if getPlayerStorageValue(cid, 42355) < 1 then
		cost = 1000
		levelname = 'greenhorn'
		levelneeded = 30
	elseif getPlayerStorageValue(cid, 42355) == 1 then
		cost = 5000
		levelname = 'scrapper'
		levelneeded = 50
	elseif getPlayerStorageValue(cid, 42355) == 2 then
		cost = 10000
		levelname = 'warlord'
		levelneeded = 80
	end
	if string.lower(keywords[1]) == 'yes' and parameters.prepare ~= 1 then
		if(getPlayerLevel(cid) >= levelneeded) then
			if(getPlayerMoney(cid) >= cost) then
				doPlayerRemoveMoney(cid, cost)
				npcHandler:say('Now you can go to test.', cid)
				setPlayerStorageValue(cid, 42351, 1)
			else
				npcHandler:say('You don\'t have ' .. cost .. ' gold coins! Come back when you will be ready!', cid)
		    end
		else
			npcHandler:say('You don\'t have ' .. levelneeded .. ' level! Come back when you will be ready!', cid)
		end
		npcHandler:resetNpc()
	elseif string.lower(keywords[1]) == 'no' then
		npcHandler:say('Come back later then!', cid)
		npcHandler:resetNpc()
	else
		if getPlayerStorageValue(cid, 42355) < 3 then
			npcHandler:say('You test will be ' .. levelname .. ' level. If you want enter you must pay ' .. cost .. ' gp and have ' .. levelneeded .. ' level. Wanna try?', cid)
		else
			npcHandler:say('You did all arena levels.',cid)
		end
	end
	return true
end

npcHandler:setMessage(MESSAGE_GREET, 'Hello |PLAYERNAME|! Do you want to make arena?')

local yesNode = KeywordNode:new({'yes'}, enterArena, {})
local noNode = KeywordNode:new({'no'}, enterArena, {})

local node1 = keywordHandler:addKeyword({'arena'}, enterArena, {prepare=1})
	node1:addChildKeywordNode(yesNode)
	node1:addChildKeywordNode(noNode)
	
local node1 = keywordHandler:addKeyword({'fight'}, enterArena, {prepare=1})
	node1:addChildKeywordNode(yesNode)
	node1:addChildKeywordNode(noNode)
local node1 = keywordHandler:addKeyword({'yes'}, enterArena, {prepare=1})
	node1:addChildKeywordNode(yesNode)
	node1:addChildKeywordNode(noNode)
npcHandler:addModule(FocusModule:new())
 
Last edited by a moderator:
Here is ur script without level required.
PHP:
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 enterArena(cid, message, keywords, parameters, node)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
	local cost = 0
	local levelname = ''
	if getPlayerStorageValue(cid, 42355) < 1 then
		cost = 1000
		levelname = 'greenhorn'
	elseif getPlayerStorageValue(cid, 42355) == 1 then
		cost = 5000
		levelname = 'scrapper'
	elseif getPlayerStorageValue(cid, 42355) == 2 then
		cost = 10000
		levelname = 'warlord'
	end
	if string.lower(keywords[1]) == 'yes' and parameters.prepare ~= 1 then
		if(getPlayerLevel(cid) >= levelneeded) then
			if(getPlayerMoney(cid) >= cost) then
				doPlayerRemoveMoney(cid, cost)
				npcHandler:say('Now you can go to test.', cid)
				setPlayerStorageValue(cid, 42351, 1)
			else
				npcHandler:say('You don\'t have ' .. cost .. ' gold coins! Come back when you will be ready!', cid)
		    end
		npcHandler:resetNpc()
	elseif string.lower(keywords[1]) == 'no' then
		npcHandler:say('Come back later then!', cid)
		npcHandler:resetNpc()
	else
		if getPlayerStorageValue(cid, 42355) < 3 then
			npcHandler:say('You test will be ' .. levelname .. ' level. If you want enter you must pay ' .. cost .. ' gp. Wanna try?', cid)
		else
			npcHandler:say('You did all arena levels.',cid)
		end
	end
	return true
end
 
npcHandler:setMessage(MESSAGE_GREET, 'Hello |PLAYERNAME|! Do you want to make arena?')
 
local yesNode = KeywordNode:new({'yes'}, enterArena, {})
local noNode = KeywordNode:new({'no'}, enterArena, {})
 
local node1 = keywordHandler:addKeyword({'arena'}, enterArena, {prepare=1})
	node1:addChildKeywordNode(yesNode)
	node1:addChildKeywordNode(noNode)
 
local node1 = keywordHandler:addKeyword({'fight'}, enterArena, {prepare=1})
	node1:addChildKeywordNode(yesNode)
	node1:addChildKeywordNode(noNode)
local node1 = keywordHandler:addKeyword({'yes'}, enterArena, {prepare=1})
	node1:addChildKeywordNode(yesNode)
	node1:addChildKeywordNode(noNode)
npcHandler:addModule(FocusModule:new())
:)
 
well, honestly the npc must be rewritten :( here goes the idea:

Player: hi
NPC: hello |playername|, want to fight today?
Player: yes
NPC: What are do you wanna make? Greenhorn, Scrapper or Warlord?
Player: warlord
NPC: You need to pay 10000 gold coins to enter in the Warlord mode, do you agree?
Player: yes
(check the money, remove the money)
NPC: Now you can pass the door, good luck!
(setPlayerStorageValue(cid, 42351, 1))

then the player makes warlord mode and goes back to the npc and wants to make the greenhorn mode, then:

Player: hi
NPC: hello |playername|, want to fight today?
Player: yes
NPC: What are do you wanna make? Greenhorn, Scrapper or Warlord?
Player: greenhorn
NPC: You need to pay 1000 gold coins to enter in the Greenhorn mode, do you agree?
Player: yes
(check the money, remove the money)
NPC: Now you can pass the door, good luck!
(setPlayerStorageValue(cid, 42351, 1))

then the player makes greenhorn mode and goes back to the npc and wants to make the scrapper mode, then:


Player: hi
NPC: hello |playername|, want to fight today?
Player: yes
NPC: What are do you wanna make? Greenhorn, Scrapper or Warlord?
Player: scrapper
NPC: You need to pay 5000 gold coins to enter in the Scrapper mode, do you agree?
Player: yes
(check the money, remove the money)
NPC: Now you can pass the door, good luck!
(setPlayerStorageValue(cid, 42351, 1))

PS: the player can do any mode at any level, infinite times, the storage in red is set so the player can pass the door, and in blue are the "variables" that are the only things that changes with the options.

That is basicly what I want that the NPC do, can anyone help me?
 
This is the best I can do, not rewritten but changed to as you wish, I still think we need the arena script aswell since it got a big part in this.
Lua:
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 enterArena(cid, message, keywords, parameters, node)
	if(not npcHandler:isFocused(cid)) then
		return false
	end
	if getPlayerStorageValue(cid, 42355) < 1 then
		cost = 2000
		levelname = 'greenhorn'
	elseif getPlayerStorageValue(cid, 42355) == 1 then
		cost = 5000
		levelname = 'scrapper'
	elseif getPlayerStorageValue(cid, 42355) == 2 then
		cost = 8000
		levelname = 'warlord'
	end
	if string.lower(keywords[1]) == 'yes' and parameters.prepare ~= 1 then
			if(getPlayerMoney(cid) >= cost) then
				doPlayerRemoveMoney(cid, cost)
				npcHandler:say('Now you can pass the door, good luck!', cid)
				setPlayerStorageValue(cid, 42351, 1)
			else
				npcHandler:say('You need ' .. cost .. 'gps to make the ' .. levelname .. ' level. Come back when you got the money!', cid)
		    end
		npcHandler:resetNpc()
	elseif string.lower(keywords[1]) == 'no' then
		npcHandler:say('Come back when you\'re then!', cid)
		npcHandler:resetNpc()
	else
		if getPlayerStorageValue(cid, 42355) < 3 then
			npcHandler:say('Your test will be ' .. levelname .. ' level. If you want enter you must pay ' .. cost .. ' gps. Wanna try?', cid)
		else
			npcHandler:say('You did all arena levels.',cid)
		end
	end
	return true
end

npcHandler:setMessage(MESSAGE_GREET, 'Hello |PLAYERNAME|, Do you want to fight today?')

local yesNode = KeywordNode:new({'yes'}, enterArena, {})
local noNode = KeywordNode:new({'no'}, enterArena, {})

local node1 = keywordHandler:addKeyword({'arena'}, enterArena, {prepare=1})
	node1:addChildKeywordNode(yesNode)
	node1:addChildKeywordNode(noNode)
	
local node1 = keywordHandler:addKeyword({'fight'}, enterArena, {prepare=1})
	node1:addChildKeywordNode(yesNode)
	node1:addChildKeywordNode(noNode)
local node1 = keywordHandler:addKeyword({'yes'}, enterArena, {prepare=1})
	node1:addChildKeywordNode(yesNode)
	node1:addChildKeywordNode(noNode)
npcHandler:addModule(FocusModule:new())
If you don't like it maybe this will work for you: MOD perfect Svargrond Arena System!
 
this will block me to make arena again :(

if getPlayerStorageValue(cid, 42355) < 3 then
npcHandler:say('Your test will be ' .. levelname .. ' level. If you want enter you must pay ' .. cost .. ' gps. Wanna try?', cid)
else
npcHandler:say('You did all arena levels.',cid)
end

and forget about the 42355 xD
 

Similar threads

Back
Top