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

[LUA] how to activate teleport when all task monsters are killed..

shrrek

New Member
Joined
Aug 11, 2011
Messages
11
Reaction score
0
Hellow, im really new to this scripting world, what i need is when the players finish the grizzly adams task and he tells them "go kill boss now", the teleport lets them into a room that i already have and summons the corresponding boss.

dont know what lua file u guys nee me to put here so i will post the ones i think you need to see.

this is the one i have that i think i need to change something so i can make it work with my tasks

PHP:
local bosses_storage = 10003
local adams = {
				[5300] = {
                         char = {effects = 10, global_storage = 5300, storage_value = 1, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "The Snapper", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 },
				[5301] = {
                         char = {effects = 10, global_storage = 5301, storage_value = 3, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "Hide", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 },
				[5302] = {
                         char = {effects = 10, global_storage = 5302, storage_value = 5, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "The Bloodtusk", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 },
				[5303] = {
                         char = {effects = 10, global_storage = 5303, storage_value = 7, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "Shardhead", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 },
				[5304] = {
                         char = {effects = 10, global_storage = 5304, storage_value = 9, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "Esmeralda", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 },
				[5305] = {
                         char = {effects = 10, global_storage = 5305, storage_value = 11, where_us_tp = {x=575,y=638,z=7}},
                         boss = {name = "The Old Widow", summon_pos = {x=575,y=636,z=7}, effect = 10},
						 },
				[5306] = {
                         char = {effects = 10, global_storage = 5306, storage_value = 13, where_us_tp = {x=875,y=974,z=10}},
                         boss = {name = "The Many", summon_pos = {x=876,y=974,z=10}, effect = 10},
						 },
				[5307] = {
                         char = {effects = 10, global_storage = 5307, storage_value = 15, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "Leviathan", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 },
				[5308] = {
                         char = {effects = 10, global_storage = 5308, storage_value = 17, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "Stonecracker", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 },
				[5309] = {
                         char = {effects = 10, global_storage = 5309, storage_value = 19, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "The Noxious Spawn", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 },
				[5310] = {
                         char = {effects = 10, global_storage = 5310, storage_value = 21, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "Thul", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 }
              }
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local adam = adams[item.uid]
if adam then
	if getPlayerStorageValue(cid, bosses_storage) == adam.char.storage_value then
		if getGlobalStorageValue(adam.global_storage) == -1 then
			setGlobalStorageValue(adam.global_storage, 1)
			doTeleportThing(cid, adam.char.where_us_tp)
			doSendMagicEffect(adam.char.where_us_tp, adam.char.effects)
			monster = doCreateMonster(adam.boss.name, adam.boss.summon_pos)
			doSendMagicEffect(adam.boss.summon_pos, adam.boss.effect)
		else
			doPlayerSendTextMessage(cid, 22, "Somebody fight with "..adam.boss.name.."!")
			doTeleportThing(cid, fromPosition)
		end
	else
		doPlayerSendTextMessage(cid, 22, "You can't enter here!")
		doTeleportThing(cid, fromPosition)
	end
end

local tp_wyjsciowe = {
					[5311] = {storage_value = 1, where_us_tp = {x=1000,y=1000,z=7}}, --the snapper
					[5312] = {storage_value = 3, where_us_tp = {x=1000,y=1000,z=7}}, --hide
					[5313] = {storage_value = 5, where_us_tp = {x=1000,y=1000,z=7}}, --the bloodtusk
					[5314] = {storage_value = 7, where_us_tp = {x=1000,y=1000,z=7}}, --shardhead
					[5315] = {storage_value = 11, where_us_tp = {x=1000,y=1000,z=7}}, --esmeralda
					[5316] = {storage_value = 13, where_us_tp = {x=576,y=631,z=7}}, --the old widow
					[5317] = {storage_value = 15, where_us_tp = {x=874,y=974,z=10}}, --the many
					[5318] = {storage_value = 17, where_us_tp = {x=1000,y=1000,z=7}}, --leviathan
					[5319] = {storage_value = 19, where_us_tp = {x=1000,y=1000,z=7}}, --stonecracker
					[5320] = {storage_value = 21, where_us_tp = {x=1000,y=1000,z=7}}, --the noxious spawn
					[5321] = {storage_value = 23, where_us_tp = {x=1000,y=1000,z=7}} --thul
					}
local exits = tp_wyjsciowe[item.uid]
if exits then
	if getPlayerStorageValue(cid, bosses_storage) == exits.storage_value then
		doRemoveCreature(monster)
	end
	setGlobalStorageValue(adams[item.uid-11].global_storage, -1)
	doTeleportThing(cid, exits.where_us_tp)
	doSendMagicEffect(exits.where_us_tp, 10)
end
return true
end
what i have done so far is make 2 teleports,i put the old widows uniqueid 5305 in the entrance teleport and 5316 id on the exit teleport, the entrance teleport tells me you cant enter her, i guess thats a good thing i think i just need it to work together with my task so it will let me in, the exit teleport works fine.

dont know what other lua file you guys need to help me, so tell me and i will post them
 
Last edited:
i think you got me wrong, i dont want a teleport created after i kill a monster, what i whant is example: player finishes killing 200 giant spiders he goes to grizzly adams and he says task, now grizzly tells him now you can go kill boss, the player should go to a specific teleport i put on the map and it should only let in the players who finished killing the 200 giant spiders and when they go in the teleport the old widow is spawned.

get it?.
 
anyone out ther pls help me, its all i need to finish my grizzly adams, everithing works fine they get exp items when finishing tasks, i just want them to be able to kill the boss, i could just add all the boss monsters i need on the map, but how can i prevent them from killing them over and over without them doing the task, it can also be a door script that only by finishing the task lets them in, the thing its that i dont know how to script :(.
 
yeah its easy lol add a area check of player/monster to the spot where the boss spawn and if non then let the player teleport there if the player has example old widow 10003 storage value so if the player has 10003 vlaue then check if there is some one in boss room if no one is inside then teleport the player + spawn monster
 
ok i got it to work by just reading some scripting guides, all i hade to do i change some sotorage values so it would let me in, now the new problem is when someone dies while killing the boss, it will wont let anyone in the teleport, it says "some one already killing it", in order to get it working again, the char that went in the teleport has to go out the exit teleport so it will let other chars in, in other words if you die inside the room you cant get back in unless u step on the exit teleport wich you cant because you died and are outside the room

hope you guys understand what i mean. how can i get it to work so when they die the boss disapears and lets other people in and also let the char that died in again to kill boss

this is the script that lets me out of the room and removes boss and also lets me in again if i did not kill it

PHP:
local exits = tp_wyjsciowe[item.uid]
if exits then
	if getPlayerStorageValue(cid, bosses_storage) ~= exits.storage_value then
		doRemoveCreature(monster)
	end
	setGlobalStorageValue(adams[item.uid-11].global_storage, -1)
	doTeleportThing(cid, exits.where_us_tp)
	doSendMagicEffect(exits.where_us_tp, 10)
end

i think i just need to change the "" "" and put something that says if player dead, but i dont know the command for player deaths.
PHP:
if "" I dont know what goes here"" then
	if getPlayerStorageValue(cid, bosses_storage) ~= ""Dont know what to put here eather, somthing to do with player death i think?""
		doRemoveCreature(monster)
	end
	setGlobalStorageValue(adams[item.uid-11].global_storage, -1)

this is just my opinion, maybe i need a total different function dont know, thats why im asking ty
 
Last edited:
you know what forget everithing, some one just tell me how to add time to the boss spawn, instead of doing all that monster go away thing, i just whant the boss to last for 5 minutes in the room..

so how can i do that???
 
shrrek this script will work like the last script you wanted. and no you don't need ondeath.. only check the area if a player is there.

Lua:
local afrompos = {x = 33035,y = 3677,z = 8} -- change to the coordinates of the area
local atopos = {x = 33055, y = 3717, z = 8} -- change to the coordinates of the area
local monster = false
local monsters = {}
local i = 1
local noPlayer = true
for xa = afrompos.x,atopos.x do
	for ya = afrompos.y,atopos.y do
		for za = afrompos.z,atopos.z do
			local Creature = getThingFromPos({x = xa,y = ya,z = za,stackpos = 253})
			if isMonster(Creature.uid) then
			monsters[i] = getThingfromPos({x=x,y=y,z=areaposrightdown.z,stackpos=253})
			i = i+1
			monster = true		
			elseif isPlayer(Creature.uid) then
			noPlayer = false
			end
		end
	end
end
if noPlayer then
	if monster then
	for r = 1, #monsters do
	doRemoveCreature(monsters[r].uid)
	end
	end
    doTeleportThing(cid, ) -- change to tp coords
    doSendMagicEffect(, 10)-- change to tp coords
else
	doPlayerSendTextMessage(cid,19,"There is already someone there.") 
end

with this you don't need to make a script for the exit.. only put coords in the tp in mapeditor

Don't forget that this is not the full script, you need to put it in an onstepin script
 
ok i tried the script but i get an error "(luagetThingfrompos) Tile not found" and server crash when i step on the teleport, maybe i did something wrong this is were i put the script, thoes it go ther? srry i dont know much about scripting im still learning, did i have to put it in a new onstepin function??


original script
PHP:
local bosses_storage = 10006
local adams = {
				[5300] = {
                         char = {effects = 10, global_storage = 5300, storage_value = 1, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "The Snapper", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 },
				[5301] = {
                         char = {effects = 10, global_storage = 5301, storage_value = 23, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "Hide", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 },
				[5302] = {
                         char = {effects = 10, global_storage = 5302, storage_value = 5, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "The Bloodtusk", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 },
				[5303] = {
                         char = {effects = 10, global_storage = 5303, storage_value = 7, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "Shardhead", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 },
				[5304] = {
                         char = {effects = 10, global_storage = 5304, storage_value = 9, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "Esmeralda", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 },
				[5305] = {
                         char = {effects = 10, global_storage = 5305, storage_value = 3, where_us_tp = {x=575,y=638,z=7}},
                         boss = {name = "The Old Widow", summon_pos = {x=575,y=636,z=7}, effect = 10},
						 },
				[5306] = {
                         char = {effects = 10, global_storage = 5306, storage_value = 13, where_us_tp = {x=875,y=974,z=10}},
                         boss = {name = "The Many", summon_pos = {x=876,y=974,z=10}, effect = 10},
						 },
				[5307] = {
                         char = {effects = 10, global_storage = 5307, storage_value = 15, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "Leviathan", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 },
				[5308] = {
                         char = {effects = 10, global_storage = 5308, storage_value = 17, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "Stonecracker", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 },
				[5309] = {
                         char = {effects = 10, global_storage = 5309, storage_value = 19, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "The Noxious Spawn", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 },
				[5310] = {
                         char = {effects = 10, global_storage = 5310, storage_value = 21, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "Thul", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 }
              }
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local adam = adams[item.uid]
if adam then
	if getPlayerStorageValue(cid, bosses_storage) == adam.char.storage_value then
		if getGlobalStorageValue(adam.global_storage) == -1 then
			setGlobalStorageValue(adam.global_storage, 1)
			doTeleportThing(cid, adam.char.where_us_tp)
			doSendMagicEffect(adam.char.where_us_tp, adam.char.effects)
			monster = doCreateMonster(adam.boss.name, adam.boss.summon_pos)
			doSendMagicEffect(adam.boss.summon_pos, adam.boss.effect)
		else
			doPlayerSendTextMessage(cid, 22, "Somebody fight with "..adam.boss.name.."!")
			doTeleportThing(cid, fromPosition)
		end
	else
		doPlayerSendTextMessage(cid, 22, "You can't enter here!")
		doTeleportThing(cid, fromPosition)
	end
end

local tp_wyjsciowe = {
					[5311] = {storage_value = 1, where_us_tp = {x=1000,y=1000,z=7}}, --the snapper
					[5312] = {storage_value = 23, where_us_tp = {x=1000,y=1000,z=7}}, --hide
					[5313] = {storage_value = 5, where_us_tp = {x=1000,y=1000,z=7}}, --the bloodtusk
					[5314] = {storage_value = 7, where_us_tp = {x=1000,y=1000,z=7}}, --shardhead
					[5315] = {storage_value = 9, where_us_tp = {x=1000,y=1000,z=7}}, --esmeralda
					[5316] = {storage_value = 4, where_us_tp = {x=579,y=636,z=7}}, --the old widow
					[5317] = {storage_value = 13, where_us_tp = {x=874,y=974,z=10}}, --the many
					[5318] = {storage_value = 15, where_us_tp = {x=1000,y=1000,z=7}}, --leviathan
					[5319] = {storage_value = 17, where_us_tp = {x=1000,y=1000,z=7}}, --stonecracker
					[5320] = {storage_value = 19, where_us_tp = {x=1000,y=1000,z=7}}, --the noxious spawn
					[5321] = {storage_value = 21, where_us_tp = {x=1000,y=1000,z=7}} --thul
					}
local exits = tp_wyjsciowe[item.uid]
if exits then
	if getPlayerStorageValue(cid, bosses_storage) ~= exits.storage_value then
		doRemoveCreature(monster)
	end
	setGlobalStorageValue(adams[item.uid-11].global_storage, -1)
	doTeleportThing(cid, exits.where_us_tp)
	doSendMagicEffect(exits.where_us_tp, 10)
end
return true
end

Now with your script
PHP:
local bosses_storage = 10006
local adams = {
				[5300] = {
                         char = {effects = 10, global_storage = 5300, storage_value = 1, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "The Snapper", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 },
				[5301] = {
                         char = {effects = 10, global_storage = 5301, storage_value = 23, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "Hide", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 },
				[5302] = {
                         char = {effects = 10, global_storage = 5302, storage_value = 5, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "The Bloodtusk", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 },
				[5303] = {
                         char = {effects = 10, global_storage = 5303, storage_value = 7, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "Shardhead", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 },
				[5304] = {
                         char = {effects = 10, global_storage = 5304, storage_value = 9, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "Esmeralda", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 },
				[5305] = {
                         char = {effects = 10, global_storage = 5305, storage_value = 3, where_us_tp = {x=575,y=638,z=7}},
                         boss = {name = "The Old Widow", summon_pos = {x=575,y=636,z=7}, effect = 10},
						 },
				[5306] = {
                         char = {effects = 10, global_storage = 5306, storage_value = 13, where_us_tp = {x=875,y=974,z=10}},
                         boss = {name = "The Many", summon_pos = {x=876,y=974,z=10}, effect = 10},
						 },
				[5307] = {
                         char = {effects = 10, global_storage = 5307, storage_value = 15, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "Leviathan", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 },
				[5308] = {
                         char = {effects = 10, global_storage = 5308, storage_value = 17, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "Stonecracker", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 },
				[5309] = {
                         char = {effects = 10, global_storage = 5309, storage_value = 19, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "The Noxious Spawn", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 },
				[5310] = {
                         char = {effects = 10, global_storage = 5310, storage_value = 21, where_us_tp = {x=1000,y=1000,z=7}},
                         boss = {name = "Thul", summon_pos = {x=1000,y=1000,z=7}, effect = 10},
						 }
              }
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local adam = adams[item.uid]
if adam then
	if getPlayerStorageValue(cid, bosses_storage) == adam.char.storage_value then
		if getGlobalStorageValue(adam.global_storage) == -1 then
			setGlobalStorageValue(adam.global_storage, 1)
			doTeleportThing(cid, adam.char.where_us_tp)
			doSendMagicEffect(adam.char.where_us_tp, adam.char.effects)
			monster = doCreateMonster(adam.boss.name, adam.boss.summon_pos)
			doSendMagicEffect(adam.boss.summon_pos, adam.boss.effect)
		else
			doPlayerSendTextMessage(cid, 22, "Somebody fight with "..adam.boss.name.."!")
			doTeleportThing(cid, fromPosition)
		end
	else
		doPlayerSendTextMessage(cid, 22, "You can't enter here!")
		doTeleportThing(cid, fromPosition)
	end
end

local tp_wyjsciowe = {
					[5311] = {storage_value = 1, where_us_tp = {x=1000,y=1000,z=7}}, --the snapper
					[5312] = {storage_value = 23, where_us_tp = {x=1000,y=1000,z=7}}, --hide
					[5313] = {storage_value = 5, where_us_tp = {x=1000,y=1000,z=7}}, --the bloodtusk
					[5314] = {storage_value = 7, where_us_tp = {x=1000,y=1000,z=7}}, --shardhead
					[5315] = {storage_value = 9, where_us_tp = {x=1000,y=1000,z=7}}, --esmeralda
					[5316] = {storage_value = 4, where_us_tp = {x=579,y=636,z=7}}, --the old widow
					[5317] = {storage_value = 13, where_us_tp = {x=874,y=974,z=10}}, --the many
					[5318] = {storage_value = 15, where_us_tp = {x=1000,y=1000,z=7}}, --leviathan
					[5319] = {storage_value = 17, where_us_tp = {x=1000,y=1000,z=7}}, --stonecracker
					[5320] = {storage_value = 19, where_us_tp = {x=1000,y=1000,z=7}}, --the noxious spawn
					[5321] = {storage_value = 21, where_us_tp = {x=1000,y=1000,z=7}} --thul
					}
local exits = tp_wyjsciowe[item.uid]
if exits then
	if getPlayerStorageValue(cid, bosses_storage) ~= exits.storage_value then
		doRemoveCreature(monster)
	end
	setGlobalStorageValue(adams[item.uid-11].global_storage, -1)
	doTeleportThing(cid, exits.where_us_tp)
	doSendMagicEffect(exits.where_us_tp, 10)
end
local afrompos = {x = 33035,y = 3677,z = 8} -- change to the coordinates of the area
local atopos = {x = 33055, y = 3717, z = 8} -- change to the coordinates of the area
local monster = false
local monsters = {}
local i = 1
local noPlayer = true
for xa = afrompos.x,atopos.x do
	for ya = afrompos.y,atopos.y do
		for za = afrompos.z,atopos.z do
			local Creature = getThingFromPos({x = xa,y = ya,z = za,stackpos = 253})
			if isMonster(Creature.uid) then
			monsters[i] = getThingfromPos({x=x,y=y,z=areaposrightdown.z,stackpos=253})
			i = i+1
			monster = true		
			elseif isPlayer(Creature.uid) then
			noPlayer = false
			end
		end
	end
end

if noPlayer then
	if monster then
	for r = 1, #monsters do
	doRemoveCreature(monsters[r].uid)
	end
	end
    doTeleportThing(cid,{x=575,y=638,z=7}) -- change to tp coords
    doSendMagicEffect({x=575,y=638,z=7}, 10)-- change to tp coords
else
	doPlayerSendTextMessage(cid,19,"There is already someone there.") 
end
return true
end
 
I hate all those scripts they all seem to be so shitty D: Make an onkill function, if monstername is the desired monster then give storage value, after xx storage values then set a final storage value, on the final storage value you trigger an event that will activate in 10 seconds saying "you got 10 seconds to loot the last monster, then you will be teleported to x y z.

And then if they later kill the monster it will check if storage value is the final value and then just return true. D:
 
i get what you say but, the thing is i dont know nothing about making scripts, i can read and understand what some things mean but im really bad at making them, sow how would that onkill be, can you make it for me pls?
 
shrrek this script will work like the last script you wanted. and no you don't need ondeath.. only check the area if a player is there.

Lua:
local afrompos = {x = 33035,y = 3677,z = 8} -- change to the coordinates of the area
local atopos = {x = 33055, y = 3717, z = 8} -- change to the coordinates of the area
local monster = false
local monsters = {}
local i = 1
local noPlayer = true
for xa = afrompos.x,atopos.x do
	for ya = afrompos.y,atopos.y do
		for za = afrompos.z,atopos.z do
			local Creature = getThingFromPos({x = xa,y = ya,z = za,stackpos = 253})
			if isMonster(Creature.uid) then
			monsters[i] = getThingfromPos({x=x,y=y,z=areaposrightdown.z,stackpos=253})
			i = i+1
			monster = true		
			elseif isPlayer(Creature.uid) then
			noPlayer = false
			end
		end
	end
end
if noPlayer then
	if monster then
	for r = 1, #monsters do
	doRemoveCreature(monsters[r].uid)
	end
	end
    doTeleportThing(cid, ) -- change to tp coords
    doSendMagicEffect(, 10)-- change to tp coords
else
	doPlayerSendTextMessage(cid,19,"There is already someone there.") 
end

with this you don't need to make a script for the exit.. only put coords in the tp in mapeditor

Don't forget that this is not the full script, you need to put it in an onstepin script

the error luagetthingfrompos comes from this line,
PHP:
monsters[i] = getThingfromPos({x=x,y=y,z=areaposrightdown.z,stackpos=253})
 
You need to make a new script for the tp. so just add my script in an onstepin script.. (write the function on top and then write return true end in the end of the script..) and then you add it in movements.xml and the actionid you use there you put on the teleport you need to step on to enter the area.. then wow it works =)

sorry if I'm not really specific, I'm a bit drunk when I write this hehe
 
dont i have to write an action id on the lua script also?? were would i put it?

i dont understand this line in the script

local Creature = getThingFromPos({x = xa,y = ya,z = za,stackpos = 253}

x = xa,y = ya,z = za what do thoes letters mean, do they stand for some cordinates?
 
Yea you define those by saying
Lua:
for xa = afrompos.x,atopos.x do
	for ya = afrompos.y,atopos.y do
		for za = afrompos.z,atopos.z do
this makes it go from a certain position to another one, so it checks every square within this area. You don't need to add actionid in the script if you add it in movements.xml
XML:
	<movevent type="stepin" actionid="30003" event="script" value="custom/teleportthingy.lua"/>

then it will only be activated if the tile/item has that actionid.. so don't use this actionid for anything else, if you do you need to add
Lua:
if item.itemid == 1387 then
in the beginning of the script

Lua:
function onStepIn(cid, item, position, lastPosition, fromPosition, toPosition, actor)
local afrompos = {x = 33035,y = 3677,z = 8} -- change to the top left coordinates of the area
local atopos = {x = 33055, y = 3717, z = 8} -- change to the down right coordinates of the area
local monster = false
local monsters = {}
local i = 1
local noPlayer = true
for xa = afrompos.x,atopos.x do
	for ya = afrompos.y,atopos.y do
		for za = afrompos.z,atopos.z do
			local Creature = getThingFromPos({x = xa,y = ya,z = za,stackpos = 253})
			if isMonster(Creature.uid) then
			monsters[i] = getThingfromPos({x=x,y=y,z=areaposrightdown.z,stackpos=253})
			i = i+1
			monster = true		
			elseif isPlayer(Creature.uid) then
			noPlayer = false
			end
		end
	end
end
if noPlayer then
	if monster then
	for r = 1, #monsters do
	doRemoveCreature(monsters[r].uid)
	end
	end
    doTeleportThing(cid, exits.where_us_tp) -- change this to the place you are supposed to get tped to
    doSendMagicEffect(exits.where_us_tp, 10)-- change this to the place you are supposed to get tped to
else
	doPlayerSendTextMessage(cid,19,"There is already someone there.") 
end
return true
end
this is how the script can look.. but this script doesn't check if you have made the task or not atm, it will only let you in if noone else is in the area and it doesn't summon a monster atm.. just add this after doTeleportThing and doSendMagicEffect if you want it to spawn a monster too.
Lua:
doCreateMonster(name of monster,{} coordinates where the monster should spawn)
 
Back
Top