./cmp_mission.lua

  1. --Global Mission Sequence Table... 
  2. Cmp_mission_seq = {} 
  3. local No_respect 
  4.  
  5. --Check if its a no respect mission 
  6. if (mission_is_active("m00") == true) or (mission_is_active("m01") == true) or (mission_is_active("m02") == true) then 
  7. 	No_respect = true 
  8. else 
  9. 	No_respect = false 
  10. end 
  11.  
  12. function cmp_mission_init() 
  13. 	Cmp_specific_doc = vint_document_find("cmp_mission") 
  14.  
  15. 	--Populate data... 
  16. 	if No_respect == true then 
  17. 		vint_dataresponder_request("cmp_mission_success", "cmp_mission_populate_no_respect", 0) 
  18. 	else 
  19. 		vint_dataresponder_request("cmp_mission_success", "cmp_mission_populate", 0) 
  20. 	end 
  21. 	--Set sequence... 
  22. 	cmp_common_screen_set_data(Cmp_mission_seq) 
  23. end 
  24.  
  25. function cmp_mission_cleanup() 
  26. --	if true then 
  27. --		debug_print("vint", "cleanup cmp_mission_cleanup()\n") 
  28. --	end 
  29. end 
  30.  
  31. function cmp_mission_first_frame() 
  32. 	local h = vint_object_find("background_force_black", 0, Cmp_common_doc) 
  33. 	vint_object_destroy(h) 
  34. 	--	vint_set_property(h, "visible", true) 
  35.  
  36. 	local h = vint_object_find("background_base", 0, Cmp_common_doc) 
  37. 	vint_set_property(h, "background", Cmp_use_as_background)	 
  38. 	 
  39. end 
  40.  
  41. ------------------------------------------------------------- 
  42. --Populates the script from the dataresponder... 
  43. ------------------------------------------------------------- 
  44.  
  45. -- @param	mission_name						This is the mission name... "DEATH AT SMILING JACKS" 
  46. -- @param	layout								"Left" or "Right" formats 
  47. -- @param	num_unlockables_to_follow		# of unlockables in the mission flow... ? not sure if this is relevant at this stage... I have no problem doing the unlockable data_responder once and logging all the data from the game. 
  48.  
  49. -- @param	cash_reward							This is the cash reward... "4000" 
  50. -- @param	cash_multiplier					Multiplier for cash			"4.0" 
  51. -- @param	cash_reward_inc_multiplier		Cash_reward with the multiplier... "12000" (This could be calculated internally) 
  52.  
  53. -- @param	respect_points_old				Respect points before... 
  54. -- @param	respect_pct_old					Respect percentage before... 
  55. -- @param	respect_level_old					Respect level before... 
  56.  
  57. -- @param	respect_points_new				Respect points after... 
  58. -- @param	respect_pct_new					Respect percent after... 
  59. -- @param	respect_level_new					Respect level after... 
  60.  
  61. -- @param	respect_multiplier				Respect multiplier "2.0" 
  62. -- @param	respect_points_multiplier		Respect points after multiplier 
  63. -- @param	respect_pct_multiplier			Respect percent after multiplier 
  64. -- @param	respect_level_multiplier		Respect level after multiplier 
  65.  
  66. function cmp_mission_populate(unlockables_to_follow, mission_internal_name, mission_name, layout, cash_reward, cash_multiplier, cash_reward_inc_multiplier, respect_points_old, respect_pct_old, respect_level_old, respect_points_new, respect_pct_new, respect_level_new, respect_multiplier, respect_points_multiplier, respect_pct_multiplier, respect_level_multiplier) 
  67.  
  68. --[[ 
  69. 	debug_print("vint", "unlockable# = " 						.. var_to_string(unlockables_to_follow).."\n") 
  70. 	debug_print("vint", "mission number = " 					.. var_to_string(mission_number).."\n") 
  71. 	debug_print("vint", "layout number = " 					.. var_to_string(layout).."\n") 
  72. 	debug_print("vint", "cash_reward" 							.. var_to_string(cash_reward).."\n") 
  73. 	debug_print("vint", "cash_multiplier = " 					.. var_to_string(cash_multiplier).."\n") 
  74. 	debug_print("vint", "cash_reward_inc_multiplier = " 	.. var_to_string(cash_reward_inc_multiplier).."\n") 
  75. 	debug_print("vint", "respect_points_old = " 				.. var_to_string(respect_points_old).."\n") 
  76. 	debug_print("vint", "respect_pct_old = " 					.. var_to_string(respect_pct_old).."\n") 
  77. 	debug_print("vint", "respect_level_old = " 				.. var_to_string(respect_level_old).."\n") 
  78. 	debug_print("vint", "respect points_new = " 				.. var_to_string(respect_points_new).."\n") 
  79. 	debug_print("vint", "respect_pct_new = " 					.. var_to_string(respect_pct_new).."\n") 
  80. 	debug_print("vint", "respect_level_new = " 				.. var_to_string(respect_level_new).."\n") 
  81. 	debug_print("vint", "respect_multiplier = " 				.. var_to_string(respect_multiplier).."\n") 
  82. 	debug_print("vint", "respect_points_multiplier = " 	.. var_to_string(respect_points_multiplier).."\n") 
  83. 	debug_print("vint", "respect_pct_multiplier = " 		.. var_to_string(respect_pct_multiplier).."\n") 
  84. 	debug_print("vint", "respect_level_multiplier = " 		.. var_to_string(respect_level_multiplier).."\n") 
  85. 	]] 
  86.  
  87. 	Cmp_mission_seq[1].type = CMP_SCREEN_TITLE_INDEX 
  88. 	Cmp_mission_seq[1].title_string = mission_name 
  89. 	Cmp_mission_seq[1].mission_internal_name = mission_internal_name 
  90.  
  91. 	Cmp_mission_seq[2].type = CMP_SCREEN_CASH_INDEX 
  92. 	Cmp_mission_seq[2].cash_reward = cash_reward 
  93. 	Cmp_mission_seq[2].cash_multiplier = cash_multiplier 
  94. 	Cmp_mission_seq[2].cash_reward_inc_multiplier = cash_reward_inc_multiplier 
  95.  
  96. 	Cmp_mission_seq[3].respect_points_old 			= respect_points_old 			 
  97. 	Cmp_mission_seq[3].respect_pct_old				= respect_pct_old				 
  98. 	Cmp_mission_seq[3].respect_level_old			= respect_level_old			 
  99. 	Cmp_mission_seq[3].respect_points_new			= respect_points_new			 
  100. 	Cmp_mission_seq[3].respect_pct_new				= respect_pct_new				 
  101. 	Cmp_mission_seq[3].respect_level_new			= respect_level_new			 
  102. 	Cmp_mission_seq[3].respect_multiplier			= respect_multiplier			 
  103. 	Cmp_mission_seq[3].respect_points_multiplier	= respect_points_multiplier	 
  104. 	Cmp_mission_seq[3].respect_pct_multiplier		= respect_pct_multiplier		 
  105. 	Cmp_mission_seq[3].respect_level_multiplier	= respect_level_multiplier	 
  106. 	 
  107. 	if unlockables_to_follow > 0 then 
  108. 		Cmp_mission_seq[4] = {} 
  109. 		Cmp_mission_seq[4].type = CMP_SCREEN_REWARD_INDEX 
  110. 		Cmp_mission_seq[4].rewards_count = unlockables_to_follow 
  111. 	else  
  112. 		Cmp_mission_seq[4] = Cmp_mission_seq[5] 
  113. 		Cmp_mission_seq[5] = nil 
  114. 	end 
  115. end 
  116.  
  117. function cmp_mission_populate_no_respect(unlockables_to_follow, mission_internal_name, mission_name, layout, cash_reward, cash_multiplier, cash_reward_inc_multiplier, respect_points_old, respect_pct_old, respect_level_old, respect_points_new, respect_pct_new, respect_level_new, respect_multiplier, respect_points_multiplier, respect_pct_multiplier, respect_level_multiplier) 
  118.  
  119. --[[ 
  120. 	debug_print("vint", "unlockable# = " 						.. var_to_string(unlockables_to_follow).."\n") 
  121. 	debug_print("vint", "mission number = " 					.. var_to_string(mission_number).."\n") 
  122. 	debug_print("vint", "layout number = " 					.. var_to_string(layout).."\n") 
  123. 	debug_print("vint", "cash_reward" 							.. var_to_string(cash_reward).."\n") 
  124. 	debug_print("vint", "cash_multiplier = " 					.. var_to_string(cash_multiplier).."\n") 
  125. 	debug_print("vint", "cash_reward_inc_multiplier = " 	.. var_to_string(cash_reward_inc_multiplier).."\n") 
  126. 	debug_print("vint", "respect_points_old = " 				.. var_to_string(respect_points_old).."\n") 
  127. 	debug_print("vint", "respect_pct_old = " 					.. var_to_string(respect_pct_old).."\n") 
  128. 	debug_print("vint", "respect_level_old = " 				.. var_to_string(respect_level_old).."\n") 
  129. 	debug_print("vint", "respect points_new = " 				.. var_to_string(respect_points_new).."\n") 
  130. 	debug_print("vint", "respect_pct_new = " 					.. var_to_string(respect_pct_new).."\n") 
  131. 	debug_print("vint", "respect_level_new = " 				.. var_to_string(respect_level_new).."\n") 
  132. 	debug_print("vint", "respect_multiplier = " 				.. var_to_string(respect_multiplier).."\n") 
  133. 	debug_print("vint", "respect_points_multiplier = " 	.. var_to_string(respect_points_multiplier).."\n") 
  134. 	debug_print("vint", "respect_pct_multiplier = " 		.. var_to_string(respect_pct_multiplier).."\n") 
  135. 	debug_print("vint", "respect_level_multiplier = " 		.. var_to_string(respect_level_multiplier).."\n") 
  136. 	]] 
  137.  
  138. 	Cmp_mission_seq[1].type = CMP_SCREEN_TITLE_INDEX 
  139. 	Cmp_mission_seq[1].title_string = mission_name 
  140. 	Cmp_mission_seq[1].mission_internal_name = mission_internal_name 
  141.  
  142. 	Cmp_mission_seq[2].type = CMP_SCREEN_CASH_INDEX 
  143. 	Cmp_mission_seq[2].cash_reward = cash_reward 
  144. 	Cmp_mission_seq[2].cash_multiplier = cash_multiplier 
  145. 	Cmp_mission_seq[2].cash_reward_inc_multiplier = cash_reward_inc_multiplier 
  146.  
  147. 	if unlockables_to_follow > 0 then 
  148. 		Cmp_mission_seq[3] = {} 
  149. 		Cmp_mission_seq[3].type = CMP_SCREEN_REWARD_INDEX 
  150. 		Cmp_mission_seq[3].rewards_count = unlockables_to_follow 
  151. 	else  
  152. 		Cmp_mission_seq[3] = Cmp_mission_seq[4] 
  153. 		Cmp_mission_seq[4] = nil 
  154. 	end 
  155. end 
  156.  
  157. if No_respect == true then 
  158. 	Cmp_mission_seq = { 
  159. 		[1] = { 
  160. 			type 				= CMP_SCREEN_TITLE_INDEX, 
  161. 			title_string 	= "DEATH AT SMILING JACKS", 
  162. 			on_start			= cmp_mission_first_frame, 
  163. 		}, 
  164. 		[2] = { 
  165. 			type = CMP_SCREEN_CASH_INDEX, 
  166. 			cash_reward						= 20000, 
  167. 			cash_multiplier 				= 45, 
  168. 			cash_reward_inc_multiplier = 38000, 
  169. 			on_start = nil, 
  170. 		}, 
  171. 		[3] = { 
  172. 			type = CMP_SCREEN_REWARD_INDEX 
  173. 		}, 
  174. 		[4] = { 
  175. 			type = CMP_SCREEN_COOP_WAIT_INDEX, 
  176. 		}, 
  177. 	} 
  178. else 
  179. 	Cmp_mission_seq = { 
  180. 		[1] = { 
  181. 			type 				= CMP_SCREEN_TITLE_INDEX, 
  182. 			title_string 	= "DEATH AT SMILING JACKS", 
  183. 			on_start			= cmp_mission_first_frame, 
  184. 		}, 
  185. 		[2] = { 
  186. 			type = CMP_SCREEN_CASH_INDEX, 
  187. 			cash_reward						= 20000, 
  188. 			cash_multiplier 				= 45, 
  189. 			cash_reward_inc_multiplier = 38000, 
  190. 			on_start = nil, 
  191. 		}, 
  192. 		[3] = { 
  193. 			type = CMP_SCREEN_RESPECT_INDEX, 
  194. 			on_start = nil, 
  195. 			respect_points_old			= 200, 
  196. 			respect_pct_old				= .4, 
  197. 			respect_level_old				=	2, 
  198. 			 
  199. 			respect_points_new			= 2000, 
  200. 			respect_pct_new				= .5, 
  201. 			respect_level_new				= 3, 
  202. 			respect_multiplier			= 40, 
  203. 			 
  204. 			respect_points_multiplier	= 2000,	 
  205. 			respect_pct_multiplier		= .5, 
  206. 			respect_level_multiplier	=5,	 
  207. 		}, 
  208. 		[4] = { 
  209. 			type = CMP_SCREEN_REWARD_INDEX 
  210. 		}, 
  211. 		[5] = { 
  212. 			type = CMP_SCREEN_COOP_WAIT_INDEX, 
  213. 		}, 
  214. 	} 
  215. end