Welcome
Here is my scripts so cats die after 7 kills and not after 1.
-> In creaturescripts.xml
Create cat.lua in creaturescripts/scripts..
-> Add this:
Hope you like it
Another example if you want an monster that can't die (it revives when killed). Can be used for trainers:
-> monstername is just the name of the creature and text is the text which is shown when the cat (first script) dies and in second script when you kill the monster and it revives.
REP++ if you like it
Here is my scripts so cats die after 7 kills and not after 1.
Code:
<event type="kill" name="Cats" event="script" value="cat.lua"/>
Create cat.lua in creaturescripts/scripts..
-> Add this:
Code:
function onKill(cid, target)
local config = {
monstername = "Cat",
text = "The cat lost her 7 lifes! :D"
}
if getCreatureName(target) == config.monstername then
local catuid = getGlobalStorageValue(tonumber(target))
if catuid >= 5 then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, config.text)
return TRUE
else
setGlobalStorageValue(tonumber(target),(catuid+1))
local maxhealth = getCreatureMaxHealth(target)
doCreatureAddHealth(target, maxhealth,1)
doSendMagicEffect(getCreaturePosition(target),49)
doSendAnimatedText(getCreaturePosition(target),maxhealth,120)
return FALSE
end
else
return TRUE
end
end
Hope you like it
Another example if you want an monster that can't die (it revives when killed). Can be used for trainers:
Code:
function onKill(cid, target)
local config = {
monstername = "Trainer",
text = "You can't kill trainers :D"
}
if getCreatureName(target) == config.monstername then
doPlayerSendTextMessage(cid, MESSAGE_INFO_DESCR, config.text)
local maxhealth = getCreatureMaxHealth(target)
doCreatureAddHealth(target, maxhealth,1)
doSendMagicEffect(getCreaturePosition(target),49)
doSendAnimatedText(getCreaturePosition(target),maxhealth,120)
return FALSE
end
return TRUE
end
-> monstername is just the name of the creature and text is the text which is shown when the cat (first script) dies and in second script when you kill the monster and it revives.
REP++ if you like it