Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: Dynamic Verb Choices  (Read 4822 times)

0 Members and 1 Guest are viewing this topic.

anarchist

  • Regular poster
  • ***
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 212
    • View Profile
Dynamic Verb Choices
« on: January 25, 2011, 08:53:43 AM »

We have started designing our adventure and we got stuck because we do not know if our idea is supported by Wintermute.

The idea is not really original. We will have right click to pop up available actions on a hotspot (item, NPC). What we want is for those actions (verbs) to be dynamic. For instance, when I click on a book, the available actions will be Look, Read, Pickup, whereas when I click on a chair next to it the available actions will be Look, Sit, Push.

Is this possible in Wintermute? If yes, how easy/difficult is it to implement it? We need this now because if it is possible it will greately affect our game design.

(EDIT: Think of Sherlock Holmes and the case of the Rose Tattoo if you haven't understood what we need)
« Last Edit: January 25, 2011, 08:59:56 AM by anarchist »
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Dynamic Verb Choices
« Reply #1 on: January 25, 2011, 09:19:14 AM »

There are certainly many ways to achieve this. But if I was to implement it, I'd leverage the event handler system.
A typical script of an interactive item in WME looks something like this:


Code: WME Script
  1. on "LookAt"
  2. {
  3.   // some code
  4. }
  5.  
  6. on "Talk"
  7. {
  8.   // some code
  9. }
  10.  
  11. on "Take"
  12. {
  13.   // some code
  14. }
  15.  

Now, you can check whether a specific item provides a handler using:

Code: WME Script
  1. if (someItem.CanHandleEvent("LookAt"))
  2. {
  3.   // some code
  4. }
  5.  

So your action menu can check which actions are supported by the clicked item and show/hide appropriate action buttons.
If you dig into the WME demo project, you'll see the action menu is already using this approach to some extent. It checks whether the item supports given action, and if not, it displays a generic response (such as "I can't take this." if there is no "Take" handler).
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

anarchist

  • Regular poster
  • ***
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 212
    • View Profile
Re: Dynamic Verb Choices
« Reply #2 on: January 25, 2011, 09:48:43 AM »

Thank you Mnemonic and let me first congratulate you for Wintermute. More thanks and congratulations will come when (and if) we complete our game  :)

To further my query, from what I understand, it is necessary to create your "Actions Window" beforehand. Therefore, you need to create a somehow static action selection. Do you mean that I can the dynamically add or remove actions from the Actions Window, whenever the user right clicks on the item/NPC (through script of course)?
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Dynamic Verb Choices
« Reply #3 on: January 25, 2011, 08:27:38 PM »

Yup, you can dynamically add buttons to a window (or hide/show/reconfigure existing ones if you prefer).
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

anarchist

  • Regular poster
  • ***
  • Karma: 5
  • Offline Offline
  • Gender: Male
  • Posts: 212
    • View Profile
Re: Dynamic Verb Choices
« Reply #4 on: January 30, 2011, 05:12:41 PM »

I have achieve this by creating a static menu with 4 buttons and dynamically changing the image of each button. It is necessary to place the action of each button in global variables. I think it is a quite efficient way to do this. Anyone have any better suggestions?
Logged
 

Page created in 0.045 seconds with 21 queries.