Please login or register.

Login with username, password and session length
Advanced search  

News:

This forum provides RSS feed. To query recent posts use this url. More...


Author Topic: Character follow  (Read 4961 times)

0 Members and 1 Guest are viewing this topic.

mylesblasonato

  • Developer
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 265
  • "Give up is to fail as sacrifice is to succeed"
    • View Profile
    • Royal Wins
Character follow
« on: September 14, 2009, 09:40:21 AM »

Hi guys,
How can i make one character follow another and then when the main character is idle, the other character will do an idle animation.

Cheers  ::beer
Myles Blasonato.
Logged
Lead Game Designer, Royal Wins.
@mylesblasonato
@royalwins
http://au.linkedin.com/pub/myles-blasonato/26/600/a38

HelLRaiseR

  • I don't want to make a Monkey Island clone :(
  • Wiki editor
  • Frequent poster
  • ****
  • Karma: 4
  • Offline Offline
  • Posts: 270
    • View Profile
    • Adventure Box Studios
Re: Character follow
« Reply #1 on: September 14, 2009, 10:50:12 AM »

I'm afraid that I don't understand you (I think  :-\), becouse you don't need to do nothing. If you want that the secondary actor follow to the main actor, in the LeftClick event of the main actor you can put secondary_actor.GoTo( main_actor.X + offset, main_actor.Y + offset ); Offset is used for the secondary actor not ocuuped the space of the main actor. When the secondary actor goes to the main actor position + the offset, the walk animation stop and WME play the idle animation.

In my game, I used an special case, some secondary actor has specific idle animations, i.e.: sit in a chair, watering flowers, repairing a car, etc. When the main actor talk with these actor, I need an aditional idle animation, I've been made an "idle talk" animation, and in the conversation y use:

actor.Talk("Hi");
secondary_actor.PlayAnim("transition between work and talk"); // for example, turn around.
secondary_actor.Talk("Hi, how do you do");
secondary_actor.PlayAnimAsync("idle_talk"); // the secondary actor wait for the main actor response.
actor.Talk("Nothing special. Can I have a look?");
secondary_actor.Talk("Yes, you can"); // When the secondary actor talks again, WME plays the talk animation again.
secondary_actor.PlayAnimAsync("idle_talk"); // and wait again for the next main actor response.
actor.Talk("OK. Thanks");
secondary_actor.Talk("You're welcome");
secondary_actor.PlayAnim("transition between talk and work"); // the secondary return to make her task.
// When the animation finish, WME plays the idle animation.

This example code, only is necessary if the secondary actor makes a task in the idle animation and you want that he wait and not made a task, but if the idle animation of the actor is an "idle" animation, WME plays automatic when the previous animation (walk, in your case) finish.


Logged
Regards,

    Fernando

HelLRaiseR

  • I don't want to make a Monkey Island clone :(
  • Wiki editor
  • Frequent poster
  • ****
  • Karma: 4
  • Offline Offline
  • Posts: 270
    • View Profile
    • Adventure Box Studios
Re: Character follow
« Reply #2 on: September 16, 2009, 07:02:30 AM »

Another thing,

In the last example, the secondary actor goes to the main actor position, when the main actor stops the secondary actor continues walking to the main actor position.

If you want that when the main actor stop, the secondary actor stops too, you can define and event in a frame of the main actor idle animation, in this event you can check the animation that the secondary actor is playing, and if the animation isn't idle, then you can force to play idle animation.

ACTOR3DX
{
  NAME = "main_actor"
  CAPTION = "Main actor"
  ; Rest of actor definition   
  ;--- external data
  MODEL = "file.x"
  ; Rest of .x files

  ANIMATION
  {
    NAME="Idle"
    LOOPING=TRUE
    EVENT
    {
      FRAME = 1
      NAME = "MainActorIdle"
    }
  }
}

on "MainActorIdle"
{

   if (!secondary_actor.IsAnimPlaying("idle"))
   {
       secondary_actor.PlayAnimAsync("idle");
   }
}
« Last Edit: September 16, 2009, 07:11:44 AM by HelLRaiseR »
Logged
Regards,

    Fernando

mylesblasonato

  • Developer
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 265
  • "Give up is to fail as sacrifice is to succeed"
    • View Profile
    • Royal Wins
Re: Character follow
« Reply #3 on: September 21, 2009, 09:23:42 AM »

I thought that would be how to do it but when i tried it because i was adding the offset the character would move wierd when the offset had to be subtracted. If that makes sense. I'll give it another go using your technique.
Thanks again for the explaination.

Cheers  ::beer
Myles Blasonato.
Logged
Lead Game Designer, Royal Wins.
@mylesblasonato
@royalwins
http://au.linkedin.com/pub/myles-blasonato/26/600/a38

mylesblasonato

  • Developer
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 265
  • "Give up is to fail as sacrifice is to succeed"
    • View Profile
    • Royal Wins
Re: Character follow
« Reply #4 on: October 07, 2009, 02:05:37 AM »

Hi guys!
I got the character to follow properly but she doesn't use the same way points as the main character.
Why?

Cheers  ::beer
Myles Blasonato.
Logged
Lead Game Designer, Royal Wins.
@mylesblasonato
@royalwins
http://au.linkedin.com/pub/myles-blasonato/26/600/a38

Mnemonic

  • WME developer
  • Administrator
  • Addicted to WME forum
  • *
  • Karma: 41
  • Offline Offline
  • Gender: Male
  • Posts: 5683
    • View Profile
    • Dead:Code Site
Re: Character follow
« Reply #5 on: October 07, 2009, 03:34:28 PM »

She doesn't? What does she use then?
Logged
Yes, I do have a twitter account
Please don't send me technical questions in private messages, use the forum. ::wave

Jyujinkai

  • Global Moderator
  • Frequent poster
  • *
  • Karma: 1
  • Offline Offline
  • Posts: 352
    • View Profile
    • Jyujinkai's WME Development Blog
Re: Character follow
« Reply #6 on: October 08, 2009, 01:00:50 AM »

@mylesb

Add code to move the follower to the exact starting point of the player toon. Then when the goto command is run it should take the exact same path.. then just add a extra move at the end to offset it.... this will not work in all cases.. but will for most things. The 2 extra moment commands on the other actors will also give it a nice delay so they walk well behind the player.
Logged
<Antoine de Saint-Exupéry> In any thing at all, perfection is finally attained not when there is no longer anything to add, but when there is no longer anything to take away...
<Carl Sagan> If you want to make a apple pie from scratch. You must first... invent the universe

mylesblasonato

  • Developer
  • Frequent poster
  • ****
  • Karma: 0
  • Offline Offline
  • Gender: Male
  • Posts: 265
  • "Give up is to fail as sacrifice is to succeed"
    • View Profile
    • Royal Wins
Re: Character follow
« Reply #7 on: October 08, 2009, 04:24:56 AM »

Thanks for the response guys!
What i have done is just use the mouse.x and mouse.Y instead of the actors because it was causing problems where the follower wouldn't follow exactly and kinda be some other place :P

It works great now anyway because i use a proximity script that checks for the distance between the 2 characters and then stops the follower if she gets too close.

Cheers  ::beer
Myles Blasonato.
Logged
Lead Game Designer, Royal Wins.
@mylesblasonato
@royalwins
http://au.linkedin.com/pub/myles-blasonato/26/600/a38
 

Page created in 0.046 seconds with 21 queries.