Advertisement
Guest User

Untitled

a guest
Jul 2nd, 2019
169
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. static function bool CanAddItemToInventory_CH(out int bCanAddItem, const EInventorySlot Slot, const X2ItemTemplate ItemTemplate, int Quantity, XComGameState_Unit UnitState, optional XComGameState CheckGameState, optional out string DisabledReason)
  2. {  
  3.     // do the filtering only if trying to...
  4.     if(UnitState.GetSoldierClassTemplateName() == 'YourMedicClassName' &&   //  equip something on your medic class
  5.         Slot == eInvSlot_Utility)   //  into the utility slot
  6.     {
  7.         if (ItemTemplate.DataName == 'SmokeGrenade' || ItemTemplate.DataName == 'MedKit')
  8.         {
  9.             return true;    // smoke grenades and med kits can be equipped
  10.         }
  11.         else
  12.         {
  13.             //  if we're trying to equip something other than a med kit or a smoke grenade
  14.             //  we build a message that will be shown to the player stating that this item is not available to your medic class
  15.             LocTag = XGParamTag(`XEXPANDCONTEXT.FindTag("XGParam"));
  16.             LocTag.StrValue0 = class'X2SoldierClassTemplateManager'.static.GetSoldierClassTemplateManager().FindSoldierClassTemplate('YourMedicClassName').DisplayName;
  17.             DisabledReason = class'UIUtilities_Text'.static.CapsCheckForGermanScharfesS(`XEXPAND.ExpandString(class'UIArmory_Loadout'.default.m_strNeedsSoldierClass));
  18.  
  19.             return false; // and disallow equipping the item
  20.         }
  21.     }
  22.  
  23.     // in all other cases don't do any filtering.
  24.     return true;
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement