Wintermute Engine > Technical forum

"ActorEntry" equivalent for entities/secondary actors

(1/1)

ylegrand:
Good last afternoon of 2017 :)

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


--- Code: ---on "ActorEntry"{
actor.WalkAnimName ="ladder";
}
on "ActorLeave"{
actor.WalkAnimName ="walk";
}
--- End code ---

It works perfectly for my main actor.

Nevertheless, I also load another actor in my Scene :


--- Code: ---var guy = Scene.LoadActor("actors\Guy\Guy.actor");
--- End code ---

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

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


--- Code: ---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";
}
}
--- End code ---

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

Indra Anagram:

--- Quote from: 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

--- End quote ---

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.

Navigation

[0] Message Index

Go to full version