OSP Code SP [WB] Random treasure hunt

Users who are viewing this thread

Cernunos

Banned
Hi all,
I finally ended this random treasure hunt.
Difficulty: intermediate. Do not ask me advice if you don't know how to add OSPs, please, there are tuts for this already.

What it does:
I added a treasure map kind of book item. How you add it to the game is your call, modders.

Read this map. Once you are done, it will start a treasure hunt quest.
You have to have the map in inv. If the player lose the map, a new one will allow him to keep going, until failure or success.
Access this map from your camp game menu.

Read the map. Then, 3 things will eventually randomly happen:
1- Next step: you will gain indication of a next step. Go close to the town/village/castle (TVC) indicated, and read again.
2- Quest failure. It will remove the map, reset the quest, and give XPs to the player. The longer the chain, the more XPs (with a little int check, this is rigale after all ^^).
3- Quest end. It will give you a last TVC, and a distance. Try to get between the current TVC and the final TVC, at the % indicated. Use your map for guidance.  If you are in the right spot, the treasure will appear. Quest is blocked until you use this treasure spot. Basic reward is gold and XPs.

If you are unlucky anough that the place to search is in impassable terrain (sea, mountain), I added a menu to reset the quest. A heartbreaker, but player will still gain XPs for its efforts.

Chain is 8 TVC max. Then, the quest will end, and you will find the treasure.

I am not a good coder, so if you have better coding practice in my mess, I would appreciate any lesson received :smile:
This is Beta. I thouroughly checked, however, there might be some glitches. Please report them so I can release a proper OSP.

Please use in your mods if you want, I would be honored. Just give some tiny bits of credits. ^^

As for credits, thanks to The_dragon for some Scripting amelioration :smile:
Thanks also to the french Forumers, they are mostly the only ones supporting me with Rigale
http://forums.taleworlds.com/index.php/board,209.0.html  those days. Merci les gens :wink:, ce système vous est dédié.
I dedicate this system to the french MB community, actually ^^

Now for the codes:
module_quests
Code:
  #rigale treasure hunt
   ("rigal_treasure_hunt_1", "Recover a lost treasure.", 0,
  "{!}Read your map to try to get closer to the treasure you are hunting."
  ),

module_party_templates
Code:
("rigale_treasure_spot","An X marks the spot",icon_bandit_lair|pf_is_static,0, fac_neutral,merchant_personality,[]),

module_items
Code:
["book_treasure_map","Treasure map", [("book_open",0)], itp_merchandise|itp_type_book, 0, 1000,weight(2)|abundance(10),imodbits_none],

module_constants
Code:
#rigale treasure
slot_th_tvc_1 = 400
slot_th_tvc_2 = 401
slot_th_tvc_3 = 402
slot_th_tvc_4 = 403
slot_th_tvc_5 = 404
slot_th_tvc_6 = 405
slot_th_tvc_7 = 406
slot_th_tvc_8 = 407

slot_final_th_search_details = 408
slot_th_treasure_found = 409

module_game_menus
Add at the end of the book selection game menu
Code:
      ("action_read_book_9",[(player_has_item, "itm_book_treasure_map"),
                             (item_slot_eq, "itm_book_treasure_map", slot_item_book_read, 0),
                             (str_store_item_name, s1, "itm_book_treasure_map"),
                             ],"{s1}.",
       [(assign, "$temp", "itm_book_treasure_map"),
        (jump_to_menu, "mnu_camp_action_read_book_start"),		
		
        ]
       ),

