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

Safari Zone V2.0

Jano

oturhaN
Joined
Feb 21, 2008
Messages
876
Solutions
1
Reaction score
68
Location
Chile
WEll Everyone who Played Pokemon (Game boy/Emulator) i think would know about this, to the people who never played pokemon the safari zone its a special place where you can find pokemons that you only can find in the safari zone, paying an amount of money to get in, you have a limit time.
Well my idea is a specail hunting area where you pay to a npc to get in and where you have a limited time to hunt, in this hunting area would be rare/powefull monsters.
Update to Version 2.0
Changes:
-Removed Time Limit, and Added Step Limit.
-Removed The Second Npc.
-Added The !safari Comand, it Will Tell You How Mouch Steps You have Left.
-Added The !leave Comand, it Will Teleport You Out The Safari Zone in The Moment That You Want.
-Fixed all Bugs.
-If The Player Logout In The Safari Zone, The Steps Counter Will Save.
-Added Configuration to The Steps That the Npc Sell.
-If You Dint Pay and Try Go in the Safari Zone yuo Will Teleported Out.
-Now you Can Make a Safari Zone, as Big as you Want, Without Place a Npc in Midle.
-Now You Dont Need The Exit Sqm be Protection Zone, Cause There Never Will Multiple Players Telerported Out at Same Time.
-If The Player Buy 300 Steps He Will Hunting 300 Steps (Before He Buy 10 Minutes but He Could Be Teleported out Whenever, without use hes time)


How Do This Work?
The New System is Based in 4 Scripts, 1 Npc, 1 Movement, 2 Talkation.
-The Npc : Sell You The Steps and Teleport You in The Safari Zone.
-Movement : Count the Steps, And Others Things.
-Talkations : Its Used to Teleport you out If You Want; Tell you How Many Steps you Have Left.



The 1st Script

Go to data/npc/scripts an create a file Called Safariin.lua
Inside Put This.

Code:
local zone = {x=4475, y=4432, z=7} --- Change it to the Entry of Your safari Zone.
local storage = 20000 ---The Storage That you Check the Steps, The same Storage That The Npc, The Movement and Te Talkation Would Have.
local steps = 600 ---the number of steps that the player have to be in safari zone.
local cost = 20  ---Prize for Each Step.
---------------------------------------End Config--------------------------------------
local pay = cost * steps ---Do Not Edit This
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

function getPlayerMoney(cid)
gold = getPlayerItemCount(cid,2148)
plat = getPlayerItemCount(cid,2152)*100
crys = getPlayerItemCount(cid,2160)*10000
money = gold + plat + crys
return money
end

function onThingMove(creature, thing, oldpos, oldstackpos)
end

function onCreatureAppear(creature)
end

function onCreatureDisappear(cid, pos)
  	if focus == cid then
          selfSay('Good bye then.')
          focus = 0
          talk_start = 0
  	end
end

function onCreatureTurn(creature)
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)
  	msg = string.lower(msg)

  	if (msgcontains(msg, 'hi') and (focus == 0)) and getDistanceToCreature(cid) < 4 then
  		selfSay('Hello ' .. creatureGetName(cid) .. '! I can take you to the safari zone.')
  		focus = cid
  		talk_start = os.clock()

  	elseif msgcontains(msg, 'hi') and (focus ~= cid) and getDistanceToCreature(cid) < 4 then
  		selfSay('Sorry, ' .. creatureGetName(cid) .. '! I talk to you in a minute.')

	elseif focus == cid then
		talk_start = os.clock()

		if msgcontains(msg, 'safari') then
			selfSay('Do you want buy ' .. steps ..' Steps in the safari zone for ' .. pay ..' gold coins?')
			talk_state = 1

		
		elseif talk_state == 1 then
			if msgcontains(msg, 'yes') then
				if getPlayerMoney(cid) >= pay then
					setPlayerStorageValue(cid,storage,0)
					doTeleportThing(cid, zone)
					doSendMagicEffect(zone,10)
					doPlayerRemoveMoney(cid,pay) 

				else
					selfSay('Sorry, you don\'t have enough money.')
				end
 			end
			talk_state = 0

			
		elseif msgcontains(msg, 'bye') and getDistanceToCreature(cid) < 4 then
			selfSay('Good bye, ' .. creatureGetName(cid) .. '!')
			focus = 0
			talk_start = 0
		end
	end
end


function onCreatureChangeOutfit(creature)
end

function onThink()
	doNpcSetCreatureFocus(focus)
	if (os.clock() - talk_start) > 30 then
  		if focus > 0 then
  			selfSay('Next Please...')
  		end
  			focus = 0
  	end
 	if focus ~= 0 then
 		if getDistanceToCreature(focus) > 5 then
 			selfSay('Good bye then.')
 			focus = 0
 		end
 	end
end
-------------------By Nahruto----------------------------

Next go to data/npc and create a new xml file with this inside

Code:
<?xml version="1.0"?>
<npc name="NAME" script="data/npc/scripts/safariin.lua" access="3" lookdir="2" autowalk="25">
	<mana now="800" max="800"/>
	<health now="200" max="200"/>
