Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: Mikael on May 19, 2007, 03:14:24 AM

Title: Flashlight script issue
Post by: Mikael on May 19, 2007, 03:14:24 AM
I have this peculiar problem when using the (magnificent) flashlight script by Mnemonic. The player is supposed to light up a room by holding a bicycle lamp. The lamp is in the inventory, and is dragged to a large hotspot in an almost black screen. The flashlight script is activated and up comes the light beam. So far no problems. Then something happens which I didn't anticipate. Since the lamp item was used to bring up the scene where the script is used, the icon for the lamp stays in the middle of the light beam (until the player right clicks, off course). The scene contains an item that can be picked up, and has a hand icon attached to it. Assuming that the player doesn't think of right clicking to get rid of the lamp icon, the hand icon is never revealed.

Is there any way to make the lamp icon go away (to be "released") as soon as it is used in the scene?

Making a transparent icon for the lamp doesn't help, since that doesn't reveal the hand icon either.

If there isn't any workaround for this, I will try a different approach, like letting the game itself activate the lamp as soon as it is held, so the player doesn't have to drag it. However, I'm not really pleased with that compromise, so I thought I'd turn here for advice first.

Thanks in advance!

Mikael
Title: Re: Flashlight script issue
Post by: Mnemonic on May 19, 2007, 09:10:53 AM
Is there any way to make the lamp icon go away (to be "released") as soon as it is used in the scene?
Sure, you can deactivate any selected inventory item by setting Game.SelectedItem = null;
So your lamp code would look like this:

Code: [Select]
on "lamp"
{
  // light the flashlight
  // ...

  Game.SelectedItem = null;
}
Title: Re: Flashlight script issue
Post by: Mikael on May 19, 2007, 10:18:24 AM
I'm stupid. But the scene looks fine now, and that's what matters.

Thanks!

Mikael