Using the game menu, "InventoryActivate" isn't listed. To access it you have to go into RawKeyBindings. By default it is set to 'Enter'.Hmm, i like this idea and tried to implement it. In the game's preferences for controls, what is the command for activating the selected item?
Also, i am curious how to set an inventory item as selected for a given Pawn / PlayerPawn....
Having looked at it some items do have it set to true... I'll get back to you on this one.
I see M_Selected, but is simply a localized name for an Inventory item it seems.
Hmm....
Code: Select all
Pawn Class
var travel Inventory SelectedItem; // currently selected inventory item
Like all inventory, unless it is your active weapon, it will be destroyed when you die so no need to mess with anything.And is the proper way to ensure the Inventory item never is dropped, is to override the DropFrom and BecomePickup methods, and essentially make them empty?
Have a close look at the Stealth mutator and how it works.
This line:
Code: Select all
inv.RespawnTime = 0.0;
--------------------------------------------------------------------
I'm back.
In class Pawn
Code: Select all
// The player/bot wants to select next item
exec function NextItem()
{
local Inventory Inv;
if (SelectedItem==None) {
SelectedItem = Inventory.SelectNext();
Return;
}
if (SelectedItem.Inventory!=None)
SelectedItem = SelectedItem.Inventory.SelectNext();
else
SelectedItem = Inventory.SelectNext();
if ( SelectedItem == None )
SelectedItem = Inventory.SelectNext();
}
Code: Select all
//
// Select first activatable item.
//
function Inventory SelectNext()
{
if ( bActivatable )
{
if ( M_Selected != "" )
Pawn(Owner).ClientMessage(ItemName$M_Selected);
return self;
}
if ( Inventory != None )
return Inventory.SelectNext();
else
return None;
}
Picking up further items will add them later in the list but wont change what is selected.
In effect we can override the NextItem key (from pawn) in your inventory class just by modifying SelectNext in your inventory to always return itself.
Code: Select all
Psudo code
function Inventory SelectNext()
{
return self;
}