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

MoveEvent Training Square

Osmose

hunf hunf
Joined
May 15, 2009
Messages
28
Reaction score
0
I made this from a discution on this thread

-- Square Skill Trainer made by Arthur aka artofwork
Pretty much by me since i modified the entire script but he got the ideia first...

i tried to make it support fist skill as well but i got a infinite loop that crash my server...
cant figure out how to solve this problem...

for information proposes, tested on TFS 0.3.4pl2! :)

data/movements/scripts/sqtrainer.lua
PHP:
-- Config --
local skillTries = 10 -- Number of tries per skill
local t = 2 * 1000 -- Set the time before try is added to skills
local lock = 10 -- Time to wait before start again in seconds

-- Weapon Types --
local weaponTypes = {
	{ 1, 2 }, -- Sword
	{ 2, 1 }, -- Club
	{ 3, 3 }, -- Axe
	{ 4, 5 }, -- Shield
	{ 5, 4 } -- Distance
}

function onStepIn(cid, item, pos, fromPos)
	local p = {cid = cid, item = item, pos = pos}
	if getPlayerStorageValue(p.cid, 18010) == 2 then
		doTeleportThing(p.cid, fromPos, TRUE)
		doPlayerSendTextMessage(p.cid,22,"You must wait "..lock.." seconds before you start again")
		return false
	end
	setPlayerStorageValue(p.cid, 18010, 1)
	if isPlayer(p.cid) and p.item.actionid == 900 then
		doPlayerSendTextMessage(p.cid,22,"Your training session will now begin")
		addEvent(trainMe, t, p)
	end
	return true
end
function onStepOut(cid, item)
	if getPlayerStorageValue(cid, 18010) == 2 then
		return false
	end
	setPlayerStorageValue(cid, 18010, 2)
	addEvent(trainLock, lock * 1000, cid)
	doPlayerSendTextMessage(cid,22,"Your training session has now ended")
	return true
end
function trainLock (cid)
	if isPlayer(cid) then
		setPlayerStorageValue(cid, 18010, 0)
	end
end
function trainMe(p)
	if isPlayer(p.cid) and getPlayerStorageValue(p.cid, 18010) == 1 and p.item.actionid == 900 then
		local weaponLeft = getPlayerSlotItem(p.cid, CONST_SLOT_LEFT)
		local weaponRight = getPlayerSlotItem(p.cid, CONST_SLOT_RIGHT)
		if weaponLeft.itemid ~= 0 then
			weaponLeft = getItemWeaponType(weaponLeft.uid)
		end
		if weaponRight.itemid ~= 0 then
			weaponRight = getItemWeaponType(weaponRight.uid)
		end
		for _, t in pairs(weaponTypes) do
			if t[1] == weaponLeft or t[1] == weaponRight then			
				doPlayerAddSkillTry(p.cid, t[2], skillTries)
			end
		end
		manaspent = getPlayerMana(p.cid)
		doPlayerAddSpentMana(p.cid, manaspent)
		doTargetCombatMana(0, p.cid, -manaspent, -manaspent, CONST_ME_NONE)

		doSendMagicEffect(getPlayerPosition(p.cid),34)
	
		addEvent(trainMe, t, p)
	end
	return true
end

movements.xml
PHP:
	<!-- Trainer Square -->
	<movevent type="StepIn" actionid="900" script="sqtrainer.lua"/>
	<movevent type="StepOut" actionid="900" script="sqtrainer.lua"/>

data/creaturescrips/scripts/login.lua add this
PHP:
setPlayerStorageValue(cid, 18010, 0)
in case player logout or server drop

Using map editor set Square you want as Trainer with ActionID 900.

im done...
improvements are welcome!!! thank you!
 
Last edited:
I test this script in my ot but not work with ml up =/ i spent mana but not ml up and when i reach distance 25 the distance skill rises very slowly :S could make mana spent only if the character has 100% of your mana and another thing beam that automatically increases the mana
 
Last edited:
I test this script in my ot but not work with ml up =/ i spent mana but not ml up and when i reach distance 25 the distance skill rises very slowly :S could make mana spent only if the character has 100% of your mana and another thing beam that automatically increases the mana

yea

change
PHP:
doPlayerAddSpentMana(p.cid, manaspent)
doTargetCombatMana(0, p.cid, -manaspent, -manaspent, CONST_ME_NONE)

to
PHP:
if getPlayerMana(p.cid) == getPlayerMaxMana(p.cid) then
    doPlayerAddSpentMana(p.cid, manaspent)
    doTargetCombatMana(0, p.cid, -manaspent, -manaspent, CONST_ME_NONE)
end
 
