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.

Pages: 1 2 [All]

Author Topic: 3 question in wme  (Read 13395 times)

0 Members and 1 Guest are viewing this topic.

Ron_Emad2

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 32
    • View Profile
3 question in wme
« on: March 16, 2009, 08:51:58 AM »

Hello Dear friends
Im emad Rahmani and connect from iran
i cant speak and wright english correctly/ please forgive me
i want work with wme
but i have 3 basic difficulty
in other word ,i have 3 question
1-i cant import 3d model in game(when i remove actor and import new 3d model , in run game i see error,and actor dont apper)
2-i want use sound in object(when player click in object(for example:desk)i want play sount(for example:oh,it is dirty desk)
3-i want take item and darg item in object(i want use condition,in other word when player use item in other item a ...)
with thanks
emad rahmani
( i asking my question in this topic,please responding)
Logged

Jyujinkai

  • Global Moderator
  • Frequent poster
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 352
    • View Profile
    • Jyujinkai's WME Development Blog
Re: 3 question in wme
« Reply #1 on: March 16, 2009, 11:42:15 AM »

1-i cant import 3d model in game(when i remove actor and import new 3d model , in run game i see error,and actor don't appear)
2-i want use sound in object(when player click in object(for example:desk)i want play sound(for example:oh,it is dirty desk)
3-i want take item and darg item in object(i want use condition,in other word when player use item in other item a ...)

1) you most likely have not built a 3D object file to be the floor of the set.
2) This is all default.. in the scene thing there should be a area for assigning sounds to an object.. or you can assign scripts to the object to have more control and use the scripts to play the sounds.
3) Not sure what you mean

a good idea when getting errors is to post your error log.
Logged
<Antoine de Saint-Exupéry> In any thing at all, perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away...
<Carl Sagan> If you want to make a apple pie from scratch. You must first... invent the universe

Azrael

  • Regular poster
  • ***
  • Karma: 9
  • Offline Offline
  • Gender: Male
  • Posts: 155
    • View Profile
    • Mad Orange
Re: 3 question in wme
« Reply #2 on: March 16, 2009, 12:44:05 PM »

I think 3 means using an object with another. Like "use hammer with glass".

To do this you only have to add some lines on "glass" (in this case) object's script.

Something like (hammer is the name of the object in your inventory):

Code: WME Script
  1. on "hammer"
  2. {
  3. //add here your script
  4. }
« Last Edit: March 20, 2009, 12:32:03 PM by Azrael »
Logged

Ron_Emad2

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 32
    • View Profile
Re: 3 question in wme
« Reply #3 on: March 16, 2009, 05:23:23 PM »

oh,thanks about your answer
but i want build a game with 3d actor and when i import trinity ,and i run the game i see an error
===========================
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: 3 question in wme
« Reply #4 on: March 16, 2009, 05:42:46 PM »

It would be helpful if you said WHAT error.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Ron_Emad2

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 32
    • View Profile
Re: 3 question in wme
« Reply #5 on: March 24, 2009, 01:49:25 PM »

Hello again dear friends
i read wme book online
it is very god
in chapter 8(8. Starting our first real game)
i want source file,in other word i want source of this toturial(project)
can i download it?
with thanks
emad
Logged

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: 3 question in wme
« Reply #6 on: March 24, 2009, 04:09:04 PM »

The source files are there on the upper left of the page.

http://res.dead-code.org/doku.php/wmebook:start

Under Preface, click on Resources--resources for all the chapters are there. 
« Last Edit: March 24, 2009, 08:36:06 PM by Catacomber »
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Ron_Emad2

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 32
    • View Profile
Re: 3 question in wme
« Reply #7 on: March 24, 2009, 05:03:06 PM »

OH THANKS
I FOUND IT
PLEASE FORGIVE ME ABOUT THIS QUESTION
WITH THANKS
EMAD/
Logged

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: 3 question in wme
« Reply #8 on: March 25, 2009, 03:13:08 AM »

