Hi
I got problem with script: I want to use function OnStepIn to gain skill tries and exp while reducing health.
my movement.xml for used script:
gravity_machine.lua :
GetPlayerStorageValue is set by talking with npc, I have checked this value, it is fine but stepping in do nothing. Also I checked item id's and it's fine, itemid is 102 and actiond is 9801. Any advice?
I got problem with script: I want to use function OnStepIn to gain skill tries and exp while reducing health.
my movement.xml for used script:
<movement type="StepIn" actionid="9801" event="script" value="gravity_machine.lua"/>
gravity_machine.lua :
Lua:
function onStepIn(cid, item, pos)
local set = getPlayerStorageValue(cid,98991)
local lvl = getPlayerLevel(cid)
local addExp2 = math.random(set * 2, set * 3)
local hp2 = math.random(0.5, 1.5)
local addExp = math.random(set, set * 1.5)
local hp = math.random(2.5, 5.5)
local addExp0 = math.random(set * 0.8, set)
local hp0 = math.random(4.5, 6.5)
if isPlayer(cid) == TRUE then
if lvl < 50 and set > 0 then
doPlayerAddExp(cid, set)
elseif 50 <= lvl <= 500 and set < lvl then
doPlayerAddExp(cid, addExp)
doPlayerRemoveMaxHpProcent(cid, hp0)
doPlayerAddSkillTry(cid, 4, 2)
elseif 50 <= lvl <= 500 and set == lvl then
doPlayerAddExp(cid, addExp)
doPlayerRemoveMaxHpProcent(cid, hp)
doPlayerAddSkillTry(cid, 4, 2)
elseif lvl > 500 and set < lvl then
doPlayerAddExp(cid, addExp2)
doPlayerRemoveMaxHpProcent(cid, hp)
doPlayerAddSkillTry(cid, 4, 2)
elseif lvl > 500 and set == lvl then
doPlayerAddExp(cid, addExp2)
doPlayerRemoveMaxHpProcent(cid, hp2)
doPlayerAddSkillTry(cid, 4, 3)
else
doPlayerSendCancel(cid, "Set Machine to a level lower than " .. (lvl + 1) .. ".")
end
end
end
GetPlayerStorageValue is set by talking with npc, I have checked this value, it is fine but stepping in do nothing. Also I checked item id's and it's fine, itemid is 102 and actiond is 9801. Any advice?
Last edited: