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

Training Problem, gets others skills while i'm training at the OT

Kaywin

Lord of War WoW/Tibia 2D
Joined
Oct 24, 2008
Messages
541
Reaction score
6
Location
SwedeN
Hello as the topic says: When I train at my OTserver "fist fighting for example". I Get sword/club/shield/dist ect.. everything! And when i train with a two handed weapon i also get shielding..


Never seen this bugg before, so can someone please explain for me how i change that asap!

Thank you!
Yours,
Sir starlight
 
I goes crazy, the players is the way to popping in and I really have to fix this!


This is what I know for now.. I'm using a tile named: black marble floor. that got a Action ID: 900 and Unique ID 0.


data/movements/scripts/tiles.lua

Code:
local config = {
	maxLevel = getConfigInfo('maximumDoorLevel')
}

local increasingItems = {[416] = 417, [426] = 425, [446] = 447, [3216] = 3217, [3202] = 3215, [11062] = 11063}
local decreasingItems = {[417] = 416, [425] = 426, [447] = 446, [3217] = 3216, [3215] = 3202, [11063] = 11062}
local depots = {2589, 2590, 2591, 2592}

local checkCreature = {isPlayer, isMonster, isNpc}
local function pushBack(cid, position, fromPosition, displayMessage)
	doTeleportThing(cid, fromPosition, false)
	doSendMagicEffect(position, CONST_ME_MAGIC_BLUE)
	if(displayMessage) then
		doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "The tile seems to be protected against unwanted intruders.")
	end
end

function onStepIn(cid, item, position, fromPosition)
	if(not increasingItems[item.itemid]) then
		return false
	end

	if(not isPlayerGhost(cid)) then
		doTransformItem(item.uid, increasingItems[item.itemid])
	end

	if(item.actionid >= 194 and item.actionid <= 196) then
		local f = checkCreature[item.actionid - 193]
		if(f(cid)) then
			pushBack(cid, position, fromPosition, false)
		end

		return true
	end

	if(item.actionid >= 191 and item.actionid <= 193) then
		local f = checkCreature[item.actionid - 190]
		if(not f(cid)) then
			pushBack(cid, position, fromPosition, false)
		end

		return true
	end

	if(not isPlayer(cid)) then
		return true
	end

	if(item.actionid == 189 and not isPremium(cid)) then
		pushBack(cid, position, fromPosition, true)
		return true
	end

	local gender = item.actionid - 186
	if(isInArray({PLAYERSEX_FEMALE,  PLAYERSEX_MALE, PLAYERSEX_GAMEMASTER}, gender)) then
		if(gender ~= getPlayerSex(cid)) then
			pushBack(cid, position, fromPosition, true)
		end

		return true
	end

	local skull = item.actionid - 180
	if(skull >= SKULL_NONE and skull <= SKULL_BLACK) then
		if(skull ~= getCreatureSkullType(cid)) then
			pushBack(cid, position, fromPosition, true)
		end

		return true
	end

	local group = item.actionid - 150
	if(group >= 0 and group < 30) then
		if(group > getPlayerGroupId(cid)) then
			pushBack(cid, position, fromPosition, true)
		end

		return true
	end

	local vocation = item.actionid - 100
	if(vocation >= 0 and vocation < 50) then
		local playerVocationInfo = getVocationInfo(getPlayerVocation(cid))
		if(playerVocationInfo.id ~= vocation and playerVocationInfo.fromVocation ~= vocation) then
			pushBack(cid, position, fromPosition, true)
		end

		return true
	end

	if(item.actionid >= 1000 and item.actionid <= config.maxLevel) then
		if(getPlayerLevel(cid) < item.actionid - 1000) then
			pushBack(cid, position, fromPosition, true)
		end

		return true
	end

	if(item.actionid ~= 0 and getPlayerStorageValue(cid, item.actionid) <= 0) then
		pushBack(cid, position, fromPosition, true)
		return true
	end

	if(getTileInfo(position).protection) then
		local depotPos, depot = getCreatureLookPosition(cid), {}
		depotPos.stackpos = STACKPOS_GROUND
		while(true) do
			if(not getTileInfo(depotPos).depot) then
				break
			end

			depotPos.stackpos = depotPos.stackpos + 1
			depot = getThingFromPos(depotPos)
			if(depot.uid == 0) then
				break
			end

			if(isInArray(depots, depot.itemid)) then
				local depotItems = getPlayerDepotItems(cid, getDepotId(depot.uid))
				doPlayerSendTextMessage(cid, MESSAGE_STATUS_DEFAULT, "Your depot contains " .. depotItems .. " item" .. (depotItems > 1 and "s" or "") .. ".")
				break
			end
		end

		return true
	end

	return false
