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

CreatureEvent Kill Monster & Create Portal

Status
Not open for further replies.
@up,
Thank you.

Bobek,
You can test it now, I am going to keep updating the "First Post."
 
THis dmn script isnt working:

Lua:
  local timed = 120 -- Seconds
local monsters =
{
        ----- Teleport Position ---------- New Player Position -----
    ["Thalas"] = {x=3374, y=3337, z=14, stackpos=1}, {x=3374, y=3359], z=15},
    ["Rahemos"] = {x=3356, y=3567, z=15, stackpos=1}, {x=3381, y=3574, z=15},
    ["Mahrdis"] = {x=3241, y=3509, z=15, stackpos=1}, {x=3220, y=3512, z=15},
	   ["Omruc"] = {x=3468, y=3450, z=15, stackpos=1}, {x=3494, y=3453, z=15}
}

function onKill(cid, target, lastHit)
    for name, pos in pairs(monsters) do
    if name == getCreatureName(target) then
        doCreateTeleport(1387, pos[1], pos[2])
        doCreatureSay(target, "You have ".. timed .." seconds before the portal closes!", TALKTYPE_ORANGE_1)
        addEvent(removeTeleport, timed * 1000)
    end
end

local function removeTeleport()
local teleport = getTileItemById(pos[1], 1387)
    if teleport.uid > 0 then
        doRemoveItem(teleport.uid)
    end
end

error I got:

Lua:
[20/08/2009 00:54:13]
[20/08/2009 00:54:13] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/ultimate.lua)
[20/08/2009 00:54:13] data/creaturescripts/scripts/ultimate.lua:5: '}' expected near ']'

I also tried to put } instead of [, but it still didnt work :s
 
richux...
Lua:
local timed = 120 -- Seconds
local monsters =
{
        ----- Teleport Position ---------- New Player Position -----
    ["Thalas"]   = {(x=3374, y=3337, z=14, stackpos=1), (x=3374, y=3359, z=15)},
    ["Rahemos"]  = {(x=3356, y=3567, z=15, stackpos=1), (x=3381, y=3574, z=15)},
    ["Mahrdis"]  = {(x=3241, y=3509, z=15, stackpos=1), (x=3220, y=3512, z=15)},
    ["Omruc"]    = {(x=3468, y=3450, z=15, stackpos=1), (x=3494, y=3453, z=15)}
}

local function removeTeleport()
local teleport = getTileItemById(pos[1], 1387)
    if teleport.uid > 0 then
        doRemoveItem(teleport.uid)
    end
end

function onKill(cid, target, lastHit)
    for name, pos in pairs(monsters) do
    if name == getCreatureName(target) then
        doCreateTeleport(1387, pos[1], pos[2])
        doCreatureSay(target, "You have ".. timed .." seconds before the portal closes!", TALKTYPE_ORANGE_1)
        addEvent(removeTeleport, timed * 1000)
    end
end
 
@Up,

Wow...You gotta be kidding me.
This whole time, all I had to do was "SWITCH" them around?

:eek:
 
richux...
Lua:
local timed = 120 -- Seconds
local monsters =
{
        ----- Teleport Position ---------- New Player Position -----
    ["Thalas"]   = {(x=3374, y=3337, z=14, stackpos=1), (x=3374, y=3359, z=15)},
    ["Rahemos"]  = {(x=3356, y=3567, z=15, stackpos=1), (x=3381, y=3574, z=15)},
    ["Mahrdis"]  = {(x=3241, y=3509, z=15, stackpos=1), (x=3220, y=3512, z=15)},
    ["Omruc"]    = {(x=3468, y=3450, z=15, stackpos=1), (x=3494, y=3453, z=15)}
}

local function removeTeleport()
local teleport = getTileItemById(pos[1], 1387)
    if teleport.uid > 0 then
        doRemoveItem(teleport.uid)
    end
end

function onKill(cid, target, lastHit)
    for name, pos in pairs(monsters) do
    if name == getCreatureName(target) then
        doCreateTeleport(1387, pos[1], pos[2])
        doCreatureSay(target, "You have ".. timed .." seconds before the portal closes!", TALKTYPE_ORANGE_1)
        addEvent(removeTeleport, timed * 1000)
    end
end

Code:
[20/08/2009 11:07:21] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/ultimate.lua)
[20/08/2009 11:07:21] data/creaturescripts/scripts/ultimate.lua:5: ')' expected near '='
 
I updated the first post again.
You guy's can test it...

Please report errors.
 
lol my wrong.. and a typical error fixed :D
Lua:
local timed = 120 -- Seconds
local monsters =
{
        ----- Teleport Position ---------- New Player Position -----
    ["Thalas"]   = { { x = 3374, y = 3337, z = 14, stackpos = 1}, { x = 3374, y = 3359, z = 15 } },
    ["Rahemos"]  = { { x = 3356, y = 3567, z = 15, stackpos = 1}, { x = 3381, y = 3574, z = 15 } },
    ["Mahrdis"]  = { { x = 3241, y = 3509, z = 15, stackpos = 1}, { x = 3220, y = 3512, z = 15 } },
    ["Omruc"]    = { { x = 3468, y = 3450, z = 15, stackpos = 1}, { x = 3494, y = 3453, z = 15 } }
}

