Would this script work?

Here you can post threads requesting help on the official POL Ultima Online Emulator Core 095. Note: Core 095 is no longer officially supported.
Post Reply
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Would this script work?

Post 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
User avatar
CWO
POL Expert
Posts: 1160
Joined: Sat Feb 04, 2006 5:49 pm

Post 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.
Xadhoom
Neophyte Poster
Posts: 30
Joined: Fri May 26, 2006 12:53 am

Post by Xadhoom »

you cannot compile this script, the function itemsback is defined with 4 paramaters but you invoke it with only 1 parameter
Poi
Grandmaster Poster
Posts: 298
Joined: Fri Apr 14, 2006 9:36 am

Post by Poi »

Ok thanks, once i get better at scripting ill try it again
Post Reply