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

Requesting Trainingroom script!!

ewcke

Santiria 8.60
Joined
Apr 13, 2009
Messages
39
Reaction score
1
Server Version:
tfs 0.2.7

trainingroom.jpg


Looking for a Trainingroom script for my 8.54-57 tfs server.

Script function:

When player steps on border(1).
The trainer spawns from "Trainer position"(2).
When player leaves the border the trainer disappares(3).

Left.Down
X) 1131
Y) 873
Z) 7


Right.Down
X) 1156
Y) 873
Z) 7


Left.Up
X) 1131
Y) 858
Z) 7


Right.Up
x) 1156
Y) 858
Z) 7
 
Last edited:
first that I'm going to say is that this is the wrong place to request scripts, you have to go to Request & Support. but anyways here is something that i cooked up, i don't know if it will work because you didn't specify any Distro, so anyways here it is:
Lua:
local dir = {
	up = 4050,
	right = 4051,
	down = 4052,
	left = 4053
	}
local cfg = {
	mon = "" --write monster name here
	}
function onStepIn(cid, item, toPosition, fromPosition)
local pos = {
	leftDown = {x = toPosition.x-1, y = toPosition.y+1, z = toPosition.z},
	leftUp = {x = toPosition.x-1, y = toPosition.y-1, z = toPosition.z}, 
	rightDown = {x = toPosition.x+1, y = toPosition.y+1, z = toPosition.z}, 
	rightUp = {x = toPosition.x+1, y = toPosition.y-1, z = toPosition.z}
	}
	if item.actionid == dir.up then
		doCreateMonster(cfg.mon, pos.leftUp)
		doCreateMonster(cfg.mon, pos.rightUp)
		doSendMagicEffect(pos.leftUp, 13)
		doSendMagicEffect(pos.rightUp, 13)
		doTransformItem(item.uid, item.itemid-1)
	end
	if item.actionid == dir.right then
		doCreateMonster(cfg.mon, pos.rightDown)
		doCreateMonster(cfg.mon, pos.rightUp)
		doSendMagicEffect(pos.rightDown, 13)
		doSendMagicEffect(pos.rightUp, 13)
		doTransformItem(item.uid, item.itemid-1)
	end
	if item.actionid == dir.down then
		doCreateMonster(cfg.mon, pos.rightDown)
		doCreateMonster(cfg.mon, pos.leftDown)
		doSendMagicEffect(pos.rightDown, 13)
		doSendMagicEffect(pos.leftDown, 13)
		doTransformItem(item.uid, item.itemid-1)
	end
	if item.actionid == dir.left then
		doCreateMonster(cfg.mon, pos.leftUp)
		doCreateMonster(cfg.mon, pos.leftDown)
		doSendMagicEffect(pos.leftUp, 13)
		doSendMagicEffect(pos.leftDown, 13)
		doTransformItem(item.uid, item.itemid-1)
	end
