Page 1 of 1

Would this script work?

Posted: Tue Jun 20, 2006 4:47 pm
by Poi
Ok i was wodnering if this script would res the person, and put all the items on the corpse back on them:

sres.src:

Code: Select all

use uo;
include "include/res2";

program sres( who, corpse, mobile )
Resurrect(mobile);
itemsback(mobile);
endprogram 


res2.inc:

Code: Select all

use uo;
function itemsback(corpse, mobile, item, ghost)
	foreach item in ListRootItemsInContainer( corpse )
   		if( !EquipItem( ghost, item ) )
      		MoveItemToContainer( item, ghost.backpack );
   		endif
	endforeach

	function ListRootItemsInContainer (byref container)

  	 var ret := { };
  	      foreach item in enumerateitemsincontainer(container)
   	   if ( item.container == container )
   	      ret.append(item);
   	   endif
  	 endforeach

  	 return ret;

	endfunction

endfunction

Posted: Tue Jun 20, 2006 8:46 pm
by CWO
if I were to do it, I would put in death.src to save their equipped items to a prop then when they res, do a foreach on the prop and re-equip the items that way.

Posted: Wed Jun 21, 2006 3:07 am
by Xadhoom
you cannot compile this script, the function itemsback is defined with 4 paramaters but you invoke it with only 1 parameter

Posted: Wed Jun 21, 2006 6:06 am
by Poi
Ok thanks, once i get better at scripting ill try it again