play sound when following NPC reaches room

Started by gregp, Mon 21/02/2005 07:45:23

Previous topic - Next topic

gregp

I have a thing in my game that you can call teleport an NPC into the room you are, and am using FollowCharacter.  (the NPC is stored in another room)

now,  everything as far as animating the teleporting view of the character when he appears on the screen is working, but as it takes him a few loops for him to appear, the sound that I've associated with it plays too early...

I can't just use NewRoomNPC, because you are supposed to be able to call him to any room you are currently in; so I use FollowCharacter.

the question is: how do I play the sound once he reaches the room and begins the animation loop?

Code: ags

FollowCharacterEx(4,1,15,90);
  PlaySound(30);
    AnimateCharacterEx(4,0,4,0,1,1);
  ReleaseCharacterView(4);




Radiant

Well, you know how many frames pass before he appears (that's the game.follow_delay variable). So set a timer when you enter the room, to that same amount of frames, and when it expires run PlaySound.

Proskrito

i think you could use NewRoomNPC(charid, character[GetPlayerCharacter()].room,x,y) : )

gregp

#3
wow, thanks, both of you
whichever  solution I choose, I'm positive the other will come in handy.

-greg

EDIT:
okay to update... turns out I can't use the timer idea...because I need to be able to call the character at anytime, not just after i enter a new room, but like I said useful stuff to me.

and then  I needed to modify the second option , but it works, now!

NewRoomNPC(4, character[1].room,character[1].x+20,character[1].y);

this was neccessary because, again, the character can be called any time any room, so I don't know what coordinates to use...so I went with the player character's coords plus 20 on the X.
Hopefully I don't run into problems if the character is standing at the far right of the screen...I probably will, i dunno.

thanks for the help, again. 
everyone is so helpful  towards one another here, it's almost sickening!

thanks, and I'll be back
greg

SMF spam blocked by CleanTalk