end

function onStepOut(cid, item, position, fromPosition)
	if(not decreasingItems[item.itemid]) then
		return false
	end

	if(not isPlayerGhost(cid)) then
		doTransformItem(item.uid, decreasingItems[item.itemid])
		return true
	end

	return false
end


data/movements/scripts/squaretrainer.lua
Code:
--[[ 
Square Skill Trainer made by Arthur aka artofwork
This script will train all of a players skills indefintely
It has a small configuration setup where you can set the number of tries per skill
The time interval in between each skill try added
A storage value to help prevent abuse
You can assign any tile you wish to this script that a player can walk on with action id 900
Added a time check based on how much soul they have left
Example:
19:32 Luceria, you have enough soul points to train for 1 hour and 10 minutes
19:32 Your training session will begin in 30 seconds
19:32 Your training session will begin in 20 seconds
19:33 Your training session will begin in 10 seconds
19:33 Your training session will now begin
]]--




-- Config --
local soul = 1 -- the amount of soul to take
local storage = 18010 -- Storage value for the player when he steps on and off the tile
local amount = 0 -- the minimum soul they need to use trainers
local skilltries = 2 -- Number of tries per skill
local t = 3000   -- Set the time before try is added to skills (4 seconds)

-- temple x, y, z coordinates set in config.lua --
local mposx = getConfigInfo('newPlayerSpawnPosX') 
local mposy = getConfigInfo('newPlayerSpawnPosY') 
local mposz = getConfigInfo('newPlayerSpawnPosZ')
-------------------------------------------------------------------------

function timeCheck(p)
local hour = math.floor(getPlayerSoul(p.cid) / 60)
local minutes = getPlayerSoul(p.cid) % 60
    if(getPlayerSoul(p.cid) > 120) then
        doPlayerSendTextMessage(p.cid,22,""..getPlayerName(p.cid)..", you have enough soul points to train for "..hour.." hours and "..minutes.." minutes")
    elseif(getPlayerSoul(p.cid) == 120) then
        doPlayerSendTextMessage(p.cid,22,""..getPlayerName(p.cid)..", you have enough soul points to train for "..hour.." hours.")
    elseif(getPlayerSoul(p.cid) > 60 and getPlayerSoul(p.cid) < 120) then
        doPlayerSendTextMessage(p.cid,22,""..getPlayerName(p.cid)..", you have enough soul points to train for "..hour.." hour and "..minutes.." minutes")
    elseif(getPlayerSoul(p.cid) == 60) then
        doPlayerSendTextMessage(p.cid,22,""..getPlayerName(p.cid)..", you have enough soul points to train for "..hour.." hour.")
    else
        doPlayerSendTextMessage(p.cid,22,""..getPlayerName(p.cid)..", you have enough soul points to train for "..minutes.." minutes")
    end
end


function templeTeleport(p)
local ACCESS_TO_USE = 0
local TEMPLE_POS = {x = mposx, y = mposy, z = mposz}
     if getPlayerAccess(p.cid) >= ACCESS_TO_USE then
        setPlayerStorageValue(p.cid, 18010, 0)
        doSendMagicEffect(getPlayerPosition(p.cid),CONST_ME_TELEPORT)
        doTeleportThing(p.cid,TEMPLE_POS)
        doSendMagicEffect(TEMPLE_POS,CONST_ME_ENERGYAREA)
     else
          doPlayerSendCancel(p.cid,"You dont have the access to do this.")
     end
end

function takeSoulPoints(p)
 if(getPlayerSoul(p.cid) > amount) then
  doPlayerAddSoul(p.cid, -p.soul)
  p.seconds = 60000
 else
  doPlayerSendTextMessage(p.cid,22,"Sorry "..getPlayerName(p.cid)..", You not have enough soul points to train.")
  addEvent(templeTeleport, 1, p)
 end
end 


function trainerthree(p)
 if isPlayer(p.cid) == TRUE and getPlayerStorageValue(p.cid, 18010) == 1 then
  doPlayerSendTextMessage(p.cid,22,"Your training session will begin in 30 seconds")
  addEvent(trainertwo, 10 * 1000, p)
 end
 return FALSE
end
 
