Please login or register.

Login with username, password and session length
Advanced search  

News:

For WME related articles and tutorials visit WME Resource Center.

Author Topic: Active/Inactive entity  (Read 1539 times)

0 Members and 1 Guest are viewing this topic.

Kraaca

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 26
    • View Profile
    • Game design
Active/Inactive entity
« on: August 20, 2009, 11:39:16 PM »

Hi all! I read similar posts, but I still cant solve this problem: I have in scene entity which change the scene. I want to change the state of this entity after the main actor will have the permision from other actor to go to another scene. I want use global variable (global enterChurch;) in dialogue with actor and to region entity to change state to active.

#include "scripts\base.inc"

global enterChurch;

this.Active = false;
if(enterChurch) this.Active = true;
/////////////////////////////////////////////////////////////////////////
on "LeftClick"
{

   
  actor.GoToObject(this);
  Game.ChangeScene("scenes\Scene7\Scene7.scene");
}

In this script is still entity inactive after use of the global entity enterChurch in dialogue.

Please, do you have some advice? Do I have bad code?
Sorry for my English. Thx

HelLRaiseR

  • I don't want to make a Monkey Island clone :(
  • Wiki editor
  • Frequent poster
  • ****
  • Karma: 4
  • Offline Offline
  • Posts: 270
    • View Profile
    • Adventure Box Studios
Re: Active/Inactive entity
« Reply #1 on: August 21, 2009, 01:20:21 AM »

I think that the error is in next code:

Code: [Select]
global enterChurch;

this.Active = false;
if(enterChurch) this.Active = true;

I'm afraid that this code will be executed only one time, when the entity is created.

You can put this code, for example, in the dialog with the other actor, when the main actor talk with the other actor and get the permision you can do this:

Code: [Select]
if the actor has permission to entry
{
   enterChurch = true;
   actor.Talk("Thanks for the permission");
}
else
{
   enterChurch = false;
   actor.Talk("Oh!  Darm!");
}

And in the entity script:

Code: [Select]
on "LeftClick"
{
   if(enterChurch)
   {
      actor.Talk("OK. Let's go!");
      actor.GoToObject(this);
      Game.ChangeScene("scenes\Scene7\Scene7.scene");
   }
   else
   {
      actor.Talk("Sorry! I don't have permission to enter in this scene");
   }
}
Logged
Regards,

    Fernando

Kraaca

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Posts: 26
    • View Profile
    • Game design
Re: Active/Inactive entity
« Reply #2 on: August 21, 2009, 08:53:17 AM »

Thanks a lot!! It works!
 

Page created in 0.125 seconds with 24 queries.