local function removeTeleport()
local teleport = getTileItemById(pos[1], 1387)
    if teleport.uid > 0 then
        doRemoveItem(teleport.uid)
    end
end

function onKill(cid, target, lastHit)
    for name, pos in pairs(monsters) do
    if name == string.lower(getCreatureName(target)) then
        doCreateTeleport(1387, pos[1], pos[2])
        doCreatureSay(target, "You have ".. timed .." seconds before the portal closes!", TALKTYPE_ORANGE_1)
        addEvent(removeTeleport, timed * 1000)
    end
end
 
@up
[21/08/2009 13:19:01] [Warning - Event::loadScript] Cannot load script (data/creaturescripts/scripts/monstertp.lua)
[21/08/2009 13:19:01] data/creaturescripts/scripts/monstertp.lua:25: 'end' expected (to close 'function' at line 18) near '<eof>'

Looks like another typical error, it's so boring - I just can't wait until this script will work, so many ideas with this :p
 
Lua:
local timed = 120 -- Seconds
local monsters =
{
        ----- Teleport Position ---------- New Player Position -----
    ["Thalas"]   = { { x = 3374, y = 3337, z = 14, stackpos = 1}, { x = 3374, y = 3359, z = 15 } },
    ["Rahemos"]  = { { x = 3356, y = 3567, z = 15, stackpos = 1}, { x = 3381, y = 3574, z = 15 } },
    ["Mahrdis"]  = { { x = 3241, y = 3509, z = 15, stackpos = 1}, { x = 3220, y = 3512, z = 15 } },
    ["Omruc"]    = { { x = 3468, y = 3450, z = 15, stackpos = 1}, { x = 3494, y = 3453, z = 15 } }
}

local function removeTeleport()
local teleport = getTileItemById(pos[1], 1387)
    if teleport.uid > 0 then
        doRemoveItem(teleport.uid)
    end
	
	return TRUE
end

function onKill(cid, target, lastHit)
    for name, pos in pairs(monsters) do
		if name:lower() == string.lower(getCreatureName(target)) then
			doCreateTeleport(1387, pos[1], pos[2])
			doCreatureSay(target, "You have ".. timed .." seconds before the portal closes!", TALKTYPE_ORANGE_1)
			addEvent(removeTeleport, timed * 1000)
		end
	end
	
	return TRUE
end

Either way, script wouldnt be fired because of this line:
Code:
if name == string.lower(getCreatureName(target)) then

You are killing an Omruc, it starts a loop and what you get is:
Code:
if "Omruc" == "omruc" then
because that is how you got him in your table.
 
Shouldn't it be like this in creaturescripts.xml?


PHP:
  <event type="kill" name="monsterPortals" event="script" value="script.lua"/>

instead of
PHP:
  <event type="kill" name="monsterPortals" script="script.lua"/>
?

event="script" value="script.lua instead of
script="script.lua"

i might be wrong :O
 
Shouldn't it be like this in creaturescripts.xml?


PHP:
  <event type="kill" name="monsterPortals" event="script" value="script.lua"/>

instead of
PHP:
  <event type="kill" name="monsterPortals" script="script.lua"/>
?

event="script" value="script.lua instead of
script="script.lua"

i might be wrong :O

Yes you are right, I used this method but I didn't mentioned this before.
 
Here is the version of script that will load without errors.

Lua:
  local timed = 120 -- Seconds
local monsters =
{
        ----- Teleport Position ---------- New Player Position -----
     ["Thalas"]   = {{x=3374, y=3337, z=14, stackpos=1}, {x=3374, y=3359, z=15}},  
    ["Rahemos"]  = {{x=3356, y=3567, z=15, stackpos=1}, {x=3381, y=3574, z=15}},
    ["Mahrdis"]  = {{x=3241, y=3509, z=15, stackpos=1}, {x=3220, y=3512, z=15}},
    ["Omruc"]    = {{x=3468, y=3450, z=15, stackpos=1}, {x=3494, y=3453, z=15}}
}

local function removeTeleport()
local teleport = getTileItemById(pos[1], 1387)
    if teleport.uid > 0 then
        doRemoveItem(teleport.uid)
    end
end

function onKill(cid, target, lastHit)
    for name, pos in pairs(monsters) do
    if name == getCreatureName(target) then
        doCreateTeleport(1387, pos[1], pos[2])
        doCreatureSay(target, "You have ".. timed .." seconds before the portal closes!", TALKTYPE_ORANGE_1)
        addEvent(removeTeleport, timed * 1000)
    end
end
    return TRUE
    end

However, it doesn't work anyways. JDB, u are a dmn scammer. Lot of ppl downloaded/repped you before they used it, and than found out that it's not working. Why the hell do you release something u haven't even tested? -.-

FOR EVERYONE - Don't rep this fool. He only released not working script that I bet you could find somewhere else.
 
Script Updated.
 
Last edited:
cen this script be applied on more than one monster like when the 2 monsters die the tp appear??
 
Status
Not open for further replies.
Back
Top