Author Topic: Gigaschatten and a npc custom animation question  (Read 373 times)

Legacy_Hushmoons

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
Gigaschatten and a npc custom animation question
« on: March 17, 2013, 04:23:07 am »


                 Couple questions on things 
1. How do I get the Torturers/Slaves to fire there ai
2. this isnt related to gigaschatten but how would i get a group of 6 npcs to fire custom animations based on there tags and to fire them to each other this is what i have so far
it is for nwm animations ia hak trying to get it too operate with gs_a_enter script

#include "int_anim_incl"
  void main(){
  object oPC = GetPCSpeaker();
  
  


  int nAnimation = ANIMATION_LOOPING_CUSTOM4; 
 object oNPC1 = GetNearestObjectByTag("NPC1");  
 object oNPC2 = GetNearestObjectByTag("NPC2"); 
 IntAnim_SetupAndRunAnimation(oNPC1, oNPC2, nAnimation);
  int nAnimation2 = ANIMATION_LOOPING_CUSTOM6;
  object oNPC3 = GetNearestObjectByTag("NPC3");
  object oNPC4 = GetNearestObjectByTag("NPC4");
  IntAnim_SetupAndRunAnimation(oNPC3, oNPC4, nAnimation2);
  int nAnimation3 = ANIMATION_LOOPING_CUSTOM5;
  object oNPC5 = GetNearestObjectByTag("NPC5");
  object oNPC6 = GetNearestObjectByTag("NPC6");
  IntAnim_SetupAndRunAnimation(oNPC5, oNPC6, nAnimation3);
( just a snippet of my code )
I can get it to work fairly well from a convo but would rather it worked on area enter or perhaps perception of pc be nice to have them do diff random animations besides the same one over and over 

any other links to gigaschatten i missed ?
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Gigaschatten and a npc custom animation question
« Reply #1 on: March 17, 2013, 02:04:56 pm »


               Please include the include. When they begin the beguine...(I doubt if anyone gets that reference).
Something like:

  #include "int_anim_incl"
  void main()
  {
  object oPC = GetLastPerceived();
  if (!GetIsPC(oPC))
  return;
  object oNPC1 = GetNearestObjectByTag("NPC1");
  object oNPC2 = GetNearestObjectByTag("NPC2");

    switch( d4())
  {
    case 1: nAnimation = ActionPlayAnimation(ANIMATION_LOOPING_CUSTOM4); break;
    case 2: nAnimation = ActionPlayAnimation(ANIMATION_LOOPING_CUSTOM5); break;
    case 3: nAnimation = ActionPlayAnimation(ANIMATION_LOOPING_CUSTOM6); break;
    case 4: nAnimation = ActionPlayAnimation(ANIMATION_LOOPING_CUSTOM7); break;
  }
  IntAnim_SetupAndRunAnimation(oNPC1, oNPC2,nAnimation);
}
               
               

               


                     Modifié par ffbj, 17 mars 2013 - 02:53 .
                     
                  


            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Gigaschatten and a npc custom animation question
« Reply #2 on: March 17, 2013, 02:29:42 pm »


               http://www.bing.com/...tail&FORM=VIRE4
               
               

               
            

Legacy_Hushmoons

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
Gigaschatten and a npc custom animation question
« Reply #3 on: March 17, 2013, 11:16:26 pm »


               //:://////////////////////////////////////////////
//:: Name int_anim_incl
//:: Copyright © 2001 Bioware Corp.
//:://////////////////////////////////////////////
/*
    Include file for Intimate Animation scripts

    Includes unique functions and subroutines
    called by Intimate Animation scripts
*/
//:://////////////////////////////////////////////
//:: Created By: NightMood
//:: Created On: 6/15/2008
//:://////////////////////////////////////////////
#include "int_anim_setting"
#include "int_anim_distanc"

// *** Used for debugging ***
void Test_ReportDistance(object oCreature1, object oCreature2, string sMessage)
{
 if(GetIsPC(oCreature1))
   SendMessageToPC(oCreature1,
     sMessage + " Distance = " + FloatToString(GetDistanceBetween(oCreature1, oCreature2)));
 if(GetIsPC(oCreature2))
   SendMessageToPC(oCreature2,
     sMessage + " Distance = " + FloatToString(GetDistanceBetween(oCreature1, oCreature2)));
}


// Adds fFacingChange degrees to fInputFacing then outputs the new facing value,
// adjusted if necessary to ensure the new facing value is between 0 and 360
// degrees (0 = East).  fInputFacing must be between 0.0 and 360.0, and
// fFacingChange must be between -360.0 and 360.0, otherwise a value of 0 (East)
// is automatically returned.
float IntAnim_AdjustFacing(float fInputFacing, float fFacingChange)
{
 if (fInputFacing < 0.0 || fInputFacing > 360.0
     || fFacingChange < -360.0 || fFacingChange > 360.0) return 0.0;
 float fFacing = fInputFacing + fFacingChange;
 if (fFacing >= 360.0) fFacing = fFacing - 360.0;
 else if (fFacing < 0.0) fFacing = fFacing + 360.0;
 return fFacing;
}


// Initiates a Fade-To-Black for PC oCreature, then a Fade-From-Black after
// fDelay
void IntAnim_FadeAndResume(object oCreature, float fDelay)
{
 float fSpeed;
 if (fDelay < 2.0) fSpeed = FADE_SPEED_FAST;
 else fSpeed = FADE_SPEED_MEDIUM;
 FadeToBlack(oCreature, fSpeed);
 DelayCommand(fDelay, FadeFromBlack(oCreature, fSpeed));
}


// Returns true if oCreature has effect eEffect.  Returns FALSE if not.
int IntAnim_GetHasEffect(object oCreature, effect eEffect)
{
 effect eNextEffect = GetFirstEffect(oCreature);
 while (GetIsEffectValid(eNextEffect))
 {
   if (eNextEffect == eEffect) return TRUE;
   eNextEffect = GetNextEffect(oCreature);
 }
 return FALSE;
}


// Gender check for intimate animations
// Returns TRUE if male-female combination, FALSE if not
//
// (Called by module OnItemActivated script when Love Wand is used)
int IntAnim_CheckCompatible(object oCreature1, object oCreature2)
{
 int nGender1 = GetGender(oCreature1);
 int nGender2 = GetGender(oCreature2);
 return ((nGender1 == GENDER_FEMALE && nGender2 == GENDER_MALE)
          || (nGender1 == GENDER_MALE && nGender2 == GENDER_FEMALE));
}


// Race compatibility check for intimate animations
// Returns TRUE if allowed, FALSE if not
//
// (Called by module OnItemActivated script when Love Wand is used)
int IntAnim_CheckAllowed(object oCreature1, object oCreature2)
{
 int nRace1 = GetRacialType(oCreature1);
 int nRace2 = GetRacialType(oCreature2);

 switch(nRace1)
 {
   case RACIAL_TYPE_HUMAN:
   case RACIAL_TYPE_HALFELF:
   switch(nRace2)
   {
     case RACIAL_TYPE_HUMAN:
     case RACIAL_TYPE_HALFELF:
     {
       return bHumanHuman;
     }
     case RACIAL_TYPE_ELF:      return bHumanElf;
     case RACIAL_TYPE_HALFORC:  return bHumanHalforc;
     case RACIAL_TYPE_DWARF:    return bHumanDwarf;
     case RACIAL_TYPE_HALFLING: return bHumanHalfling;
     case RACIAL_TYPE_GNOME:    return bHumanGnome;
   }
   case RACIAL_TYPE_ELF:
   switch(nRace2)
   {
     case RACIAL_TYPE_HUMAN:
     case RACIAL_TYPE_HALFELF:
     {
       return bHumanElf;
     }
     case RACIAL_TYPE_ELF:      return bElfElf;
     case RACIAL_TYPE_HALFORC:  return bElfHalforc;
     case RACIAL_TYPE_DWARF:    return bElfDwarf;
     case RACIAL_TYPE_HALFLING: return bElfHalfling;
     case RACIAL_TYPE_GNOME:    return bElfGnome;
   }
   case RACIAL_TYPE_HALFORC:
   switch(nRace2)
   {
     case RACIAL_TYPE_HUMAN:
     case RACIAL_TYPE_HALFELF:
     {
       return bHumanHalforc;
     }
     case RACIAL_TYPE_ELF:      return bElfHalforc;
     case RACIAL_TYPE_HALFORC:  return bHalforcHalforc;
     case RACIAL_TYPE_DWARF:    return bHalforcDwarf;
     case RACIAL_TYPE_HALFLING: return bHalforcHalfling;
     case RACIAL_TYPE_GNOME:    return bHalforcGnome;
   }
   case RACIAL_TYPE_DWARF:
   switch(nRace2)
   {
     case RACIAL_TYPE_HUMAN:
     case RACIAL_TYPE_HALFELF:
     {
       return bHumanDwarf;
     }
     case RACIAL_TYPE_ELF:      return bElfDwarf;
     case RACIAL_TYPE_HALFORC:  return bHalforcDwarf;
     case RACIAL_TYPE_DWARF:    return bDwarfDwarf;
     case RACIAL_TYPE_HALFLING: return bDwarfHalfling;
     case RACIAL_TYPE_GNOME:    return bDwarfGnome;
   }
   case RACIAL_TYPE_HALFLING:
   switch(nRace2)
   {
     case RACIAL_TYPE_HUMAN:
     case RACIAL_TYPE_HALFELF:
     {
       return bHumanHalfling;
     }
     case RACIAL_TYPE_ELF:      return bElfHalfling;
     case RACIAL_TYPE_HALFORC:  return bHalforcHalfling;
     case RACIAL_TYPE_DWARF:    return bDwarfHalfling;
     case RACIAL_TYPE_HALFLING: return bHalflingHalfling;
     case RACIAL_TYPE_GNOME:    return bHalflingGnome;
   }
   case RACIAL_TYPE_GNOME:
   switch(nRace2)
   {
     case RACIAL_TYPE_HUMAN:
     case RACIAL_TYPE_HALFELF:
     {
       return bHumanGnome;
     }
     case RACIAL_TYPE_ELF:      return bElfGnome;
     case RACIAL_TYPE_HALFORC:  return bHalforcGnome;
     case RACIAL_TYPE_DWARF:    return bDwarfGnome;
     case RACIAL_TYPE_HALFLING: return bHalflingGnome;
     case RACIAL_TYPE_GNOME:    return bGnomeGnome;
   }
 }
 return FALSE; // Default if no match found (one or both not standard playable race)
}


// Height compatibility check for standing and kneeling animations
// Returns TRUE if compatible, FALSE if not
//
// (Called by int_anim_cond_ht conditional script for Love Wand dialog)
int IntAnim_CheckHeightCompatible(object oCreature1, object oCreature2)
{
 int nRace1 = GetRacialType(oCreature1);
 int nRace2 = GetRacialType(oCreature2);

 switch(nRace1)
 {
   case RACIAL_TYPE_HUMAN:
   case RACIAL_TYPE_HALFELF:
   case RACIAL_TYPE_HALFORC:
   case RACIAL_TYPE_ELF:
   {
     switch(nRace2)
     {
       case RACIAL_TYPE_HUMAN:
       case RACIAL_TYPE_HALFELF:
       case RACIAL_TYPE_HALFORC:
       case RACIAL_TYPE_ELF:
       {
         return TRUE;
       }
     }
     return FALSE;
   }
   case RACIAL_TYPE_DWARF:
   case RACIAL_TYPE_HALFLING:
   case RACIAL_TYPE_GNOME:
   {
     switch(nRace2)
     {
       case RACIAL_TYPE_DWARF:
       case RACIAL_TYPE_HALFLING:
       case RACIAL_TYPE_GNOME:
       {
         return TRUE;
       }
     }
     return FALSE;
   }
 }
 return FALSE; // Default if no match found (one or both not standard playable race)
}


// Applies EffectCutsceneGhost to oCreature1 and oCreature2 if not already
// applied
void IntAnim_ApplyEffectCutsceneGhost(object oCreature1, object oCreature2)
{
 effect eGhost = EffectCutsceneGhost();
 if (!IntAnim_GetHasEffect(oCreature1, eGhost))
   ApplyEffectToObject(DURATION_TYPE_PERMANENT, eGhost, oCreature1);
 if (!IntAnim_GetHasEffect(oCreature2, eGhost))
   ApplyEffectToObject(DURATION_TYPE_PERMANENT, eGhost, oCreature2);
}


// Resets phenotypes to normal and removes EffectCutsceneGhost from oCreature1
// and oCreature2
//
// (Called by IntAnim_StopAnimation)
void IntAnim_ResetPhenoTypes(object oCreature1, object oCreature2)
{
 effect eGhost = EffectCutsceneGhost();
 RemoveEffect(oCreature1, eGhost);
 RemoveEffect(oCreature2, eGhost);
 if (GetPhenoType(oCreature1) == 9) SetPhenoType(PHENOTYPE_NORMAL, oCreature1);
 if (GetPhenoType(oCreature2) == 9) SetPhenoType(PHENOTYPE_NORMAL, oCreature2);
}


// Returns location for partner of oCreature at distance fDistance and direction
// fDirection from the position of oCreature.  Orientation (facing direction) of
// the partner location will be fFacing
//
// (Called by IntAnim_Approach)
location IntAnim_GetPartnerLocation(object oCreature, float fDistance, float fDirection, float fFacing)
{
 vector vCreatureToPartner = fDistance * VectorNormalize(AngleToVector(fDirection));
 vector vPartnerPosition = GetPosition(oCreature) + vCreatureToPartner;
 return Location(GetArea(oCreature), vPartnerPosition, fFacing);
}


// Stops any currently playing animation.  Also resets phenotype of oCreature1
// ando Creature2 to PHENOTYPE_NORMAL if input nResetPhenoTypes is set to TRUE.
//
// (Called by IntAnim_StartLoveWandDialog and action script associated with
// "Stop for now" option of Love Wand dialog)
void IntAnim_StopAnimation(object oCreature1, object oCreature2, int nResetPhenoTypes = FALSE, int bKeepCreature2Faded = FALSE)
{
 SetCommandable(TRUE, oCreature1);
 SetCommandable(TRUE, oCreature2);
 AssignCommand(oCreature1, ClearAllActions(TRUE));
 AssignCommand(oCreature2, ClearAllActions(TRUE));

 // Fade to black to hide transition from intimate animation to standing
 // then fade from black once complete.
 if (GetIsPC(oCreature1)) IntAnim_FadeAndResume(oCreature1, 2.0);
 if (GetIsPC(oCreature2))
 {
   if (bKeepCreature2Faded == FALSE) IntAnim_FadeAndResume(oCreature2, 2.0);
   else
   {
     FadeToBlack(oCreature2, FADE_SPEED_FASTEST);
     DelayCommand(1.0, BlackScreen(oCreature2));
   }
 }
 DelayCommand(1.0,
   AssignCommand(oCreature1, ActionPlayAnimation(ANIMATION_LOOPING_PAUSE, 1.0, 0.1)));
 DelayCommand(1.0,
   AssignCommand(oCreature2, ActionPlayAnimation(ANIMATION_LOOPING_PAUSE, 1.0, 0.1)));
 if (nResetPhenoTypes == TRUE)
 {
   DeleteLocalInt(oCreature1, "Int_Anim_Last_Animation");
   DeleteLocalInt(oCreature2, "Int_Anim_Last_Animation");
   DelayCommand(1.2, IntAnim_ResetPhenoTypes(oCreature1, oCreature2));
 }
}


// Plays selected intimate animation.
//
// (Called by IntAnim_SetFacings once distance and facing directions are set)
void IntAnim_PlayAnimation(object oCreature1, object oCreature2, int nAnimation)
{
 // Used for testing animation distances.  Uncomment the following line to
 // display the distance between Love Wand user and the selected partner when
 // the animation is played.
 // Test_ReportDistance(oCreature1, oCreature2, "IntAnim_PlayAnimation");

 SetLocalInt(oCreature1, "Int_Anim_Last_Animation", nAnimation);
 SetLocalInt(oCreature2, "Int_Anim_Last_Animation", nAnimation);
 AssignCommand(oCreature1, ClearAllActions(TRUE));
 AssignCommand(oCreature2, ClearAllActions(TRUE));
 AssignCommand(oCreature1, ActionPlayAnimation(nAnimation, 1.0, CONST_IA_DEFAULT_DURATION));
 AssignCommand(oCreature2, ActionPlayAnimation(nAnimation, 1.0, CONST_IA_DEFAULT_DURATION));
 float fDelay = 1.0;
 if (nAnimation == ANIMATION_LOOPING_CUSTOM4) fDelay = 4.0; // Longer unfade delay for set up time
 if (GetIsPC(oCreature1)) DelayCommand(fDelay, FadeFromBlack(oCreature1));
 if (GetIsPC(oCreature2)) DelayCommand(fDelay, FadeFromBlack(oCreature2));
//  SetCommandable(FALSE, oCreature1);
//  SetCommandable(FALSE, oCreature2);
}


// Sets oCreature1 and oCreature2 to face each other.
//
// (Called by IntAnim_Approach)
void IntAnim_SetFacings(object oCreature1, object oCreature2)
{
 vector vPosition1 = GetPosition(oCreature1);
 vector vPosition2 = GetPosition(oCreature2);
 AssignCommand(oCreature1, SetFacingPoint(vPosition2));
 AssignCommand(oCreature2, SetFacingPoint(vPosition1));
}


// Applies EffectCutsceneGhost to oCreature1 and oCreature2 to allow close
// proximity, moves oCreature1 to the correct distance from oCreature2 for
// the selected animation, then calls IntAnim_PlayAnimation to play the
// animation.
//
// Normally displays FadeToBlack to any involved PCs to hide the movements, but
// input bFadeAtStart can be set to FALSE if already in a FadeToBlack condition
// when IntAnim_Approach is called.  This will prevent a player character from
// seeing a fade-unfade-fade.  (IntAnim_SetupAndRunAnimation uses this
// option when it must take extra time to change creature phenotypes)
//
// (Called by IntAnim_SetupAndRunAnimation)
void IntAnim_Approach(object oCreature1, object oCreature2, int nAnimation, int bFadeAtStart = TRUE)
{
 // Get correct distance for race/gender/animation combination
 float fApproachDist = IntAnim_GetDistance(oCreature1, oCreature2, nAnimation);

 // Used for testing animation distances.  Uncomment the following two lines to
 // display the commanded distance to set between Love Wand user and the
 // selected partner before the animation is played.
 // if(GetIsPC(oCreature1)) SendMessageToPC(oCreature1, "Commanded distance = " + FloatToString(fApproachDist));
 // if(GetIsPC(oCreature2)) SendMessageToPC(oCreature2, "Commanded distance = " + FloatToString(fApproachDist));

 // If race/gender/animation combination not allowed/compatible, do not play
 if (fApproachDist < 0.0)
 {
   if (GetIsPC(oCreature1))
   {
     SendMessageToPC(oCreature1, "Your height difference with your partner makes that position too difficult.");
     FadeFromBlack(oCreature1);
   }
   if (GetIsPC(oCreature2)) FadeFromBlack(oCreature2);
   return;
 }

 // Clear current creature actions and apply EffectCutsceneGhost to both if
 // not already applied
 AssignCommand(oCreature1, ClearAllActions(TRUE));
 AssignCommand(oCreature2, ClearAllActions(TRUE));
 IntAnim_ApplyEffectCutsceneGhost(oCreature1, oCreature2);

 // Set oCreature1 and oCreature2 to face one another, apply FadeToBlack to
 // any PCs, jump oCreature1 to oCreature2's location, then have oCreature1
 // back away to the correct distance.  Once complete, call IntAnim_SetFacings
 // to ensure facing directions are correct and initiate animation
 IntAnim_SetFacings(oCreature1, oCreature2);
 if (GetIsPC(oCreature1) && bFadeAtStart == TRUE)
   DelayCommand(0.5, FadeToBlack(oCreature1));
 if (GetIsPC(oCreature2) && bFadeAtStart == TRUE)
   DelayCommand(0.5, FadeToBlack(oCreature2));
 DelayCommand(2.0, AssignCommand(oCreature1,
   ActionJumpToLocation(IntAnim_GetPartnerLocation(oCreature2, fApproachDist,
                        GetFacing(oCreature2),
                        IntAnim_AdjustFacing(GetFacing(oCreature2), 180.0)))));
 DelayCommand(3.0, IntAnim_PlayAnimation(oCreature1, oCreature2, nAnimation));
}


// Confirms that oCreature1 and oCreature2 are a mixed-gender pair, changes
// their phenotypes to 9, if required, then calls IntAnim_Approach to initiate
// the selected animation.  Displays FadeToBlack to any PCs involved if either
// phenotype must be changed.
//
// (Called by one of the Love Wand dialog action scripts for the five intimate
// animations)
void IntAnim_SetupAndRunAnimation(object oCreature1, object oCreature2, int nAnimation)
{
 if (!IntAnim_CheckCompatible(oCreature1, oCreature2)) return;
 SetCommandable(TRUE, oCreature1);
 SetCommandable(TRUE, oCreature2);

 // Only perform animation if oCreature1 and oCreature2 are PHENOTYPE_NORMAL
 // or already PhenoType 9
 if (GetPhenoType(oCreature1) == 9)
 {
   if (GetPhenoType(oCreature2) == 9)
   {
     IntAnim_Approach(oCreature1, oCreature2, nAnimation);
   }
   else if (GetPhenoType(oCreature2) == PHENOTYPE_NORMAL)
   {
     SetPhenoType(9, oCreature2);
     if (GetIsPC(oCreature1)) FadeToBlack(oCreature1, FADE_SPEED_FASTEST);
     if (GetIsPC(oCreature2)) FadeToBlack(oCreature2, FADE_SPEED_FASTEST);
     DelayCommand(5.0, IntAnim_Approach(oCreature1, oCreature2, nAnimation, FALSE));
   }
 }
 else if (GetPhenoType(oCreature1) == PHENOTYPE_NORMAL)
 {
   SetPhenoType(9, oCreature1);
   if (GetPhenoType(oCreature2) == PHENOTYPE_NORMAL) SetPhenoType(9, oCreature2);
   if (GetIsPC(oCreature1)) FadeToBlack(oCreature1, FADE_SPEED_FASTEST);
   if (GetIsPC(oCreature2)) FadeToBlack(oCreature2, FADE_SPEED_FASTEST);
   DelayCommand(5.0, IntAnim_Approach(oCreature1, oCreature2, nAnimation, FALSE));
 }
}


// Causes oCreature1 and oCreature2 to lie down next to each other.
// nAnimation1 and nAnimation2 should be ANIMATION_LOOPING_DEAD_BACK or
// ANIMATION_LOOPING_DEAD_FRONT, to have oCreature1 and oCreature2 lie
// face up or face down.
//
// (Called by int_anim_lw_ldb action script associated with
// "Lie down next to each other" line of Love Wand dialog)
void IntAnim_LieDown(object oCreature1, object oCreature2, int nAnimation1, int nAnimation2)
{
 SetLocalInt(oCreature1, "Int_Anim_Last_Animation", nAnimation1);
 SetLocalInt(oCreature2, "Int_Anim_Last_Animation", nAnimation2);
 AssignCommand(oCreature1, ClearAllActions(TRUE));
 AssignCommand(oCreature2, ClearAllActions(TRUE));
 if (GetIsPC(oCreature1)) FadeToBlack(oCreature1, FADE_SPEED_FASTEST);
 if (GetIsPC(oCreature2)) FadeToBlack(oCreature2, FADE_SPEED_FASTEST);

 IntAnim_ApplyEffectCutsceneGhost(oCreature1, oCreature2);

 float fFacing1;
 if (nAnimation1 == nAnimation2) fFacing1 = GetFacing(oCreature2);
 else fFacing1 = IntAnim_AdjustFacing(GetFacing(oCreature2), 180.0);

 DelayCommand(1.0, AssignCommand(oCreature1,
   ActionJumpToLocation(IntAnim_GetPartnerLocation(oCreature2, 0.5,
                        GetFacing(oCreature2) + 90.0, fFacing1))));
 DelayCommand(2.0, AssignCommand(oCreature1,
   ActionPlayAnimation(nAnimation1, 1.0, CONST_IA_DEFAULT_DURATION)));
 DelayCommand(2.0, AssignCommand(oCreature2,
   ActionPlayAnimation(nAnimation2, 1.0, CONST_IA_DEFAULT_DURATION)));

 DelayCommand(2.1, FadeFromBlack(oCreature1));
 DelayCommand(2.1, FadeFromBlack(oCreature2));
}


// Causes oCreature1 and oCreature2 to collapse together.
//
// (Called by int_anim_lw_col action script associated with
// "Collapse together" line of Love Wand dialog)
void IntAnim_Collapse(object oCreature1, object oCreature2)
{
 object oMale;
 object oFemale;
 float fMaleFacing;
 float fFemaleFacing;
 float fFacingDifference;
 int nLastAnimation = GetLocalInt(oCreature1, "Int_Anim_Last_Animation");
 int nMaleAnimation;
 int nFemaleAnimation;

 if (GetGender(oCreature1) == GENDER_MALE)
 {
    fMaleFacing = GetFacing(oCreature1);
    oMale = oCreature1;
    oFemale = oCreature2;
 }
 else
 {
    fMaleFacing = GetFacing(oCreature2);
    oMale = oCreature2;
    oFemale = oCreature1;
 }

 switch(nLastAnimation)
 {
   case ANIMATION_LOOPING_CUSTOM2:
   {
     nMaleAnimation = ANIMATION_LOOPING_DEAD_BACK;
     nFemaleAnimation = ANIMATION_LOOPING_DEAD_FRONT;
     fFacingDifference = 195.0;
     break;
   }
   case ANIMATION_LOOPING_CUSTOM3:
   {
     nMaleAnimation = ANIMATION_LOOPING_DEAD_FRONT;
     nFemaleAnimation = ANIMATION_LOOPING_DEAD_FRONT;
     fFacingDifference = 15.0;
     break;
   }
   case ANIMATION_LOOPING_CUSTOM4:
   {
     nMaleAnimation = ANIMATION_LOOPING_DEAD_FRONT;
     nFemaleAnimation = ANIMATION_LOOPING_DEAD_BACK;
     fFacingDifference = 195.0;
     break;
   }
   case ANIMATION_LOOPING_CUSTOM5:
   case ANIMATION_LOOPING_CUSTOM6:
   {
     nMaleAnimation = ANIMATION_LOOPING_DEAD_BACK;
     nFemaleAnimation = ANIMATION_LOOPING_DEAD_BACK;
     fFacingDifference = 15.0;
     break;
   }
   // If not one of the five Intimate Animations
   nMaleAnimation = ANIMATION_LOOPING_DEAD_BACK;
   nFemaleAnimation = ANIMATION_LOOPING_DEAD_BACK;
   fFacingDifference = 15.0;
 }
 fFemaleFacing = IntAnim_AdjustFacing(fMaleFacing, fFacingDifference);

 SetLocalInt(oMale, "Int_Anim_Last_Animation", nMaleAnimation);
 SetLocalInt(oFemale, "Int_Anim_Last_Animation", nFemaleAnimation);
 AssignCommand(oMale, ClearAllActions(TRUE));
 AssignCommand(oFemale, ClearAllActions(TRUE));
 if (GetIsPC(oMale)) FadeToBlack(oCreature1, FADE_SPEED_FASTEST);
 if (GetIsPC(oFemale)) FadeToBlack(oCreature2, FADE_SPEED_FASTEST);

 IntAnim_ApplyEffectCutsceneGhost(oCreature1, oCreature2);

 if (GetIsPC(oFemale))
 {
   DelayCommand(1.0, AssignCommand(oMale, SetFacing(fMaleFacing)));
   DelayCommand(1.0, AssignCommand(oFemale,
     JumpToLocation(IntAnim_GetPartnerLocation(oMale, 0.5,
                    IntAnim_AdjustFacing(fMaleFacing, -90.0), fFemaleFacing))));
 }
 else
 {
   DelayCommand(1.0, AssignCommand(oFemale, SetFacing(fFemaleFacing)));
   DelayCommand(1.0, AssignCommand(oMale,
     JumpToLocation(IntAnim_GetPartnerLocation(oFemale, 0.5,
                    IntAnim_AdjustFacing(fMaleFacing, 90.0), fMaleFacing))));
 }

 DelayCommand(2.0, AssignCommand(oMale,
   ActionPlayAnimation(nMaleAnimation, 1.0, CONST_IA_DEFAULT_DURATION)));
 DelayCommand(2.0, AssignCommand(oFemale,
   ActionPlayAnimation(nFemaleAnimation, 1.0, CONST_IA_DEFAULT_DURATION)));
 DelayCommand(2.1, FadeFromBlack(oMale));
 DelayCommand(2.1, FadeFromBlack(oFemale));
}


// Stop any previous animations and initiate Love Wand dialog.
//
// (Called by module OnItemActivated script)
void IntAnim_StartLoveWandDialog(object oActivator, object oTarget)
{
 SetLocalObject(oActivator, "Int_Anim_Wand_Target", oTarget);
 SetCommandable(TRUE, oActivator);
 SetCommandable(TRUE, oTarget);
 int nLastActivatorAnimation = GetLocalInt(oActivator, "Int_Anim_Last_Animation");

 // If previous animation already played or playing, stop before initiating
 // dialog for next animation (otherwise partner of oActivator may continue
 // animation after oActivator stops)
 if (nLastActivatorAnimation != 0)
 {
   IntAnim_StopAnimation(oActivator, oTarget, FALSE, TRUE);
   DelayCommand(2.0, AssignCommand(oActivator,
     ActionStartConversation(oActivator, "int_anim_wand", TRUE, FALSE)));
 }
 else
 {
   AssignCommand(oActivator,
     ActionStartConversation(oActivator, "int_anim_wand", TRUE, FALSE));
 }
}


// Sets oCreature2 to face oCreature1 and moves oCreature1 close to oCreature2
//
// (Called by module OnItemActivated script if partners are too far apart)
void IntAnim_MoveCloser(object oCreature1, object oCreature2)
{
 AssignCommand(oCreature1, ClearAllActions(TRUE));
 AssignCommand(oCreature2, ClearAllActions(TRUE));
 AssignCommand(oCreature2, SetFacingPoint(GetPosition(oCreature1)));
 AssignCommand(oCreature1, ActionMoveToObject(oCreature2));
}
the inc file
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Gigaschatten and a npc custom animation question
« Reply #4 on: March 17, 2013, 11:24:09 pm »


               Yeah that is huge. Well did you try out what I posted?
That include has two includes included in it.  No need to post them just mentioning it.
               
               

               


                     Modifié par ffbj, 17 mars 2013 - 11:29 .
                     
                  


            

Legacy_Hushmoons

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
Gigaschatten and a npc custom animation question
« Reply #5 on: March 18, 2013, 10:39:27 pm »


               Error variable defined without type

starting
case 1: nAnimation = ActionPlayAnimation(ANIMATION_LOOPING_CUSTOM4); break;
               
               

               
            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Gigaschatten and a npc custom animation question
« Reply #6 on: March 19, 2013, 03:40:48 am »


               Sorry about that.  The basic structure:

//goes in the onperceived of npc
 void main()
 {
 object oPC = GetLastPerceived();
 if (!GetIsPC(oPC))
 return;
  if (GetDistanceToObject(oPC) < (10.0))
switch (d4())
 {
   case 1:  ActionPlayAnimation(ANIMATION_FIREFORGET_BOW); break;
   case 2:  ActionPlayAnimation( ANIMATION_LOOPING_PAUSE_DRUNK); break;
   case 3:  ActionPlayAnimation( ANIMATION_FIREFORGET_DRINK); break;
   case 4:  ActionPlayAnimation( ANIMATION_FIREFORGET_TAUNT); break;
 }

}
               
               

               
            

Legacy_Hushmoons

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
Gigaschatten and a npc custom animation question
« Reply #7 on: March 19, 2013, 09:46:52 pm »


               Nice trimmed to one script kudos if I were to switch (d4()) to (d10())
Id be able to run 10 cases correct?
               
               

               
            

Legacy_Hushmoons

  • Newbie
  • *
  • Posts: 14
  • Karma: +0/-0
Gigaschatten and a npc custom animation question
« Reply #8 on: March 19, 2013, 09:57:21 pm »


               my next idea is to readapt the nicely done drugs system into a std system lolz have to watch for these promiscuous women and sort going for kind of a roman bathhouse, of a sort. for lack of a better word to describe my  sort of loosley based idea for a social setting maybe, lots of ambience to the mod. interaction with numerous objects/npcs. Ive been building with the toolset since 2003. Probably better at areas than the whole coding thing but ive learned alot thru the years. This community amazes me with the support and interaction on such an old platform. best game ive ever purchased coming form a addicted wow player. This game keeps my imagination flowing



Leaves are falling all around, It's time I was on my way.
Thanks to you, I'm much obliged for such a pleasant stay.
               
               

               


                     Modifié par Hushmoons, 19 mars 2013 - 09:58 .
                     
                  


            

Legacy_ffbj

  • Hero Member
  • *****
  • Posts: 1097
  • Karma: +0/-0
Gigaschatten and a npc custom animation question
« Reply #9 on: March 19, 2013, 11:32:39 pm »


               Guess you better ramble on...
Yeah d10 will give you 10 choices.
Yeah it's great.  The fact that there is so much flexibility allows a great deal of creativity.

with tales of brave Ulysses, how his naked ears were tortured
by the sirens sweetly singing.