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

Solved

Exmortis

Member
Joined
Jun 27, 2008
Messages
189
Reaction score
5
I'm creating a quest and I've come to a stop where you're supposed to be teleported to a certain location when you step on a tile.
And at the same time, 6 monsters spawns around you.
optional: (either when all monsters are dead, a teleport will be created or some kind of way to get back before the stepin tile.)
The NPC is already fixed so that's not an issue but i decided to include it in the picture anyway.

The picture explains pretty much what I want.

I'm useing TFS 0.2.7

teletile.jpg

Thanks for any help I get, and of course Rep.
 
Last edited:
Asuming I understood, after you talk to a Npc he will set you a storage value so you can enter, the script would be this:
I did it really really fast, cause I have no time, so I cud not shorten it nor test it :S
Lua:
local storage = 35000
local pos = {x=EDIT, y=EDIT, Z=EDIT} ---- Where tp will tp you.
local pos1 = {x=EDIT, y=EDIT, Z=EDIT} ----- Pos1 > Pos 6 (where monsters will summon)
local pos2 = {x=EDIT, y=EDIT, Z=EDIT}
local pos3 = {x=EDIT, y=EDIT, Z=EDIT}
local pos4 = {x=EDIT, y=EDIT, Z=EDIT}
local pos5 = {x=EDIT, y=EDIT, Z=EDIT}
local pos6 = {x=EDIT, y=EDIT, Z=EDIT}
function onStepIn(cid, item, pos)
ppos = getPlayerPosition(cid)
if getPlayerStorageValue(cid,storage) == 1 then
setPlayerStorageValue(cid,storage,1)
doTeleportThing(cid,pos)
doSendAnimatedText(ppos,"In!",math.random(1,60))
doSendMagicEffect(ppos,5)
doSummonCreature("demon",pos1)
doSummonCreature("demon",pos2)
doSummonCreature("demon",pos3)
doSummonCreature("demon",pos4)
doSummonCreature("demon",pos5)
doSummonCreature("demon",pos6)
else
doPlayerSendCancel(cid, "You have to talk with the Npc first")
end
return true
end
 
That wasn't really what I was after.. since I then have to script a NPC to make the storage to 35000 and I'm such newb.
I meant that you step on the tile, get teleported In and kill all the monsters that spawns simultaneously and then talk to the NPC to buy aols.
But If you or anyone could make a NPC that gives you that storage, that would be awesome too.
Rep+
 
Oh alright, then just remove the storages :)
Lua:
local pos = {x=EDIT, y=EDIT, Z=EDIT} ---- Where tp will tp you.
local pos1 = {x=EDIT, y=EDIT, Z=EDIT} ----- Pos1 > Pos 6 (where monsters will summon)
local pos2 = {x=EDIT, y=EDIT, Z=EDIT}
local pos3 = {x=EDIT, y=EDIT, Z=EDIT}
local pos4 = {x=EDIT, y=EDIT, Z=EDIT}
local pos5 = {x=EDIT, y=EDIT, Z=EDIT}
local pos6 = {x=EDIT, y=EDIT, Z=EDIT}
function onStepIn(cid, item, pos)
ppos = getPlayerPosition(cid)
doTeleportThing(cid,pos)
doSendAnimatedText(ppos,"In!",math.random(1,60))
doSendMagicEffect(ppos,5)
doSummonCreature("demon",pos1)
doSummonCreature("demon",pos2)
doSummonCreature("demon",pos3)
doSummonCreature("demon",pos4)
doSummonCreature("demon",pos5)
doSummonCreature("demon",pos6)
else
doPlayerSendCancel(cid, "You have to talk with the Npc first")
return true
end

Or a cool Npc that you have to make a mission before going there
Lua:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)
local Topic = {}
 
local storage = 35000
 
function onCreatureAppear(cid)				npcHandler:onCreatureAppear(cid) end
function onCreatureDisappear(cid) 			npcHandler:onCreatureDisappear(cid) end
function onCreatureSay(cid, type, msg) 	npcHandler:onCreatureSay(cid, type, msg) end
function onThink() 						npcHandler:onThink() end
 
