Author Topic: Silent drops?  (Read 330 times)

Legacy_Knight_Shield

  • Hero Member
  • *****
  • Posts: 812
  • Karma: +0/-0
Silent drops?
« on: November 13, 2012, 02:03:54 pm »


                I have the monsters dropping their loot directly on the ground.Im using Silicone Scouts loot.

Question:How do I get the drops to make sound when they drop like when a PC drops them?


//************************************************
//** ss_treas_toss                              **
//**                                            **
//** This function is used to scatter the       **
//** inventory of a creature or chest on the    **
//** ground around it when opened or killed.    **
//**                                            **
//** 1 = toss and destroy                       **
//** 2 = toss and leave                         **
//**                                            **
//************************************************
//**Created By: Jason Hunter (SiliconScout)     **
//**                                            **
//**Version: 1.6c                               **
//**                                            **
//**Last Changed Date: July 17, 2004            **
//************************************************

location IsValidLoc(location lPoint);

void main()
{
   object oInv =OBJECT_SELF;
   object oArea = GetArea(oInv);
   object oItem = GetFirstItemInInventory(oInv);
   object oCreate;

   int iOption = GetLocalInt(OBJECT_SELF,"ss_t_toss");

   vector vInv = GetPosition(oInv);
   vector vSpawn;

   float vInvX = (vInv.x);
   float vInvY = (vInv.y);
   float vInvZ = (vInv.z);
   float vSpawnX;
   float vSpawnY;
   float iVecAdd;

   location lSpawn;


   while (oItem != OBJECT_INVALID)
   {

       //Get a random vecor within 1 and 2.5 meters
       while(iVecAdd < 0.2)
       {
           iVecAdd = d100(1)*0.025;
       }

       if (d4() < 3) vSpawnX = vInvX + iVecAdd;
       else vSpawnX = vInvX - iVecAdd;

       iVecAdd=0.0;
       while(iVecAdd < 0.2)
       {
           iVecAdd = d100(1)*0.025;
       }

       if (d4() < 3) vSpawnY = vInvY + iVecAdd;
       else vSpawnY = vInvY - iVecAdd;

       //set vector
       vSpawn = Vector(vSpawnX, vSpawnY, vInvZ);

       //Set spawn location
       lSpawn = Location(oArea,vSpawn,0.0);

       //validate the location to drop on
          lSpawn = IsValidLoc(lSpawn);

       if (GetItemStackSize(oItem) > 1)
       {
           oCreate = CreateObject(GetObjectType(oItem),GetResRef(oItem),lSpawn,FALSE);
           SetItemStackSize(oCreate,GetItemStackSize(oItem));
       }else
       {
           CreateObject(GetObjectType(oItem),GetResRef(oItem),lSpawn,FALSE);
       }
       DestroyObject(oItem,0.0);
       oItem = GetNextItemInInventory(oInv);
   }

   //Keep the chest live.
   if (iOption > 1) return;

   //if it's not then let the object die
   DestroyObject(oInv);

}

//////////////////////////////////////////////////////////////////////
// Function. Generates a Valid location to place an object
// !WARNING! Make sure oArea is valid. Requires a custom creature
// with Null Human appearance TAG = "Null" ResRef = "null"
// nMinX, nMinY = lower left corner. nMaxX, nMaxY = Upper Right Corner
// Example; location lSpawn = RanValidLoc(oArea,10,10,30,30);
//////////////////////////////////////////////////////////////////////

location IsValidLoc(location lPoint)
{
   CreateObject(OBJECT_TYPE_CREATURE,"ss_nulltoss",lPoint);
   object oNull = GetObjectByTag("ss_nulltoss");
   if(GetIsObjectValid(oNull))
       {
       location lSpawn = GetLocation(oNull);
       DestroyObject(oNull);
       return lSpawn;
       }
   else
       {
       return lPoint;
       }
}
               
               

               


                     Modifié par Knight_Shield, 13 novembre 2012 - 02:09 .
                     
                  


            

Legacy_Fester Pot

  • Hero Member
  • *****
  • Posts: 1698
  • Karma: +0/-0
Silent drops?
« Reply #1 on: November 13, 2012, 04:55:42 pm »


               You'll want to add a PlaySound command in the script where the items are being created.

PlaySound("it_genericsmall");


There's a slew of it_* sounds you can pick from.

If you want to hear them, create a sound object.

ADD SOUNDS -> Name Filter: ITEM

it_genericsmall I believe is the normal sound.

You could work the script to check what item type it is when it's created, then play the appropriate sound for that item type - swords, armor, gems, gold.

The only thing is when multiple items are dropped, I'm pretty sure you'll hear the LAST sound of the item that is dropped, not all of them.

FP!
               
               

               


                     Modifié par Fester Pot, 13 novembre 2012 - 05:04 .