module_game_menus
Add in some camp menu.
Code:
       ("camp_read_treasure_map",
	   [ 
		(player_has_item,"itm_book_treasure_map"),
		(check_quest_active,"qst_rigal_treasure_hunt_1"),
	   
	   ], 
		"I want to read my treasure map.",
       [
   
	   (try_begin), #treasure found. You have to check to keep going   
			(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_treasure_found,1),
			(display_message,"@Treasure has been found. You have to dig it now."),

	   (else_try), #initialize quest
	   
	   
	   
	   
			(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_1,0),
			
			(store_random_in_range,":starting_town",towns_begin,towns_end),
			(quest_set_slot,"qst_rigal_treasure_hunt_1",slot_th_tvc_1,":starting_town"),
			(str_store_party_name,s5,":starting_town"),
			(display_message,"@You must first travel to the town of {s5}. Use your map again when you are near it."),
			(add_quest_note_from_sreg,"qst_rigal_treasure_hunt_1",1,"@You must first travel to the town of {s5}. Use your map again when you are near it.", 0),
		(else_try),
			(try_begin),
				(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_1,0),(assign,":slot_to_change",slot_th_tvc_1),
			(else_try),	
				(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_2,0),(assign,":slot_to_change",slot_th_tvc_2),(assign,":current_tvc",slot_th_tvc_1),
			(else_try),									
				(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_3,0),(assign,":slot_to_change",slot_th_tvc_3),(assign,":current_tvc",slot_th_tvc_2),(assign,":treasure_hunt_final",slot_th_tvc_1),
			(else_try),										
				(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_4,0),(assign,":slot_to_change",slot_th_tvc_4),(assign,":current_tvc",slot_th_tvc_3),(assign,":treasure_hunt_final",slot_th_tvc_2),
			(else_try),										
				(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_5,0),(assign,":slot_to_change",slot_th_tvc_5),(assign,":current_tvc",slot_th_tvc_4),(assign,":treasure_hunt_final",slot_th_tvc_3),
			(else_try),										
				(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_6,0),(assign,":slot_to_change",slot_th_tvc_6),(assign,":current_tvc",slot_th_tvc_5),(assign,":treasure_hunt_final",slot_th_tvc_4),
			(else_try),										
				(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_7,0),(assign,":slot_to_change",slot_th_tvc_7),(assign,":current_tvc",slot_th_tvc_6),(assign,":treasure_hunt_final",slot_th_tvc_5),
			(else_try),										
				(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_8,0),(assign,":slot_to_change",slot_th_tvc_8),(assign,":current_tvc",slot_th_tvc_7),(assign,":treasure_hunt_final",slot_th_tvc_6),
			(else_try),	
				(assign,":current_tvc",slot_th_tvc_8),(assign,":treasure_hunt_final",slot_th_tvc_7),
			(try_end),		

			(quest_get_slot,":current_tvc_as_beacon","qst_rigal_treasure_hunt_1",":current_tvc"),
			(store_distance_to_party_from_party, ":distance", ":current_tvc_as_beacon", "p_main_party"),
			(str_store_party_name,s5,":current_tvc_as_beacon"),			
			(quest_get_slot,":last_treasure_search_distance","qst_rigal_treasure_hunt_1",slot_final_th_search_details),			

			(try_begin),
				(gt,":last_treasure_search_distance",0),
				(quest_get_slot,":last_treasure_search_tvc","qst_rigal_treasure_hunt_1",":treasure_hunt_final"),
				(quest_get_slot,":last_treasure_search_distance","qst_rigal_treasure_hunt_1",slot_final_th_search_details),
				
				(store_distance_to_party_from_party, ":distance_party_to_last_tvc", ":current_tvc_as_beacon", "p_main_party"),
				(store_distance_to_party_from_party, ":distance_party_to_final_tvc", ":last_treasure_search_tvc", "p_main_party"),		
				(store_distance_to_party_from_party, ":total_distance_between_last_two_tvc",":last_treasure_search_tvc", ":current_tvc_as_beacon"),				

				(assign,":percentage_distance_last_two_tvc",":total_distance_between_last_two_tvc"),
				(val_mul,":percentage_distance_last_two_tvc",":last_treasure_search_distance"),
				(val_div,":percentage_distance_last_two_tvc",100),			
				(store_sub,":remaining_distance_to_final_tvc",":total_distance_between_last_two_tvc",":percentage_distance_last_two_tvc"),				
				(store_sub,":remaining_distance_to_last_tvc",":total_distance_between_last_two_tvc",":remaining_distance_to_final_tvc"),				
				
				
				#(store_distance_to_party_from_party, ":party_distance_to_last_tvc",":last_treasure_search_tvc", "p_main_party"),				

				#(store_distance_to_party_from_party, ":distance", ":current_tvc_as_beacon", "p_main_party"),					







				
				(assign,reg51,":total_distance_between_last_two_tvc"),
				(assign,reg52,":distance_party_to_last_tvc"),
				(assign,reg53,":distance_party_to_final_tvc"),
				(assign,reg54,":remaining_distance_to_final_tvc"),
				(assign,reg55,":remaining_distance_to_last_tvc"),				
				
				
				(str_store_party_name,s5,":current_tvc_as_beacon"),					
				(str_store_party_name,s4,":last_treasure_search_tvc"),

				(display_message,"@Distance between {s4} and {s5} is {reg51}, ^and beetwen party and {s5} is {reg52}, ^between party and {s4} is {reg53}, ^between treasure and {s4} is {reg54}, ^between treasure and {s5} is {reg55}"),
							
				
				(try_begin),
					(gt,":distance_party_to_last_tvc",":remaining_distance_to_last_tvc"),
					(display_message,"@You are too far from {s5}."),
					(add_quest_note_from_sreg,"qst_rigal_treasure_hunt_1",3,"@Treasure final search. You are too far from {s5}", 0),
				(try_end),
				(try_begin),
					(gt,":distance_party_to_final_tvc",":remaining_distance_to_final_tvc"),
					(display_message,"@You are too far from {s4}."),
					(add_quest_note_from_sreg,"qst_rigal_treasure_hunt_1",4,"@Treasure final search. You are too far from {s4}", 0),					
				(try_end),	
				(try_begin),
					(eq,":distance_party_to_last_tvc",":remaining_distance_to_last_tvc"),
					(display_message,"@You are at the good distance from {s5}."),
					(add_quest_note_from_sreg,"qst_rigal_treasure_hunt_1",3,"@Treasure final search. You are at the good distance from {s5}", 0),
				(try_end),
				(try_begin),
					(eq,":distance_party_to_final_tvc",":remaining_distance_to_final_tvc"),
					(display_message,"@You are at the good distance from {s4}."),
					(add_quest_note_from_sreg,"qst_rigal_treasure_hunt_1",4,"@Treasure final search. Good distance from {s4}", 0),					
				(try_end),
				(try_begin),
					(lt,":distance_party_to_last_tvc",":remaining_distance_to_last_tvc"),
					(display_message,"@You are too close from {s5}."),
					(add_quest_note_from_sreg,"qst_rigal_treasure_hunt_1",3,"@Treasure final search. You are too close from {s5}", 0),
				(try_end),
				(try_begin),
					(lt,":distance_party_to_final_tvc",":remaining_distance_to_final_tvc"),
					(display_message,"@You are too close from {s4}."),
					(add_quest_note_from_sreg,"qst_rigal_treasure_hunt_1",4,"@Treasure final search. You are too close from {s4}", 0),					
				(try_end),
				(try_begin),
					(eq,":distance_party_to_final_tvc",":remaining_distance_to_final_tvc"),
					(eq,":distance_party_to_last_tvc",":remaining_distance_to_last_tvc"),	
					(display_message,"@HURRAY, You found the X that marks the spot. Now for some digging."),
					(add_quest_note_from_sreg,"qst_rigal_treasure_hunt_1",3,"@Treasure final search. Good distance from {s5}", 0),					
					(add_quest_note_from_sreg,"qst_rigal_treasure_hunt_1",4,"@Treasure final search. Good distance from {s4}", 0),						
					(add_quest_note_from_sreg,"qst_rigal_treasure_hunt_1",5,"@Treasure final search. You found the treasure!", 0),
					(assign,":continue",1),
				(try_end),
					
				(try_begin),
					(eq,":continue",1),
					(set_spawn_radius,1),
					(spawn_around_party,"p_main_party","pt_rigale_treasure_spot"),
					(quest_set_slot,"qst_rigal_treasure_hunt_1",slot_th_treasure_found,1),
				(try_end),	
				
				
			(else_try),
				(gt,":distance",2),
				(display_message,"@You must get closer to {s5}."),
				(add_quest_note_from_sreg,"qst_rigal_treasure_hunt_1",1,"@You must get closer to {s5}. Use your map again when you are near it.", 0),				

			(else_try),
				(display_message,"@You are close enough from {s5}."),
				(store_random_in_range,":hunt_random_follow",1,21),

				(try_begin), 
					#quest ends. initialize last searching step. max 7 steps before end of quest
					(this_or_next|neg|quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_7,0),
					(is_between,":hunt_random_follow",16,21), 
					(quest_get_slot,":current_tvc_as_beacon","qst_rigal_treasure_hunt_1",":current_tvc"),
					(call_script,"script_rigale_check_tvc_in_vicinity_th",30,":current_tvc_as_beacon"),
					(quest_set_slot,"qst_rigal_treasure_hunt_1",":slot_to_change","$g_th_final_tvc"),
					(str_store_party_name,s5,"$g_th_final_tvc"),
					#set up the distance where the treasure might be, between the last two tvc
					(store_random_in_range,":where_to_look",1,6),
					
					(try_begin),
						(eq,":where_to_look",1),(assign, reg60,25),
					(else_try),
						(eq,":where_to_look",2),(assign, reg60,30),
					(else_try),					
						(eq,":where_to_look",3),(assign, reg60,50),
					(else_try),					
						(eq,":where_to_look",4),(assign, reg60,66),
					(else_try),					
						(eq,":where_to_look",5),(assign, reg60,75),
					(try_end),	
					(quest_set_slot,"qst_rigal_treasure_hunt_1",slot_final_th_search_details,reg60),
					(str_store_party_name,s4,":current_tvc_as_beacon"),					
					(str_store_party_name,s5,"$g_th_final_tvc"),
					(display_message,"@GREAT NEWS. Some clues lead you to think that the treasure is probably at {reg60}% the distance from {s5} to {s4}. Use your map again when you think you are there."),
					(add_quest_note_from_sreg,"qst_rigal_treasure_hunt_1",1,"@Closing in. Use your map at {reg60}% the distance from {s5} to {s4}.", 0),



				(else_try),#false clue, treasure hunt is a failure. Reset variables, and give xp to player, the longer the hunt the more XP
					(is_between,":hunt_random_follow",1,3),
					(display_message,"@This treasure hunt was obviously a fake. Quest is a failure."),	



					(try_begin),
						(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_1,0),(assign,":bonus_xp_for_long_quest",1),
					(else_try),	
						(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_2,0),(assign,":bonus_xp_for_long_quest",2),
					(else_try),									
						(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_3,0),(assign,":bonus_xp_for_long_quest",3),
					(else_try),										
						(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_4,0),(assign,":bonus_xp_for_long_quest",4),
					(else_try),										
						(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_5,0),(assign,":bonus_xp_for_long_quest",5),
					(else_try),										
						(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_6,0),(assign,":bonus_xp_for_long_quest",6),
					(else_try),										
						(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_7,0),(assign,":bonus_xp_for_long_quest",7),
					(else_try),										
						(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_8,0),(assign,":bonus_xp_for_long_quest",8),
					(try_end),	

					(store_mul,":min_xp_bonus",25,":bonus_xp_for_long_quest"),
					(store_mul,":max_xp_bonus",60,":bonus_xp_for_long_quest"),
					(store_attribute_level,":bonus_intelligence","trp_player",ca_intelligence),
					(store_random_in_range, ":rand_bonus_intelligence", 1, 21),
					(store_add,":total_int_bonus",":rand_bonus_intelligence",":bonus_intelligence"),

					(store_random_in_range, ":overall_xp_gain", ":min_xp_bonus", ":max_xp_bonus"),

					(try_begin),
						(lt,":total_int_bonus",22),
						(val_div,":overall_xp_gain",4),
						(add_xp_to_troop, ":overall_xp_gain", "trp_player"),
						(assign,reg6,":overall_xp_gain"),
						(str_store_string, s16, "@You hardly understand why you failed, and so gain a mere {reg6} extra experience from your failure."),	
					(else_try),
						(ge,":total_int_bonus",22),
						(add_xp_to_troop, ":overall_xp_gain", "trp_player"),
						(assign,reg6,":overall_xp_gain"),
						(str_store_string, s16, "@You globally understand why you failed, and so gain {reg6} extra experience from your failure."),	
					(try_end),	
					
					(try_for_range, ":slot", slot_th_tvc_1, slot_th_tvc_8 + 1),
						(quest_set_slot,"qst_rigal_treasure_hunt_1", ":slot", 0),
					(try_end),
					(quest_set_slot,"qst_rigal_treasure_hunt_1",slot_th_treasure_found,0),
					(quest_set_slot,"qst_rigal_treasure_hunt_1", slot_final_th_search_details, 0),	

					(fail_quest,"qst_rigal_treasure_hunt_1"),
					(cancel_quest,"qst_rigal_treasure_hunt_1"),					
					(troop_remove_item,"trp_player","itm_book_treasure_map"),
					(item_set_slot, "itm_book_treasure_map", slot_item_book_reading_progress, 0),
					(item_set_slot, "itm_book_treasure_map", slot_item_book_read, 0),					

						
				(else_try),	
					(is_between,":hunt_random_follow",3,16), #quete keeps going. initialize next step.
					(quest_get_slot,":current_tvc_as_beacon","qst_rigal_treasure_hunt_1",":current_tvc"),
					(call_script,"script_rigale_check_tvc_in_vicinity_th",30,":current_tvc_as_beacon"),
					(quest_set_slot,"qst_rigal_treasure_hunt_1",":slot_to_change","$g_th_final_tvc"),
					(str_store_party_name,s5,"$g_th_final_tvc"),
					(display_message,"@Some clues lead you to {s5}. Use your map again when you are near it."),
					(add_quest_note_from_sreg,"qst_rigal_treasure_hunt_1",1,"@Your next step is {s5}. Use your map again when you are near it.", 0),
			  


			  (try_end),

		   (try_end),

	   (try_end),
			
	   ],
       ),  

       ("camp_treasure_map_innaccessible",
	   [ 
			(quest_get_slot,":last_treasure_search_distance","qst_rigal_treasure_hunt_1",slot_final_th_search_details),			
			(gt,":last_treasure_search_distance",0),
			(neg|quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_treasure_found,1),
	   
	   ], 
		"I cannot reach the designated spot. This treasure was a fake. I want to cancel this hunt.",
       [
  		(quest_get_slot,":last_treasure_search_distance","qst_rigal_treasure_hunt_1",slot_final_th_search_details),	 
	   (try_begin), #treasure found. You have to check to keep going   
			(gt,":last_treasure_search_distance",0),



					(try_begin),
						(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_1,0),(assign,":bonus_xp_for_long_quest",1),
					(else_try),	
						(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_2,0),(assign,":bonus_xp_for_long_quest",2),
					(else_try),									
						(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_3,0),(assign,":bonus_xp_for_long_quest",3),
					(else_try),										
						(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_4,0),(assign,":bonus_xp_for_long_quest",4),
					(else_try),										
						(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_5,0),(assign,":bonus_xp_for_long_quest",5),
					(else_try),										
						(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_6,0),(assign,":bonus_xp_for_long_quest",6),
					(else_try),										
						(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_7,0),(assign,":bonus_xp_for_long_quest",7),
					(else_try),										
						(quest_slot_eq,"qst_rigal_treasure_hunt_1",slot_th_tvc_8,0),(assign,":bonus_xp_for_long_quest",8),
					(try_end),	
					(store_mul,":min_xp_bonus",25,":bonus_xp_for_long_quest"),
					(store_mul,":max_xp_bonus",60,":bonus_xp_for_long_quest"),
					(store_attribute_level,":bonus_intelligence","trp_player",ca_intelligence),
					(store_random_in_range, ":rand_bonus_intelligence", 1, 21),
					(store_add,":total_int_bonus",":rand_bonus_intelligence",":bonus_intelligence"),


					(store_random_in_range, ":overall_xp_gain", ":min_xp_bonus", ":max_xp_bonus"),
					(try_begin),
						(lt,":total_int_bonus",22),
						(val_div,":overall_xp_gain",4),
						(add_xp_to_troop, ":overall_xp_gain", "trp_player"),
						(assign,reg6,":overall_xp_gain"),
						(str_store_string, s16, "@You hardly understand why you failed, and so gain a mere {reg6} extra experience from your failure."),	
					(else_try),
						(ge,":total_int_bonus",22),
						(add_xp_to_troop, ":overall_xp_gain", "trp_player"),
						(assign,reg6,":overall_xp_gain"),
						(str_store_string, s16, "@You globally understand why you failed, and so gain {reg6} extra experience from your failure."),	
					(try_end),	
					
					(try_for_range, ":slot", slot_th_tvc_1, slot_th_tvc_8 + 1),
						(quest_set_slot,"qst_rigal_treasure_hunt_1", ":slot", 0),
					(try_end),
					
					(quest_set_slot,"qst_rigal_treasure_hunt_1", slot_final_th_search_details, 0),

					(fail_quest,"qst_rigal_treasure_hunt_1"),						
					(cancel_quest,"qst_rigal_treasure_hunt_1"),						
					(troop_remove_item,"trp_player","itm_book_treasure_map"),
					(item_set_slot, "itm_book_treasure_map", slot_item_book_reading_progress, 0),
					(item_set_slot, "itm_book_treasure_map", slot_item_book_read, 0),

	   ],
       ),  	 
 

