• 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 Tp after killing monster once worked now it's not working.

astamor

New Member
Joined
Jul 22, 2011
Messages
42
Reaction score
2
I have this script and it works perfectly:


Code:
local teleportID = 1387
local config = {
['bishop neden'] = {destPos = {x=966, y=992, z=7}, teleportPos = {x=1007, y=993, z=8}, timeToExpire = 120, effect = CONST_ME_TELEPORT},
}

function onDeath(cid, corpse, deathList)
local monsterType = isCreature(cid) and config[getCreatureName(cid):lower()]
if monsterType then
local tileItem, teleportEffect, teleportPos = getTileItemById(monsterType.teleportPos, teleportID).uid, monsterType.effect, monsterType.teleportPos
if tileItem > 0 then
doRemoveThing(tileItem)
end
doCreateTeleport(teleportID, monsterType.destPos, teleportPos)
doSendMagicEffect(teleportPos, teleportEffect)
local seconds, minutes = monsterType.timeToExpire, 0;
while(seconds >= 60)do
minutes = minutes + 1;
seconds = seconds - 60;
end
doCreatureSay(cid, 'You have '..minutes..' minute'..(minutes > 1 and 's' or '')..(seconds > 0 and (' and '..seconds..' second'..(seconds > 0 and 's' or '')) or '')..' until teleport will be shut down.', TALKTYPE_MONSTER)
return addEvent(function()
local teleportItem = getTileItemById(teleportPos, teleportID).uid
if teleportItem > 0 then
return doRemoveThing(teleportItem) and doSendMagicEffect(teleportPos, teleportEffect)
end end, monsterType.timeToExpire * 1000, teleportPos, teleportEffect)
end
return true
end

and in creaturescripts.xml:

Code:
<event type="death" name="teleportCreate" event="script" value="monstertp.lua"/>

and in the monster file:


Code:
<script>
    <event name="teleportCreate"/>
    </script>

And I wanted to create new monster with the same scripts so I did this:


Code:
local teleportID = 1387
local config = {
['Bishop Arthur'] = {destPos = {x=979, y=924, z=7}, teleportPos = {x=979, y=924, z=7}, timeToExpire = 120, effect = CONST_ME_TELEPORT},
}

function onDeath(cid, corpse, deathList)
local monsterType = isCreature(cid) and config[getCreatureName(cid):lower()]
if monsterType then
local tileItem, teleportEffect, teleportPos = getTileItemById(monsterType.teleportPos, teleportID).uid, monsterType.effect, monsterType.teleportPos
if tileItem > 0 then
doRemoveThing(tileItem)
end
doCreateTeleport(teleportID, monsterType.destPos, teleportPos)
doSendMagicEffect(teleportPos, teleportEffect)
local seconds, minutes = monsterType.timeToExpire, 0;
while(seconds >= 60)do
minutes = minutes + 1;
seconds = seconds - 60;
end
doCreatureSay(cid, 'You have '..minutes..' minute'..(minutes > 1 and 's' or '')..(seconds > 0 and (' and '..seconds..' second'..(seconds > 0 and 's' or '')) or '')..' until teleport will be shut down.', TALKTYPE_MONSTER)
return addEvent(function()
local teleportItem = getTileItemById(teleportPos, teleportID).uid
if teleportItem > 0 then
return doRemoveThing(teleportItem) and doSendMagicEffect(teleportPos, teleportEffect)
end end, monsterType.timeToExpire * 1000, teleportPos, teleportEffect)
end
return true
end

In creaturescripts.xml

Code:
<event type="death" name="teleportCreate" event="script" value="bishop arthur.lua"/>

and in monster file:

Code:
<script>
    <event name="teleportCreate"/>
    </script

And after I kill second monsters nothing happens. There are no errors in server console at all. Where is the problem ?
 
I have just tried it. I've changed to:

Code:
<event type="death" name="arthur" event="script" value="bishop arthur.lua"/>

and in monster file:


Code:
<script>
    <event name="arthur"/>
    </script>
 
event name should be the name you use in the creaturescripts.xml line.
You can also just add more monsters to the same script btw, just add a new line in local config.
Also, monster name should be without capitals:
['Bishop Arthur']
should be
['bishop arthur']
 
Yes I know, I've just posted it wrong in previous post. It's exactly the same "arthur".
I've tried adding new monster to the same script and nothing. But there are no errors in console.
Ahhh, finally it's working :) as you said, without capitals :) thank you :)
 
Last edited:
Show how you did it.

Already solved.
Didn't see the edit (last line you added later) :p
 
Last edited:
My script now looks like this:


Code:
local teleportID = 1387
local config = {
['bishop neden'] = {destPos = {x=966, y=992, z=7}, teleportPos = {x=1007, y=993, z=8}, timeToExpire = 120, effect = CONST_ME_TELEPORT},
['bishop arthur'] = {destPos = {x=979, y=921, z=6}, teleportPos = {x=975, y=924, z=7}, timeToExpire = 120, effect = CONST_ME_TELEPORT},
['soul of bishop neden'] = {destPos = {x=979, y=924, z=5}, teleportPos = {x=979, y=920, z=6}, timeToExpire = 120, effect = CONST_ME_TELEPORT},
['hellbringer'] = {destPos = {x=978, y=921, z=4}, teleportPos = {x=980, y=925, z=5}, timeToExpire = 120, effect = CONST_ME_TELEPORT},
['messenger of death'] = {x=966, y=946, z=7}, teleportPos = {x=973, y=921, z=4}, timeToExpire = 120, effect = CONST_ME_TELEPORT},
}

function onDeath(cid, corpse, deathList)
local monsterType = isCreature(cid) and config[getCreatureName(cid):lower()]
if monsterType then
local tileItem, teleportEffect, teleportPos = getTileItemById(monsterType.teleportPos, teleportID).uid, monsterType.effect, monsterType.teleportPos
if tileItem > 0 then
doRemoveThing(tileItem)
end
doCreateTeleport(teleportID, monsterType.destPos, teleportPos)
doSendMagicEffect(teleportPos, teleportEffect)
local seconds, minutes = monsterType.timeToExpire, 0;
while(seconds >= 60)do
minutes = minutes + 1;
seconds = seconds - 60;
end
doCreatureSay(cid, 'You have '..minutes..' minute'..(minutes > 1 and 's' or '')..(seconds > 0 and (' and '..seconds..' second'..(seconds > 0 and 's' or '')) or '')..' until teleport will be shut down.', TALKTYPE_MONSTER)
return addEvent(function()
local teleportItem = getTileItemById(teleportPos, teleportID).uid
if teleportItem > 0 then
return doRemoveThing(teleportItem) and doSendMagicEffect(teleportPos, teleportEffect)
end end, monsterType.timeToExpire * 1000, teleportPos, teleportEffect)
end
return true
end

and in creaturescripts.xml:


Code:
    <event type="death" name="teleportCreate" event="script" value="monstertp.lua"/>
    <event type="death" name="arthur" event="script" value="bishop arthur.lua"/>
    <event type="death" name="soul" event="script" value="soulofbishopneden.lua"/>
    <event type="death" name="hellbringer" event="script" value="hellbringer.lua"/>
    <event type="death" name="messenger" event="script" value="messengerofdeath.lua"/>
 
Back
Top