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

TFS npc/train time

keatoru

...workin...
Joined
Apr 26, 2008
Messages
96
Reaction score
0
Location
KY, USA
The Train Time
What I want to do is have an NPC that will sell you a set amount of time and when you walk onto a pressure pad in a certain location it will activate the time and u can start training. When the time is up you get tped back in front of the npc that you bought the time from.
This is a screen of the one of the areas I want to use the script:
distance.jpg

Basically the NPC would be standing behind the counter and someone would walk up and buy some time then they would walk around onto that pressure pad time is activated they walk on over to the trainers (the targets) and train. Times up and they get tped back in front of the counter.
This is basically how i want it to work. If you decide to try and create this try to make it as universal (i guess that would be the word) as possible so i can use it in more than one location. also when someone steps on the pad i don't want them to be able to go back out. and if u don't have time you can't step on the pad..

The NPC:
This goes along with the train time. What I'm trying to do is create different places like a pally guild/knight guild/mage guild/druid guild and in them they have trainers and a shop. I want to make the shop keeper and train time npc to be one.


Thank you so much if you help me.

*Server is TFS 0.3 rev. 902*
 
would be nice, but ahm a easily cheat for that is "restand" on the tile so you will get back your time :O anyways, I will see if I can make that code in the night, am too busy right now :/
 
thanks

hm. yea i see that yet would i be possible to block that tile from being stepped on by that person after they step off of it..
 
Ok, I'm just too lazy to make the code, so here it comes

Script a npc, then add it to a line this.

TRAIN PAID ZONE V2.0
Code:
elseif msgcontains(msg, 'entrance') then
             selfSay('are you sure to enter at the training monk\'s rooms, you must pay me 500k per hour!')
             talk_state = 2

             elseif talk_state == 2 then
             if msgcontains(msg,'yes') then
             if doPlayerRemoveMoney(cid,500000) then
             SetPlayerStorageValue(Cid,10001,1)
             selfSay('Ok, good luck with this!')
             else
             selfSay('Sorry, you don\'t have enough money')
             end
             end
             talk_state = 0

Code:
function onStepIn(cid, item, position, fromPosition)
	if item.actionid == 10001 and getPlayerStorageValue(cid,10001,1) then          -- tile for passing
	local training ={x=positions,y=of,z=monkzone}
		local back ={x=positions,y=of,z=returns}
		local trainingzone1 ={x=positions,y=of,z=summoningmonks, stackpos = 1}
		local trainingzone2 ={x=positions,y=of,z=summoningmonks, stackpos = 1}
		local trainingzone3 ={x=positions,y=of,z=summoningmonks, stackpos = 1}
		
		doTeleportThing(cid,training,1)
		local setup = uptime + 1440
		doSummonCreature('Training Monk', trainingzone1)
		doSummonCreature('Training Monk', trainingzone2)
		doSummonCreature('Training Monk', trainingzone3)
		setPlayerStorageValue(cid,10000,setup)
		setPlayerStorageValue(cid,10001,-1)
		
		elseif item.actionid == 10001 and getPlayerStorageValue(cid,10001) == -1 then
		doTeleportThing(cid,back,1)
		end
		local uptime = getWorldUpTime(cid)
		local afterup = getPlayerStorageValue(cid,10000)
	if item.actionid == 10000 and uptime >= afterup then
	doTeleportThing(cid,back,1)
	setPlayerStorageValue(cid,10000,-1)
	setPlayerStorageValue(cid,10001,-1)
	doRemoveItem(cid,trainingzone1,1)
	doRemoveItem(cid,trainingzone2,1)
	doRemoveItem(cid,trainingzone3,1)
	end
	return TRUE
end

Explanation of my V2.0

This time the NPC Gives you the variable for the tile, when you're on the tile, the tile will set you the variable of time, then you will be able to training, if the player re-press the tile in search of more time, will be automatically kicked, because the tile removed his variable when he press for first time.

When the times goes out, and the player moves by his anti-afk, will be kicked. Because the others tiles with action id of 10000

So this is the overall

NPC

Gives you the variable 10001

Pressing Tile

Gives you the variable 10000 by the uptime and remove the variable 10001

10000 Tiles.

Check if the variable gaved by the pressed tile its >= if its major or equal to the variable will autokick the player




Please, if you have any feedback, let me know
This message was written at 2 am on my country, so I don't have any memory of this tomorrow :P

If it has any bug, let me know it aswell...

HAVE FUN :P

Btw, CREDITS 100% By ME, Kramer Infernal
 
k, well this seems like it will only work for one location... What I am wanting is to where there is multiple buildings and areas. one for each voc. and this looks like it only works in one location..

also this part:
Code:
	local training ={x=positions,y=of,z=monkzone}
		local back ={x=positions,y=of,z=returns}
		local trainingzone1 ={x=positions,y=of,z=summoningmonks, stackpos = 1}
		local trainingzone2 ={x=positions,y=of,z=summoningmonks, stackpos = 1}
		local trainingzone3 ={x=positions,y=of,z=summoningmonks, stackpos = 1}
		
		doTeleportThing(cid,training,1)
		local setup = uptime + 1440
		doSummonCreature('Training Monk', trainingzone1)
		doSummonCreature('Training Monk', trainingzone2)
		doSummonCreature('Training Monk', trainingzone3)
		setPlayerStorageValue(cid,10000,setup)
		setPlayerStorageValue(cid,10001,-1)
I'm not exactly sure what coords this part is asking:
Code:
	local training ={x=positions,y=of,z=monkzone}
		local back ={x=positions,y=of,z=returns}
and below that. i'm not sure why i would need it if the monks are saved on to the map.


i meant to put this in the first post but forgot. i want to be able to make it voc specific. like at one location say the pally trainers, only pallys can buy time and step on the pad. then at knight trainers only knights can buy time and step on the pad and so on. also isn't it possible to make it to where no matter if they are standing still, walking or w/e to tp them back when time goes...
 
blablablablabla xD
ok lets go to the topic.

Sorry for didn't explain that I passed off :P
Training is the zone you will be teleported when you step in the square
back, is the tile you will get back when the time get finished.

the last paragraph I didn't understand it all, but if you need to do it for multiple vocations, change the code and then make him for multiple vocations

P.S: delete then the lines that includes trainingzone1, 2 and 3 in his words :P

have fun :P
 
go to movements/movement.xml, and copy paste these msges

Code:
	<movevent event="StepIn" actionid="10001" script="yourfile.lua"/>
<movevent event="StepIn" actionid="10000" script="yourfile.lua"/>

Please replace yourfile with the name of your file in movements/scripts/yourfile.lua :)

am gonna sleep, its actually the 4:14 am here, bye bye :P
 
Back
Top