• 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 Unique Training System. (4 versions included)

Potar

SocialWorld
Senator
Joined
Mar 1, 2009
Messages
1,664
Reaction score
125
Location
Warsaw, Poland
I would like you to present my simple and useful script.

Its very easy to change something, like addevent when a player is teleported back etc.​

Training Sytem V1: Free Training.
Training System V2: Training for soul points.
Training System V3: Kick within x minutes.
Training System V4: Training for soul points + Fixes + Magic level training!

Unique Training System. V1 (training free)

How is it works?

Its easy, when you use a command, you will be moved to the training area, and your possition before using command will be saved.

Commands:

/training ON - You'll be move to the training area, you can use this command only in PZ zones.
/training OFF - You leave the training arena, you can use this command only in PZ zones.

Compatible with:

TFS 0.4 should be work with 0.3.6 / 0.3.7

Any ideas / errors / suggestions , just write here!

In talkactions.xml
Lua:
<talkaction words="/training" event="script" value="training.lua"/>

Script:

In talkactions/scripts

Lua:
local storage = 29994 --save player posstion before REMEMBER! Storage 29995 and 29996 must be free too!
local storage2 = 31233 --exhaustion storage
local storage3 = 29993 --player on training arena (check)

function onSay(cid, words, param, channel)
if (exhaustion.get (cid, storage2)) then
	doPlayerSendCancel (cid, "You can use this command one time per 3 secconds!")
return TRUE
else
	exhaustion.set(cid, storage2, 3)
	end

if(not getTileInfo(getThingPosition(cid)).protection) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can teleport to training arena only in PZ zones!") and true
end

if(param == '') then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must write type of trenning OFF or ON.") and true
end

if(param == 'ON') then
if getPlayerStorageValue(cid, storage3) <= 0 then
	local playerPos = getPlayerPosition(cid)
		setPlayerStorageValue(cid, storage, playerPos.x)
		setPlayerStorageValue(cid, storage+1, playerPos.y)
		setPlayerStorageValue(cid, storage+2, playerPos.z)
		doTeleportThing(cid, {x=872, y=255, z=8}) -- trainers pos.
		doSendMagicEffect({x=872, y=255, z=8}, CONST_ME_TELEPORT) -- trainers pos.
		setPlayerStorageValue(cid, storage3, 1)
		else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are into training arena!")
		end
	return true 
end

if(param == 'OFF') then
local x = getPlayerStorageValue(cid, storage)
local y = getPlayerStorageValue(cid, storage+1)
local z = getPlayerStorageValue(cid, storage+2)

	if(x > 2 and y > -2) then
		doTeleportThing(cid, {x=x, y=y, z=z})
		doSendMagicEffect({x=x, y=y, z=z}, CONST_ME_TELEPORT)
		setPlayerStorageValue(cid, storage, 1)
		setPlayerStorageValue(cid, storage+1, 1)
		setPlayerStorageValue(cid, storage+2, 1)
		setPlayerStorageValue(cid, storage3, 0)
		else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must use /training ON command first!")
	return true 
	end
end

return true
end



Unique Training System. V2 (training for soul points)

I added new training method (send soul points for training) and optimized the script.

How its work now?

Training will cost you soul points (1 per minute you can set it). When your soul points will come to zero, you will be kicked from the training place, if you do not have soul points there is a message "Sorry, but you have not enough souls for training!".

Remember, the training area must be can't to logout, but if you want for can logout too, just write here, i will write creaturescript script.

Lua:
local storage = 29994 --save player posstion before REMEMBER! Storage 29995 and 29996 must be free too!
local storage2 = 31233 --exhaustion storage
local storage3 = 29993 --player on training arena (check)
local trainingpos = {x=872, y=255, z=8} --training possition (move to)
local cost = 1 --minutes = souls (how you spend minutes for 1 soul)
 
function onSay(cid, words, param, channel)
if (exhaustion.get (cid, storage2)) then
	doPlayerSendCancel (cid, "You can use this command one time per 3 secconds!")
return TRUE
else
	exhaustion.set(cid, storage2, 3)
	end
 
if(not getTileInfo(getThingPosition(cid)).protection) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can teleport to training arena only in PZ zones!") and true
end
 
if(param == '') then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must write type of trenning OFF or ON.") and true
end
 
if(param == 'ON') then
if	(getPlayerSoul(cid) >= 1) then
	if getPlayerStorageValue(cid, storage3) <= 0 then
	local playerPos = getPlayerPosition(cid)
		setPlayerStorageValue(cid, storage, playerPos.x)
		setPlayerStorageValue(cid, storage+1, playerPos.y)
		setPlayerStorageValue(cid, storage+2, playerPos.z)
		doTeleportThing(cid, trainingpos)
		doSendMagicEffect(trainingpos, CONST_ME_TELEPORT)
		setPlayerStorageValue(cid, storage3, 1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Welcome to the training room, training will cost you soul points (1 per minute). When your soul points will come to zero, you will be kicked from the training place.")
		check = addEvent(soulcheck, cost*60*1000, cid)
		else
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are into training arena!")
		end
else
doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "Sorry, but you have not enough souls for training!")
		end
	return true 