Add in game_menu
Code:
  ("rigale_treasure_spot",0,
   "An X marks the spot. What do you want to do?",
   "none",
   [

    ],
    [
      ("dig_for_treasure",
	  [],
	  "Dig for treasure",
       [
	   (store_random_in_range,":gained_xp",300,500),
	   (store_random_in_range,":gained_gold",500,1000),	
		(troop_add_gold,"trp_player",":gained_gold"),
		(add_xp_to_troop,":gained_xp","trp_player"),	   
		(try_for_range, ":slot", slot_th_tvc_1, slot_th_tvc_8 + 1),
			(quest_set_slot,"qst_rigal_treasure_hunt_1", ":slot", 0),
		(try_end),
		(quest_set_slot,"qst_rigal_treasure_hunt_1",slot_th_treasure_found,0),
		(quest_set_slot,"qst_rigal_treasure_hunt_1", slot_final_th_search_details, 0),	   
		(troop_remove_item,"trp_player","itm_book_treasure_map"),
		(item_set_slot, "itm_book_treasure_map", slot_item_book_reading_progress, 0),
		(item_set_slot, "itm_book_treasure_map", slot_item_book_read, 0),
		(complete_quest,"qst_rigal_treasure_hunt_1"),			
		(cancel_quest,"qst_rigal_treasure_hunt_1"),			
                (remove_party, "$g_encountered_party"),	
                (change_screen_return),
	   
	   ]
       ),
	   
      ("resume_camp",
	  [],
	  "Resume travelling.",
      [
           (change_screen_return),
      ]
       ),
	   
      ]
  ),


