| Author | Message | 
        
			| AgentBaron 
					Joined: Mon May 18, 2009 11:48 pm
 Posts: 205
 Location: The swamps of Stuporia!
   |   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 | 
					
					     | 
	
	
		|  | 
	
			| Grif REAL AMERICAN HERO 
					Joined: Sat Jan 27, 2007 10:25 pm
 Posts: 5655
   |   Re: Shallow pockets.SwapNextInventory probably doesn't work. You should be giving it to him fine, though. 
 
 | 
		
			| Fri Jun 05, 2009 4:19 am | 
					
					   | 
	
	
		|  | 
	
			| AgentBaron 
					Joined: Mon May 18, 2009 11:48 pm
 Posts: 205
 Location: The swamps of Stuporia!
   |   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 | 
					
					     | 
	
	
		|  | 
	
			| Darlos9D 
					Joined: Mon Jul 16, 2007 9:50 am
 Posts: 1512
 Location: Tallahassee, FL
   |   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 | 
					
					     | 
	
	
		|  | 
	
			| AgentBaron 
					Joined: Mon May 18, 2009 11:48 pm
 Posts: 205
 Location: The swamps of Stuporia!
   |   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 | 
					
					     | 
	
	
		|  | 
	
			| Grif REAL AMERICAN HERO 
					Joined: Sat Jan 27, 2007 10:25 pm
 Posts: 5655
   |   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 | 
					
					   | 
	
	
		|  | 
	
			| AgentBaron 
					Joined: Mon May 18, 2009 11:48 pm
 Posts: 205
 Location: The swamps of Stuporia!
   |   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 | 
					
					     | 
	
	
		|  | 
	
			| Grif REAL AMERICAN HERO 
					Joined: Sat Jan 27, 2007 10:25 pm
 Posts: 5655
   |   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 | 
					
					   | 
	
	
		|  | 
	
			| AgentBaron 
					Joined: Mon May 18, 2009 11:48 pm
 Posts: 205
 Location: The swamps of Stuporia!
   |   Re: Shallow pockets.Crap works fine on Build 23?  Gee, I'd have never guessed.     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 | 
					
					     | 
	
	
		|  | 
	
	
		|  |