Newbie (blessed) items problem on player death

Get Help on scripting in POL with configurations, config setups, script trouble shooting, etc.

Moderator: POL Developer

Post Reply
User avatar
Ciechu
New User
Posts: 29
Joined: Mon Oct 15, 2018 5:36 am
Location: Poland

Newbie (blessed) items problem on player death

Post 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
guialtran
Grandmaster Poster
Posts: 120
Joined: Wed Jul 30, 2008 12:42 pm

Re: Newbie (blessed) items problem on player death

Post 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.
User avatar
Ciechu
New User
Posts: 29
Joined: Mon Oct 15, 2018 5:36 am
Location: Poland

Re: Newbie (blessed) items problem on player death

Post by Ciechu »

Ok, thank you.

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

Thank you!
Post Reply