DayZ 1.27
DayZ Explorer by KGB
 
Загрузка...
Поиск...
Не найдено
DeCraftWoodenCrate.c
См. документацию.
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 {
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
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
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
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?
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.
Определения EnScript.c:11
Определения constants.c:659
Определения InventoryItem.c:731
Определения EnMath.c:7
Определения PlayerBaseClient.c:2
bool m_IngredientDestroy[MAX_NUMBER_OF_INGREDIENTS]
Определения RecipeBase.c:36
int m_ResultToInventory[MAXIMUM_RESULTS]
Определения RecipeBase.c:43
override bool CanDo(ItemBase ingredients[], PlayerBase player)
Определения DeCraftWoodenCrate.c:74
bool m_IngredientUseSoftSkills[MAX_NUMBER_OF_INGREDIENTS]
Определения RecipeBase.c:32
string m_Name
Определения RecipeBase.c:17
float m_ResultSetHealth[MAXIMUM_RESULTS]
Определения RecipeBase.c:41
float m_ResultSetQuantity[MAXIMUM_RESULTS]
Определения RecipeBase.c:40
bool m_ResultSetFullQuantity[MAXIMUM_RESULTS]
Определения RecipeBase.c:39
bool m_IsInstaRecipe
Определения RecipeBase.c:24
override void Do(ItemBase ingredients[], PlayerBase player, array< ItemBase > results, float specialty_weight)
Определения DeCraftWoodenCrate.c:85
void AddResult(string item)
Определения RecipeBase.c:174
bool m_ResultUseSoftSkills[MAXIMUM_RESULTS]
Определения RecipeBase.c:47
int m_ResultReplacesIngredient[MAXIMUM_RESULTS]
Определения RecipeBase.c:46
float m_IngredientAddHealth[MAX_NUMBER_OF_INGREDIENTS]
Определения RecipeBase.c:33
float m_Specialty
Определения RecipeBase.c:23
float m_IngredientSetHealth[MAX_NUMBER_OF_INGREDIENTS]
Определения RecipeBase.c:35
int m_ResultInheritsHealth[MAXIMUM_RESULTS]
Определения RecipeBase.c:44
float m_MinQuantityIngredient[MAX_NUMBER_OF_INGREDIENTS]
Определения RecipeBase.c:27
float m_AnimationLength
Определения RecipeBase.c:22
override void Init()
Определения DeCraftWoodenCrate.c:3
int m_ResultInheritsColor[MAXIMUM_RESULTS]
Определения RecipeBase.c:45
float m_MaxQuantityIngredient[MAX_NUMBER_OF_INGREDIENTS]
Определения RecipeBase.c:28
float m_IngredientAddQuantity[MAX_NUMBER_OF_INGREDIENTS]
Определения RecipeBase.c:34
float m_MinDamageIngredient[MAX_NUMBER_OF_INGREDIENTS]
Определения RecipeBase.c:29
float m_MaxDamageIngredient[MAX_NUMBER_OF_INGREDIENTS]
Определения RecipeBase.c:30
void InsertIngredient(int index, string ingredient, DayZPlayerConstants uid=DayZPlayerConstants.CMD_ACTIONFB_CRAFTING)
Определения RecipeBase.c:143
Определения RecipeBase.c:6
Result for an object found in CGame.IsBoxCollidingGeometryProxy.
static proto bool CastTo(out Class to, Class from)
Try to safely down-cast base class to child class.
const int STATE_RUINED
Определения constants.c:846
const int STATE_WORN
Определения constants.c:849
const int STATE_DAMAGED
Определения constants.c:848
const int STATE_BADLY_DAMAGED
Определения constants.c:847
const int STATE_PRISTINE
Определения constants.c:850
static proto float RandomFloat(float min, float max)
Returns a random float number between and min[inclusive] and max[exclusive].
static int RandomIntInclusive(int min, int max)
Returns a random int number between and min [inclusive] and max [inclusive].
Определения EnMath.c:54