function trainertwo(p)
 if isPlayer(p.cid) == TRUE and getPlayerStorageValue(p.cid, 18010) == 1 then
  doPlayerSendTextMessage(p.cid,22,"Your training session will begin in 20 seconds")
  addEvent(trainerone, 10 * 1000, p)
 end
 return FALSE
end
 
function trainerone(p)
 if isPlayer(p.cid) == TRUE and getPlayerStorageValue(p.cid, 18010) == 1 then
  doPlayerSendTextMessage(p.cid,22,"Your training session will begin in 10 seconds")
  addEvent(readyToTrain, 10 * 1000, p)
 end
 return FALSE
end
 
function readyToTrain(p)
 if isPlayer(p.cid) == TRUE and getPlayerStorageValue(p.cid, 18010) == 1 then
  doPlayerSendTextMessage(p.cid,22,"Your training session will now begin")
  doPlayerAddSoul(p.cid, -p.soul)
  addEvent(trainMeA, t, p)
 end
 return FALSE
end
 
function trainMeA(p)
 if isPlayer(p.cid) == TRUE and getPlayerStorageValue(p.cid, 18010) == 1 then
  doPlayerAddSkillTry(p.cid, SKILL_FIST, skilltries)
  doPlayerAddSkillTry(p.cid, SKILL_SWORD, skilltries)
  doPlayerAddSkillTry(p.cid, SKILL_CLUB, skilltries)
  doPlayerAddSkillTry(p.cid, SKILL_AXE, skilltries)
  doPlayerAddSkillTry(p.cid, SKILL_DISTANCE, skilltries)
  doPlayerAddSkillTry(p.cid, SKILL_SHIELD, skilltries)
  if(p.seconds <= 1000) then
  addEvent(takeSoulPoints, 1 * 1000, p)
  end
  p.seconds = p.seconds - t
  addEvent(trainMeB, t, p)
 end
 return FALSE
end
 
function trainMeB(p)
 if isPlayer(p.cid) == TRUE and getPlayerStorageValue(p.cid, 18010) == 1 then
  doPlayerAddSkillTry(p.cid, SKILL_FIST, skilltries)
  doPlayerAddSkillTry(p.cid, SKILL_CLUB, skilltries)
  doPlayerAddSkillTry(p.cid, SKILL_SWORD, skilltries)
  doPlayerAddSkillTry(p.cid, SKILL_AXE, skilltries)
  doPlayerAddSkillTry(p.cid, SKILL_DISTANCE, skilltries)
  doPlayerAddSkillTry(p.cid, SKILL_SHIELD, skilltries)
  if(p.seconds <= 1000) then
  addEvent(takeSoulPoints, 1 * 1000, p)
  end
  p.seconds = p.seconds - t
  addEvent(trainMeA, t, p)
 end
 return FALSE
end
 
function onStepIn(cid, item)
local seconds = 60000
local p = {cid = cid, item = item, pos = pos, soul = soul, seconds = seconds}
 setPlayerStorageValue(p.cid, 18010, 1)
 if isPlayer(p.cid) == TRUE and getPlayerStorageValue(p.cid, 18010) == 1 then
  if(p.item.actionid == 900 and (getPlayerSoul(p.cid) > amount)) == TRUE then
        timeCheck(p)
        addEvent(trainerthree, 1 * 1000, p)
    else
        addEvent(takeSoulPoints, 1, p)
    end
    end
 
 return FALSE
end
 
function onStepOut(cid, item)
 if isPlayer(cid) == TRUE then
  setPlayerStorageValue(cid, 18010, 0)
  doPlayerSendTextMessage(cid,22,"Your training session has now ended")
 end
end

movments.xml

Code:
   	<!-- Square Trainer -->
    	<movevent type="StepIn" actionid="900" event="script" value="squaretrainer.lua"/>
    	<movevent type="StepOut" actionid="900" event="script" value="squaretrainer.lua"/>
 
Last edited:
Just remove the lines in movements.xml and use normal trainers or
change in squaretrainers.lua:
LUA:
  doPlayerAddSkillTry(p.cid, SKILL_FIST, skilltries)
  doPlayerAddSkillTry(p.cid, SKILL_SWORD, skilltries)
  doPlayerAddSkillTry(p.cid, SKILL_CLUB, skilltries)
  doPlayerAddSkillTry(p.cid, SKILL_AXE, skilltries)
  doPlayerAddSkillTry(p.cid, SKILL_DISTANCE, skilltries)
  doPlayerAddSkillTry(p.cid, SKILL_SHIELD, skilltries)
 
Back
Top