function greetCallback(cid)
	Topic[cid] = 0
	return true
end
 
function creatureSayCallback(cid, type, msg)
	if not npcHandler:isFocused(cid) then
		return false
	elseif (msgcontains(msg, 'quest') or msgcontains(msg, 'mission')) and getPlayerStorageValue(cid, storage) == -1 then
		npcHandler:say('Do you want to join the mission?', cid)
		Topic[cid] = 1
	elseif msgcontains(msg, 'yes') and Topic[cid] == 1 then
			npcHandler:say('Ask me for a {mission}, and after you completed it you can make the xxx quest!.', cid)
			setPlayerStorageValue(cid, storage, 1)
		else
			npcHandler:say('Okay, as you want!', cid)
		end
		Topic[cid] = 0
	elseif msgcontains(msg, 'mission') then
		local v = getPlayerStorageValue(cid, storage)
		if v == 1 then -- Start Mission 1
			npcHandler:say('Let\'s see if you are worthy. Bring me 10 demon shields', cid)
			setPlayerStorageValue(cid, storage, 2)
			Topic[cid] = 0
		elseif v == 2 then
			npcHandler:say("Your current mission is to bring 10 demon shields, are you done with that mission?", cid)
			Topic[cid] = 2
        end
	
    elseif Topic[cid] == 2 then -- Finish mission 1 
		if msgcontains(msg, 'yes') then
			if doPlayerRemoveItem(cid,2520,10) then
			npcHandler:say('You have been very brave! You now can go to xxxx quest!', cid)
				setPlayerStorageValue(cid, storage, 3)
			else
				npcHandler:say("Continue your mission and return to me after you're done.", cid)
			end
		else
			npcHandler:say("You better don't return here until you've finished your mission.", cid)
		end
		Topic[cid] = 0
	end
	return true
end
 
npcHandler:setMessage(MESSAGE_GREET, "Greetings, fellow believer |PLAYERNAME|!")
npcHandler:setMessage(MESSAGE_FAREWELL, "Always be on guard, |PLAYERNAME|!")
npcHandler:setMessage(MESSAGE_WALKAWAY, "This ungraceful haste is most suspicious!")
 
npcHandler:setCallback(CALLBACK_GREET, greetCallback)
npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())

And same file that before at movements
Lua:
local storage = 35000
local pos = {x=EDIT, y=EDIT, Z=EDIT} ---- Where tp will tp you.
local pos1 = {x=EDIT, y=EDIT, Z=EDIT} ----- Pos1 > Pos 6 (where monsters will summon)
local pos2 = {x=EDIT, y=EDIT, Z=EDIT}
local pos3 = {x=EDIT, y=EDIT, Z=EDIT}
local pos4 = {x=EDIT, y=EDIT, Z=EDIT}
local pos5 = {x=EDIT, y=EDIT, Z=EDIT}
local pos6 = {x=EDIT, y=EDIT, Z=EDIT}
function onStepIn(cid, item, pos)
ppos = getPlayerPosition(cid)
if getPlayerStorageValue(cid,storage) == 3 then
doTeleportThing(cid,pos)
doSendAnimatedText(ppos,"In!",math.random(1,60))
doSendMagicEffect(ppos,5)
doSummonCreature("demon",pos1)
doSummonCreature("demon",pos2)
doSummonCreature("demon",pos3)
doSummonCreature("demon",pos4)
doSummonCreature("demon",pos5)
doSummonCreature("demon",pos6)
else
doPlayerSendCancel(cid, "You have to talk with the Npc first")
end
return true
end

Try both, made em really fast, gtg now hope they work xD
 
Neither the summons or teleport works, only the effects.
The summons give me a message like "luadosummon creature<> cannot summon monster: demon" and the teleportscript doesnt give me any errors.
Im going to look for the error to see if i can solve it, thank you mate.

