|
Une dernière version plus optimisée, plus synchronisée et plus esthétique, je trouve. Enfin, moi, elle me convient telle quelle. Si un jour, je trouvais le temps, peut-être me pencherais-je sur les déplacements, mais ça m'a l'air quasi impossible à faire car les "SetFacing" se font instantanément malgré les "ActionDoCommand" contrairement à ce qu'on pourrait supposer (du moins, c'est ce que j'ai constaté pour ma part).
Il subsiste un tout petit problème... La charmante danseuse PNJ perd la tête à la fin de la danse. Elle continue à la tourner sans cesse... rien n'y fait. Si quelqu'un a une idée moins barbare que la mienne qui consiste à lui reparler pour la calmer... (Dans ce cas, prévoir un autre dialogue se déclenchant après la danse).
Voici la version finale de la "Barbarian Az-Dance"
//:://///////////////////////////////////////////// //:: FileName az_danse //::////////////////////////////////////////////// //::////////////////////////////////////////////// //:: Created By: Azmathiel //:: Created On: 02/09/2003 16:46:18 //:: rev. 2 & final //:: Created On: 02/09/2003 23:52:18 //::////////////////////////////////////////////// void main() { // Danse a deux // Pb: le PC va bouger plus vite que le NPC dans des danses tournantes // a cause de la vitesse angulaire. // coder un pseudo menuet est plus simple que de coder une valse // .............................................................. // On va coder une danse pas classique du tout alors. Juste pour voir
object oPC = GetPCSpeaker(); object oNPC = OBJECT_SELF; object oArea = GetArea(oPC);
int iSaluer = ANIMATION_FIREFORGET_SALUTE; int iCourber = ANIMATION_FIREFORGET_BOW; int iTourneTG = ANIMATION_FIREFORGET_HEAD_TURN_LEFT; int iTourneTD = ANIMATION_FIREFORGET_HEAD_TURN_RIGHT; int iLeverBras1 = ANIMATION_LOOPING_CONJURE1; int iLeverBras2 = ANIMATION_LOOPING_CONJURE2; int iPencher = ANIMATION_LOOPING_GET_MID; int iJerk = ANIMATION_FIREFORGET_DODGE_DUCK; int i2Bras =ANIMATION_FIREFORGET_VICTORY1; int iBrasD = ANIMATION_FIREFORGET_VICTORY2; int iBras2 = ANIMATION_FIREFORGET_VICTORY3;
int iMusic = TRACK_BATTLE_ARIBETH;
int iPas; int iMaxDuree = 2; // regler ici le nombre de boucles a faire faire aux danseurs
float fSpeedN = 1.0; float fSpeedF = 2.0; float fSpeedS = 0.5;
SetLocalInt(oPC, "danse", TRUE);
int iOldMusicD = MusicBackgroundGetDayTrack(oArea); int iOldMusicN = MusicBackgroundGetNightTrack(oArea);
MusicBackgroundStop(oArea); MusicBackgroundChangeDay(oArea, iMusic); MusicBackgroundChangeNight(oArea, iMusic); MusicBackgroundSetDelay(oArea, 0); MusicBackgroundPlay(oArea);
ActionDoCommand(AssignCommand(oPC, SetFacing(GetFacing(oNPC)+180.0)));
ActionDoCommand(AssignCommand(oNPC, ActionPlayAnimation(iCourber, fSpeedS, 0.0))); ActionDoCommand(AssignCommand(oPC, ActionPlayAnimation(iCourber, fSpeedS, 0.0)));
ActionDoCommand(AssignCommand(oNPC, ActionWait( 1.0))); ActionDoCommand(AssignCommand(oPC,ActionMoveToLocation(GetLocation(oNPC), FALSE)));
while (GetLocalInt(oPC, "danse") == TRUE) { iPas++; ActionDoCommand(AssignCommand(oNPC, ActionPlayAnimation(iSaluer, fSpeedS, 0.0))); ActionDoCommand(AssignCommand(oPC, ActionPlayAnimation(iSaluer, fSpeedS, 0.0)));
ActionDoCommand(AssignCommand(oNPC, ActionWait( 1.0))); ActionDoCommand(AssignCommand(oPC, ActionWait( 1.0)));
// A faire plus tard avec un recalcul de positions deportees // de l'un par rapport a l'autre //ActionDoCommand(AssignCommand(oNPC,ActionMoveToLocation(GetLocation(oPC), FALSE))); //ActionDoCommand(AssignCommand(oPC,ActionMoveToLocation(GetLocation(oNPC), FALSE)));
ActionDoCommand(AssignCommand(oNPC, ActionPlayAnimation(iLeverBras1, fSpeedN, 3.0))); ActionDoCommand(AssignCommand(oPC, ActionPlayAnimation(iLeverBras1, fSpeedN, 3.0)));
ActionDoCommand(AssignCommand(oNPC, ActionPlayAnimation(iLeverBras2, fSpeedN, 3.0))); ActionDoCommand(AssignCommand(oPC, ActionPlayAnimation(iLeverBras2, fSpeedN, 3.0)));
ActionDoCommand(AssignCommand(oNPC, ActionPlayAnimation(iLeverBras1, fSpeedN, 3.0))); ActionDoCommand(AssignCommand(oPC, ActionPlayAnimation(iLeverBras1, fSpeedN, 3.0)));
ActionDoCommand(AssignCommand(oNPC, ActionPlayAnimation(iTourneTD, fSpeedN, 1.0))); ActionDoCommand(AssignCommand(oPC, ActionPlayAnimation(iTourneTD, fSpeedN, 1.0)));
ActionDoCommand(AssignCommand(oNPC, ActionWait( 1.0))); ActionDoCommand(AssignCommand(oPC, ActionWait( 1.0)));
ActionDoCommand(AssignCommand(oNPC, ActionPlayAnimation(iTourneTG, fSpeedN, 1.0))); ActionDoCommand(AssignCommand(oPC, ActionPlayAnimation(iTourneTG, fSpeedN, 1.0)));
ActionDoCommand(AssignCommand(oNPC, ActionWait( 1.0))); ActionDoCommand(AssignCommand(oPC, ActionWait( 1.0)));
ActionDoCommand(AssignCommand(oNPC, ActionPlayAnimation(iLeverBras1, fSpeedN, 3.0))); ActionDoCommand(AssignCommand(oPC, ActionPlayAnimation(iLeverBras1, fSpeedN, 3.0)));
ActionDoCommand(AssignCommand(oNPC, ActionPlayAnimation(i2Bras, fSpeedN, 3.0))); ActionDoCommand(AssignCommand(oPC, ActionPlayAnimation(i2Bras, fSpeedN, 3.0)));
ActionDoCommand(AssignCommand(oNPC, ActionPlayAnimation(iLeverBras1, fSpeedN, 3.0))); ActionDoCommand(AssignCommand(oPC, ActionPlayAnimation(iLeverBras1, fSpeedN, 3.0)));
ActionDoCommand(AssignCommand(oNPC, ActionPlayAnimation(iBrasD, fSpeedN, 3.0))); ActionDoCommand(AssignCommand(oPC, ActionPlayAnimation(iBrasD, fSpeedN, 3.0)));
if (iPas > iMaxDuree) SetLocalInt(oPC, "danse", FALSE); } ActionDoCommand(AssignCommand(oNPC, ActionPlayAnimation(iSaluer, fSpeedS, 0.0))); ActionDoCommand(AssignCommand(oPC, ActionPlayAnimation(iSaluer, fSpeedS, 0.0)));
ActionDoCommand(AssignCommand(oNPC, ActionPlayAnimation(iCourber, fSpeedS, 0.0))); ActionDoCommand(AssignCommand(oPC, ActionPlayAnimation(iCourber, fSpeedS, 0.0))); // ATTENTION, si on remet la musique en l'etat ici, on ne remarquera meme pas qu'elle a change // A faire ailleurs donc.
} // END MAIN
|