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" equivalent for entities/secondary actors  (Read 7115 times)

0 Members and 1 Guest are viewing this topic.

ylegrand

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 13
  • Keep trying
    • View Profile
"ActorEntry" equivalent for entities/secondary actors
« on: December 31, 2017, 03:05:02 PM »

Good last afternoon of 2017 :)

In my 2D scene, I have different ladders regions, on which I have atteched the following script :

Code: [Select]
on "ActorEntry"{
actor.WalkAnimName ="ladder";
}
on "ActorLeave"{
actor.WalkAnimName ="walk";
}

It works perfectly for my main actor.

Nevertheless, I also load another actor in my Scene :

Code: [Select]
var guy = Scene.LoadActor("actors\Guy\Guy.actor");
It seems that the ActorEnter/ActorLeave low level events only work for the main actor (the interactive one): nothing is triggered when the loaded actor walk through the ladders.

Is there a way to make him also able to interract with the region's script ?



I wish an happy new year to the whole community  ;D
« Last Edit: December 31, 2017, 03:11:39 PM by ylegrand »
Logged

ylegrand

  • Lurker
  • *
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 13
  • Keep trying
    • View Profile
Re: "ActorEntry" equivalent for entities/secondary actors
« Reply #1 on: December 31, 2017, 03:23:44 PM »

Quick update : I managed to have a correct behaviour, but only because I have only 2 actors :

Code: [Select]
on "ActorEntry"{
if (Scene.GetRegionAt(actor.X, actor.Y) == this){
actor.WalkAnimName ="ladder";
}else{
var guy= Scene.GetFreeNode("guy");
guy.WalkAnimName ="ladder";
}
}
on "ActorLeave"{
if (Scene.GetRegionAt(actor.X, actor.Y) == this){
actor.WalkAnimName ="walk";
}else{
var guy= Scene.GetFreeNode("guy");
guy.WalkAnimName ="walk";
}
}

I'm still looking for a smarter way to do it.
Thanks a lot !
Logged

Indra Anagram

  • Occasional poster
  • **
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 74
  • Periodical returnee
    • View Profile
Re: "ActorEntry" equivalent for entities/secondary actors
« Reply #2 on: January 15, 2018, 03:25:04 AM »

Quick update : I managed to have a correct behaviour, but only because I have only 2 actors

Hey ylegrand!

I am pretty green to WME and know nothing about programming, but when I tried to load and set in motion several actors in my scene the problem was in 'Game.MainObject = actor;' line.

Maybe this will help you. Please tell me if that was the point.
Logged
Owls are not what they seem...
 

Page created in 0.021 seconds with 20 queries.