Jump to content

AlanHK

Members
  • Content Count

    4
  • Joined

  • Last visited

Everything posted by AlanHK

  1. Excuse me, how can I change the quantity of an ammunition instance? I want to write a script for converting bullets from 9x39 to 762x39 using a wrench But I hope the quantity corresponds, using a few 9x39 will generate a few 762x39 But after generating a set of 762x39 bullets Ammo762Object.SetQuantity(Ammo9Object.getQuantity()); Failed to change the quantity, is there any way to modify the number of bullet instances? Please guide me, teachers.
  2. 无论如何,感谢您的热情帮助!
  3. I roughly understand, which means that this synthesis process can only be executed on the client side and cannot modify the ammunition quantity, right? We still need to develop the server, thank you.
  4. 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); } };
×