Please login or register.

Login with username, password and session length
Advanced search  

News:

Forum rules - please read before posting, it can save you a lot of time.

Author Topic: How do I place new item in the game scene?  (Read 2915 times)

0 Members and 1 Guest are viewing this topic.

interesting

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 4
    • View Profile
How do I place new item in the game scene?
« on: December 29, 2006, 02:41:47 PM »

Hi, I'm begginer in this engine, I have demo with trinity, there is teapot on the ground and I would like to add another one to pick up, so I did something like this:
items.items:
Code: [Select]
item
{
 //copied from item one but with changes
caption="teapot2"
name="teapot2"
}
Now I also created teapot2.script which is the copy of teapot.script, with changed names, and edited scene_init.script
Code: [Select]
if(!game.isistemtaken("teapot2"))
{
var Teapot2=Scene.LoadActor3D(path the same as with teapot)
//two lines from teapot but with changed tepot2.property
}
What else should I do? Becouse on the scene appears second teapot, but it looks exactly the same as the first one, has the same caption, ect... and I can pick it up, but in my inventory there is still only one teapot ;/
Please, help me :)
Logged

interesting

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 4
    • View Profile
Re: How do I place new item in the game scene?
« Reply #1 on: December 29, 2006, 02:44:23 PM »

Ok, I thin I found the answer, I'm blind, but there is also actor teapot, that I didn't notice.
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: How do I place new item in the game scene?
« Reply #2 on: December 29, 2006, 02:55:37 PM »

Yes, the items defined in the "items.items" file only represent items to be displayed in the inventory window, they don't have much to do with scenes.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

interesting

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 4
    • View Profile
Re: How do I place new item in the game scene?
« Reply #3 on: December 29, 2006, 03:05:43 PM »

Ok, I created folder actors/teapot2, which is the copy of actors/teapot, I edited teapot2.script like this:
Code: [Select]
#include "scripts\base.inc"

////////////////////////////////////////////////////////////////////////////////
on "LookAt"
{
  actor.GoTo(171, 465);
  actor.TurnTo(DI_UPLEFT);

  actor.Talk("There is a teapot lying on the floor.");
}

////////////////////////////////////////////////////////////////////////////////
on "Take"
{
  actor.GoTo(171, 465);
  actor.TurnTo(DI_UPLEFT);
  actor.Talk("I'll take itttttt.");
  Game.Interactive = false;
  actor.PlayAnim("take_down"); 
  actor.AddMesh("actors\trinity\teapot_taken.ms3d", "teapot2", "Bip01 R Finger12");
  this.Active = false;
  Game.TakeItem("teapot2");
  actor.PlayAnim("take_up");
  actor.PlayAnimChannel(1, "holding_item");
  Game.Interactive = true;
}

My items.item file
Code: [Select]
ITEM
{
   CURSOR_COMBINED = TRUE
   CAPTION = "Teapot"
   NAME = "teapot"
   IMAGE = "items\teapot.png"
   CURSOR = "items\teapot.png"
;   CURSOR_HOVER = "items\book_h.bmp"
   SCRIPT = "items\teapot.script"
}

ITEM
{
   CURSOR_COMBINED = TRUE
   CAPTION = "Teapot2"
   NAME = "teapot2"
   IMAGE = "items\teapot.png"
   CURSOR = "items\teapot.png"
;   CURSOR_HOVER = "items\book_h.bmp"
   SCRIPT = "items\teapot2.script"
}
Teapot2 script from items directory
Code: [Select]
#include "scripts\base.inc"


////////////////////////////////////////////////////////////////////////////////
on "LookAt"
{
  actor.Talk("An oddly textured teapot.");
}

////////////////////////////////////////////////////////////////////////////////
on "Take"
{
  Game.SelectedItem = "teapot2";
}


////////////////////////////////////////////////////////////////////////////////
on "LeftClick"
{
  Game.SelectedItem = "teapot2";
}

And lines that I added to scene_init.script
Code: [Select]
if(!Game.IsItemTaken("teapot2"))
{
  var Teapot2 = Scene.LoadActor3D("actors\teapot2\teapot2.act3d");
  Teapot2.SkipTo(163, 442);
  Teapot2.Direction = DI_DOWNLEFT;
}
And now I have 2 teapots, which are acting exactly the same way ;/ What's wrong with that?
Logged

adonf

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 124
    • View Profile
Re: How do I place new item in the game scene?
« Reply #4 on: January 02, 2007, 11:34:48 AM »

it looks like you forgot to reference the new script in the ACT3D file. you will need to edit actors\teapot2\teapot.act3d and change the "script" line to "script=actors\teapot2\teapot2.script" or something like that.

and by the way, happy new year everybody
Logged
I am the Milkman. My milk is good.
 

Page created in 0.06 seconds with 24 queries.