This is how my script looks like right now:
Code:
local pos = {x=1144, y=1279, Z=8} ---- Where tp will tp you.
local pos1 = {x=1144, y=1278, Z=8} ----- Pos1 > Pos 6 (where monsters will summon)
local pos2 = {x=1144, y=1280, Z=8}
local pos3 = {x=1146, y=1277, Z=8}
local pos4 = {x=1146, y=1281, Z=8}
local pos5 = {x=1148, y=1277, Z=8}
local pos6 = {x=1148, y=1281, Z=8}

function onStepIn(cid, item, position, fromPosition)
	if item.uid == 46145 then
ppos = getPlayerPosition(cid)
	doTeleportThing(cid,pos)
	doSendAnimatedText(ppos,"In!",math.random(1,60))
	doSendMagicEffect(ppos,5)
	doSummonCreature("demon",pos1)
	doSummonCreature("demon",pos2)
	doSummonCreature("demon",pos3)
	doSummonCreature("demon",pos4)
	doSummonCreature("demon",pos5)
	doSummonCreature("demon",pos6)
return TRUE
end
end
 
Last edited:
Try:
Lua:
local pos = {x=1144, y=1279, Z=8} ---- Where tp will tp you.
local pos1 = {x=1144, y=1278, Z=8} ----- Pos1 > Pos 6 (where monsters will summon)
local pos2 = {x=1144, y=1280, Z=8}
local pos3 = {x=1146, y=1277, Z=8}
local pos4 = {x=1146, y=1281, Z=8}
local pos5 = {x=1148, y=1277, Z=8}
local pos6 = {x=1148, y=1281, Z=8}

function onStepIn(cid, item, position, fromPosition)
	if item.uid == 46145 then
ppos = getPlayerPosition(cid)
	doTeleportThing(cid,pos)
	doSendAnimatedText(ppos,"In!",math.random(1,60))
	doSendMagicEffect(ppos,5)
	doSummonCreature(cid, "demon", pos1)
	doSummonCreature(cid, "demon", pos2)
	doSummonCreature(cid, "demon", pos3)
	doSummonCreature(cid, "demon", pos4)
	doSummonCreature(cid, "demon", pos5)
	doSummonCreature(cid, "demon", pos6)
end
return true
end
 
I have no idea, but it just doesnt teleport or spawn any creatures.

This is what I put in movements.xml:
Code:
<movevent event="StepIn" uniqueid="46145" script="aoltrap.lua" />

This is what I put in aoltrap.lua:
Code:
local pos = {x=1144, y=1279, Z=8} ---- Where tp will tp you.
local pos1 = {x=1144, y=1278, Z=8} ----- Pos1 > Pos 6 (where monsters will summon)
local pos2 = {x=1144, y=1280, Z=8}
local pos3 = {x=1146, y=1277, Z=8}
local pos4 = {x=1146, y=1281, Z=8}
local pos5 = {x=1148, y=1277, Z=8}
local pos6 = {x=1148, y=1281, Z=8}
 
function onStepIn(cid, item, position, fromPosition)
	if item.uid == 46145 then
ppos = getPlayerPosition(cid)
	doTeleportThing(cid,pos)
	doSendAnimatedText(ppos,"In!",math.random(1,60))
	doSendMagicEffect(ppos,5)
	doSummonCreature(cid, "demon", pos1)
	doSummonCreature(cid, "demon", pos2)
	doSummonCreature(cid, "demon", pos3)
	doSummonCreature(cid, "demon", pos4)
	doSummonCreature(cid, "demon", pos5)
	doSummonCreature(cid, "demon", pos6)
end
return true
end

And this is the uniqueID I'm useing on the tile: 46145
No actionids or anything.
The tiles ID is 426
 
Yeah, I'm getting strange errors when trying to use it in my OT aswell :l.
I'll ask for help and try to fix it, sorry.
 
Try this ^_^
PHP:
local playerNewPos = {x=1144, y=1279, Z=8}
local monstersPositions = {{x=1144, y=1278, Z=8},{x=1144, y=1280, Z=8},{x=1146, y=1277, Z=8},{x=1146, y=1281, Z=8},{x=1148, y=1277, Z=8},{x=1148, y=1281, Z=8}}
local monsterName = "Demon"
 
