Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
preparechicken.c
Go to the documentation of this file.
1class PrepareChicken extends PrepareAnimal
2{
3 override void Init()
4 {
5 super.Init();
6
7 //----------------------------------------------------------------------------------------------------------------------
8 //ingredient 1
9 InsertIngredient(0,"DeadChicken_ColorBase");//you can insert multiple ingredients this way
10 m_IngredientAddHealth[0] = 0; // 0 = do nothing
11 m_IngredientSetHealth[0] = -1; // -1 = do nothing
12 m_IngredientAddQuantity[0] = 0; // 0 = do nothing
13 m_IngredientDestroy[0] = true; // true = destroy, false = do nothing
14
15 //----------------------------------------------------------------------------------------------------------------------
16 AddResult("Bone");//add results here
17 m_ResultSetFullQuantity[0] = false; // true = set full quantity, false = do nothing
18 m_ResultSetQuantity[0] = 2; // -1 = do nothing
19 m_ResultSetHealth[0] = -1; // -1 = do nothing
20 m_ResultInheritsHealth[0] = 0; // (value) == -1 means do nothing; a (value) >= 0 means this result will inherit health from ingredient number (value);(value) == -2 means this result will inherit health from all ingredients averaged(result_health = combined_health_of_ingredients / number_of_ingredients)
21 m_ResultInheritsColor[0] = -1; // (value) == -1 means do nothing; a (value) >= 0 means this result classname will be a composite of the name provided in AddResult method and config value "color" of ingredient (value)
22 m_ResultToInventory[0] = -2; // (value) == -2 spawn result on the ground;(value) == -1 place anywhere in the players inventory, (value) >= 0 means switch position with ingredient number(value)
23 m_ResultReplacesIngredient[0] = 0; // (value) == -1 means do nothing; a value >= 0 means this result will transfer item propertiesvariables, attachments etc.. from an ingredient value
24
25 }
26
27 override void Do(ItemBase ingredients[], PlayerBase player,array<ItemBase> results, float specialty_weight)//gets called upon recipe's completion
28 {
29 ItemBase deadChicken = ingredients[0];
30 Bone resultBones = Bone.Cast(results[0]);
31 ItemBase result;
32
33 int steakCount = Math.RandomIntInclusive(2,4);
34 for (int i=0; i < steakCount; ++i)
35 {
36 result = ItemBase.Cast(player.SpawnEntityOnGroundRaycastDispersed("ChickenBreastMeat"));
37 MiscGameplayFunctions.TransferItemProperties(deadChicken, result);
38 result.SetQuantityNormalized(Math.RandomFloatInclusive(0.8,1));
39 }
40
41 result = ItemBase.Cast(player.SpawnEntityOnGroundRaycastDispersed("ChickenFeather"));
42 MiscGameplayFunctions.TransferItemProperties(deadChicken, result);
43 result.SetQuantity(Math.RandomIntInclusive(5,15));
44
45 if (resultBones)
46 {
47 MiscGameplayFunctions.TransferItemProperties(deadChicken, resultBones);
48 resultBones.SetQuantity(Math.RandomIntInclusive(2,5));
49 }
50
51 SetBloodyHands(ingredients, player);
52 }
53}
Definition enmath.c:7
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
override Widget Init()
Definition dayzgame.c:127
void SetBloodyHands(PlayerBase player, bool show)
int m_ResultReplacesIngredient[MAXIMUM_RESULTS]
Definition recipebase.c:62
int m_ResultToInventory[MAXIMUM_RESULTS]
Definition recipebase.c:59
float m_IngredientAddHealth[MAX_NUMBER_OF_INGREDIENTS]
Definition recipebase.c:49
float m_IngredientSetHealth[MAX_NUMBER_OF_INGREDIENTS]
Definition recipebase.c:51
int m_ResultInheritsHealth[MAXIMUM_RESULTS]
Definition recipebase.c:60
void AddResult(string item)
Definition recipebase.c:198
int m_ResultInheritsColor[MAXIMUM_RESULTS]
Definition recipebase.c:61
float m_ResultSetQuantity[MAXIMUM_RESULTS]
Definition recipebase.c:56
bool m_ResultSetFullQuantity[MAXIMUM_RESULTS]
Definition recipebase.c:55
void InsertIngredient(int index, string ingredient, DayZPlayerConstants uid=BASE_CRAFT_ANIMATION_ID, bool showItem=false)
Definition recipebase.c:159
float m_ResultSetHealth[MAXIMUM_RESULTS]
Definition recipebase.c:57
float m_IngredientAddQuantity[MAX_NUMBER_OF_INGREDIENTS]
Definition recipebase.c:50
bool m_IngredientDestroy[MAX_NUMBER_OF_INGREDIENTS]
Definition recipebase.c:52
void Do(PlayerBase player)