end
 
if(param == 'OFF') then
local x = getPlayerStorageValue(cid, storage)
local y = getPlayerStorageValue(cid, storage+1) --Storage 29995 must be free too!
local z = getPlayerStorageValue(cid, storage+2) --Storage 29996 must be free too!
	if(x > 2 and y > -2) then
		doTeleportThing(cid, {x=x, y=y, z=z})
		doSendMagicEffect({x=x, y=y, z=z}, CONST_ME_TELEPORT)
		setPlayerStorageValue(cid, storage, 1)
		setPlayerStorageValue(cid, storage+1, 1)
		setPlayerStorageValue(cid, storage+2, 1)
		setPlayerStorageValue(cid, storage3, 0)
		stopEvent(check)
		else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must use /training ON command first!")
	return true 
	end
end
 
return true
end

function soulcheck(cid)
if	(getPlayerSoul(cid) >= 1) then 
	doPlayerAddSoul(cid, -1)
	doSendAnimatedText(getPlayerPosition(cid), "-1 Soul", 70)
	check = addEvent(soulcheck, cost*60*1000,cid)
else
local x = getPlayerStorageValue(cid, storage)
local y = getPlayerStorageValue(cid, storage+1)
local z = getPlayerStorageValue(cid, storage+2)
		doTeleportThing(cid, {x=x, y=y, z=z})
		doSendMagicEffect({x=x, y=y, z=z}, CONST_ME_TELEPORT)
		setPlayerStorageValue(cid, storage, 1)
		setPlayerStorageValue(cid, storage+1, 1)
		setPlayerStorageValue(cid, storage+2, 1)
		setPlayerStorageValue(cid, storage3, 0)
		stopEvent(check)
end
end

Unique Training System. V3 (kick from trainers within x minutes)

I added new training method (kick from trainers within x minutes).

How its work now?

Player will be kicked within x minutes, from training arena.

Remember, the training area must be can't to logout, but if you want for can logout too, just write here, i will write creaturescript script.

Lua:
local storage = 29994 --save player posstion before REMEMBER! Storage 29995 and 29996 must be free too!
local storage2 = 31233 --exhaustion storage
local storage3 = 29993 --player on training arena (check)
local trainingpos = {x=872, y=255, z=8} --training possition (move to)
local kicktime = 1 --minutes to kick
 
function onSay(cid, words, param, channel)
if (exhaustion.get (cid, storage2)) then
	doPlayerSendCancel (cid, "You can use this command one time per 3 secconds!")
return TRUE
else
	exhaustion.set(cid, storage2, 3)
	end
 
if(not getTileInfo(getThingPosition(cid)).protection) then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You can teleport to training arena only in PZ zones!") and true
end
 
if(param == '') then
return doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must write type of trenning OFF or ON.") and true
end
 
if(param == 'ON') then
	if getPlayerStorageValue(cid, storage3) <= 0 then
	local playerPos = getPlayerPosition(cid)
		setPlayerStorageValue(cid, storage, playerPos.x)
		setPlayerStorageValue(cid, storage+1, playerPos.y)
		setPlayerStorageValue(cid, storage+2, playerPos.z)
		doTeleportThing(cid, trainingpos)
		doSendMagicEffect(trainingpos, CONST_ME_TELEPORT)
		setPlayerStorageValue(cid, storage3, 1)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are in training arena, you have been kicked within "..kicktime.." minutes!")
		check = addEvent(kickyo, kicktime*60*1000, cid)
		else
	doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You are into training arena!")
		end
	return true 
end
 
if(param == 'OFF') then
local x = getPlayerStorageValue(cid, storage)
local y = getPlayerStorageValue(cid, storage+1) --Storage 29995 must be free too!
local z = getPlayerStorageValue(cid, storage+2) --Storage 29996 must be free too!
	if(x > 2 and y > -2) then
		doTeleportThing(cid, {x=x, y=y, z=z})
		doSendMagicEffect({x=x, y=y, z=z}, CONST_ME_TELEPORT)
		setPlayerStorageValue(cid, storage, 1)
		setPlayerStorageValue(cid, storage+1, 1)
		setPlayerStorageValue(cid, storage+2, 1)
		setPlayerStorageValue(cid, storage3, 0)
		stopEvent(check)
		else
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You must use /training ON command first!")
	return true 
	end
end
 
return true
end

function kickyo(cid)

local x = getPlayerStorageValue(cid, storage)
local y = getPlayerStorageValue(cid, storage+1)
local z = getPlayerStorageValue(cid, storage+2)
		doTeleportThing(cid, {x=x, y=y, z=z})
		doSendMagicEffect({x=x, y=y, z=z}, CONST_ME_TELEPORT)
		setPlayerStorageValue(cid, storage, 1)
		setPlayerStorageValue(cid, storage+1, 1)
		setPlayerStorageValue(cid, storage+2, 1)
		setPlayerStorageValue(cid, storage3, 0)
		doPlayerSendTextMessage(cid, MESSAGE_STATUS_CONSOLE_BLUE, "You have been kicked from training area!")
end


Unique Training System. V4 (training with XLOG for Mages / Druides for soul points!)

Its very simple script, but i changed alot, if it must working on xlog, so i changed events, to globalevents, more stable, now you can training from every PZ zones, but now it is not teleport you to before use place becouse, I did not need this.

You can also change mana spent, but i used it to my server, and it is working fine (3h for 1mlvl or less/more dependent mlvl and level)

So let me show you:

creaturescripts (also you must register it on login.lua and add to creaturescripts.xml name="login"):
Lua:
function onLogin(cid)
local storage = 29993
setPlayerStorageValue(cid, storage, 0)
return true
end

Globalevents.xml
Lua:
<globalevent name="training" interval="60000" event="script" value="training.lua"/>
Script:
Lua:
local storage = 29993

function onThink(interval, lastExecution)
for _, name in ipairs(getOnlinePlayers()) do
local cid = getPlayerByName(name)

	if getPlayerStorageValue(cid, storage) == 1 then
		if (getPlayerSoul(cid) >= 1) then 
			doPlayerAddSoul(cid, -1)
		if isSorcerer(cid) then
			doPlayerAddSpentMana(cid, getPlayerMaxMana(cid)*0.3) -- you can change it
				end
		if isDruid(cid) then
			doPlayerAddSpentMana(cid, getPlayerMaxMana(cid)*0.3) -- you can changeit
				end
			doSendAnimatedText(getPlayerPosition(cid), "-1 Soul", 70)
		else
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
		doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)), CONST_ME_TELEPORT)
		setPlayerStorageValue(cid, storage, 0)
		end
	end
 end
return true
end

training.lua (other scripts like prevoius versions)

Lua:
local storage = 29993 --player on training arena (check)
local storage2 = 31233 --exhaustion storage
local trainingpos = {x=872, y=255, z=8} --training possition (move to)
 
function onSay(cid, words, param, channel)
if (exhaustion.get (cid, storage2)) then
	doPlayerSendCancel (cid, "You can use this command one time per 3 secconds!")
return TRUE
else
	exhaustion.set(cid, storage2, 3)
	end
 
if(not getTileInfo(getThingPosition(cid)).protection) then
return doPlayerSendTextMessage(cid,22, "You can teleport to training arena only in PZ zones!") and true
end
 
if(param == '') then
return doPlayerSendTextMessage(cid,22, "You must write type of trenning OFF or ON.") and true
end
 
if(param == 'ON') then
if (getPlayerSoul(cid) >= 1) then
	if getPlayerStorageValue(cid, storage) <= 0 then
		doTeleportThing(cid, trainingpos)
		doSendMagicEffect(trainingpos, CONST_ME_TELEPORT)
		setPlayerStorageValue(cid, storage, 1)
		doPlayerSendTextMessage(cid,22, "Welcome to the training room, training will cost you soul points (1 per minute). When your soul points will come to zero, you will be kicked from the training place.")
		else
	doPlayerSendTextMessage(cid,22, "You are into training arena!")
		end
else
doPlayerSendTextMessage(cid,22, "Sorry, but you have not enough souls for training!")
		end
	return true 
end
 
if(param == 'OFF') then
	if getPlayerStorageValue(cid, storage) == 1 then
		doTeleportThing(cid, getTownTemplePosition(getPlayerTown(cid)))
		doSendMagicEffect(getTownTemplePosition(getPlayerTown(cid)), CONST_ME_TELEPORT)
		setPlayerStorageValue(cid, storage, 0)
		else
		doPlayerSendTextMessage(cid,22, "You must use /training ON command first!")
	end
		return true 
end
 
return true
end
 
Last edited:
Without trying it out, i already repped you for helping out the community and posting such nice scripts that others wouldn't release it for free. Keep it up mate, srry aswell for my poor english
 
Thank you, wise words :)

- - - Updated - - -

Version 4 added, OFFLINE SKILLING FOR MAGES / DRUIDS.

Unique Training System. V4 (training with XLOG for Mages / Druides for soul points!)
 
how do i gain soulpoints?
cause it says how you lose them but not how to gain them
 
You can gain it by hunting the monsters, configurable in vocation.XML , you can also make action script to refill them.
 
Back
Top