Hiya,
this question came several times and although it will be implemented in a future version of WME, the script solution is quite easy.
I'll write it quite "straight", of course you can create a far more comfortable function of it. In this example we have two inventories - for Peter and Paul. And of course you have to make those internal inventories (inv_Peter / inv_Paul) global !
// We need some variables...
var counter, counter2, amount;
var inv_Peter = new Array();
var inv_Paul = new Array();
// Peter is the current actor, so this becomes his inventory:
Game.TakeItem("book1");
Game.TakeItem("book2");
Game.TakeItem("book3");
Game.TakeItem("book4");
// And this will be the default inventory for Paul, assuming
// we didn't play with him yet.
inv_Paul[0] = "book5";
inv_Paul[1] = "book6";
inv_Paul[2] = "book7";
inv_Paul[3] = "book8";
// okay, now we switch from Peter to Paul.
// let's truncate the internal inventory of Peter,
// fill it with the current items and clear the
// current game inventory
inv_Peter = null;
amount = Game.NumItems;
for(counter=0; counter<(amount); counter=counter+1)
{
inv_Peter[counter] = Game.GetItem(0);
Game.DropItem(inv_Peter[counter]);
}
// now we just fill up the (currently empty) game inventory with the
// internal inventory of Paul
for(counter2=0; counter2<counter; counter2=counter2+1)
{
Game.TakeItem(inv_Paul[counter2]);
}
// done.
Not too beauty, but should work fine.
Jerrot.