View unanswered posts | View active topics It is currently Tue Jan 07, 2025 1:10 am



Reply to topic  [ 9 posts ] 
 Shallow pockets. 
Author Message
User avatar

Joined: Mon May 18, 2009 11:48 pm
Posts: 205
Location: The swamps of Stuporia!
Reply with quote
Post 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?


Fri Jun 05, 2009 4:18 am
Profile YIM
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post Re: Shallow pockets.
SwapNextInventory probably doesn't work. You should be giving it to him fine, though.


Fri Jun 05, 2009 4:19 am
Profile
User avatar

Joined: Mon May 18, 2009 11:48 pm
Posts: 205
Location: The swamps of Stuporia!
Reply with quote
Post 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.


Fri Jun 05, 2009 4:59 am
Profile YIM
User avatar

Joined: Mon Jul 16, 2007 9:50 am
Posts: 1512
Location: Tallahassee, FL
Reply with quote
Post 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.


Fri Jun 05, 2009 4:40 pm
Profile YIM
User avatar

Joined: Mon May 18, 2009 11:48 pm
Posts: 205
Location: The swamps of Stuporia!
Reply with quote
Post 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.


Fri Jun 05, 2009 5:08 pm
Profile YIM
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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.


Fri Jun 05, 2009 10:08 pm
Profile
User avatar

Joined: Mon May 18, 2009 11:48 pm
Posts: 205
Location: The swamps of Stuporia!
Reply with quote
Post 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.


Sat Jun 06, 2009 1:36 pm
Profile YIM
REAL AMERICAN HERO
User avatar

Joined: Sat Jan 27, 2007 10:25 pm
Posts: 5655
Reply with quote
Post 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.


Sat Jun 06, 2009 5:34 pm
Profile
User avatar

Joined: Mon May 18, 2009 11:48 pm
Posts: 205
Location: The swamps of Stuporia!
Reply with quote
Post 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.


Sat Jun 06, 2009 11:17 pm
Profile YIM
Display posts from previous:  Sort by  
Reply to topic   [ 9 posts ] 

Who is online

Users browsing this forum: No registered users


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group.
Designed by STSoftware for PTF.
[ Time : 0.038s | 15 Queries | GZIP : Off ]