astamor
New Member
- Joined
- Jul 22, 2011
- Messages
- 42
- Reaction score
- 2
I have this script and it works perfectly:
and in creaturescripts.xml:
and in the monster file:
And I wanted to create new monster with the same scripts so I did this:
In creaturescripts.xml
and in monster file:
And after I kill second monsters nothing happens. There are no errors in server console at all. Where is the problem ?
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 ?