Don't like ads? PRO users don't see any ads ;-)
Guest

aa_trg_en_carpet

By: henesua on Jul 18th, 2012  |  syntax: C  |  size: 1.78 KB  |  hits: 25  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. //::///////////////////////////////////////////////
  2. //:: aa_trg_en_carpet
  3. //:://////////////////////////////////////////////
  4. /*
  5.     intended for use in a trigger's onenter event and paired with aa_trg_ex_carpet in the onexit event
  6.     this is used to solve the problem of placeable carpets not changing the footstep type
  7.  
  8.     changes footstep sounds within a trigger to correspond with an imposed material type
  9.  
  10.     FOOTSTEP_TYPE
  11.     1   dirt
  12.     2   grass
  13.     3   stone
  14.     4   wood
  15.     5   water
  16.     6   carpet
  17.     7   metal
  18.     8   puddle
  19.     9   leaves
  20.     10  sand
  21.     11  snow
  22.  
  23.     default is carpet
  24.  
  25. */
  26. //:://////////////////////////////////////////////
  27. //:: Created By: The Magus (2011 apr 5)
  28. //:: Modified: The Magus (2011 dec 30) enabled different footstep types w/ carpet as the default
  29. //:: Modified: The Magus (2012 aug 21) reworked the footsteps 2da and this script
  30. //:://////////////////////////////////////////////
  31.  
  32.  
  33. void main()
  34. {
  35.  object oCreature = GetEnteringObject();
  36.  if ( !GetIsObjectValid(oCreature) )
  37.     return;
  38.  
  39.  int nFeet      = GetFootstepType(oCreature);
  40.  if(    nFeet == FOOTSTEP_TYPE_INVALID
  41.     ||  nFeet == FOOTSTEP_TYPE_FEATHER_WING
  42.     ||  nFeet == FOOTSTEP_TYPE_FEATHER_WING
  43.     ||  (nFeet >= 13 && nFeet <= 16)
  44.     ||  nFeet == 18
  45.     ||  nFeet == 19
  46.     ||  (nFeet > 20 && nFeet <30)
  47.    )
  48.     return;
  49.  
  50.  int nDefault   = GetLocalInt(oCreature, "FOOTSTEP_DEFAULT");
  51.  if(!nDefault && nFeet<30)
  52.  {
  53.     nDefault    = nFeet;
  54.     SetLocalInt(oCreature, "FOOTSTEP_DEFAULT", nFeet);
  55.  }
  56.  
  57.     // Set new footsteps
  58.     int nFootstepType = GetLocalInt(OBJECT_SELF,"FOOTSTEP_TYPE");
  59.     if(!nFootstepType)
  60.         nFootstepType = 6;
  61.  
  62.     nFootstepType   = (nFootstepType*30)+nDefault;
  63.  
  64.     SetFootstepType(nFootstepType, oCreature);
  65. }