Data Realms Fan Forums
http://45.55.195.193/

Shallow pockets.
http://45.55.195.193/viewtopic.php?f=73&t=15184
Page 1 of 1

Author:  AgentBaron [ Fri Jun 05, 2009 4:18 am ]
Post subject:  Shallow pockets.

I'm having a hard time here. I want my boss character to always be equipped with a gun, but when I try to add another weapon to his inventory, nothing seems to happen. Here is the code I'm using:

Code:
if (MovableMan:IsInventoryEmpty(noswitchum)) then
<tab>local NoswitchumWeaponList = {"AK-47", "Spas12", "YAK47"};
<tab>local noswitchumweapon = CreateHDFirearm(NoswitchumWeaponList[math.random(#NoswitchumWeaponList)]);
<tab>noswitchum:AddInventoryItem(noswitchumweapon);
end


I've pondered that he's just not equipping the newly given gun, so I also tried noswitchum:SwapNextInventory(); but that isn't working either. Is there something I'm missing?

Author:  Grif [ Fri Jun 05, 2009 4:19 am ]
Post subject:  Re: Shallow pockets.

SwapNextInventory probably doesn't work. You should be giving it to him fine, though.

Author:  AgentBaron [ Fri Jun 05, 2009 4:59 am ]
Post subject:  Re: Shallow pockets.

Nope, no luck. And what's more is that it breaks the mission's endgame code so that the mission doesn't count as a win when he's dead, either. Boggles the mind, it does.

Author:  Darlos9D [ Fri Jun 05, 2009 4:40 pm ]
Post subject:  Re: Shallow pockets.

For some reason AddInventory, when you create a new item and try to pass it in as an argument, just gives you an error. Its been getting in my way too. Hopefully updates will fix this.

Author:  AgentBaron [ Fri Jun 05, 2009 5:08 pm ]
Post subject:  Re: Shallow pockets.

Ah, okay. Yeah, because AddInventory seems to have worked fine for freshly spawned actors, but I've never seen it update an actor's inventory in real-time. I guess I'll just have to settle with a character that can be disarmed before his health hits 50 or one holding an indestructible version of a gun.

Author:  Grif [ Fri Jun 05, 2009 10:08 pm ]
Post subject:  Re: Shallow pockets.

AddInventory works completely fine when run inside scenes; it could be an error with pointing to MOs correctly? No idea, but rest assured that I've added weapons to an actor while running the main game.

Author:  AgentBaron [ Sat Jun 06, 2009 1:36 pm ]
Post subject:  Re: Shallow pockets.

Did you manage that in Build 22 or 23? I've been making my stuff on Build 22; do you think the build number might have something to do with it?

If you can make it happen, then there's got to be something CC doesn't like about my code.

Author:  Grif [ Sat Jun 06, 2009 5:34 pm ]
Post subject:  Re: Shallow pockets.

Uh, build 23? You know, the latest one, where ♥♥♥♥ works fine?

Although I duplicated code from TLB's Body Ladder scene, which works fine in B22.

Author:  AgentBaron [ Sat Jun 06, 2009 11:17 pm ]
Post subject:  Re: Shallow pockets.

Crap works fine on Build 23? Gee, I'd have never guessed. :P Anyway, thanks for the help. I seem to be following TLB's example fine, I guess I just need to keep messing with it and see what happens. At least I'm on the right track.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/