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

Teleport !

manuveiu

New Member
Joined
Jun 22, 2010
Messages
73
Reaction score
1
Hey guys, i'm with a problem with my Ot's. I'm trying to do a quest but i want to do a Creature who , when it die he turn into a teleport. If someone can help me with it i'll Rep++ ! [Yes, i know, my english sucks.]


Yours manu
 
creaturescripts/scripts/dead
function onKill(cid, target)
local m = {
["Ghazbaran"] = {
message = "Escape through the teleport quickly before it closes!",
cfg = {
{
time = 10, -- Seconds until tp closes.
to = { x = xxx, y = xxx, z = xxx }, -- Where the tp takes you.
tp = { x = xxx, y = xxx, z = xxx } -- Where the tp creates.
},
}
}
}
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
local function deleteTeleport()
local teleport = getTileItemById(c.tp, 1387).uid
if(teleport > 0) then
doRemoveItem(teleport)
doSendMagicEffect(c.tp, CONST_ME_POFF)
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


creaturescripts/creaturescripts.XML
<event type="kill" name="MonsterPortal" event="script" value="dead.lua"/>
 
Lua:
local m,p = 'Creaturename',{x=1,y=1,z=7} -- creaturename of monster & teleport destination.
function onKill(cid,target)
local v = getThingPos(cid)
	if getCreatureName(target:lower()) == m:lower() then
		doTeleportThing(cid,p)
		doSendMagicEffect(v,CONST_ME_TELEPORT)
		doPlayerSendTextMessage(cid,MESSAGE_FIRST,'You killed '..m..' and got teleported.')
	end
	return true
end
 
Thx guys! another question... can some one do for me a script of the rewards of the warth of emperor. i don't know how to make a quest thats cancel the other reward like anihilator for exemple...
 
data/actioins/scripts/annihichests.lua
Lua:
local t = {
[6001] = {8001,"magic sword",2400},
[6002] = {8001,"demon armor",2494},
[6003] = {8001,"stonecutter axe",2431},
[6004] = {8001,"annihilation bear",2326}
}

function onUse(cid,item,fromPosition,itemEx,toPosition)
local v = t[item.uid]
      if getPlayerStorageValue(cid,v[1]) == -1 and getPlayerFreeCap(cid) >= (getItemWeightById(v[3])) then
         setPlayerStorageValue(cid,v[1],1)
               doPlayerAddItem(cid,v[3])
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You have found a " .. v[2] .. "!")
         elseif getPlayerStorageValue(cid,v[1]) == 1 then
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "It is empty")
         elseif getPlayerFreeCap(cid) < (getItemWeightById(v[3])) then
               doPlayerSendTextMessage(cid,MESSAGE_INFO_DESCR, "You need " .. getItemWeightById(v[3]) .. ".00 oz in order to get the item")
                 end
     return true
end

data/actions/actions.xml
XML:
<action uniqueid="6001-6004" event="script" value="annihichests.lua"/>

Go to your map, put this UIDs in chests:
6001 for magic sword chest
6002 for demon armor chest
6003 for stonecutter axe chest
6004 for annihi bear chest
 
its a creatureescript, you musnt add it in the monster file. You only change the name of the monster in the script, for example there says Ghazbaran, you can change it like for a chiken or a dog :p
Did you change the positions?
what error did it says?
 
Back
Top