Why my scripts of races don't work?
When I advance level...
If I'm a human or I'm a dwarf my hp on level 4 is 168. It should not!
Dwarf:
Human:
...and the HP is equal
WTF?
Human script:
Login.lua:
creaturescripts.xml:
The dwarf should have more hitpoints than human!
When I advance level...
Code:
function onAdvance(cid, skill, oldLevel, newLevel)
if(skill == SKILL__EXPERIENCE) then
return true
end
if getPlayerSex(cid) == 5 then
if ((skill == SKILL__LEVEL) and (newLevel <= 150) and (newLevel > oldLevel)) then
if getPlayerStorageValue(cid, 96609765040) == newLevel then
else
setPlayerStorageValue(cid, 96609765040, newLevel)
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+2)
end
end
end
return true
end
If I'm a human or I'm a dwarf my hp on level 4 is 168. It should not!
Dwarf:
Code:
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+2)
Code:
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+1)
...and the HP is equal
Human script:
Code:
function onAdvance(cid, skill, oldLevel, newLevel)
if(skill == SKILL__EXPERIENCE) then
return true
end
if getPlayerSex(cid) == 0 or getPlayerSex(cid) == 1 then
if ((skill == SKILL__LEVEL) and (newLevel <= 150) and (newLevel > oldLevel)) then
if getPlayerStorageValue(cid, 96609765040) == newLevel then
else
setPlayerStorageValue(cid, 96609765040, newLevel)
setCreatureMaxHealth(cid, getCreatureMaxHealth(cid)+1)
if getCreatureMaxMana(cid) > 0 then
setCreatureMaxMana(cid, getCreatureMaxMana(cid)+2)
end
end
end
end
return true
end
Login.lua:
Code:
registerCreatureEvent(cid, "Human")
registerCreatureEvent(cid, "Dwarf")
creaturescripts.xml:
Code:
<event type="advance" name="Human" event="script" value="human adv.lua"/>
<event type="advance" name="Dwarf" event="script" value="dwarf adv.lua"/>
The dwarf should have more hitpoints than human!