Data Realms Fan Forums http://45.55.195.193/ |
|
Working with actor inventories http://45.55.195.193/viewtopic.php?f=73&t=15844 |
Page 1 of 1 |
Author: | Sean Mirrsen [ Mon Jul 13, 2009 11:22 pm ] |
Post subject: | Working with actor inventories |
Hello there. I recently found a Lua function that seems to have gone unnoticed, Actor:Inventory(), or maybe MovableObject:Inventory(), I'm not sure which. So far, it seems it only returns the next item in the actor's inventory, as a pointer. I haven't found a way to make it return a list or array or anything. Its use is that in conjunction with SwapNextInventory, like this: Code: self:SwapNextInventory(self:Inventory(),true); you can quickly cycle through the entire inventory of an actor, without cycling through MOs/attachables and the like. Makes searching for pointers to specific carried items rather easy. The only real problem with this is that SwapNextInventory doesn't touch whatever is currently being held. Can any of the local Lua gurus point me to a good way to instantly cycle the actor's currently held item? And if it so happens that this was already known (though the wiki and my search results hint at the contrary), what else can you suggest for quickly skimming through the actor's inventory to find an instance of a specific weapon/item? |
Author: | mail2345 [ Tue Jul 14, 2009 12:45 am ] |
Post subject: | Re: Working with actor inventories |
HasObject. Nice find. Also, just spawn killer particles at the pos of the weapon that is being held. |
Author: | TheLastBanana [ Tue Jul 14, 2009 12:46 am ] |
Post subject: | Re: Working with actor inventories |
You can also Detach the weapon, set its Lifetime to 1 or set ToDelete to true, can't you? |
Author: | Sean Mirrsen [ Tue Jul 14, 2009 6:20 am ] |
Post subject: | Re: Working with actor inventories |
Heh, no, that's not what I'm looking for. HasObject returns a boolean for whether or no you have the item (not the pointer to it), and deleting or detaching the held item requires that you obtain the pointer to it first. I need either a way to see what's in the hands (preferably a way that doesn't involve scanning all MOs on the scene), or a way to make the actor put its held item into the inventory. Basically, it's for my SWAT Kats mod, I wanted to have any Glovatrix be usable by any SWAT Kat, but this means I have to get a pointer to a Glovatrix that is carried. Using SwapNextInventory cycles works as long as it's not held, but without so much as a way to just know it's held, I can't prevent a while loop from locking up CC. I also don't know how to see the amount of items in inventory - then I could just cycle through the inventory once, and if the item is not there (but HasObject on it returns true), I can postpone the check. Btw, I found the function by scanning the executable contents (as in, renaming EXE to TXT and looking through). There were some other things I haven't seen mentioned in the Wiki, like Box functions HasNoArea, IsInside, GetBoxInside, RemoveBoxInside. I don't know what they do yet. There's also an odd INI property WoundLimit, I don't know what it's supposed to do either. Maybe I'll find something useful eventually.. edit: oops, on closer inspection the functions refer to the Area class, not the Box class. Which is still interesting, because the Area class isn't on the Wiki... |
Author: | Grif [ Tue Jul 14, 2009 6:47 am ] |
Post subject: | Re: Working with actor inventories |
http://www.datarealms.com/wiki/index.ph ... #Functions Areas are defined within scenes. Also boxes are pretty well documented, and if you find a function through that that isn't in official documentation then it's probably either A: not working or B: not there for a reason (or of course C: not picked up by data's source crawler) |
Author: | Sean Mirrsen [ Tue Jul 14, 2009 6:56 am ] |
Post subject: | Re: Working with actor inventories |
Well, if it's not working or not there for a reason, that's just more incentive to go and find it, right? Because I haven't seen a listing of functions and properties for an Area or a Player, though they are used in scene scripting. |
Page 1 of 1 | All times are UTC [ DST ] |
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group http://www.phpbb.com/ |