Please login or register.

Login with username, password and session length
Advanced search  

News:

Latest WME version: WME 1.9.1 (January 1st, 2010) - download

Author Topic: "ActorEntry" event on Region object  (Read 3389 times)

0 Members and 1 Guest are viewing this topic.

Ennio

  • Lurker
  • *
  • Karma: 2
  • Offline Offline
  • Posts: 40
    • View Profile
"ActorEntry" event on Region object
« on: January 15, 2012, 08:31:05 PM »

I have a strange bug with a trigger region.
This region is activated when an event occured in game, and has a script attached that is executed when the actor entry this region (actorentry event).

I've set the SaveState attribute of this region to true, so when i return the scene, my region is regularly activated, and it's ok...but wherever my actor enters the scene he activates the trigger and the actorEntry event is executed...how is that possibile?
I can't find a solution...
Logged

Azrael

  • Regular poster
  • ***
  • Karma: 9
  • Offline Offline
  • Gender: Male
  • Posts: 155
    • View Profile
    • Mad Orange
Re: "ActorEntry" event on Region object
« Reply #1 on: January 16, 2012, 09:04:46 AM »

There is another actor in the scene that is inside this region?
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: "ActorEntry" event on Region object
« Reply #2 on: January 16, 2012, 04:49:58 PM »

How does your scene_init.script for that scene look like?
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Jose

  • Regular poster
  • ***
  • Karma: 2
  • Offline Offline
  • Posts: 134
    • View Profile
Re: "ActorEntry" event on Region object
« Reply #3 on: January 16, 2012, 07:02:05 PM »

Hi Ennio,

maybe I don't understand you right but if I do it, I think there isn't any bug in the behavior of the ActorEntry event of the region. Whenever the region is active and the actor entries in that region, the WME engine is going to raise the ActorEntry event for that region and, as far as you have code in the handler of the ActorEntry event for that region, that code will be executed. If you want that code executed only the first time the actor entries the region then you can add a boolean custom property to that region. Let's assume you call that property isFirstTime and you've set its initial value to 'true', then in the code for the ActorEntry event handler you have to ask if isFirstTime is true. If so, then execute the rest of the code and set isFirstTime to false, this way your code will be executed only one time. This will be similar to this code:

Code: WME Script
  1. on "ActorEntry"
  2. {
  3.     if(this.isFirstTime)
  4.     {
  5.          The code you want to execute...
  6.          this.isFirstTime = false;
  7.     }
  8. }
  9.  

Hope this helps.
« Last Edit: January 16, 2012, 07:37:12 PM by Jose »
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: "ActorEntry" event on Region object
« Reply #4 on: January 16, 2012, 08:11:26 PM »

I am asking specifically because there is default code which might for a short time place actor to that region. :)
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Ennio

  • Lurker
  • *
  • Karma: 2
  • Offline Offline
  • Posts: 40
    • View Profile
Re: "ActorEntry" event on Region object
« Reply #5 on: January 17, 2012, 12:53:12 PM »

Ok! thank you for your reply wich were very helpful!

I don't want a region that triggers event only one time, so the problem, according to metamorphium's advise, is that i have a sprite entity that skips to this region in my init scritpt.
So ActorEntry event is activated not only by the actor itself! I did not know  :-[

Will be easy to fix the code now :)
Thank you again!
Logged

Jose

  • Regular poster
  • ***
  • Karma: 2
  • Offline Offline
  • Posts: 134
    • View Profile
Re: "ActorEntry" event on Region object
« Reply #6 on: January 17, 2012, 11:51:51 PM »

Opssss! Shame on me, I confused 'wherever' with 'whenever'  :-[ Me and my fu***ng English  :'(
Logged

Ennio

  • Lurker
  • *
  • Karma: 2
  • Offline Offline
  • Posts: 40
    • View Profile
Re: "ActorEntry" event on Region object
« Reply #7 on: January 18, 2012, 09:34:07 AM »

ahhaha don't worry! finally the international language won't be the english, but the chinese, and then the problem will become serious!  :P  :P  :P
Logged

metamorphium

  • Global Moderator
  • Addicted to WME forum
  • *
  • Karma: 12
  • Offline Offline
  • Gender: Male
  • Posts: 1511
  • Vampires!
    • View Profile
    • CBE  software s.r.o.
Re: "ActorEntry" event on Region object
« Reply #8 on: January 18, 2012, 01:33:58 PM »

你好, glad it worked :)
Logged
J.U.L.I.A. Enhanced Edition, Vampires!, J.U.L.I.A., J.U.L.I.A. Untold, Ghost in the Sheet

Ennio

  • Lurker
  • *
  • Karma: 2
  • Offline Offline
  • Posts: 40
    • View Profile
Re: "ActorEntry" event on Region object
« Reply #9 on: January 18, 2012, 08:57:52 PM »

...and metamorphium will be in advantage :P
Logged
 

Page created in 0.03 seconds with 24 queries.