You don't have to apologize for your questions.  I asked a lot of them.  Some of them were ignorant (not stupid but ignorant because I didn't know certain things).  That's how I learned--by asking a lot of questions and not caring if they were ignorant or even stupid.  :  )  But it's important to post your code so someone can examine it and see where it needs some improvement and to post your code errors that show up in either your SceneEdit log or your WME log so Mnemonic and others can help you.  If you don't know how to find your WME log or your SceneEdit log, please say something.  :  ) 

And if you want to use one object on another you have to code them for example use crow on bar to make crowbar.  You make item crow and item bar and then code both crow script and bar script as follows:

Code: WME Script
  1. #include "scripts\base.inc"
  2.  
  3. on "LeftClick"
  4. {
  5.     Game.SelectedItem = "crow";
  6. }
  7.  
  8. on "bar"
  9. {   Game.TakeItem("crowbar");
  10.     Game.DeleteItem("bar");     
  11.         Game.DeleteItem("crow");
  12. }
  13.  
  14. and on crow:
  15.  
  16. #include "scripts\base.inc"
  17.  
  18. on "LeftClick"
  19. {
  20.     Game.SelectedItem = "bar";
  21. }
  22.  
  23. on "crow"
  24. {   Game.TakeItem("crowbar");
  25.         Game.DeleteItem("crow");
  26.         Game.DeleteItem("bar")
  27.         }
  28.  

So each object can interact with the other and you get a new object--it's all there in the WME Book. 

But it's very important to remember that when you're coding an object and deleting it that you put all the script necessary to run BEFORE the deleteitem of the item you're talking about-- because once you delete the item you're talking about-- the script that follows will not kick in cause the item is gone--so get into the habit of deleting your items that you are talking about at the very end of your script.

« Last Edit: March 25, 2009, 03:20:59 PM by Catacomber »
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Ron_Emad2

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 32
    • View Profile
Re: 3 question in wme
« Reply #9 on: March 25, 2009, 06:13:19 AM »

oh, i very happy becuse i get best help from best friends in this forum
thanks :-*
Logged

Ron_Emad2

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 32
    • View Profile
Re: 3 question in wme
« Reply #10 on: March 30, 2009, 07:41:01 AM »

