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

help script kill monster get tp

Emon Stor

New Member
Joined
Sep 5, 2010
Messages
16
Reaction score
0
I need a scritp that when one kills a monster get one tp , could somebody help me plzz??
for TFS :D:D:D
 
I got this from an old thread, its JDB's.

data/creaturecsripts/scripts/portals.lua
Lua:
----------->Scripetd by JDB<------------
---->Credits to JDB for this script<----
local m = {
        ["monster name"] = {
                message = "Escape through the teleport quickly before it closes!",
                cfg = {
                        {
                                time = 60, -- Seconds until tp closes.
                                to = { x = ???, y = ??, z = ? }, -- Where the tp takes you.
                                tp = { x = ???, y = ??, z = ? } -- Where the tp creates.
                        },
                }
        }
}

function onKill(cid, target)
        if isPlayer(target) then
                return true
        end
        local monster = m[getCreatureName(target)]
        if monster then
                for i = 1, #monster.cfg do
                        local c = monster.cfg[i]
                                local function deleteTeleport()
                                local teleport = getTileItemById(c.tp, 1387).uid
                                        if(teleport > 0) then
                                                doRemoveItem(teleport)
                                                doSendMagicEffect(c.tp, CONST_ME_POFF)
                                                doSendAnimatedText(c.tp, "Closed", TEXTCOLOR_RED)
                                        end
                                        return true
                                end
                        doCreateTeleport(1387, c.to, c.tp)
                        doSendMagicEffect(c.tp, CONST_ME_ENERGYAREA)
                        addEvent(deleteTeleport, c.time * 1000)
                end
                doCreatureSay(cid, monster.message, TALKTYPE_ORANGE_1)
        end
        return true
end

login.lua add
Lua:
registerCreatureEvent(cid, "MonsterPortal")

creaturescripts.xml add
XML:
<event type="kill" name="MonsterPortal" event="script" value="portals.lua"/>
 
Last edited:
data/creaturecsripts/scripts/portals.lua

Lua:
function onKill(cid, target)
	local m = {
		["CHANGE THIS TO THE MONSTER NAME"] = {
			message = "Text...",
			teaser = { "Teaser text.." }
			cfg = {
				{
					deaths = 1, -- How many times the monster must die.
					time = 10, -- Seconds until tp closes.
					to = { x = 1000, y = 1000, z = 7 }, -- Where the tp takes you 
					tp = { x = 1000, y = 1000, z = 7 } -- Where the tp creates
				},
			}
		}
	}
	if isPlayer(target) then
		return true
	end
	local monster = m[getCreatureName(target)]
	local check = getGlobalStorageValue(monster)
	if monster then
		for i = 1, #monster.cfg do
			local c = monster.cfg[i]
			return check >= c.deaths and c.deaths ~= 0 and setGlobalStorageValue(monster, ((c.deaths ~= nil and (check == -1 and 1) or check + 1) or -1)) and doCreatureAddHealth(monster, getCreatureMaxHealth(monster), true) and doCreatureSay(monster, monster.teaser[math.random(1, #monster.teaser)], TALKTYPE_ORANGE_1) and doCreateTeleport(c.to, c.tp) and doSendMagicEffect(c.tp, CONST_ME_TELEPORT) and addEvent(function() doRemoveItem(getTileItemById(c.tp, 1387).uid) end, c.time * 1000) or c.deaths <= 1 and doCreatureSay(cid, monster.message, TALKTYPE_ORANGE_1) and doCreateTeleport(c.to, c.tp) and doSendMagicEffect(c.tp, CONST_ME_TELEPORT) and addEvent(function() doRemoveItem(getTileItemById(c.tp, 1387).uid) end, c.time * 1000)
		end
	end
	return true
end

login.lua - add this line

Lua:
registerCreatureEvent(cid, "Portals")

creaturescripts.xml

XML:
<event type="kill" name="Portals" event="script" value="portals.lua"/>

Also change in the portals.lua MONSTERNAME,WHERE PORTAL CREATES,WHERE DOES IT TAKE YOU,AND SECONDS UNTIL THE TP CLOSES,AND HOW MANY TIMES MONSTER NEEDS TO DIE!
 
Last edited:
Back
Top