Odp: Potwory i exp
Zrobi?em dwa skrypty, poniewa? nie wiedzia?em, kt?ry b?dzie dla Ciebie wygodniejszy. Pierwszy dzia?a tak, ?e sami przypisujemy w skrypcie do danego potwora ilo?? leveli jakie dostaniemy, a w drugim nic nie zmieniamy, tylko w ka?dym potworze w
/data/monster ustawiamy w
"experience" ile leveli ma dodawa?. Czyli np. je?li dragon ma dodawa? 20 leveli ustawiamy tak:
[LUA]<monster name="Dragon" nameDescription="a dragon" race="blood" experience="20" speed="180" manacost="0">[/LUA]
Do
/data/creaturescripts/creaturescripts.xml dodajemy:
[LUA] <event type="kill" name="MonsterExp" event="script" value="monsters.lua"/> [/LUA]
Do
/data/creaturescripts/scripts/login.lua przed ostatnim "return true" dodajemy:
[LUA] registerCreatureEvent(cid, "MonsterExp")[/LUA]
W
/data/creaturescripts/scripts/ tworzymy plik
monsters.lua i wklejamy do niego pierwszy lub drugi skrypt:
I.
[LUA]local monsters = {
['dragon'] = 20, ---- ['potwor'] = ilosc leveli,
['demon'] = 100,
['ghazbaran'] = 200
}
function onKill(cid, target, lastHit)
local amount = monsters[getCreatureName(target):lower()]
local pos = getCreaturePosition(cid)
if isMonster(target) and amount and not getCreatureMaster(target) then
doPlayerAddSkill(cid, SKILL__LEVEL, amount, true)
doSendAnimatedText(pos, amount, COLOR_WHITE)
end
return true
end[/LUA]
II.
[LUA]function onKill(cid, target, lastHit)
local monster = getMonsterInfo(getCreatureName(target))
local pos = getCreaturePosition(cid)
if isMonster(target) and not getCreatureMaster(target) then
doPlayerAddSkill(cid, SKILL__LEVEL, monster.experience, true)
doSendAnimatedText(pos, monster.experience, COLOR_WHITE)
end
return true
end[/LUA]
| Notka moderatorska: |
| +2 OT Expert. |