Author Topic: Spring Cleaning  (Read 380 times)

Legacy_One Thousand Talons Mao Ra

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
Spring Cleaning
« on: November 16, 2010, 10:07:29 pm »


               My mod is in need of a little clean up. What is the default tag for the loot bags dropped when something is killed? This is suprisingly difficult for a bad scripter like myself to find. ':whistle:'
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Spring Cleaning
« Reply #1 on: November 16, 2010, 10:10:33 pm »


               I think it is "bodybag"
               
               

               
            

Legacy_kalbaern

  • Hero Member
  • *****
  • Posts: 1531
  • Karma: +0/-0
Spring Cleaning
« Reply #2 on: November 17, 2010, 01:02:47 am »


               It's "BodyBag", not sure if case sensitive will matter, but that is the actual tag.
               
               

               
            

Legacy_One Thousand Talons Mao Ra

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
Spring Cleaning
« Reply #3 on: November 17, 2010, 02:14:24 am »


               Yep, cases matter. Thank you!
               
               

               
            

Legacy_Lightfoot8

  • Hero Member
  • *****
  • Posts: 4797
  • Karma: +0/-0
Spring Cleaning
« Reply #4 on: November 17, 2010, 04:30:21 am »


               Trick:

When not knowing how to find some of this stuff.  Like the Tag or even ResRef for the body bag.  

Try saving your game.  Renaming  your saved game to  xxx.mod  instead of xxx.sav and open it in the toolset to look for your answers.    



This is even a good way to find local vars that are  on an NPC.
               
               

               
            

Legacy_One Thousand Talons Mao Ra

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
Spring Cleaning
« Reply #5 on: November 17, 2010, 11:37:01 pm »


               Wow! That could be ridiculously handy!
               
               

               
            

Legacy_One Thousand Talons Mao Ra

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
Spring Cleaning
« Reply #6 on: November 21, 2010, 12:53:21 pm »


               ':whistle:' Uhm, so I have no problem with making a loop for destroying all BodyBags but that leaves the contents still laying there. How would you guys/gals destroy the bag AND everything in it? Because the items change.
               
               

               
            

Legacy__Knightmare_

  • Full Member
  • ***
  • Posts: 191
  • Karma: +0/-0
Spring Cleaning
« Reply #7 on: November 21, 2010, 01:42:24 pm »


               You would need to have a loop within the loop. The "outer" loop goes through and finds the bags (like you have). The "inner" loop would then go through and destroy the contents of the bag before destroying the bag itself and moving on to the next bag (in the outer loop).

Example (part pseudo-code):

object oBag = Your First BodyBag;
while(GetIsObjectValid(oBag)) // Outer Loop - Find a Bag
   {
   object oInv = GetFirstItemInInventory(oBag);
   while(GetIsObjectValid(oInv)) // Inner Loop - Destroy Bag's Inventory
      {
      DestroyObject(oInv, 0.0, FALSE);
      oInv = GetNextItemInInventory(oBag);
      } // End Inner Loop

   if(oInv == OBJECT_INVALID) // If all inventory has been destroyed destroy Bag itself
      {
      DestroyObject(oBag, 0.0, FALSE);
      }

   oBag = Your Next BodyBag;
   } // End Outer Loop
               
               

               


                     Modifié par _Knightmare_, 21 novembre 2010 - 02:03 .
                     
                  


            

Legacy_One Thousand Talons Mao Ra

  • Jr. Member
  • **
  • Posts: 66
  • Karma: +0/-0
Spring Cleaning
« Reply #8 on: November 26, 2010, 05:01:18 am »


               Sweeeeet. '<img'> I used.....
---
object oCenter = GetObjectByTag("ArenaCenter");
object oLoot;
int iLootbags = 1;
while (iLootbags <= 15)
   {
   oLoot = GetNearestObjectByTag("BodyBag", oCenter, iLootbags);
   object oInv = GetFirstItemInInventory(oLoot);
   while(GetIsObjectValid(oInv))
      {
      DestroyObject(oInv);
      oInv = GetNextItemInInventory(oLoot);
      }
   DestroyObject(oLoot);
        iLootbags++;
   }
---
Works great. So can you use switches inside of switches, too?
               
               

               
            

Legacy__Knightmare_

  • Full Member
  • ***
  • Posts: 191
  • Karma: +0/-0
Spring Cleaning
« Reply #9 on: November 26, 2010, 12:51:44 pm »


               

One Thousand Talons Mao Ra wrote...

So can you use switches inside of switches, too?


Yes you can. 'Image

You can keep "stacking/layering" them as long as you can keep what you are doing straight and not confuse your self lol. You can have a switch inside a switch inside a loop inside a loop inside a switch, etc. In theory this can be unlimited layers, but if you get too complicated, the game may throw a TMI error.
               
               

               


                     Modifié par _Knightmare_, 26 novembre 2010 - 12:54 .