Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.

Messages - anarchist

Pages: 1 ... 10 11 [12] 13 14 15
166
Technical forum / Re: Inventory item highlight
« on: March 25, 2011, 04:25:56 PM »
Thanks Mnemonic. I have already achieved this using MouseEntry and MouseLeave events. We are building our game having in mind that we do not want those annoying "I cannot do that" or "You cannot use these things together" words from the game, which our team has learned to despise in even many great adventure games. The "different hover image" I have mentioned is to show to the players that using the item is not possible, in order to prevent them from doing the good old "try all items with all hotspots", which in my opinion reduces some of the atmosphere and realism of the game.

If anyone is interested in such approach check out the code below:

Code: WME Script
  1. on "MouseEntry"
  2. {
  3.         var item = Game.SelectedItem;
  4.         if(item != null && !this.CanHandleEvent(item.Name)){
  5.                 var defaultSprite = item.GetSprite();
  6.                 item.SetHoverCursor(defaultSprite + "_d.bmp");
  7.         }
  8. }
  9.  
  10. on "MouseLeave"
  11. {
  12.         var item = Game.SelectedItem;
  13.         if(item != null){
  14.                 var defaultSprite = item.GetSprite();
  15.                 item.SetHoverCursor(defaultSprite + "_h.bmp");
  16.         }
  17. }
  18.  

You need to have an extra icon for the item which is the "cannot make action" item. I named it the same as the normal icon with extra extension _d, similar to _h for the hover icon. It is simple but the only drawback is that you have to add this code to every actor and hotspot in the game.

167
Technical forum / Re: Inventory item highlight
« on: March 14, 2011, 07:39:07 PM »
Not solved.

Come on guys more than 100 people saw this. Noone knows?

168
Technical forum / Re: Menu problem again!
« on: March 09, 2011, 04:55:47 PM »
Where have you placed this piece of code? It seems to me that it should work. Try to place it inside the menu window's script.

169
Technical forum / Re: Inventory item highlight
« on: March 09, 2011, 04:54:04 PM »
Thanks Mihulik for your response but unfortunately I don't understand what you are trying to say  ::slug Could you please be a bit more thorough?

One solution is to set for every entity the MouseEnter event and change the cursor there. But this would be too much work and I am bound to miss something. I need something more dynamic like:

Code: WME Script
  1. if(!entity.CanHandleEvent(item.Name)){
  2.   //set mouse cursor to custom
  3. }
  4.  

Of course that could cause problems when the user moves the cursor away from the entity, where the cursor should be set back to the CURSOR image, as defined in items.items.

An important question is whether this is a built in function or if there is editable code for this. If there is indeed editable code that handles the cursor for inventory items, tweaking that code would easily solve my problem.

170
Technical forum / Inventory item highlight
« on: March 08, 2011, 11:21:16 PM »
When clicking on an inventory item, the item is selected using

Code: WME Script
  1. Game.SelectedItem = ActObj;
  2.  

Then, when the cursor moves around and hovers over entities and actors, we see the CURSOR_HOVER icon, defined in the items.items file.

What I am trying to do is for some particular entities/actors to show a different hover image. I could not find the code in any script that is responsible for this behaviour so I assume it is built in.

Is there a way around it?

171
Technical forum / Re: Disabling inventory
« on: March 05, 2011, 01:45:45 PM »
I think you mean the script file named game_loop.script which is by default placed in the scripts folder.

172
Technical forum / Re: Help me with my menu
« on: March 03, 2011, 09:34:09 PM »
Look inside your main menu script for the on "Keypress" event. You should see something like this:

Code: WME Script
  1. on "Keypress"
  2. {
  3.   // on Esc key
  4.   if(Keyboard.KeyCode==VK_ESCAPE)
  5.    {
  6.  

There you can define what happens when the player presses the escape key (VK_ESCAPE)

173
Technical forum / Re: Help me with my menu
« on: March 03, 2011, 06:12:25 PM »
For this type of menu, instead of:

Code: WME Script
  1. mainMenu.GoExclusive();

try

Code: WME Script
  1. mainMenu.GoSystemExclusive();

174
Technical forum / Re: Custom actor variables
« on: March 02, 2011, 12:24:20 PM »
Thank you it is quite clear now.

175
Technical forum / Re: Custom actor variables
« on: March 01, 2011, 03:36:34 PM »
What about includes? In the WME Book, in chapter 2.5 it says:

Quote
Important:
Never initialize your variables in the include files. They will get reinitialized with every inclusion of your script.

So if I have a script.inc file which contains:

Code: WME Script
  1. var variable = 10;
  2.  

and include this script in two scripts attached to 2 entities in a scene. Does this mean that the code will be executed twice, one for each include, each time the scene is loaded?

176
Technical forum / Re: Custom actor variables
« on: February 27, 2011, 04:07:29 PM »
Thanks a lot guys for your quick answers.

So, if I define them in the actor's script like this:

Code: WME Script
  1. this.AnyVariable = "test";
  2.  

will the variable be reset every time I call Game.LoadActor()? I am a bit confused as to what parts of scripts are executed when. In the WME documentation (help and metamorphium's book) it is said that whenever you include a script, the variables that are set as

Code: WME Script
  1. var variable = value

inside that script (outside functions and event handlers) are reset to value with each include. So, if I have such code in lets say base.inc it will not work. If I have it inside game.script or game_loop.script, will they be reset every time the game is run, even if the user loads a saved game?

Thanks again.

177
Technical forum / Custom actor variables
« on: February 26, 2011, 07:08:16 PM »
I have my actors and want to set some custom variables, which I can access using actor_name.customVariable. Those variables will be set in the beginning of each chapter.

First question is how to set such variables? If I set them in the actor_name.script should they be global or simple var? Second question is when to initialize them? I know if I initialize them for instance in the actor_name.script, they will be reset every time I Game.LoadActor3d() to load the actor. Is this true?

178
Scripts, plugins, utilities, goodies / Re: Sierra right click interface
« on: February 23, 2011, 12:30:04 AM »
Excellent example thanks Rocco

179
Technical forum / Re: Catching mouse left click while executing script
« on: February 17, 2011, 08:50:28 PM »
The following piece of code was causing the problem.

Code: WME Script
  1. if(ActObj != null){
  2.     ActObj.ApplyEvent("LeftClick");
  3. }
  4.  

When clicking on the window (not one of the buttons, static etc.) the ActObj was the window itself. So it called its leftclick event handler and it got stuck in an infinite loop.

180
Community bulletin board / Re: WME BOOK is online
« on: February 17, 2011, 03:30:08 PM »
Excellent work metamorphium! I have advertised your book to other fellow wintermute noobs and use it regularly until I learn the engine. Please continue this excellent work. I am really looking forward to the Going 2.5D chapter. If you require any sort of help (the best I can give is greek translation and english proof reading) just pm me.

Pages: 1 ... 10 11 [12] 13 14 15

Page created in 0.076 seconds with 20 queries.