Help with animated NPC

Started by Loeky, Fri 15/08/2003 16:27:46

Previous topic - Next topic

Loeky

Hello,

I have a little throuble with a NPC.
In the scene i want to make you are hiding in a room. A NPC walks through the room. When the NPC stops he has to do a little animation and than NPC leaves the room again.

The only problem I have is while the NPC is animating, you as player can not do something (for example pick something up). You have to wait untill the animation has finished. I want to do something when the animation of the NPC is still running.

Is something like that possible and if so how.

Thanks.

Timosity

#1
It's possible to do, it just requires a bit of scripting.


In the repeatedly execute of the room try something like this:

 // script for room: Repeatedly execute

if (GetGlobalInt(10)==1){     // this is just the int to start things off
SetCharacterView(NPC,10);  // the view you want to set
AnimateCharacter(NPC,0,5,0); // your animation with your details
SetGlobalInt(10,2); // takes you to the next stage
}


if (GetGlobalInt(10)==2){
if (character[NPC].animating == 0) {
AnimateCharacter(NPC,1,5,0);
SetGlobalInt(10,3); // for next stage
}
}

if (GetGlobalInt(10)==3){
if (character[NPC].animating == 0) {
*************etc etc

Just put all the animations in like that, and you will still have complete control of your character while the animation is running.

The key is:
if (character[NPC].animating == 0) {

instead of:
while (character[NPC].animating) Wait(1);

as the Wait command blocks anything else from happening.

Note: (use "SetGlobalInt(10,1);" somewhere else before you enter the room

Note2: You can also use

if (character[NPC].walking == 0) {

after a command like:
MoveCharacterDirect(NPC,277, 139);

just substitue it for the relevant places as in the above script

Hope this helps, if you have any questions just ask

~Tim

Loeky


SMF spam blocked by CleanTalk