<look type="154" head="0" body="96" legs="97" feet="2" addons="3"  />
</npc>


The 2nd Script.
Go to data/movements/scripts and create a file called safari.lua
inside put this.

Code:
local storage = 20000 ---The Storage That you Check the Steps, The same Storage That The Npc, The Movement and Te Talkation Would Have.
local out = {x=4469, y=4414, z=6} --- Change it to the Exit of Your safari Zone
local steps = 600 ---the number of steps that the player have to be in safari zone.
------------------------------------------------End Config-------------------------------------------------
function onStepIn(cid, item, pos)
if isPlayer(cid) == 1 then
stepleft = getPlayerStorageValue(cid,storage)
if stepleft <= steps and stepleft >= 0 then
setPlayerStorageValue(cid,storage,stepleft+1)
elseif stepleft >= steps then
setPlayerStorageValue(cid,storage,-1)
doTeleportThing(cid, out)
doSendMagicEffect(out,10)
doPlayerSendTextMessage(cid,22,"The Time in The Safari Zone is Over, Come Back Soon.")
elseif stepleft == -1 then
doTeleportThing(cid, out)
doSendMagicEffect(out,10)
doPlayerSendTextMessage(cid,22,"You Are Not Allowed To be in The Safari Zone.")
end
end
end
-------------------By Nahruto----------------------------

This Part is Important You Would Select a Ground Type That You Dont Have in any other Area of your map.

in data/movements/movements.xml add this line

Code:
<movevent event="StepIn" itemid="XXXX" script="safari.lua" />

Change The XXXX to ID of the Ground you Select.


The 3th Script.
Goto to data/talkations/scripts and create a new file Called safari.lua
inside put this.

Code:
local storage = 20000 ---The Storage That you Check the Steps, The same Storage That The Npc, The Movement and Te Talkation Would Have.
local out = {x=4469, y=4414, z=6} --- Change it to the Exit of Your safari Zone
--------------------------------------------------------------------------------------------------------------------------
function onSay(cid, words, param)
inzone = getPlayerStorageValue(cid,storage)
if inzone == -1 then
doPlayerSendTextMessage(cid,22,"You Are not In The Safari Zone.")
elseif inzone > -1 then
doTeleportThing(cid,out)
doPlayerSendTextMessage(cid,22,"You Have Left the Safari Zone, Come Back Soon.")
setPlayerStorageValue(cid,storage,-1)
doSendMagicEffect(out,10)
end
end
-------------------By Nahruto----------------------------

The 4th Script.
Goto to data/talkations/scripts and create a new file Called safaristeps.lua
inside put this.
Code:
local storage = 20000 ---The Storage That you Check the Steps, The same Storage That The Npc, The Movement and Te Talkation Would Have.
local steps = 600 ---the number of steps that the player have to be in safari zone.
---------------------------------------------End Config-----------------------------------------------------------------------------
function onSay(cid, words, param)
inzone = getPlayerStorageValue(cid,storage)
left = steps - inzone
if inzone == -1 then
doPlayerSendTextMessage(cid,22,"You Are not In The Safari Zone.")
elseif inzone > -1 then
doPlayerSendTextMessage(cid,22,"You Have " .. left .. " Steps Left in the Safari Zone.")
end
end
-------------------By Nahruto----------------------------

Now Go to data/talkations/talkations.xml and add this Lines.

Code:
<talkaction words="!leave" script="safari.lua" />
<talkaction words="!safari" script="safaristeps.lua" />


Ok now all the Scripts are Ready.
Now You Would Place the npc on the map editor And build You Safari Zone.
The Ground of the Safari Zone Would be the Same in all the area, and not will be the same of other area.
Change The Config of the Scripts, they Are Easy to Config.


Examples:
I Say !safari, it Reply "23:46 You Have 574 Steps Left in the Safari Zone."
I Say !leave, im Teleported Out and it Say "23:47 You Have Left the Safari Zone, Come Back Soon."(and the Steps are Reset to 0)
I Try Go in the Safari Zone Without Pay, it Say "23:48 You Are Not Allowed To be in The Safari Zone."
I Use all My Steps in the Safari Zone, it say "23:51 The Time in The Safari Zone is Over, Come Back Soon."

-There Are Not Know Bugs.
-Next Version, Ill Try Use The Floor That You Want.


Now Enjoy =).
Report The Bugs Here.
Give New Ideas Here.
 
Last edited:
i really like this i will use it thanks!
Also what happends if you log out in the zone?
 
Last edited:
Well can i use actionid?
instead of itemid in the safari zone cuz i think i used a lot of grounds on my ot!

xD
 
Lol that would take adges. but nahruto i tested this and i had a problem, when the steps run out in the safari zone it says -1 steps and doesnt teleport you out. i'm using TFS v 11
 
Really nice. But instead steps it can be made for time, like 4 hours and etc?
Cool system :]

[COLOR="#4aae5"]Geeky[/COLOR].
 
Here it did not work.
The NPC teleports the player to saffari, but the number of steps is not counted.
And so never ending time player on saffari zone!
Help-me please!
 
someone can updated funcions in this script for 8.60 ? would be great to integrate it into this version
HELP REP+
regards!
 
Back
Top