Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: Adventure-Macher on January 18, 2011, 08:41:56 PM

Title: entering area, then new layer
Post by: Adventure-Macher on January 18, 2011, 08:41:56 PM
Hi,

I have an area, with a region. So there is a closed wall, with a door. I will make it, that the character go automaticaly through the door, and in this situation, the wall will flip out and the player can see somethink of inside this entered room. So I have another layer, putting on closed-walllayer. The main-background shows the complete open room.

Can I handle this with a script? When entering the area from the door to the inside of the room, then the script will run. And when going out of the room, the script will stop.

Will this be done by:

EntityName
    The name of the new entity

??
Title: Re: entering area, then new layer
Post by: Mnemonic on January 18, 2011, 09:14:23 PM
Regions provide two events, ActorEntry and ActorLeave. So you are able to detect actor entering an area in the scene and call some script code.
Attach the following script to the region:

Code: WME Script
  1. on "ActorEntry"
  2. {
  3.   Game.Msg("actor entered the area");
  4.   // do something
  5. }
  6.  
  7. on "ActorLeave"
  8. {
  9.   Game.Msg("actor left the area");
  10.   // do something else
  11. }
  12.  
Title: Re: entering area, then new layer
Post by: Adventure-Macher on January 18, 2011, 09:32:43 PM
Hi,

thanks. So I can put a new layer when "ActorEntry"? And what should I do, then "ActorLeave"?
Title: Re: entering area, then new layer
Post by: Mnemonic on January 18, 2011, 09:43:31 PM
I think it would be easier to prepare the layer in SceneEdit and only show/hide it in the script. However, nothing is stopping you from dynamically creating the layer (Scene.AddLayer()) and destroying it (Scene.DeleteLayer()).