I want to run an object's animation after the player interacts with a NPC. First, I have the NPC walk to another part of the room, afterwards, I want the object to animate. The problem is, the global script doesn't recognize my object. What I did then is made my code in the global just for the NPC, then in the room I wrote a code for the object to run it's animation under certain conditions. But I don't know what function to place it under. I've tried Room Load after FadeIn and Repeatedly Execute, but to no avail.
Here's my global script code:
Code: ags
And my Room code:
Code: ags
After the NPC walks to his location, nothing happens unless I leave the room and then come back again. Only then does the second code run.
Would the easiest thing be to simply make my object a character and handle it all in the global script? What am I doing wrong?
Here's my global script code:
function cButt_Interact()
{
cPup.Walk(479, 218, eBlock);
cButt.Walk(500, 127);
cButt.AddWaypoint(557, 303);
cButt.AddWaypoint(441, 385);
cButt.AddWaypoint(37, 353);
cButt.Clickable = false;
}
And my Room code:
function room_AfterFadeIn()
{
if ((cButt.Clickable == false)&&(cButt.Moving == false)) {
oFrogEatFly.SetView(16);
oFrogEatFly.Animate(0, 0, eOnce, eBlock);
cButt.ChangeRoom(2, 583, 450);
oFrogEatFly.SetView(17);
oFrogEatFly.Animate(0, 0, eOnce, eBlock);
}
}
After the NPC walks to his location, nothing happens unless I leave the room and then come back again. Only then does the second code run.
Would the easiest thing be to simply make my object a character and handle it all in the global script? What am I doing wrong?