Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: Kraaca on August 20, 2009, 11:39:16 PM

Title: Active/Inactive entity
Post by: Kraaca 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
Title: Re: Active/Inactive entity
Post by: HelLRaiseR 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");
   }
}
Title: Re: Active/Inactive entity
Post by: Kraaca on August 21, 2009, 08:53:17 AM
Thanks a lot!! It works!