Code: Select all
function onItemUse(target)
local body = caster:getEquipID(SLOT_BODY);
if(target:hasStatusEffect(EFFECT_REGEN) == false) then
if (body == 14520) then -- Dream Robe +1
target:addStatusEffect(EFFECT_REGEN,1,3,150);
else
end
target:addStatusEffect(EFFECT_REGEN,1,3,120);
else
target:messageBasic(423);
end
end;
caster:getEquipID(SLOT_BODY); was returning a nil value. Once caster: was changed to target: , the conditional for the body piece was not returning a match using method in script, and thus always continuing on as if body was not equipped.
Removed the local variable definition, and compared target:getEquipID(SLOT_BODY) to 14520 directly. Selbina milk now seems to work as intended. Commenting on top of file was also for a different item, yogurt, ID 5575 so that was changed as well despite it not really affecting anything.
Changes made to script as follows:
Code: Select all
function onItemUse(target)
if(target:hasStatusEffect(EFFECT_REGEN) == false) then
if (target:getEquipID(SLOT_BODY) == 14520) then -- Dream Robe +1
target:addStatusEffect(EFFECT_REGEN,1,3,150);
else
end
target:addStatusEffect(EFFECT_REGEN,1,3,120);
else
target:messageBasic(423);
end
end;