• 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!
  • New resources must be posted under Resources tab. A discussion thread will be created automatically, you can't open threads manually anymore.

TalkAction Choose Pokemon with NPC v1

Shiko Erye

LUA - Scripter
Joined
Dec 7, 2010
Messages
106
Reaction score
12
Create new lua file and copy this inside to
LUA:
local focus = 0 -- Do Not Edit This
local talk_start = 0 -- Do Not Edit This
local target = 0 -- Do Not Edit This
local following = false -- Do Not Edit This
local attacking = false --Do Not Edit This
local newbie = 1010101
function onCreatureDisappear(cid, pos)
  	if focus == cid then
          selfSay('Good bye then.')
          focus = 0
          talk_start = 0
  	end
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)
local health = 1000
local maxhealth = 1000
newbies = getPlayerStorageValue(cid,newbie)
  	msg = string.lower(msg)
	newperson = getPlayerStorageValue(cid,newbie)
  	if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
  		selfSay('Hello, I am professor Hoa. I was once a legendary pokemon trainer, now I have switched to studies in the laboratory of Professor Oak.')
  		focus = cid
  		talk_start = os.clock()
  	elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
  		selfSay('Sorry, wait your turn.')
	elseif focus == cid then
		talk_start = os.clock()
if msgcontains(msg, 'help') and newbies <= 0 then
	selfSay('I have a charmander, squirtle anh bulbasaur. I can give you one pokemon to help you make your journey, would you like?')
	talk_state = 1
elseif talk_state == 1 and newbies <= 0 then
	if msgcontains(msg, 'yes') then
		selfSay('Ok, so what pokemon you like?')
		talk_state_s = 2
	elseif talk_state_s == 2 then
		if msgcontains(msg, 'bulbasaur') then
			local description = "Contains a Bulbasaur."
			local poke1 = "This is Bulbasaur's pokeball. HP = ["..health.."/"..maxhealth.."]"
			item = doCreateItemEx(2219)
			doItemSetAttribute(item, "poke", poke1)
			doItemSetAttribute(item, "nome", "Bulbasaur")
			doItemSetAttribute(item, "description", description)
			doPlayerAddItemEx(cid, item, true)
			doTransformItem(item, 2222)
			doPlayerAddItem(cid, 2147, 6)
			doPlayerAddSoul(cid, 1)
			setPlayerStorageValue(cid, 54842, "Bulbasaur, ")
			selfSay("You Choose a Bulbasaur. Here are your pokemon and 6 pokeballs.")
			setPlayerStorageValue(cid,newbie,1)
		elseif msgcontains(msg, 'charmander') then
			local description = "Contains a Charmander."
			local poke1 = "This is Charmander's pokeball. HP = ["..health.."/"..maxhealth.."]"
			item = doCreateItemEx(2219)
			doItemSetAttribute(item, "poke", poke1)
			doItemSetAttribute(item, "nome", "Charmander")
			doItemSetAttribute(item, "description", description)
			doPlayerAddItemEx(cid, item, true)
			doTransformItem(item, 2222)
			doPlayerAddItem(cid, 2147, 6)
			doPlayerAddSoul(cid, 1)
			setPlayerStorageValue(cid, 54842, "Charmander, ")
			selfSay("You Choose a Charmander. Here are your pokemon and 6 pokeballs.")
			setPlayerStorageValue(cid,newbie,1)
		elseif msgcontains(msg, 'squirtle') then
			local description = "Contains a Squirtle."
			local poke1 = "This is Squirtle's pokeball. HP = ["..health.."/"..maxhealth.."]"
			item = doCreateItemEx(2219)
			doItemSetAttribute(item, "poke", poke1)
			doItemSetAttribute(item, "nome", "Squirtle")
			doItemSetAttribute(item, "description", description)
			doPlayerAddItemEx(cid, item, true)
			doTransformItem(item, 2222)
			doPlayerAddItem(cid, 2147, 6)
			doPlayerAddSoul(cid, 1)
			setPlayerStorageValue(cid, 54842, "Squirtle, ")
			selfSay("You Choose a Squirtle. Here are your pokemon and 6 pokeballs.")
			setPlayerStorageValue(cid,newbie,1)
		elseif msgcontains(msg, 'no') then
			selfSay("OK... What you want?")
		elseif msgcontains(msg, 'bye') then
			selfSay("OK! Bye...")
			focus = 0
			talk_start = 0
		else
			selfSay("Tell me what pokemon you like?")
		end
	elseif msgcontains(msg, 'no') then
		selfSay("OK... What you want?")
		talk_state = 0
	elseif msgcontains(msg, 'bye') then
		selfSay("OK! Bye...")
		focus = 0
		talk_start = 0
	end
elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 2 then
		selfSay('Good bye!')
		focus = 0
		talk_start = 0
end
end
end


function onThink()
	doNpcSetCreatureFocus(focus)
	if (os.clock() - talk_start) > 30 then
  		if focus > 0 then
  			selfSay('Bye...')
  		end
  			focus = 0
  	end
 	if focus ~= 0 then
 		if getDistanceToCreature(focus) >= 2 then
 			selfSay('Good bye then.')
 			focus = 0
 		end
 	end
end
-------------------By Shiko Erye----------------------------

And Create new xml file with inside this
Code:
<?xml version="1.0" encoding="UTF-8"?>
<npc name="Professor Hoa" script="your lua file" walkinterval="2000" floorchange="0">
<health now="200" max="200"/>
<look type="171" head="97" body="114" legs="114" feet="0" /> 
</npc>


-You can change name npc [Professor Hoa] to your npc name.
-This script can help you make pokemon to new player, pokemon give to your client maybe charmander, squirtle, bulbausar or you can create new Other Pokemon.
 
Back
Top