Spring Cleaning
Débuté par
One Thousand Talons Mao Ra
, nov. 16 2010 10:07
#1
Posté 16 novembre 2010 - 10:07
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.
#2
Posté 16 novembre 2010 - 10:10
I think it is "bodybag"
#3
Posté 17 novembre 2010 - 01:02
It's "BodyBag", not sure if case sensitive will matter, but that is the actual tag.
#4
Posté 17 novembre 2010 - 02:14
Yep, cases matter. Thank you!
#5
Posté 17 novembre 2010 - 04:30
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.
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.
#6
Posté 17 novembre 2010 - 11:37
Wow! That could be ridiculously handy!
#7
Posté 21 novembre 2010 - 12:53
#8
Posté 21 novembre 2010 - 01:42
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
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 .
#9
Posté 26 novembre 2010 - 05:01
Sweeeeet.
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?
---
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?
#10
Posté 26 novembre 2010 - 12:51
One Thousand Talons Mao Ra wrote...
So can you use switches inside of switches, too?
Yes you can.
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 .





Retour en haut






