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

CreatureEvent When you die, your zombie wakes up...

Jetro

jangeldev
Joined
Aug 1, 2011
Messages
452
Reaction score
68
Location
Venezuela
Hi all, this is a script i released some time ago in other forum, i hope you like it.
Description:
When you die your corpse will become a zombie (or other monster, u can configure that at table "monsters"), that monster will has ur outfit and hp. Something like this:
LUEe9i.png


now go to your data/creaturescripts/creaturescripts.xml and add this:
XML:
 <event type="death" name="Zombie" event="script" value="zombie.lua"/> 
   <event type="look" name="ZombieLook" event="script" value="zombie.lua"/>

goto creaturescripts/scripts/ and create a new script called zombie.lua
inside it put this:
Lua:
local monsters = {"zombie", "ghoul", "ghost", "spectre"} --Here you can configure the monsters
local storage = 325

function onDeath(cid, corpse, deathList)

   local outfit = getCreatureOutfit(cid)
   local health = getCreatureMaxHealth(cid)
   local pos = getThingPos(cid)
   local name = getCreatureName(cid)
   local sex = getPlayerSex(cid)
   local voc = getPlayerVocationName(cid)


   doRemoveItem(corpse.uid)
   x = doCreateMonster(monsters[math.random(#monsters)], pos)
   doPlayerSetStorageValue(x, storage, name.."'s "..getCreatureName(x)..". "..(sex == 0 and "She" or "He").." was a "..voc)
   setCreatureMaxHealth(x, health)
   doCreatureAddHealth(x, health - getCreatureHealth(x))
   doSendMagicEffect(pos, CONST_ME_SMALLCLOUDS)
   doCreatureChangeOutfit(x, outfit)
      
   return false
end

function onLook(cid, thing, position, lookDistance)
   
   if (isMonster(thing.uid) and getPlayerStorageValue(thing.uid, storage)  ~= -1) then
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You see "..getPlayerStorageValue(thing.uid, storage))
              return false
   end
   
   return true
end

now go to creaturescripts/scripts/login.lua and paste this at the end of the file:
Lua:
registerCreatureEvent(cid, "Zombie")
registerCreatureEvent(cid, "ZombieLook")

That's all
 
It would be better if there was an actual Zombie system, where if you die, you become a Zombie and play as one (slow walking, infectious attacks [e.g. utori pox/mort], etc).

Would be a cool event. Nice release though. ;)
 
it is not possible to die from poison in RL tibia anymore

OK, Thank you :D

- - - Updated - - -

Edit: Other question: I have rookgaard enabled in my server... I dead in rookgaard and my corpse now is zombie and is very stronger for rookgaard!!! Can you put min level in script?
 
Nice idea! But it aint good to put in OT's tho :/
 
With min level:

Lua:
local monsters = {"zombie", "ghoul", "ghost", "spectre"} --Here you can configure the monsters
local storage = 325
local minLevel = 10
 
function onDeath(cid, corpse, deathList)

if getPlayerLevel < minLevel then
return true
end
 
   local outfit = getCreatureOutfit(cid)
   local health = getCreatureMaxHealth(cid)
   local pos = getThingPos(cid)
   local name = getCreatureName(cid)
   local sex = getPlayerSex(cid)
   local voc = getPlayerVocationName(cid)
 
 
   doRemoveItem(corpse.uid)
   x = doCreateMonster(monsters[math.random(#monsters)], pos)
   doPlayerSetStorageValue(x, storage, name.."'s "..getCreatureName(x)..". "..(sex == 0 and "She" or "He").." was a "..voc)
   setCreatureMaxHealth(x, health)
   doCreatureAddHealth(x, health - getCreatureHealth(x))
   doSendMagicEffect(pos, CONST_ME_SMALLCLOUDS)
   doCreatureChangeOutfit(x, outfit)
 
   return false
end
 
function onLook(cid, thing, position, lookDistance)
 
   if (isMonster(thing.uid) and getPlayerStorageValue(thing.uid, storage) ~= -1) then
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You see "..getPlayerStorageValue(thing.uid, storage))
              return false
   end
 
   return true
end
 
What I have to do if i want this only happen with a certain vocation, and the zombie only last 10 seconds?
 
With specific vocs:

Lua:
local monsters = {"zombie", "ghoul", "ghost", "spectre"} --Here you can configure the monsters
local storage = 325
local minLevel = 10
local vocs = {1, 2, 5, 6}
 
function onDeath(cid, corpse, deathList)
 
if getPlayerLevel < minLevel then
return true
end
 
   local outfit = getCreatureOutfit(cid)
   local health = getCreatureMaxHealth(cid)
   local pos = getThingPos(cid)
   local name = getCreatureName(cid)
   local sex = getPlayerSex(cid)
   local voc = getPlayerVocationName(cid)
 
if not(isInArray(vocs, voc)) then
return true
end
 
   doRemoveItem(corpse.uid)
   x = doCreateMonster(monsters[math.random(#monsters)], pos)
   doPlayerSetStorageValue(x, storage, name.."'s "..getCreatureName(x)..". "..(sex == 0 and "She" or "He").." was a "..voc)
   setCreatureMaxHealth(x, health)
   doCreatureAddHealth(x, health - getCreatureHealth(x))
   doSendMagicEffect(pos, CONST_ME_SMALLCLOUDS)
   doCreatureChangeOutfit(x, outfit)
 
   return false
end
 
function onLook(cid, thing, position, lookDistance)
 
   if (isMonster(thing.uid) and getPlayerStorageValue(thing.uid, storage) ~= -1) then
      doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, "You see "..getPlayerStorageValue(thing.uid, storage))
              return false
   end
 
   return true
end
 
Back
Top