Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
decraftwoodencrate.c
Go to the documentation of this file.
1class DeCraftWoodenCrate extends RecipeBase
2{
3 override void Init()
4 {
5 m_Name = "#STR_breakdown0";
6 m_IsInstaRecipe = false;//should this recipe be performed instantly without animation
7 m_AnimationLength = 1;//animation length in relative time units
8 m_Specialty = 0.02;// value > 0 for roughness, value < 0 for precision
9
10 //conditions
11 m_MinDamageIngredient[0] = -1;//-1 = disable check
12 m_MaxDamageIngredient[0] = 3;//-1 = disable check
13
14 m_MinQuantityIngredient[0] = -1;//-1 = disable check
15 m_MaxQuantityIngredient[0] = -1;//-1 = disable check
16
17 m_MinDamageIngredient[1] = -1;//-1 = disable check
18 m_MaxDamageIngredient[1] = 3;//-1 = disable check
19
20 m_MinQuantityIngredient[1] = -1;//-1 = disable check
21 m_MaxQuantityIngredient[1] = -1;//-1 = disable check
22 //----------------------------------------------------------------------------------------------------------------------
23
24 //INGREDIENTS
25 //ingredient 1
26 InsertIngredient(0,"WoodenCrate");//you can insert multiple ingredients this way
27
28 m_IngredientAddHealth[0] = 0;// 0 = do nothing
29 m_IngredientSetHealth[0] = -1; // -1 = do nothing
30 m_IngredientAddQuantity[0] = 0;// 0 = do nothing
31 m_IngredientDestroy[0] = true;//true = destroy, false = do nothing
32 m_IngredientUseSoftSkills[0] = false;// set 'true' to allow modification of the values by softskills on this ingredient
33
34 //ingredient 2
35 InsertIngredient(1,"Crowbar");
36 InsertIngredient(1,"WoodAxe");
37 InsertIngredient(1,"Hatchet");
38 InsertIngredient(1,"FirefighterAxe");
39
40 m_IngredientAddHealth[1] = -20;// 0 = do nothing
41 m_IngredientSetHealth[1] = -1; // -1 = do nothing
42 m_IngredientAddQuantity[1] = 0;// 0 = do nothing
43 m_IngredientDestroy[1] = false;// false = do nothing
44 m_IngredientUseSoftSkills[1] = true;// set 'true' to allow modification of the values by softskills on this ingredient
45
46 //----------------------------------------------------------------------------------------------------------------------
47
48 //result1
49 AddResult("WoodenPlank");//add results here
50
51 m_ResultSetFullQuantity[0] = false;//true = set full quantity, false = do nothing
52 m_ResultSetQuantity[0] = 2;//-1 = do nothing
53 m_ResultSetHealth[0] = -1;//-1 = do nothing
54 m_ResultInheritsHealth[0] = 1;// (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)
55 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)
56 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)
57 m_ResultUseSoftSkills[0] = false;// set 'true' to allow modification of the values by softskills on this result
58 m_ResultReplacesIngredient[0] = -1;// value == -1 means do nothing; a value >= 0 means this result will transfer item propertiesvariables, attachments etc.. from an ingredient value
59
60 //result2
61 AddResult("Nail");//add results here
62
63 m_ResultSetFullQuantity[1] = false;//true = set full quantity, false = do nothing
64 m_ResultSetQuantity[1] = 6;// -1 = do nothing
65 m_ResultSetHealth[1] = -1;// -1 = do nothing
66 m_ResultInheritsHealth[1] = 1;// (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)
67 m_ResultInheritsColor[1] = -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)
68 m_ResultToInventory[1] = -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)
69 m_ResultUseSoftSkills[1] = false;// set 'true' to allow modification of the values by softskills on this result
70 m_ResultReplacesIngredient[1] = -1;// value == -1 means do nothing; a value >= 0 means this result will transfer item propertiesvariables, attachments etc.. from an ingredient value
71 //----------------------------------------------------------------------------------------------------------------------
72 }
73
74 override bool CanDo(ItemBase ingredients[], PlayerBase player)//final check for recipe's validity
75 {
76 ItemBase crate;
77 Class.CastTo(crate, ingredients[0]);
78
79 if ( crate.GetInventory().CountInventory() > 1 )
80 return false;
81
82 return true;
83 }
84
85 override void Do(ItemBase ingredients[], PlayerBase player,array<ItemBase> results, float specialty_weight)//gets called upon recipe's completion
86 {
87 ItemBase crate;
88 Class.CastTo(crate, ingredients[0]);
89 int hp = crate.GetHealthLevel("");
90
91 switch ( hp )
92 {
93 case GameConstants.STATE_PRISTINE:
94 results[0].SetQuantity(Math.RandomIntInclusive( 6, 8 ));
95 results[0].SetHealth( results[0].GetMaxHealth() * Math.RandomFloat( 0.6, 0.8 ));
96 results[1].SetQuantity(Math.RandomIntInclusive( 12, 16 ));
97 results[1].SetHealth( results[1].GetMaxHealth() * Math.RandomFloat( 0.6, 0.8 ));
98 break;
99
100 case GameConstants.STATE_WORN:
101 results[0].SetQuantity(Math.RandomIntInclusive( 5, 7 ));
102 results[0].SetHealth( results[0].GetMaxHealth() * Math.RandomFloat( 0.5, 0.8 ));
103 results[1].SetQuantity(Math.RandomIntInclusive( 9, 13 ));
104 results[1].SetHealth( results[1].GetMaxHealth() * Math.RandomFloat( 0.5, 0.8 ));
105 break;
106
107 case GameConstants.STATE_DAMAGED:
108 results[0].SetQuantity(Math.RandomIntInclusive( 4, 6 ));
109 results[0].SetHealth( results[0].GetMaxHealth() * Math.RandomFloat( 0.3, 0.6 ));
110 results[1].SetQuantity(Math.RandomIntInclusive( 6, 10 ));
111 results[1].SetHealth( results[1].GetMaxHealth() * Math.RandomFloat( 0.3, 0.6 ));
112 break;
113
114 case GameConstants.STATE_BADLY_DAMAGED:
115 results[0].SetQuantity(Math.RandomIntInclusive( 3, 5 ));
116 results[0].SetHealth( results[0].GetMaxHealth() * Math.RandomFloat( 0.1, 0.3 ));
117 results[1].SetQuantity(Math.RandomIntInclusive( 3, 7 ));
118 results[1].SetHealth( results[1].GetMaxHealth() * Math.RandomFloat( 0.1, 0.3 ));
119 break;
120
121 //unnescessary? We do not allow recipe crafting with ruined items?
122 case GameConstants.STATE_RUINED:
123 results[0].SetQuantity(Math.RandomIntInclusive( 1, 2 ));
124 results[0].SetHealth( results[0].GetMaxHealth() * Math.RandomFloat( 0.05, 0.2 ));
125 results[1].SetQuantity(Math.RandomIntInclusive( 1, 4 ));
126 results[1].SetHealth( results[1].GetMaxHealth() * Math.RandomFloat( 0.05, 0.2 ));
127 break;
128
129 default:
130 results[0].SetQuantity(Math.RandomIntInclusive( 1, 2 ));
131 results[0].SetHealth( results[0].GetMaxHealth() * Math.RandomFloat( 0.05, 0.2 ));
132 results[1].SetQuantity(Math.RandomIntInclusive( 1, 4 ));
133 results[1].SetHealth( results[1].GetMaxHealth() * Math.RandomFloat( 0.05, 0.2 ));
134 break;
135 }
136 }
137};
Super root of all classes in Enforce script.
Definition enscript.c:11
Definition enmath.c:7
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
override Widget Init()
Definition dayzgame.c:127
int m_ResultReplacesIngredient[MAXIMUM_RESULTS]
Definition recipebase.c:62
int m_ResultToInventory[MAXIMUM_RESULTS]
Definition recipebase.c:59
bool m_IngredientUseSoftSkills[MAX_NUMBER_OF_INGREDIENTS]
Definition recipebase.c:48
float m_IngredientAddHealth[MAX_NUMBER_OF_INGREDIENTS]
Definition recipebase.c:49
bool m_IsInstaRecipe
Definition recipebase.c:40
float m_IngredientSetHealth[MAX_NUMBER_OF_INGREDIENTS]
Definition recipebase.c:51
int m_ResultInheritsHealth[MAXIMUM_RESULTS]
Definition recipebase.c:60
float m_Specialty
Definition recipebase.c:39
void AddResult(string item)
Definition recipebase.c:198
int m_ResultInheritsColor[MAXIMUM_RESULTS]
Definition recipebase.c:61
float m_MinDamageIngredient[MAX_NUMBER_OF_INGREDIENTS]
Definition recipebase.c:45
float m_MaxQuantityIngredient[MAX_NUMBER_OF_INGREDIENTS]
Definition recipebase.c:44
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_AnimationLength
Definition recipebase.c:38
float m_MaxDamageIngredient[MAX_NUMBER_OF_INGREDIENTS]
Definition recipebase.c:46
float m_IngredientAddQuantity[MAX_NUMBER_OF_INGREDIENTS]
Definition recipebase.c:50
float m_MinQuantityIngredient[MAX_NUMBER_OF_INGREDIENTS]
Definition recipebase.c:43
bool m_IngredientDestroy[MAX_NUMBER_OF_INGREDIENTS]
Definition recipebase.c:52
bool m_ResultUseSoftSkills[MAXIMUM_RESULTS]
Definition recipebase.c:63
bool CanDo(PlayerBase player, TStringVectorMap surfaceTypes)
void Do(PlayerBase player)
class SyncedValue m_Name