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: ActorEntry for MainObject actor only.  (Read 4122 times)

0 Members and 1 Guest are viewing this topic.

redfox

  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 122
    • View Profile
ActorEntry for MainObject actor only.
« on: September 05, 2014, 01:04:55 AM »

I am trying to use ActorEntry when my main actor enters a floor region to trigger code. This works with no issue but it is also triggered by All actors rather than just my main actor, as defined in my game script -

Code: [Select]
actor = Game.LoadActor3D("my3dactor.act3d");
Game.MainObject = actor;

How might I add code to check if it is my main actor triggering a regions ActorEntry script, and ignore non player 3D actors.
Logged

redfox

  • Regular poster
  • ***
  • Karma: 1
  • Offline Offline
  • Posts: 122
    • View Profile
Re: ActorEntry for MainObject actor only.
« Reply #1 on: September 05, 2014, 01:07:45 AM »

I found this in an old post - so I might have found a solution  :)

Code: [Select]
on "ActorEntry"
{
  if (Scene.GetRegionAt(actor1.X, actor1.Y) == this) Game.Msg("actor 1 is in region");
}
Logged

keybone

  • Regular poster
  • ***
  • Karma: 0
  • Offline Offline
  • Posts: 112
    • View Profile
    • Lucine
Re: ActorEntry for MainObject actor only.
« Reply #2 on: September 19, 2014, 01:21:38 PM »

or y can done a global variable with name of actor

example:
In game.script add:

Code: WME Script
  1. global NameActor;
  2. NameActor=Character1;

IF/When you chage actor change the variable NameActor


Code: WME Script
  1. on "ActorEntry"
  2.  {
  3.      if (NameActor==Character1)
  4.     {
  5.      if (Scene.GetRegionAt(actor1.X, actor1.Y) == this) Game.Msg("actor 1 is in region");
  6.      }
  7.  }

Logged
Lucine Company http://www.lucine.it/
Tales of Lucine: The Realm of Hobdark http://www.lucine.it/TalesOfLucine
 

Page created in 0.039 seconds with 21 queries.