Hello dear friend
i come back with new question ::)
i build new scene and i want player get item and actor say "it is very good)
but actor dont get item
and item dont apper in inventory item
(when i test with sorce file of chapter 8 it work fine/but...
i sure script is ok becuse i cpy /past it ;D
i build item sprite from source file but it dont work
i copy item from source file but it dont work ::rock
...
Logged

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: 3 question in wme
« Reply #11 on: March 30, 2009, 03:27:11 PM »

What's your code?   :)

You made the item in items/items file?

Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Ron_Emad2

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 32
    • View Profile
Re: 3 question in wme
« Reply #12 on: March 31, 2009, 01:29:03 PM »

my code:
#include "scripts\base.inc"


////////////////////////////////////////////////////////////////////////////////
on "LeftClick"
{
   global mashin;
 
   if (mashin == null) mashin = 0;
 
   Game.Interactive = false;
   actor.GoTo(578,456);
   actor.TurnTo(DI_UP);
 
   if (mashin < 3) mashin = mashin + 1;
 
   switch(mashin)
   {
      case 1:
         actor.TakeItem("anbor");
            actor.Talk("ye done anbor,baresh midaream,be ghol moien:");
         actor.Talk("ti ye bazi adventure bayad har chi didi ro ba dari");
         
         break;
      case 2:
         actor.Talk("oh,ye sim,dash meghi,chera dahanet va monde");
         actor.Talk("amir jan nazare shoma chiye>?");
         actor.Talk("bikhiyal ,beza varesh daram badan sohbat mikonim,bazitoni bokonin");
         actor.TakeItem("sim");
         break;
      default:
         actor.Talk("doroste in ye teste,ama dige roto kam kon,chiz dige ye nist");
           break;         
   }
 
   Game.Interactive = true;
}
my item.item file:
ITEM
{
   CURSOR_COMBINED = TRUE
   CAPTION = "WME User's Guide"
   NAME = "book"
   IMAGE = "items\book.bmp"
   CURSOR = "items\book.bmp"
   CURSOR_HOVER = "items\book_h.bmp"
   SCRIPT = "items\book.script"
}

ITEM
{
    CURSOR_COMBINED = TRUE
    CAPTION = "anbor"
    NAME = "anbor"
    SPRITE = "items\anbor.sprite"
    CURSOR = "items\anbor.sprite"
    CURSOR_HOVER = "items\anbor.sprite"
    SCRIPT = "items\anbor.sprite"
}

ITEM
{
    CURSOR_COMBINED = TRUE
    CAPTION = "sim"
    NAME = "sim"
    SPRITE = "items\sim.sprite"
    CURSOR = "items\sim.sprite"
    CURSOR_HOVER = "items\sim.sprite"
    SCRIPT = "items\sim.script"
}

ITEM
{
    CURSOR_COMBINED = TRUE
    CAPTION = "sang"
    NAME = "sang"
    SPRITE = "items\sang.sprite"
    CURSOR = "items\sang.sprite"
    CURSOR_HOVER = "items\sang.sprite"
    SCRIPT = "items\sang.script"
}

ITEM
{
    CURSOR_COMBINED = TRUE
    CAPTION = "darbazkon"
    NAME = "darbazkon"
    SPRITE = "items\darbazkon.sprite"
    CURSOR = "items\darbazkon.sprite"
    CURSOR_HOVER = "items\darbazkon.sprite"
    SCRIPT = "items\darbazkon.script"
}
and i build all sprite and picture and...
Logged

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: 3 question in wme
« Reply #13 on: April 01, 2009, 03:49:43 AM »

All that is beyond me but in your game script do you have something like:

Game.InventoryObject = actor;

?

Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Ron_Emad2

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 32
    • View Profile
Re: 3 question in wme
« Reply #14 on: April 02, 2009, 02:21:01 PM »

hello again dear friends
i think i know cuse of my problem :
it is game.script in source file of chapter8(wme online book)
#include "scripts\base.inc"
#include "scripts\keys.inc"

// store some of the game's attributes in global variables for convenience
Keyboard = Game.Keyboard;
Scene = Game.Scene;

// load the "caption" window
var win = Game.LoadWindow("interface\system\caption.window");
global WinCaption = win.GetControl("caption");

// load our main actor
molly = Game.LoadActor("actors\molly\molly.actor");

actor = molly;

Game.MainObject = actor;
Game.InventoryObject = actor;

// run the "daemon" script
Game.AttachScript("scripts\game_daemon.script");

Game.InventoryVisible = true;

// which scene to load?
Game.ChangeScene("scenes\Room\Room.scene");


////////////////////////////////////////////////////////////////////////////////
on "LeftClick"
{
  var ActObj = Game.ActiveObject;
  if(ActObj!=null)
  {
    if(Game.SelectedItem != null && Game.SelectedItem!=ActObj)
    {
      var Item = Game.SelectedItem;
      if(ActObj.CanHandleEvent(Item.Name)) ActObj.ApplyEvent(Item.Name);
    }
    else
        ActObj.ApplyEvent("LeftClick");
  }
  else
  {
    Scene.ApplyEvent("LeftClick");
  }
}



on "RightClick"
{
  if (Game.SelectedItem != null){
    Game.SelectedItem = null;
  }
}





////////////////////////////////////////////////////////////////////////////////
on "Keypress"
{
  // on Esc or F1 key
  if(Keyboard.KeyCode==VK_ESCAPE || Keyboard.KeyCode==VK_F1)
  {
    // load and display the main menu window
    WinCaption.Visible = false;
    var WinMainMenu = Game.LoadWindow("interface\system\mainmenu.window");
    WinMainMenu.Center();
    WinMainMenu.GoSystemExclusive();
    Game.UnloadObject(WinMainMenu);
  }
}


////////////////////////////////////////////////////////////////////////////////
on "QuitGame"
{
  // on Alt+F4 (window close)
  // load and display the quit confirmation window
  WinCaption.Visible = false;
  var WinQuit = Game.LoadWindow("interface\system\quit.window");
  WinQuit.Center();
  WinQuit.GoSystemExclusive();

  // and if the user selected Yes
  if(WinQuit.xResult)
  {
    // quit the game
    Game.QuitGame();
  }
  // otherwise just unload the quit window from memory
  else Game.UnloadObject(WinQuit);
}

but it is game.script of mygame
#include "scripts\base.inc"
#include "scripts\keys.inc"

// store some of the game's attributes in global variables for convenience
Keyboard = Game.Keyboard;
Scene = Game.Scene;


// load the right-click menu
global WinMenu = Game.LoadWindow("interface\menu\menu.window");
WinMenu.Visible = false;

// load the "caption" window
var win = Game.LoadWindow("interface\system\caption.window");
global WinCaption = win.GetControl("caption");


global MenuObject = null;


// load our main actor
actor = Game.LoadActor("actors\molly\molly.actor");
Game.MainObject = actor;

// run the "game loop" script
Game.AttachScript("scripts\game_loop.script");


// which scene to load?
Game.ChangeScene(Game.StartupScene);



////////////////////////////////////////////////////////////////////////////////
on "LeftClick"
{
  // what did we click?
  var ActObj = Game.ActiveObject;
  if(ActObj!=null)
  {
    // clicking an inventory item
    if(ActObj.Type=="item" && Game.SelectedItem==null)
    {
      Game.SelectedItem = ActObj;
    }
    // using an inventory item on another object
    else if(Game.SelectedItem != null && Game.SelectedItem!=ActObj)
    {
      var Item = Game.SelectedItem;
      if(ActObj.CanHandleEvent(Item.Name)) ActObj.ApplyEvent(Item.Name);
      else if(Item.CanHandleEvent("default-use")) Item.ApplyEvent("default-use");
      else if(ActObj.CanHandleEvent("default-use")) ActObj.ApplyEvent("default-use");
      else actor.Talk("I can't use these things together.");
    }
    // just a simple click
    else ActObj.ApplyEvent("LeftClick");
  }
  // else propagate the LeftClick event to a scene
  else
  {
    Scene.ApplyEvent("LeftClick");
  }
}



////////////////////////////////////////////////////////////////////////////////
on "RightClick"
{
  // if inventory item selected? deselect it
  if (Game.SelectedItem != null){
    Game.SelectedItem = null;
    return;
  }

  var ActObj = Game.ActiveObject;

  // is the righ-click menu visible? hide it
  if(WinMenu.Visible == true) WinMenu.Visible = false;
  else if(ActObj!=null)
  {
    // if the clicked object can handle any of the "verbs", display the right-click menu
    if(ActObj.CanHandleEvent("Take") || ActObj.CanHandleEvent("Talk") || ActObj.CanHandleEvent("LookAt"))
    {
      // store the clicked object in a global variable MenuObject
      MenuObject = Game.ActiveObject;
      var Caption = WinMenu.GetControl("caption");
      Caption.Text = MenuObject.Caption;

      // adjust menu's position
      WinMenu.X = Game.MouseX - WinMenu.Width / 2;
      if(WinMenu.X < 0) WinMenu.X = 0;
      if(WinMenu.X+WinMenu.Width>Game.ScreenWidth) WinMenu.X = Game.ScreenWidth-WinMenu.Width;

      WinMenu.Y = Game.MouseY - WinMenu.Height / 2;
      if(WinMenu.Y<0) WinMenu.Y = 0;
      if(WinMenu.Y+WinMenu.Height>Game.ScreenHeight) WinMenu.Y = Game.ScreenHeight-WinMenu.Height;

      // and show the right-click menu
      WinMenu.Visible = true;

      // stop the actor from whatever he was going to do
      actor.Reset();
    }
    // no verbs supported, no menu is needed; just send the RightClick event to the object
    else ActObj.ApplyEvent("RightClick");
  }
}


////////////////////////////////////////////////////////////////////////////////
on "Keypress"
{
  // on Esc or F1 key
  if(Keyboard.KeyCode==VK_ESCAPE || Keyboard.KeyCode==VK_F1)
  {
    // load and display the main menu window
    WinCaption.Visible = false;
    var WinMainMenu = Game.LoadWindow("interface\system\mainmenu.window");
    WinMainMenu.Center();
    WinMainMenu.GoSystemExclusive();
    Game.UnloadObject(WinMainMenu);
  }
}


////////////////////////////////////////////////////////////////////////////////
on "QuitGame"
{
  // on Alt+F4 (window close)
  // load and display the quit confirmation window
  WinCaption.Visible = false;
  var WinQuit = Game.LoadWindow("interface\system\quit.window");
  WinQuit.Center();
  WinQuit.GoSystemExclusive();

  // and if the user selected Yes
  if(WinQuit.xResult)
  {
    // quit the game
    Game.QuitGame();
  }
  // otherwise just unload the quit window from memory
  else Game.UnloadObject(WinQuit);
}

please help me
with thanks
emad
Logged

Catacomber

  • Supporter
  • Frequent poster
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Female
  • Posts: 443
  • I love mice.
    • View Profile
    • Catacomber.com
Re: 3 question in wme
« Reply #15 on: April 02, 2009, 08:44:13 PM »

I don't see anything wrong there.  Are you getting error messages in WME log file?  Or in scene log file?  You should always check for error messages and post them in the forum. 
Logged
http://www.catacomber.com/
Code: WME Script
  1. Mnemonic is wonderful.
  2.  

Ron_Emad2

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 32
    • View Profile
Re: 3 question in wme
« Reply #16 on: April 03, 2009, 11:48:55 AM »

No,I dont get any error
but when i take item ,it dont show in inventory item
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: 3 question in wme
« Reply #17 on: April 03, 2009, 12:00:06 PM »

Does the TakeItem() line get called? Add some diagnostic messages like this:

Code: WME Script
  1. Game.Msg("Taking item");
  2. actor.TakeItem("anbor");
  3. Game.Msg("Taken: " + actor.HasItem("anbor"));
  4. Game.Msg("Whos inventory is displayed: " + Game.InventoryObject);
  5.  

What displays on screen when you do this?
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Ron_Emad2

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 32
    • View Profile
Re: 3 question in wme
« Reply #18 on: April 03, 2009, 12:37:05 PM »

i test it
it work fine but
item dont apper(show)in inventory item
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: 3 question in wme
« Reply #19 on: April 03, 2009, 12:41:09 PM »

So what output did you get? You should get something like:

Taking item
Taken: yes
Whos inventory is displayed: [actor]

If you still don't see the item, there's something wrong with your inventory box definition (i.e. the part of the user interface which displays inventory).
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Ron_Emad2

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 32
    • View Profile
Re: 3 question in wme
« Reply #20 on: April 03, 2009, 12:57:43 PM »

i see this massege
takin item
taken : yes
whos inventory displayed:[gameobject]
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: 3 question in wme
« Reply #21 on: April 03, 2009, 01:07:27 PM »

Ok, so either change it to Game.TakeItem() OR add the line

Game.InventoryObject = actor;

to your game.script (it is present in the code you posted above, I thought it was the code you were using...).
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Ron_Emad2

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 32
    • View Profile
Re: 3 question in wme
« Reply #22 on: April 03, 2009, 01:35:52 PM »

oh, when i add this code (Game.InventoryObject = actor;)to my game it take item and it apper(show)in inventory item
yhanks
oh another question: i must use this code(Game.InventoryObject = actor;)in all item?
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: 3 question in wme
« Reply #23 on: April 03, 2009, 01:43:24 PM »

No, you only need to add it once (preferrably to game.script).

In WME, each object (game, actors, entities...) can have their own items. That's why you can use both:

Game.TakeItem("something");
  and
actor.TakeItem("something");

The Game.InventoryObject property then specifies, who's items are displayed on screen.
It's intended for games with several playable characters, to allow you switching between them.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Ron_Emad2

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 32
    • View Profile
Re: 3 question in wme
« Reply #24 on: April 03, 2009, 01:58:22 PM »

Thanks about your help
i work becuse i want build a professional game
i will come back ;D
Logged

Ron_Emad2

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 32
    • View Profile
Re: 3 question in wme
« Reply #25 on: April 04, 2009, 08:51:34 AM »

i cobe back with new question
i want use item on other item but actor say : i cant use these thinge together
but i done all worjk
i test my work in sample project of wme and it work fine and items combine
but in my project it dont work
please help me
with thanks
emad  :'(
Logged
Pages: 1 2 [All]
 

Page created in 0.057 seconds with 24 queries.