Page 1 of 1

Selbina Milk fix

Posted: Fri Oct 10, 2014 11:54 pm
by horizon
Noticed selbina milk was not functioning properly. original scripting:

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;
Hopefully this helps someone out. My first official contribution!

Re: Selbina Milk fix

Posted: Sat Oct 11, 2014 12:13 am
by kjLotus
horizon wrote:My first official contribution!
https://help.github.com/articles/creati ... l-request/

Re: Selbina Milk fix

Posted: Sat Oct 11, 2014 1:14 am
by horizon
I was a little unsure doing this for the first time, but hopefully I did this correctly.
I created a fork on my account, edited the script for selbina milk, committed it, and then issued a pull request with base:darkstarproject:master and my master as the comparison.