Page 1 of 1

Newbie (blessed) items problem on player death

Posted: Fri Nov 30, 2018 8:13 am
by Ciechu
Hi,

If player move newbie item (for example robe), to main backpack and die, It will be no problem - after ressurect this robe still will be in backpack, BUT

If player move this robe to another container (example bag in main backpack), these robe is in corpse after player die.

Can you help me for script a function that every newbie items move to main backpack after character die?

I know how to do it, but my script need optimalization..

Thank you, Ciechu

Re: Newbie (blessed) items problem on player death

Posted: Fri Nov 30, 2018 9:22 am
by guialtran
misc/chrdeath.src

Code: Select all

program chrdeath(corpse,ghost)
	var backpack := ghost.backpack;
	MoveNewbieItemsFromTheBodyToBackpack(corpse,backpack);
endprogram

function MoveNewbieItemsFromTheBodyToBackpack(corpse,backpack)
	foreach item in (EnumerateItemsInContainer(corpse))
		SleepMS(10);
		if(item.newbie)
			MoveItemToContainer( item, backpack );
		endif
	endforeach
endfunction
You'll have to be careful.
if the player has backpacks of newbie items :deadhorse:
you'll have to get around this problem by creating backpacks and moving the newbie items in.

Re: Newbie (blessed) items problem on player death

Posted: Fri Nov 30, 2018 11:33 am
by Ciechu
Ok, thank you.

That is what I wrote also. I think there was anything better than foreach.

Thank you!