Jump to content

  • Log In with Google      Sign In   
  • Create Account


[UDK] Clarity on the default inventory system, and removing a weapon


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
3 replies to this topic

#1 Sammieo   Members   -  Reputation: 147

Like
0Likes
Like

Posted 05 March 2013 - 06:55 AM

Hey guys, I'm just trying to do a simple test where MyPlayerController has a function that can remove the item in the current user's inventory. I'm not using any specially built system of inventory, I'm using the default Unreal Tournament inventory system. So the idea is that if the player pawn touches some actor (let's call it MyWeaponRemover), then MyWeaponRemover will call this function on MyPlayerController and remove the weapon they have equipped. (i.e If they had only their current weapon, now they would have nothing.) With what little I knowI guess it'd look something like:
function RemoveWeapon()
{
    DefaultInventory(0)=None;
}
How far off would I be if I said that? I've done some searching for the topic of the default inventory system, but I've not seen much info. I've also seen many guides on how to make my own inventory system, but I'm on a tight deadline and don't have the time to make a completely new inventory. Any advice or suggested resources?

Sponsor:

#2 ratrace135   Members   -  Reputation: 445

Like
1Likes
Like

Posted 05 March 2013 - 09:23 AM

The DefaultInventory's given to the player when they're spawned. After that, the weapon will be in the InventoryManager, and you'll have to use the DropFrom(vector StartLocation, vector StartVelocity) function from the inventory class to get the pawn to throw out its current weapon... Luckily, that's already done for you with the PlayerController's ThrowWeapon() function (which calls the Pawn's ThrowActiveWeapon() function), so you don't need to make the function at all. biggrin.png


Edited by ratrace135, 05 March 2013 - 09:23 AM.


#3 Sammieo   Members   -  Reputation: 147

Like
0Likes
Like

Posted 06 March 2013 - 12:49 PM

ratrace, thanks for that! I'm unfortunately not able to test that any time soon, so I can't answer my next question, but what I want to happen is for the weapon to be removed from the game, not just dropped somewhere on the ground. Would these functions do that, or need I use another built-in function, or make one of my own?

#4 ratrace135   Members   -  Reputation: 445

Like
1Likes
Like

Posted 06 March 2013 - 11:21 PM

Ahh, no, ThrowWeapon() would spawn a DroppedPickup in its place. You'll have to remove the weapon directly with the InventoryManager's RemoveFromInventory(Inventory ItemToRemove) function. I wrote out what to do, but then where's the fun in that? I'll let you have your fun figuring it out instead of just giving you the answers tongue.png






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS