Selbina Milk fix

Post Reply
horizon
Posts: 29
Joined: Wed Sep 24, 2014 10:28 pm

Selbina Milk fix

Post by horizon » Fri Oct 10, 2014 11:54 pm

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!
Attachments
jug_of_selbina_milk.txt
(793 Bytes) Downloaded 256 times

User avatar
kjLotus
Special Guest
Posts: 1813
Joined: Sun Jul 22, 2012 2:16 pm

Re: Selbina Milk fix

Post by kjLotus » Sat Oct 11, 2014 12:13 am

horizon wrote:My first official contribution!
https://help.github.com/articles/creati ... l-request/

horizon
Posts: 29
Joined: Wed Sep 24, 2014 10:28 pm

Re: Selbina Milk fix

Post by horizon » Sat Oct 11, 2014 1:14 am

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.

Post Reply