Modding Q&A [For Quick Questions and Answers]

Users who are viewing this thread

Status
Not open for further replies.
Perhaps this got lost in the off topic stuff. :wink:

The Dark Robin said:
I am creating a new backstory, and have run into a problem. After modifying some stuff, I've ended up with this mission template:
Code:
   (	"alley_fight", mtf_battle_mode,charge,
    "Alley fight",
    [    
      (0,mtef_team_0|mtef_use_exact_number,0,aif_start_alarmed,1,[]),
      (1,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (2,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (3,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (4,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (5,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (6,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (7,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (8,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (9,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (10,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (11,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
      (12,mtef_visitor_source|mtef_team_1,0,aif_start_alarmed,1,[]),
    ],    
    [
    
      common_inventory_not_available,
      
      (ti_on_agent_spawn, 0, 0, [],
      [              
        (store_trigger_param_1, ":agent_no"),
        (get_player_agent_no, ":player_agent"),
        
        (try_begin),
        (neq, ":agent_no", ":player_agent"),
        (agent_ai_set_aggressiveness, ":agent_no", 199),
        (try_end),          
        (assign, "$g_main_attacker_agent", "trp_slaver_chief"),		
      ]),
              
# Health regen for the player
(5, 0, 0, [
(neg|main_hero_fallen),
(get_player_agent_no, ":agent"),
(agent_is_alive, ":agent"),
      ], [
(get_player_agent_no, ":agent"),
(store_agent_hit_points, ":health", ":agent", 1),
(val_add, ":health", 1),
(agent_set_hit_points, ":agent", ":health", 1),
]),
     

      (ti_tab_pressed, 0, 0, [], 
      [
        (display_message, "str_cannot_leave_now"),
      ]),

      (0, 0, ti_once, [],
       [
         (set_party_battle_mode),
        ]),

      (0, 0, ti_once, 
       [
         (neg|main_hero_fallen),
       (this_or_next|neg|agent_is_alive, "$g_main_attacker_agent"),
       (agent_is_wounded, "$g_main_attacker_agent"),
       ],
       [	   
		 (jump_to_menu, "mnu_first_backstory_player_won"),
         (finish_mission),
       ]),
	   
      (0, 0, ti_once, 
       [
         (main_hero_fallen),
       ],
       [	   
		 (jump_to_menu, "mnu_first_backstory_player_lost"),
         (finish_mission),
       ]),
	   
     ]+ common_sprint,
	 ),

However, on entering the mission, the player is immediately sent to the first_backstory_player_won menu, even though the slaver chief is clearly still alive.

And here is the script that starts the mission:
Code:
   #script_prepare_alley_to_fight
   (
   "prepare_alley_to_fight",
   [

     #(store_faction_of_party, ":faction_no", "$current_town"),
     (stop_all_sounds, 1),  
    (play_track, "track_children_of_the_future", 1),
     (modify_visitors_at_site, "scn_first_forest_fight"),

     (reset_visitors),
     (set_visitor, 0, "trp_player"),
     (set_visitor, 1, "trp_manhunter"),
	 (set_visitor, 2, "trp_manhunter"),
	 (set_visitor, 3, "trp_manhunter"),
	 (set_visitor, 4, "trp_manhunter"),
	 (set_visitor, 5, "trp_manhunter"),
	 (set_visitor, 6, "trp_manhunter"),
	 (set_visitor, 7, "trp_manhunter"),
     (set_visitor, 8, "trp_manhunter"),
	 (set_visitor, 9, "trp_manhunter"),
	 (set_visitor, 10, "trp_manhunter"),
	 (set_visitor, 11, "trp_slave_driver"),
	 (set_visitor, 12, "trp_slaver_chief"),
	 
	 #(try_begin),
     #  (eq, ":faction_no", "fac_kingdom_1"), #swadian
     #  (assign, ":bandit_troop", "trp_steppe_bandit"),
     #(else_try),
     #  (eq, ":faction_no", "fac_kingdom_2"), #vaegir
     #  (assign, ":bandit_troop", "trp_taiga_bandit"),
     #(else_try),
     #  (eq, ":faction_no", "fac_kingdom_3"), #khergit
     #  (assign, ":bandit_troop", "trp_mountain_bandit"),
     #(else_try),
     #  (eq, ":faction_no", "fac_kingdom_4"), #nord
     #  (assign, ":bandit_troop", "trp_sea_raider"),
     #(else_try),
     #  (eq, ":faction_no", "fac_kingdom_5"), #rhodok
     #  (assign, ":bandit_troop", "trp_forest_bandit"),
     #(else_try),
     #  (eq, ":faction_no", "fac_kingdom_6"), #sarranid
     #  (assign, ":bandit_troop", "trp_desert_bandit"),
     #(try_end),

     #(set_visitor, 3, ":bandit_troop"),

     (jump_to_scene, "scn_first_forest_fight"),
	 (set_jump_mission,"mt_alley_fight"),
     (change_screen_mission),
   ]),

Code is really badly formatted, (I have a headache so yeah. :sad:) but it should work. :???:
 
The Dark Robin said:
Perhaps this got lost in the off topic stuff. :wink:

First you are assigning troop id (trp_slaver_chief) as $g_main_attacker_agent:
Code:
        (assign, "$g_main_attacker_agent", "trp_slaver_chief"),
then you using it as agent id:
Code:
       (this_or_next|neg|agent_is_alive, "$g_main_attacker_agent"),
       (agent_is_wounded, "$g_main_attacker_agent"),
it will not work.

Instead of:
Code:
        (assign, "$g_main_attacker_agent", "trp_slaver_chief"),
You need something like that:
Code:
       (agent_get_troop_id, ":troop_no", ":agent_no"),
       (eq, ":troop_no", "trp_slaver_chief"),
       (assign, "$g_main_attacker_agent", ":agent_no"),
 
Waldzios said:
The Dark Robin said:
Perhaps this got lost in the off topic stuff. :wink:

First you are assigning troop id (trp_slaver_chief) as $g_main_attacker_agent:
Code:
        (assign, "$g_main_attacker_agent", "trp_slaver_chief"),
then you using it as agent id:
Code:
       (this_or_next|neg|agent_is_alive, "$g_main_attacker_agent"),
       (agent_is_wounded, "$g_main_attacker_agent"),
it will not work.

Instead of:
Code:
        (assign, "$g_main_attacker_agent", "trp_slaver_chief"),
You need something like that:
Code:
       (agent_get_troop_id, ":troop_no", ":agent_no"),
       (eq, ":troop_no", "trp_slaver_chief"),
       (assign, "$g_main_attacker_agent", ":agent_no"),

Thanks! :grin:
 
I have a little problem that I havn't been able to figure out.
I am trying to add a shin guard (?), meaning a second part besides a boots for foot armor. What would I add to a item code so i can do this.
For instance what would i add to the following?

Code:
["plate_boots2", "Silver Plate Boots", [("plate_boots2",0)], itp_merchandise| itp_type_foot_armor | itp_attach_armature,0, 3470 , weight(4.5)|abundance(70)|head_armor(0)|body_armor(0)|leg_armor(39)|difficulty(12) ,imodbits_plate ],


 
After adding some new armors to my game, I loaded it up and this happened. Anyone know what I did wrong?

Djy5ZO6.jpg
 
McBeanie said:
After adding some new armors to my game, I loaded it up and this happened. Anyone know what I did wrong?
Djy5ZO6.jpg

i used to get this problem all the time. make sure every new texture file you use is imported into a BRF, otherwise the game can't read them. i.e. import the textures for that model into the brf of the same model, or at the very least a brf that your module can load up.
 
Modify script_game_get_item_extra_text.
Code:
  #script_game_get_item_extra_text:
  # This script is called from the game engine when an item's properties are displayed.
  # INPUT: arg1 = item_no, arg2 = extra_text_id (this can be between 0-7 (7 included)), arg3 = item_modifier
  # OUTPUT: result_string = item extra text, trigger_result = text color (0 for default)
  ("game_get_item_extra_text",
    [
      (store_script_param, ":item_no", 1),
      (store_script_param, ":extra_text_id", 2),
      (store_script_param, ":item_modifier", 3),
      (try_begin),
        (is_between, ":item_no", food_begin, food_end),
        (try_begin),
          (eq, ":extra_text_id", 0),
          (assign, ":continue", 1),
          (try_begin),
            (this_or_next|eq, ":item_no", "itm_cattle_meat"),
            (this_or_next|eq, ":item_no", "itm_pork"),
				(eq, ":item_no", "itm_chicken"),
				
            (eq, ":item_modifier", imod_rotten),
            (assign, ":continue", 0),
          (try_end),
          (eq, ":continue", 1),
          (item_get_slot, ":food_bonus", ":item_no", slot_item_food_bonus),
          (assign, reg1, ":food_bonus"),
          (set_result_string, "@+{reg1} to party morale"),
          (set_trigger_result, 0x4444FF),
        (try_end),
# Modification Begin
      (else_try),	
        (try_begin),	  
	  (eq, ":item_no", "itm_unique_sword"),	
          (eq, ":extra_text_id", 0),
          (set_result_string, "@This sword was forged by a drunk blacksmith, hence it's uniqueness."),
          (set_trigger_result, 0xFFEEDD),		
        (try_end),
# Modification End
      (else_try),
        (is_between, ":item_no", readable_books_begin, readable_books_end),
        (try_begin),
          (eq, ":extra_text_id", 0),
          (item_get_slot, reg1, ":item_no", slot_item_intelligence_requirement),
          (set_result_string, "@Requires {reg1} intelligence to read"),
          (set_trigger_result, 0xFFEEDD),
        (else_try),
          (eq, ":extra_text_id", 1),
          (item_get_slot, ":progress", ":item_no", slot_item_book_reading_progress),
          (val_div, ":progress", 10),
          (assign, reg1, ":progress"),
          (set_result_string, "@Reading Progress: {reg1}%"),
          (set_trigger_result, 0xFFEEDD),
        (try_end),
      (else_try),
        (is_between, ":item_no", reference_books_begin, reference_books_end),
        (try_begin),
          (eq, ":extra_text_id", 0),
          (try_begin),
            (eq, ":item_no", "itm_book_wound_treatment_reference"),
            (str_store_string, s1, "@wound treament"),
          (else_try),
            (eq, ":item_no", "itm_book_training_reference"),
            (str_store_string, s1, "@trainer"),
          (else_try),
            (eq, ":item_no", "itm_book_surgery_reference"),
            (str_store_string, s1, "@surgery"),
          (try_end),
          (set_result_string, "@+1 to {s1} while in inventory"),
          (set_trigger_result, 0xFFEEDD),
        (try_end),
      (try_end),
  ]),
 
All the items seem able to get all of the modifiers for some reason, i.e. Meek Light Crossbow, Sharp Heraldic Mail, Godly Hides, Large Bag of Courser. Even items I haven't edited have the problem.

EDIT: Also, what determines the weapons that troops use? My pikemen keep using their shortswords for all combat as opposed to their pikes.
Finally, what about the troop classification, I have a troop with throwing axes, a nordic war sword, and a shield, and they're classified as archers.
 
Never seen the first problem with item modifiers unless you changed header_item_modifiers or imodbit_none. Native has improved its weapon selection capabilities, but there's a reason there's so many weapon switching scripts out there. One-handed weapons are always guaranteed whereas polearms are not. The classification is done by default through the tf_guarantee_flags: horse -> cavalry, ranged -> archer
 
For my mod, I just added the 13th faction, but for some reason, I can not recruit troops from thier villages. With the other factions I added, I did not have this problem, so at the moment I am stuck, Because I do not know what to do to fix this problem.

I also have another bug, but for some reason I think it is linked to the bug above, in the start I randomly level up to a level between 19 and 26. I had this before, but I fergot how I fixed it.

any help would be appreciated.
 
@Dion

Did you miss to assign forst tier troops to your new faction in module_troops.oy? That seems to be the problem, when your character levels up at the beginning and might explain why you cannot recruit them.

Kind regards,
G.
 
Lumos said:
xPearse said:
Looked in the osp but didn't find anything, searched here and found this. Im not good at this and don't know how to set this up for the zombies troops I have, any help on how to.
For God's sake...
Code:
(ti_on_agent_spawn, 0, 0, [
	(store_trigger_param, ":agent", 1),
	(agent_get_troop_id, ":troop", ":agent"),
	(troop_get_type, ":race", ":troop"),
	(eq, ":race", tf_ZOMBIE_MOTHER_****ER), # Whatever you've got them defined as in header_troops and module_skins
	(agent_set_speed_limit, ":agent", 4),
  ], []),
Easy as pie.

Ok digging up old post, I added this into mission templates but got a ton of errors when I exported. I may have placed it in the wrong area so is there a certain place that I should put this in the code blocks. It's somewhere in between and before I placed it at the end but still got errors, I know im hopeless but please help.
 
Status
Not open for further replies.
Back
Top Bottom