Well, but what i can do with the skills problem, because when i have 25 or more in distance left to climb or i advance in distance but ver very slowly
 
Can you explain step by step how to add this on my server.... your explanation don't easy to undertand, i'm a noob on scripts and otserv world...
 
I have a problem...
I added that in movements/scripts...

-- Config --
local skillTries = 10 -- Number of tries per skill
local t = 2 * 1000 -- Set the time before try is added to skills
local lock = 10 -- Time to wait before start again in seconds

-- Weapon Types --
local weaponTypes = {
{ 1, 2 }, -- Sword
{ 2, 1 }, -- Club
{ 3, 3 }, -- Axe
{ 4, 5 }, -- Shield
{ 5, 4 } -- Distance
}

function onStepIn(cid, item, pos, fromPos)
local p = {cid = cid, item = item, pos = pos}
if getPlayerStorageValue(p.cid, 18010) == 2 then
doTeleportThing(p.cid, fromPos, TRUE)
doPlayerSendTextMessage(p.cid,22,"You must wait "..lock.." seconds before you start again")
return false
end
setPlayerStorageValue(p.cid, 18010, 1)
if isPlayer(p.cid) and p.item.actionid == 900 then
doPlayerSendTextMessage(p.cid,22,"Your training session will now begin")
addEvent(trainMe, t, p)
end
return true
end
function onStepOut(cid, item)
if getPlayerStorageValue(cid, 18010) == 2 then
return false
end
setPlayerStorageValue(cid, 18010, 2)
addEvent(trainLock, lock * 1000, cid)
doPlayerSendTextMessage(cid,22,"Your training session has now ended")
return true
end
function trainLock (cid)
if isPlayer(cid) then
setPlayerStorageValue(cid, 18010, 0)
end
end
function trainMe(p)
if isPlayer(p.cid) and getPlayerStorageValue(p.cid, 18010) == 1 and p.item.actionid == 900 then
local weaponLeft = getPlayerSlotItem(p.cid, CONST_SLOT_LEFT)
local weaponRight = getPlayerSlotItem(p.cid, CONST_SLOT_RIGHT)
if weaponLeft.itemid ~= 0 then
weaponLeft = getItemWeaponType(weaponLeft.uid)
end
if weaponRight.itemid ~= 0 then
weaponRight = getItemWeaponType(weaponRight.uid)
end
for _, t in pairs(weaponTypes) do
if t[1] == weaponLeft or t[1] == weaponRight then
doPlayerAddSkillTry(p.cid, t[2], skillTries)
end
end
manaspent = getPlayerMana(p.cid)
doPlayerAddSpentMana(p.cid, manaspent)
doTargetCombatMana(0, p.cid, -manaspent, -manaspent, CONST_ME_NONE)

doSendMagicEffect(getPlayerPosition(p.cid),34)

addEvent(trainMe, t, p)
end
return true
end




Then i added that in movements.xml:

<movevent event="StepIn" actionid="900" script="sqtrainer.lua"/>
<movevent event="StepOut" actionid="900" script="sqtrainer.lua"/>

But when i go now on the Tile, I made with action id 900, Then there comes:
13:51 The tile seems to be protected against unwanted intruders.
in a green colour.

Why??

I use cryingdamson4pl2-gui 0.3.4 (client 8.42)
 
@up
probably action 900 is conflicting with another custom script on your server
try change it to another value
 
I made this from a discution on this thread

-- Square Skill Trainer made by Arthur aka artofwork
Pretty much by me since i modified the entire script but he got the ideia first...

i tried to make it support fist skill as well but i got a infinite loop that crash my server...
cant figure out how to solve this problem...

in case player logout or server drop

Using map editor set Square you want as Trainer with ActionID 900.

im done...
improvements are welcome!!! thank you!


The reason you can't fix the problem with this script is because you didn't write it, I did!

As you can see "-- Square Skill Trainer made by Arthur aka artofwork"

Don't go stealing other people's scripts and calling them your own, give credit where credit is due.


@up
probably action 900 is conflicting with another custom script on your server
try change it to another value

Are you an idiot?
Do you even know what this code says?

I can fix your version of this, but i rather not because you wanna take all the credit.


To everyone else you can find the real script here on otfans.net:
Movement: Square Trainer (no longer will you need monks)
Code:
http://otfans.net/showthread.php?t=140837
 
Last edited:
u copied it from someone i'm pretty sure...this script was released several times...:$
 
Man help pls.
I changed the action id 900 with an other action id, with multiple others.... But it doesn't work.
When I go onto the tile, there comes:
The Tile seems to be protected against unwanted intruders.
Please help!

I am using TFS.0.3.6pl1
 
Last edited:
Back
Top