Mano não é só o Demon, são todos sumons... da uma olhada ae!
Olha só, eu instalei o script mas não estava dando o Exp em hits...Então acrescentei esta Tag em todos os monsters, ai funcionou...
Obs.: Usei os sistema no meu PC em Win 7, funciona direitinho sem precisar registrar as tags no monstros...Mas quando passei para Vps em linux só funcionou desta Forma.
Exphit.lua
rateExp = 300 -- 0 a 100
rateExp1 = 200 -- 101 a 125
rateExp2 = 150 -- 126 a 150
rateExp3 = 100 -- 151 a 200
rateExp4 = 75 -- 201 a 250
rateExp5 = 25 -- 251 a 300
rateExp6 = 13 -- 301 a 400
rateExp7 = 7 -- 401 a 450
rateExp8 = 3 -- 451
bonus = 1 -- Bonus por estar com exp ring
expringid = 148 -- Id do exp ring
------------------------------
function CalculeExp(monsterhp, exptotal, hit)
local x = hit <= monsterhp and math.ceil(exptotal * hit / monsterhp) or 0
local x2 = x - 20 + math.random(20)
return x2 > 0 and x2 or 0
end
function isSummon(uid)
return uid ~= getCreatureMaster(uid) or false
end
function onStatsChange(cid, attacker, type, combat, value)
if type == STATSCHANGE_HEALTHLOSS then
if isMonster(cid) then
if isCreature(attacker) then
local sid = isSummon(attacker) == true and getCreatureMaster(attacker) or attacker
if isPlayer(sid) and getPlayerLevel(sid) <= 100 then
local expg = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp, value)
doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg.." exp.")
doSendAnimatedText(getThingPos(sid), expg, 215)
doPlayerAddExp(sid, expg)
elseif isPlayer(sid) and getPlayerLevel(sid) > 100 and getPlayerLevel(sid) <= 125 then
local expg1 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp1, value)
doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg1.." exp.")
doSendAnimatedText(getThingPos(sid), expg1, 215)
doPlayerAddExp(sid, expg1)
elseif isPlayer(sid) and getPlayerLevel(sid) > 125 and getPlayerLevel(sid) <= 150 then
local expg2 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp2, value)
doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg2.." exp.")
doSendAnimatedText(getThingPos(sid), expg2, 215)
doPlayerAddExp(sid, expg2)
elseif isPlayer(sid) and getPlayerLevel(sid) > 150 and getPlayerLevel(sid) <= 200 then
local expg3 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp3, value)
doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg3.." exp.")
doSendAnimatedText(getThingPos(sid), expg3, 215)
doPlayerAddExp(sid, expg3)
elseif isPlayer(sid) and getPlayerLevel(sid) > 200 and getPlayerLevel(sid) <= 250 then
local expg4 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp4, value)
doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg4.." exp.")
doSendAnimatedText(getThingPos(sid), expg4, 215)
doPlayerAddExp(sid, expg4)
elseif isPlayer(sid) and getPlayerLevel(sid) > 250 and getPlayerLevel(sid) <= 300 then
local expg5 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp5, value)
doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg5.." exp.")
doSendAnimatedText(getThingPos(sid), expg5, 215)
doPlayerAddExp(sid, expg5)
elseif isPlayer(sid) and getPlayerLevel(sid) > 300 and getPlayerLevel(sid) <= 450 then
local expg6 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp6, value)
doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg6.." exp.")
doSendAnimatedText(getThingPos(sid), expg6, 215)
doPlayerAddExp(sid, expg6)
elseif isPlayer(sid) and getPlayerLevel(sid) > 400 and getPlayerLevel(sid) <= 400 then
local expg7 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp7, value)
doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg7.." exp.")
doSendAnimatedText(getThingPos(sid), expg7, 215)
doPlayerAddExp(sid, expg7)
elseif isPlayer(sid) and getPlayerLevel(sid) > 450 then
local expg8 = CalculeExp(getCreatureMaxHealth(cid), getMonsterInfo(getCreatureName(cid)).experience * rateExp8, value)
doPlayerSendTextMessage(sid, 23, "Você Ganhou "..expg8.." exp.")
doSendAnimatedText(getThingPos(sid), expg8, 215)
doPlayerAddExp(sid, expg8)
end
end
end
elseif type == STATSCHANGE_HEALTHGAIN then
return false
end
return true
end
function onCombat(cid, target)
if isMonster(target) and not isSummon(target) and not isPlayer(target) then
registerCreatureEvent(target, "ExpGain")
end
return true
end
XLM do Demon.
<?xml version="1.0" encoding="UTF-8"?>
<monster name="Demon" nameDescription="a demon" race="fire" experience="6000" speed="280" manacost="0">
<health now="8200" max="8200"/>
<look type="35" corpse="5995"/>
<targetchange interval="5000" chance="8"/>
<strategy attack="100" defense="0"/>
<flags>
<flag summonable="0"/>
<flag attackable="1"/>
<flag hostile="1"/>
<flag illusionable="0"/>
<flag convinceable="0"/>
<flag pushable="0"/>
<flag canpushitems="1"/>
<flag canpushcreatures="1"/>
<flag targetdistance="1"/>
<flag staticattack="40"/>
<flag runonhealth="0"/>
</flags>
<attacks>
<attack name="melee" interval="2000" skill="70" attack="130"/>
<attack name="manadrain" interval="3000" chance="13" range="7" min="-80" max="-300"/>
<attack name="fire" interval="2000" chance="14" range="7" radius="7" target="1" min="-160" max="-350">
<attribute key="shootEffect" value="fire"/>
<attribute key="areaEffect" value="firearea"/>
</attack>
<attack name="firefield" interval="1000" chance="15" range="7" radius="1" target="1">
<attribute key="shootEffect" value="fire"/>
</attack>
<attack name="energy" interval="3000" chance="30" length="8" spread="0" min="-220" max="-460">
<attribute key="areaEffect" value="energy"/>
</attack>
</attacks>
<defenses armor="50" defense="55">
<defense name="healing" interval="1000" chance="15" min="90" max="200">
<attribute key="areaEffect" value="blueshimmer"/>
</defense>
<defense name="speed" interval="1000" chance="15" speedchange="200" duration="20000">
<attribute key="areaEffect" value="redshimmer"/>
</defense>
</defenses>
<elements>
<element firePercent="100"/>
<element physicalPercent="25"/>
<element earthpercent="20"/>
<element energyPercent="20"/>
<element deathPercent="20"/>
<element icePercent="-25"/>
<element holyPercent="-10"/>
</elements>
<immunities>
<immunity lifedrain="1"/>
<immunity paralyze="1"/>
<immunity invisible="1"/>
</immunities>
<summons maxSummons="2">
<summon name="fire elemental" interval="2000" chance="10" max="2"/>
</summons>
<voices interval="5000" chance="10">
<voice sentence="MUHAHAHAHA!" yell="1"/>
<voice sentence="I SMELL FEEEEEAAAR!" yell="1"/>
<voice sentence="CHAMEK ATH UTHUL ARAK!" yell="1"/>
<voice sentence="Your resistance is futile!"/>
<voice sentence="Your soul will be mine!" yell="0"/>
</voices>
<loot>
<item id="2148" countmax="90" chance="28000"/><!-- gold coin -->
<item id="2148" countmax="80" chance="28000"/><!-- gold coin -->
<item id="2148" countmax="75" chance="28000"/><!-- gold coin -->
<item id="2148" countmax="65" chance="28000"/><!-- gold coin -->
<item id="7368" countmax="5" chance="3100"/><!-- assassin star -->
<item id="5954" chance="1150"/><!-- demon horn -->
<item id="2520" chance="750"/><!-- demon shield -->
<item id="2462" chance="3000"/><!-- devil helmet -->
<item id="2387" chance="21000"/><!-- double axe -->
<item id="2432" chance="6000"/><!-- fire axe -->
<item id="2795" countmax="6" chance="12500"/><!-- fire mushroom -->
<item id="2393" chance="1650"/><!-- giant sword -->
<item id="2179" chance="700"/><!-- golden ring -->
<item id="2418" chance="1650"/><!-- golden sickle -->
<item id="7590" chance="10000"/><!-- great mana potion -->
<item id="7590" chance="10000"/><!-- great mana potion -->
<item id="7590" chance="10000"/><!-- great mana potion -->
<item id="2396" chance="1000"/><!-- ice rapier -->
<item id="1987" chance="100000"><!-- bag -->
<inside>
<item id="2472" chance="150"/><!-- magic plate armor -->
<item id="2514" chance="550"/><!-- mastermind shield -->
<item id="2176" chance="3000"/><!-- orb -->
<item id="2152" countmax="3" chance="23750"/><!-- platinum coin -->
<item id="1982" chance="1000"/><!-- purple tome -->
<item id="2214" chance="900"/><!-- ring of healing -->
<item id="2149" chance="10000"/><!-- small emerald -->
<item id="2165" chance="1500"/><!-- stealth ring -->
<item id="2151" chance="3300"/><!-- talon -->
<item id="8473" chance="12500"/><!-- ultimate health potion -->
<item id="8473" chance="12500"/><!-- ultimate health potion -->
<item id="8473" chance="12500"/><!-- ultimate health potion -->
<item id="2171" chance="1200"/><!-- platinum amulet -->
<item id="2164" chance="800"/><!-- might ring -->
<item id="7382" chance="950"/><!-- demonrage sword -->
<item id="2470" chance="450"/><!-- golden legs -->
<item id="7393" chance="50"/><!-- demon trophy -->
</inside>
</item>
</loot>
<script>
<event type="statschange" name="ExpGain" event="script" value="exphit.lua"/>
<event type="combat" name="ExpHit" event="script" value="exphit.lua"/>
</script>
</monster>