module_scripts
Code:
 ("rigale_check_tvc_in_vicinity_th",
		 [
	(store_script_param, ":vicinity", 1),
	(store_script_param, ":party_to_check", 2),	

	(try_for_range, ":cur_party",centers_begin,centers_end),
		(store_distance_to_party_from_party, ":dist",":cur_party", ":party_to_check"),

		(try_begin),
			(lt,":dist",":vicinity"),
			(store_random_in_range,":designated_tvc",1,10),

			(try_begin),
				(neq,":designated_tvc",1),
				(assign,":continue",1),
			(else_try),
				(assign,"$g_th_final_tvc",":cur_party"),			
				(assign,":continue",0),
			(try_end),

		(try_end),

	(try_end),

	(try_begin),
		(eq,":continue",1),
		(call_script,"script_rigale_check_tvc_in_vicinity_th",":vicinity",":party_to_check"),
	(try_end),
		
		
		]
  ),

module_scripts
add in "game_event_party_encounter" script
Code:
         (else_try),
#			(party_get_template_id, ":ptype","$g_encountered_party"),
            (eq,":template","pt_rigale_treasure_spot"),
           (jump_to_menu, "mnu_rigale_treasure_spot"),

module_scripts
add in "initialize_item_info"

Code:
(item_set_slot, "itm_book_treasure_map", slot_item_intelligence_requirement, 11),

