Thank you for your help, but in the actual script, I have already checked the quantity.
This is a process script that has been checked in the Init settings for a minimum quantity of 1 for 9x39. I also confirmed in Debug that I could obtain a quantity of 9x39, but resetting the quantity through SetQuantity failed.
modded class PluginRecipesManagerBase
{
override void RegisterRecipies()
{
super.RegisterRecipies();
RegisterRecipe(new AmmoNewCraft_762x39);
}
};
class AmmoNewCraft_762x39 extends RecipeBase
{
override void Init()
{
m_Name = "Craft 762x39";
m_IsInstaRecipe = false;
m_AnimationLength = 2;
m_Specialty = -0.2;
m_MinDamageIngredient[0] = -1;
m_MaxDamageIngredient[0] = -1;
m_MinQuantityIngredient[0] = 1;
m_MaxQuantityIngredient[0] = -1;
m_MinDamageIngredient[1] = -1;
m_MaxDamageIngredient[1] = -1;
m_MinQuantityIngredient[1] = 1;
m_MaxQuantityIngredient[1] = -1;
InsertIngredient(0,"Wrench");m_IngredientAddHealth[0] = -30;
m_IngredientSetHealth[0] = -1;
m_IngredientAddQuantity[0] = -1;
m_IngredientDestroy[0] = false;
m_IngredientUseSoftSkills[0] = false;
InsertIngredient(1,"Ammo_9x39");
m_IngredientAddHealth[1] = -1;
m_IngredientSetHealth[1] = -1;
m_IngredientAddQuantity[1] = -1;
m_IngredientDestroy[1] = true;
m_IngredientUseSoftSkills[1] = false;
AddResult("Ammo_762x39");
m_ResultSetFullQuantity[0] = false;
m_ResultSetQuantity[0] = -1;
m_ResultSetHealth[0] = -1;
m_ResultInheritsHealth[0] = -2;
m_ResultInheritsColor[0] = -1;
m_ResultToInventory[0] = -2;
m_ResultUseSoftSkills[0] = true;
m_ResultReplacesIngredient[0] = -1;
}
override bool CanDo(ItemBase ingredients[], PlayerBase player) {
return true;
}
override void Do(ItemBase ingredients[], PlayerBase player, array < ItemBase > results, float specialty_weight) {
float health_ing_1 = ingredients[0].GetHealth("", "");
float health_ing_2 = ingredients[1].GetHealth("", "");
float resultHealth = Math.Min(health_ing_1, health_ing_2);
float resultQuantity = ingredients[1].GetQuantity();
ItemBase resultItem = results.Get(0);
resultItem.SetHealth(resultHealth);
resultItem.SetQuantity(resultQuantity);
}
};