end
function onStepOut(cid, item, fromPosition)
local pos2 = {
	leftDown = {x = fromPosition.x-1, y = fromPosition.y+1, z = fromPosition.z, stackpos = 255},
	leftUp = {x = fromPosition.x-1, y = fromPosition.y-1, z = fromPosition.z, stackpos = 255}, 
	rightDown = {x = fromPosition.x+1, y = fromPosition.y+1, z = fromPosition.z, stackpos = 255}, 
	rightUp = {x = fromPosition.x+1, y = fromPosition.y-1, z = fromPosition.z, stackpos = 255}
	}	
	if item.actionid == dir.up then
	local getMon1 = getThingfromPos(pos2.rightUp) 
	local getMon2 = getThingfromPos(pos2.leftUp)
		if getMon1.uid > 0 and getMon2.uid > 0 then
			doRemoveCreature(getMon1.uid)
			doRemoveCreature(getMon2.uid)
			doSendMagicEffect(pos2.rightUp, 13)
			doSendMagicEffect(pos2.leftUp, 13)
		end
		doTransformItem(item.uid, item.itemid+1)	
	end	
	if item.actionid == dir.right then
	local getMon1 = getThingfromPos(pos2.rightUp) 
	local getMon2 = getThingfromPos(pos2.rightDown)
		if getMon1.uid > 0 and getMon2.uid > 0 then
			doRemoveCreature(getMon1.uid)
			doRemoveCreature(getMon2.uid)
			doSendMagicEffect(pos2.rightUp, 13)
			doSendMagicEffect(pos2.rightDown, 13)
		end
		doTransformItem(item.uid, item.itemid+1)
	end	
	if item.actionid == dir.down then
	local getMon1 = getThingfromPos(pos2.rightDown) 
	local getMon2 = getThingfromPos(pos2.leftDown)
		if getMon1.uid > 0 and getMon2.uid > 0 then
			doRemoveCreature(getMon1.uid)
			doRemoveCreature(getMon2.uid)
			doSendMagicEffect(pos2.rightDown, 13)
			doSendMagicEffect(pos2.leftDown, 13)
		end
		doTransformItem(item.uid, item.itemid+1)
	end	
	if item.actionid == dir.left then
	local getMon1 = getThingfromPos(pos2.leftDown) 
	local getMon2 = getThingfromPos(pos2.leftUp)
		if getMon1.uid > 0 and getMon2.uid > 0 then
			doRemoveCreature(getMon1.uid)
			doRemoveCreature(getMon2.uid)
			doSendMagicEffect(pos2.leftDown, 13)
			doSendMagicEffect(pos2.leftUp, 13)
		end
		doTransformItem(item.uid, item.itemid+1)
	end		
end
and place the 'border' with action id:
if you want monsters to appear:
UP = 4050
RIGHT = 4051
DOWN = 4052
LEFT = 4053
This was made and tested on TFS 0.3.5
 
Last edited:
first that I'm going to say is that this is the wrong place to request scripts, you have to go to Request & Support. but anyways here is something that i cooked up, i don't know if it will work because you didn't specify any Distro, so anyways here it is:
Lua:
local dir = {
	up = 4050,
	right = 4051,
	down = 4052,
	left = 4053
	}
local cfg = {
	mon = "" --write monster name here
	}
function onStepIn(cid, item, toPosition, fromPosition)
local pos = {
	leftDown = {x = toPosition.x-1, y = toPosition.y+1, z = toPosition.z},
	leftUp = {x = toPosition.x-1, y = toPosition.y-1, z = toPosition.z}, 
	rightDown = {x = toPosition.x+1, y = toPosition.y+1, z = toPosition.z}, 
	rightUp = {x = toPosition.x+1, y = toPosition.y-1, z = toPosition.z}
	}
	if item.actionid == dir.up then
		doCreateMonster(cfg.mon, pos.leftUp)
		doCreateMonster(cfg.mon, pos.rightUp)
		doSendMagicEffect(pos.leftUp, 13)
		doSendMagicEffect(pos.rightUp, 13)
		doTransformItem(item.uid, item.itemid-1)
	end
	if item.actionid == dir.right then
		doCreateMonster(cfg.mon, pos.rightDown)
		doCreateMonster(cfg.mon, pos.rightUp)
		doSendMagicEffect(pos.rightDown, 13)
		doSendMagicEffect(pos.rightUp, 13)
		doTransformItem(item.uid, item.itemid-1)
	end
	if item.actionid == dir.down then
		doCreateMonster(cfg.mon, pos.rightDown)
		doCreateMonster(cfg.mon, pos.leftDown)
		doSendMagicEffect(pos.rightDown, 13)
		doSendMagicEffect(pos.leftDown, 13)
		doTransformItem(item.uid, item.itemid-1)
	end
	if item.actionid == dir.left then
		doCreateMonster(cfg.mon, pos.leftUp)
		doCreateMonster(cfg.mon, pos.leftDown)
		doSendMagicEffect(pos.leftUp, 13)
		doSendMagicEffect(pos.leftDown, 13)
		doTransformItem(item.uid, item.itemid-1)
	end
end
function onStepOut(cid, item, fromPosition)
local pos2 = {
	leftDown = {x = fromPosition.x-1, y = fromPosition.y+1, z = fromPosition.z, stackpos = 255},
	leftUp = {x = fromPosition.x-1, y = fromPosition.y-1, z = fromPosition.z, stackpos = 255}, 
	rightDown = {x = fromPosition.x+1, y = fromPosition.y+1, z = fromPosition.z, stackpos = 255}, 
	rightUp = {x = fromPosition.x+1, y = fromPosition.y-1, z = fromPosition.z, stackpos = 255}
	}	
	if item.actionid == dir.up then
	local getMon1 = getThingfromPos(pos2.rightUp) 
	local getMon2 = getThingfromPos(pos2.leftUp)
		if getMon1.uid > 0 and getMon2.uid > 0 then
			doRemoveCreature(getMon1.uid)
			doRemoveCreature(getMon2.uid)
			doSendMagicEffect(pos2.rightUp, 13)
			doSendMagicEffect(pos2.leftUp, 13)
		end
		doTransformItem(item.uid, item.itemid+1)	
	end	
	if item.actionid == dir.right then
	local getMon1 = getThingfromPos(pos2.rightUp) 
	local getMon2 = getThingfromPos(pos2.rightDown)
		if getMon1.uid > 0 and getMon2.uid > 0 then
			doRemoveCreature(getMon1.uid)
			doRemoveCreature(getMon2.uid)
			doSendMagicEffect(pos2.rightUp, 13)
			doSendMagicEffect(pos2.rightDown, 13)
		end
		doTransformItem(item.uid, item.itemid+1)
	end	
	if item.actionid == dir.down then
	local getMon1 = getThingfromPos(pos2.rightDown) 
	local getMon2 = getThingfromPos(pos2.leftDown)
		if getMon1.uid > 0 and getMon2.uid > 0 then
			doRemoveCreature(getMon1.uid)
			doRemoveCreature(getMon2.uid)
			doSendMagicEffect(pos2.rightDown, 13)
			doSendMagicEffect(pos2.leftDown, 13)
		end
		doTransformItem(item.uid, item.itemid+1)
	end	
	if item.actionid == dir.left then
	local getMon1 = getThingfromPos(pos2.leftDown) 
	local getMon2 = getThingfromPos(pos2.leftUp)
		if getMon1.uid > 0 and getMon2.uid > 0 then
			doRemoveCreature(getMon1.uid)
			doRemoveCreature(getMon2.uid)
			doSendMagicEffect(pos2.leftDown, 13)
			doSendMagicEffect(pos2.leftUp, 13)
		end
		doTransformItem(item.uid, item.itemid+1)
	end		
end
and place the 'border' with action id:
if you want monsters to appear:
UP = 4050
RIGHT = 4051
DOWN = 4052
LEFT = 4053
This was made and tested on TFS 0.3.5

I would like if you maybe could help me with that things. I've edited some in this thread now (uploaded ID:s and new picture.) Hope you can help me.

Thanks.
 
what kind of server are you using?? because most of the users here(including myself) script for tfs and so you may have some problems making some of these scripts work for any other distro.
EDIT: MSG me tomorrow and i might be able to help you.
 
I'm using tfs version 0.2.7.

Add this in your global.lua:
Code:
doCreateMonster = doSummonCreature
in movements.xml, register the script like this:
Code:
	<movevent event="StepIn" fromaid="4050" toaid="4053" script="scriptname.lua"/>
	<movevent event="StepOut" fromaid="4050" toaid="4053" script="scriptname.lua"/>
 
ok i have edited your picture in order to explain where do the action ids go on the map editor:
trainingroom.jpg

if you want them to spawn UP then place the action id # that belongs to UP in the map editor(the pic has the Action id #s)this script will place the the monsters in their respective spots.
 
Back
Top