Character Animation

Started by ScottDoom, Fri 02/07/2004 10:55:27

Previous topic - Next topic

ScottDoom

Ok. Here is my long and weird looking script:

if (character[GetPlayerCharacter()].inv[1] > 0) {Ã, 
Ã,  Ã, DisplaySpeech(JER, "GIVE MESSAGE");
Ã,  Ã, }
if (character[GetPlayerCharacter()].inv[1] > 0) {
Ã,  FollowCharacter(1, -1);
Ã,  }
if (character[GetPlayerCharacter()].inv[1] > 0) {
Ã,  SetCharacterView (FISH, 5);
Ã,  }
if (character[GetPlayerCharacter()].inv[1] > 0) {
Ã,  What goes here?
Ã,  }
if (character[GetPlayerCharacter()].inv[1] > 0) {
Ã,  ReleaseCharacterView(FISH);
Ã,  }
if (character[GetPlayerCharacter()].inv[1] == 0) {
Ã,  DisplaySpeech(JER, "NO GIVE MESSAGE");
Ã,  }
if (character[GetPlayerCharacter()].inv[1] > 0) {
Ã,  LoseInventory(1);
Ã,  }

I've been using the built-in functions to look up commands to write in my scripts, and for this one I looked up how to make a character play through an animation before doing anything else. It was right there, titled "Character - run animation loop." However, unlike the other functions, it didn't give a script example at the bottom so now I'm stuck.

Thanks for the help.

Ashen

Also, why have you used so many 'if (character[GetPlayerCharacter()].inv[1] > 0)' lines? Surely you could condense them down to one:

if (character[GetPlayerCharacter()].inv[1] > 0) {Ã, 
Ã,  DisplaySpeech(JER, "GIVE MESSAGE");
Ã,  FollowCharacter(1, -1);
Ã,  SetCharacterView (FISH, 5);
Ã,  AnimateCharacter (FISH, loop, delay, repeat);
Ã,  ReleaseCharacterView(FISH);
Ã,  LoseInventory(1);
}
else if (character[GetPlayerCharacter()].inv[1] == 0) {
Ã,  DisplaySpeech(JER, "NO GIVE MESSAGE");
}
I know what you're thinking ... Don't think that.

ScottDoom

#2
Thanks for the info. I wasn't sure if I could include multiple commands under one if statement. I'll test it out now.

The character "FISH" still isn't doing anything. He stops following character "JER" and just stands there. I want him to run through loop 0 of VIEW5 once, and then after that I want him to remain in the final frame of VIEW5...

if (character[GetPlayerCharacter()].inv[1] > 0) {Ã, 
Ã,  DisplaySpeech(JER, "GIVE ITEM MESSAGE");
Ã,  FollowCharacter(1, -1);
Ã,  SetCharacterView (FISH, 5);
Ã,  AnimateCharacter (FISH, 0, 5, 0);
Ã,  ReleaseCharacterView(FISH);
Ã,  LoseInventory(1);
}
else if (character[GetPlayerCharacter()].inv[1] == 0) {
Ã,  DisplaySpeech(JER, "NO ITEM TO GIVE MESSAGE");
}

Ashen

#3
I think the problem is that AnimateCharacter () is blocking, which means ReleaseCharacterView() is called before the animation happens. My bad.
Try:

AnimateCharacterEx (FISH, 0, 5, 0, 0, 1);

And yes, you can use multiple commands, provided you remember the braces  - { and }. For a single command, you'd only need:

if (character[GetPlayerCharacter()].inv[1] > 0) DisplaySpeech(JER, "GIVE ITEM MESSAGE");
I know what you're thinking ... Don't think that.

ScottDoom

#4
Ok. Once again, thanks for all the info. It works now.

I want him to remain in the last frame of the animation he just went through, but I'll try to figure that out on my own first...

Ok. I figured that part out. I just added another loop to VIEW5, with just the last frame of the animation in it. Then I told the character to animate in that loop, and remain in it.

SMF spam blocked by CleanTalk