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

trainers come and go.

fredde3436

Member
Joined
Jul 6, 2009
Messages
226
Reaction score
7
I could use a script when u walk on a tile a Training monk will pop up, and when you step out, he will disappear, to minimize the cpu/ram usage :)
 
But show me place where you want those trainers.
For example
0, 1,
2, 0,
0, 1,

2 = that tile
1 = trainers
Try to draw train room xD

af6131ab.jpg
 
Last edited:
Ok, I have done this
[Tested on TFS 0.3.6]
movements/scripts/train.lua
LUA:
function onStepIn(cid, item, pos, frompos)
trainpos = {x=frompos.x+1, y=frompos.y-1, z=frompos.z} 
trainpos2 = {x=frompos.x+1, y=frompos.y+1, z=frompos.z}
doSummonCreature("Training monk", trainpos)
doSummonCreature("Training monk", trainpos2)

  end

  function onStepOut(cid, item, pos, frompos)
trainpos = {x=frompos.x+1, y=frompos.y-1, z=frompos.z, stackpos=253} 
train1 = getThingFromPos(trainpos)
trainpos2 = {x=frompos.x+1, y=frompos.y+1, z=frompos.z, stackpos=253}
train2 = getThingFromPos(trainpos2)
if isCreature(train1.uid) and isCreature(train2.uid) then
doRemoveCreature(train1.uid)
doRemoveCreature(train2.uid)
end
end

In movements.xml
Code:
<movevent type="StepIn" actionid="1221" event="script" value="train.lua"/> 
<movevent type="StepOut" actionid="1221" event="script" value="train.lua"/>

EDIT
I edited this script, now if someone kills a training it(console) won't send errors :P

rep if I helped :)
 
Last edited:
you make mistake

PHP:
function onStepIn(cid, item, pos, frompos)
trainpos = {x=pos.x+1, y=pos.y-1, z=pos.z} 
trainpos2 = {x=pos.x+1, y=pos.y+1, z=pos.z}
doSummonCreature("Training monk", trainpos)
doSummonCreature("Training monk", trainpos2)

  end

  function onStepOut(cid, item, pos, frompos)
trainpos = {x=frompos.x+1, y=frompos.y-1, z=frompos.z, stackpos=253} 
train1 = getThingFromPos(trainpos)
trainpos2 = {x=frompos.x+1, y=frompos.y+1, z=frompos.z, stackpos=253}
train2 = getThingFromPos(trainpos2)
if isCreature(train1.uid) and isCreature(train2.uid) then
doRemoveCreature(train1.uid)
doRemoveCreature(train2.uid)
end
end
 
Back
Top