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: Inventory / Items / Sounds  (Read 2585 times)

0 Members and 1 Guest are viewing this topic.

Veritas

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 4
    • View Profile
Inventory / Items / Sounds
« on: December 14, 2009, 05:58:26 PM »

Hey Guys,
i am still new to wintermute and have a bunch of questions and at least one kind of problem.

When my actor grabs an item a sound should be played. So i put this into the attached scriptfile and it works nice, sound is played by grabbing.

Now I want a sound to be played if the actor takes the already grabbed item out of the inventory again to the cursor. And a Sound for making it drop back to the inventory.

Where and how do I solve this? I already had a view in the game.script and the items.items but I have not yet something sensefull in mind.
Does anyone?
Logged

Veritas

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 4
    • View Profile
Re: Inventory / Items / Sounds
« Reply #1 on: December 14, 2009, 07:13:26 PM »

ok i now found a solution, but it does not work for the "right-click"

Code: [Select]
on "RightClick"
{
  // if inventory item selected? deselect it
  var ActObj = Game.ActiveObject;
  if (Game.SelectedItem != null){


Game.SelectedItem = ActObj;
LOG(ActObj.Name); // here it just prints "sc:null" instead of the name of the object which i do put out ( which is "chain")
if (ActObj.Name == "chain")
LOG("put back"); // placeholder for drop it back to inventory sound

Game.SelectedItem = null;
    return;
  }
}
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Inventory / Items / Sounds
« Reply #2 on: December 14, 2009, 07:50:22 PM »

Game.ActiveObject is the object that's under mouse pointer. You don't need it in the right-click handler at all. If you want the name of the selected item, get it like this:

Code: WME Script
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave
 

Page created in 0.05 seconds with 25 queries.