Wintermute Engine Forum

Wintermute Engine => Bug reports => Not a bug => Topic started by: cremen on May 06, 2008, 08:15:40 PM

Title: Entity inventory not saved then i live scene.
Post by: cremen on May 06, 2008, 08:15:40 PM
Is it right behavior?

for WME_DEMO

at OldGuy.script i added code:

Code: [Select]
on "LeftClick"
{
  GoToObject();
  if( this.HasItem("Book") ){
this.DropItem("Book");
Game.TakeItem("Book");
  };
}

on "Book"
{
  GoToObject();
  Game.Interactive = false;
  Game.DropItem("Book");
  this.TakeItem("Book");
  Game.Interactive = true;
}

and then i give this guy book (Lovely WME Tutorial, i think) and after go to street, and go back... his inventory empty... is it right? (hey, OldGay, give back my book!!!)

P.S. sorry for my pure English.
Title: Re: Entity inventory not saved then i live scene.
Post by: Mnemonic on May 06, 2008, 09:56:06 PM
Old guy in WME demo is only loaded in a single scene. When you leave the scene, the entity is destroyed and reloaded later when you revisit the scene.
Title: Re: Entity inventory not saved then i live scene.
Post by: cremen on May 07, 2008, 07:08:04 AM
i.e. at other hand, i must using actor and not entity for it?
Title: Re: Entity inventory not saved then i live scene.
Post by: metamorphium on May 07, 2008, 07:46:19 AM
no. in other words you have to make the entity global and not attached to Scene.
Title: Re: Entity inventory not saved then i live scene.
Post by: cremen on May 07, 2008, 08:31:44 AM
ok. thanks. i'll try it.
Title: Re: Entity inventory not saved then i live scene.
Post by: cremen on May 07, 2008, 03:03:32 PM
ok i do it. it's work. but i found a little bug (?)

i created global variable:


Code: [Select]
global Inventories; // at base.inc


// at scene_init.script
if( Inventories["ENT_Box"] == null ){
   Inventories["ENT_Box"] = Game.CreateEntity("ENT_Box");
}

// at region
if( Inventories["ENT_Box"].HasItem("Some_Item") ){ // <- this code did't compile, syntax error... BUT!
  // do some, but..
}

// at region
var ent = Inventories["ENT_Box"];
if( ent.HasItem("Some_Item") ){ // <- this code compiled, and work...
  // do some,
}

i think it is'nt but, but i must...
Title: Re: Entity inventory not saved then i live scene.
Post by: Mnemonic on May 10, 2008, 08:43:33 AM
It's not a bug, it's a known limitation of the current script compiler.