module_simple_triggers
Add after the (str_store_string, s2, "@ Your engineer skill has increased by 1."), line

Code:
       (else_try), #rigale treasure
         (eq, "$g_player_reading_book", "itm_book_treasure_map"),
		 (start_quest,"qst_rigal_treasure_hunt_1"),
         (str_store_string, s2, "@ You finally understand what this map is all about. Let the treasure hunt begin ! ^ Read the map from your camp menu."),
		 
		(add_quest_note_from_sreg,"qst_rigal_treasure_hunt_1",1,"@You finally understand the treasure map. Read it again from camp menu.", 0),		 
       (try_end),


Tadaaaa.
This is the basic system, it can be improved in many ways.
I hope you like it.

Cheers,
Cernunos :smile:
 
Some stuff already:
Forgot the remove_party in the dig menu. Added.
Forgot the change screen return same menu: added.
Forgot the game encounter menu switch: Added.
Treasure map reading part was missing: Added.

Sorry for the missing parts people, I got a little fast on the copy pasting :sad:
 
Hello

Excellent! Awesome! I am simply admiring!  :wink:
For testing, my mod will use this, it is quite suitable for a RPG mod.

Thanks Cernunos

Tchin !
:twisted:
 
Don't admire the coding, it is a mess. However, this can show you how to add a new book, I know you were wondering.
 
Removed some functions that were rigalesque. Should work for non rigale systems now :smile: Thanks BierTolkien for pointing out.
 
Fixed a copy/paste indication, from the wrong "game_event_party_encounters" to the correct "game_event_party_encounter"  (without s).

Thanks again BierTolkien, you are obviously the only one testing this code ^^. Aw well...
 
Back
Top Bottom