function onStepIn(cid, item, position, fromPosition)
	doTeleportThing(cid, playerNewPos, TRUE)
	doSendMagicEffect(getCreaturePosition(cid),5)
	for i, monsterPosition in pairs(monstersPositions) do
		doCreateMonster(monsterName, monsterPosition, false)
	end
	return true
end
If doesn't work try monster name 'demon'.
 
Lua:
local t = {
	{x=1144, y=1278, Z=8},
	{x=1144, y=1280, Z=8},
	{x=1146, y=1277, Z=8},
	{x=1146, y=1281, Z=8},
	{x=1148, y=1277, Z=8},
	{x=1148, y=1281, Z=8}
}
 
function onStepIn(cid, item, position, fromPosition)
	if isPlayer(cid) == TRUE then
		doTeleportThing(cid, {x=1144, y=1279, Z=8})
		doSendMagicEffect({x=1144, y=1279, Z=8}, CONST_ME_EXPLOSIONHIT)
		for i = 1, #t do
			doSummonCreature('Demon', t[i])
		end
	end
end
 
With your script I get the error "docreatemonster" a nil value, are you sure this is for 0.2.7? :p
Opss...
I had open tfs 0.3.6pl1 and 0.2.7.r83 sources :$
C:\Documents and Settings\user\Pulpit\0.2.7.r83\luascripts.cpp
PHP:
int32_t LuaScriptInterface::luaDoSummonCreature(lua_State* L)
{
	//doSummonCreature(name, pos)
	PositionEx pos;
	popPosition(L, pos);
	std::string name = popString(L);

	ScriptEnviroment* env = getScriptEnv();

	Monster* monster = Monster::createMonster(name);
	if(!monster)
	{
		std::string error_str = (std::string)"Monster name(" + name + (std::string)") not found";
		reportErrorFunc(error_str);
		lua_pushnumber(L, LUA_ERROR);
		return 1;
	}

	if(!g_game.placeCreature(monster, pos))
	{
		delete monster;
		std::string error_str = (std::string)"Can not summon monster: " + name;
		reportErrorFunc(error_str);
		lua_pushnumber(L, LUA_ERROR);
		return 1;
	}

	uint32_t cid = env->addThing(monster);
	lua_pushnumber(L, cid);
	return 1;
}
So it should be:
PHP:
local playerNewPos = {x=1144, y=1279, Z=8}
local monstersPositions = {{x=1144, y=1278, Z=8},{x=1144, y=1280, Z=8},{x=1146, y=1277, Z=8},{x=1146, y=1281, Z=8},{x=1148, y=1277, Z=8},{x=1148, y=1281, Z=8}}
local monsterName = "Demon"
 
function onStepIn(cid, item, position, fromPosition)
    doTeleportThing(cid, playerNewPos, TRUE)
    doSendMagicEffect(getCreaturePosition(cid),5)
    for i, monsterPosition in pairs(monstersPositions) do
        doSummonCreature(monsterName, monsterPosition)
    end
    return true
end
 
I don't get it, what the hell is wrong with my server.. how can it NOT summon monsters? :S
cannotsummonmonster.jpg

I've tried with both capital and small characters, and i've tried it with different monsters..
 
I decided to use cykotitans code and remove the teleportthing, so now it works.

Code:
local t = {
	storage = 32000,
	monster = {"Demon", {x=100, y=100, z=7}},
	msg = "It's too quiet here..."
}
function onStepIn(cid, item, position, fromPosition)
	if getPlayerStorageValue(cid, t.storage) < 1 then       
		doCreatureSay(cid, t.msg, TALKTYPE_ORANGE_1)
		doSummonCreature(t.monster[1], t.monster[2])
		setPlayerStorageValue(cid, t.storage, 1)
	end
	return TRUE
end
 
Last edited:
Back
Top