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: Dialog and item help  (Read 3970 times)

0 Members and 1 Guest are viewing this topic.

Phantasmagoria

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 3
    • View Profile
Dialog and item help
« on: May 19, 2008, 06:24:23 PM »

Hi Hi

just signed up, BTW love WME.

I tried and tried to get this to work but I have no idea how. This is what should happen;

the player enters the scene and automatically starts talking to an NPC.
After the dialog ends the player can either leave the scene or talk to the NPC again.
If the player talks to the NPC and selects a special line of the dialog string then the character changes and the
player can not leave the scene until picking up an item that previously the player could only look at.

I can get the player to talk to the NPC automatically and change the way he looks with special line of dialog,
but as for the item and stopping the player from leaving the scene until after picking up the item I'm lost.

If anyone can help or has a bit of code it would be greatly appreciated.
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Dialog and item help
« Reply #1 on: May 20, 2008, 09:58:47 AM »

The exit from your scene is probably some region entity. All you need to do is to activate/deactivate this entity based on player's action. Something like this:

Code: WME Script
  1. var Exit = Scene.GetNode("exit_entity"); // the name of your exit entity here
  2. Exit.Active = true; // or false, to activate or deactivate
  3.  

As for where exactly to execute this code depends on how exactly your script works.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Phantasmagoria

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 3
    • View Profile
Re: Dialog and item help
« Reply #2 on: May 20, 2008, 12:59:28 PM »

Thank you Mnemonic, that worked a treat ;D

I added it to my dialog and the door stops working. Here is a shortened bit of my code;

Code: [Select]
// fill the response box
    Game.AddResponse(0, Responses[0]);
    Game.AddResponse(1, Responses[1]);
    Game.AddResponse(1, Responses[2]);

    // let the player choose one
    Selected = Game.GetResponse();

    // let the actor say the selected sentence
    actor.Talk(Responses[Selected]);

    // now let the Old Guy reply depending on the selected sentence
    if(Selected==0)
    {
      this.Talk("Some text.");
      this.Talk("Something else.");
      actor.Talk("*ahem*");
    }
    else if(Selected==1)
    {
          this.Talk("Some other text");
          actor.Talk("*ahem*.");
  Game.UnloadObject(actor);
  actor = Game.LoadActor("actors\Sarg2\Sarg2.actor");
  Game.MainObject = actor;
  var Exit = Scene.GetNode("DoorToF2"); // the name of your exit entity here
          Exit.Active = false; // or true, to activate or deactivate
    }
    else if(Selected==2) Loop = false;
  }
}


Am I right in thinking that this bit of code is also used to make the item active and to turn the door back
on after getting it?


BTW, Sorry about posting in the wrong forum  :)
Logged

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Dialog and item help
« Reply #3 on: May 20, 2008, 01:41:14 PM »

Am I right in thinking that this bit of code is also used to make the item active and to turn the door back
on after getting it?
Yes. Generally speaking, you can use GetNode() method to query any part of the scene and change it's properties. Not just its activity, but for example its name, graphics, font, etc.


BTW, Sorry about posting in the wrong forum  :)
No problem.
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Phantasmagoria

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 3
    • View Profile
Re: Dialog and item help
« Reply #4 on: May 20, 2008, 03:16:10 PM »

Quote
Yes. Generally speaking, you can use GetNode() method to query any part of the scene and change it's properties. Not just its activity, but for example its name, graphics, font, etc

Wow. That's really cool thanks. It's works so good :D



 ::beer to you Mnemonic, thanks for making WME.
Logged
 

Page created in 0.071 seconds with 21 queries.