Wintermute Engine Forum

Wintermute Engine => Technical forum => Topic started by: ylegrand on December 31, 2017, 03:05:02 PM

Title: "ActorEntry" equivalent for entities/secondary actors
Post by: ylegrand 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
Title: Re: "ActorEntry" equivalent for entities/secondary actors
Post by: ylegrand 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 !
Title: Re: "ActorEntry" equivalent for entities/secondary actors
Post by: Indra Anagram 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.