Having random meshes for a single horse

Users who are viewing this thread

John25-

Sergeant at Arms
Hi everyone, I am working on a mod in which horses should have different colours (meshes) on a single item instead of having three times the same item but with a different mesh for each one. You could tell me to just leave it as it is, but this brings an issue:

One of the units in the mod can be either mounted or dismounted, but so far I have been using three items for the horse (saddle horse, hunter, and courser). The issue is that 3/4 of the units are mounted considering they have 3 horse items in their inventory, while I only want 1/2 of them to be mounted. I have noticed that the usual saddle horse in Warband is black in most cases but can also be white and brown:
["saddle_horse","Saddle Horse", [("saddle_horse",0),("horse_c",imodbits_horse_good)], itp_merchandise|itp_type_horse, 0, 240,abundance(90)|hit_points(100)|body_armor(8 )|difficulty(1)|horse_speed(45)|horse_maneuver(44)|horse_charge(10)|horse_scale(104),imodbits_horse_basic],

bRW1e5g.png

→ From a merchant in-game, and both horses refer to the same item in module_items.py

I am wondering if there is a way to make one horse item with all three saddle horse, hunter, and courser 'colours' (meshes), so that the ratio of mounted/dismounted soldiers would be closer to 1/2, and the ratio of the horse mesh would be close to 1/3 looking like a saddle horse, 1/3 looking like a courser, and 1/3 looking like a hunter. Considering the saddle_horse item can have two meshes (although one of them is imodbits_horse_good), I guess there can be a way to add a third mesh, and most important a way for all of them to appear equally in-game.
If I use a single item in the troop's inventory (new_horse), the ratio of mounted/dismounted soldiers is good (1/2), but all horses appear looking like saddle horses. Here is the code I have made:
["new_horse","Saddle Horse", [("saddle_horse",0),("courser",0),("hunting_horse",0)], itp_merchandise|itp_type_horse, 0,
240,abundance(90)|hit_points(100)|body_armor(8 )|difficulty(1)|horse_speed(45)|horse_maneuver(44)|horse_charge(10)|horse_scale(104),imodbits_horse_basic],

I was hoping that all three meshes would be appearing in-game by removing that imodbits_horse_good from the original saddle_horse item, however only the black ones appear and there are no hunter or courser meshes at all among the troops

I may simply have missed a detail in the coding process for the issue to be sorted, but have no idea of what needs to be done
 
Solution
Sadly I have to tell you that it won't work with horses. Beside the fact that I made a little code misstake of mine, it should be something like
Code:
    (ti_on_agent_spawn, 0, 0, [],
    [
    (store_trigger_param_1, ":agent_no"),
    (agent_get_horse, ":horse", ":agent_no"),
    (gt, ":horse", -1),
    (agent_get_item_id, ":horse_item", ":horse"),#Forgot to get the item_id of the horse, before we only checked the agent_id of the horse.
    (call_script, "script_random_horse", ":agent_no", ":horse_item"),
    ]),
there is the fact that at ti_on_agent_spawn the agents are already spawned. We can change the equipment of spawned agents. However, horses are no equipment anymore inside a scene but they are agents on their own. Now I was...
The engine is expected to call always the first standard mesh, I would be surprised if it even put out a few cases of the other variants. It's not working that way. The only way which I would get into mind would be to have the exact same horse in different colours (given that you it available in different coloured variants).

Are you sure that you want to have three different meshes for the horse variants or would you also be fine with three differently textured variants of the same horse?

Is the troop expected to be unmounted and mounted sometimes? Since they are all sorted into the infantry group at the orders iirc. Not sure if you have watched out for that potential side effect.
 
Upvote 0
I just need three textures considering the mesh is the same, but how to randomise them then?
The troop should be mainly unmounted but I can't afford to have three horse items in their Inventory as it would then be the opposite: most of them would be mounted. And in the meantime I would also like the horses to have random textures and not only one
 
Upvote 0
Add in module_strings.py strings like
Code:
  ("random_horse_1", "random_horse_1"),
  ("random_horse__2", "random_horse_2"),
  ...
  ("random_horse_end", "random_horse_end"),
Be aware that the second entry should always be the name of the respective material for the relevant horse mesh. So you need to add the texture variants to your texture folder and create texture and material entries via openbrf in one of your brf files.
Make then use of the operation cur_item_set_material (looking through header_operations.py is worth the time)
Code:
cur_item_set_material                  = 1978   # (cur_item_set_material, <string_no>, <sub_mesh_no>, [<lod_begin>], [<lod_end>]), #only call inside ti_on_init_item in module_items # lod values are optional. lod_end is not included.
Apply it to the relevant horse entry in module_items.py via ti_on_init_item
Code:
  ["common_horse_a","Sumpter Horse",[("sumpter_horse",0)],itp_type_horse,0,50,hit_points(40)|body_armor(1)|difficulty(1)|horse_speed(28)|horse_maneuver(33)|horse_charge(5),imodbits_none,[(ti_on_init_item,[(store_random_in_range, ":rand_horse", "str_random_horse_1", "str_random_horse_end"),(cur_item_set_material, ":rand_horse", sumpter_horse),])]],
The horse should then have a random look. Not sure if I have written it up correctly but should only be bugfixing then for you (I think it should work without assigning the lod values behind).

Give me a short feedback if it works :wink:
 
Last edited:
Upvote 0
I get this error when compiling module_items.py:
["new_horse","Saddle Horse", [("saddle_horse",0)], itp_merchandise|itp_type_horse, 0,
240,abundance(90)|hit_points(100)|body_armor(8 )|difficulty(1)|horse_speed(45)|horse_maneuver(44)|horse_charge(10)|horse_scale(104) ,imodbits_none,[(ti_on_init_item,[(store_random_in_range, ":rand_horse", "str_random_horse_1", "str_random_horse_end"),(cur_item_set_material, ":rand_horse", saddle_horse ),])]],
NameError: name 'saddle_horse' is not defined
What does that name refer to? A mesh? (which I guess would then have to be added to module_meshes.py)
 
Upvote 0
A misstake of mine, Seek&Destroy helped me out with that at the modding discord. It should be
Code:
(cur_item_set_material, ":rand_horse", 0, 0)
But he also reported that it probably doesn't work for horses, so we might be at a dead end. You will have to try how it works out.
 
Upvote 0
There is always the old solution of having two units: a mounted one with three horse items in its inventory, and a dismounted one with no horse
But this is a bit annoying as they both relate to the same unit in my mod. It would be much more convenient to have both of them as a one unit

Otherwise is there a way to change the ratio of what piece of equipment they will be using from their inventory?
 
Upvote 0
There is something you could try out, I discussed it at the modding discord and if we haven't missed something yet it should work out.
I however want to underline the fact that it's purely experimental and I couldn't test it yet, so you would be my test bunny if you don't mind ^^

You define a new modifier constant at the top of module_items.py. Look for
Code:
# Some constants for ease of use.
and add at the end of all those lines
Code:
imodbits_random_horse = imodbit_timid | imodbit_meek
Assign this imodbit to the horse entries, given that the horses have no other modifiers (I am using the timid and meek modifier since they are unused ones without any active effect given you didn't restore them at module.ini).
You can then use this to bring in variants for the horse via assigning different meshes to the different imodbits like following example
Code:
["common_horse_a","Sumpter Horse",[("sumpter_horse_a",0), ("sumpter_horse_b",imodbit_timid), ("sumpter_horse_c",imodbit_meek)],itp_type_horse,0,50,hit_points(40)|body_armor(1)|difficulty(1)|horse_speed(28)|horse_maneuver(33)|horse_charge(5),imodbits_random_horse],
Now you can only give items with specific modifiers to troops and not an entire set imodbits and you want to give troops a horse with a random modifier. So something like this inside module_scripts.py should do it
Code:
    #script_random_horse
    #input: troop, item (horse)
    #output: none
    #result: troop gets items with modifiers
    ("random_horse",
    [
    (store_script_param, ":troop", 1),
    (store_script_param, ":item", 2),
    (troop_remove_item, ":troop", ":item"),
    (store_random_in_range, ":random", 0, 30),#change values here and at the following checks to edit the percentage
    (try_begin),
        (is_between, ":random", 0, 10),
        (troop_add_item, ":troop", ":item", 1),#no modifier, default
    (else_try),
        (is_between, ":random", 10, 20),
        (troop_add_item, ":troop", ":item", 8589934592),#timid modifier
    (else_try),
        (is_between, ":random", 20, 30),
        (troop_add_item, ":troop", ":item", 17179869184),#meek modifier
    (try_end),
    ]),
Then you need a place to get that script called which is module_mission_templates.py. There you need to watch out for the relevant mission templates for you (in singleplayer probably lead_charge) and there for the ti_on_agent_spawn. Integrate there then the following (so no simple copy pasting but adapting it into the already given code there)
Code:
    (ti_on_agent_spawn, 0, 0, [],
    [
    (store_trigger_param_1, ":agent_no"),
    (agent_get_horse, ":horse", ":agent_no"),
    (gt, ":horse", -1),
    (call_script, "script_random_horse", ":agent_no", ":horse"),
    ]),
To not overwrite the players/companions/lords/etc. horse imodbits you can let it be active only for the non-hero troops, it would then be instead the following
Code:
    (ti_on_agent_spawn, 0, 0, [],
    [
    (store_trigger_param_1, ":agent_no"),
    (agent_get_troop_id,":hero_check", ":agent_no"),
    (neg|troop_is_hero,":hero_check"),
    (agent_get_horse, ":horse", ":agent_no"),
    (gt, ":horse", -1),
    (call_script, "script_random_horse", ":agent_no", ":horse"),
    ]),
The drawback of this method which you might have noticed already would be that the horses which get affected by this script could get no other imodbits. You might want to have the other normal imodbits so you can simply create new horse entries which appear at the market for the player (and exclude the ones above from being sold there of course). To the Lords and Companions you could then assign an individual horse which is not changing the colours. Horses which are assigned to troops but do not have an individual mesh for one of the two imodbits call always the default, so you can also have troops which are all using the same horse or only two different horses with a 2:1 distribution.

One more step which you would need to do is removing the respective string of the imodbit, so that it won't show up inbattle. Copy paste the file item_modifiers.csv out of one of the language folder and add it to the english language folder (english is the default language, so most stuff there doesn't need a csv file). Then look inside for the two modifier and simply delete the entry for the string, so that it looks like the following in the end (for me in notepad).
Code:
imod_timid|%s
imod_meek|%s

As said, it's an experiment. You can test it or say nay. I can't tell you how quickly we manage to test this out otherwise though. If you test it, please give a feedback about the results :wink:
 
Upvote 0
I could not find that item_modifiers.csv so I skipped the last step, but then I get an error message when compiling module_scripts.py:
Exporting scripts...
Traceback (most recent call last):
File "process_scripts.py", line 40, in <module>
save_scripts(variables,variable_uses,scripts,tag_uses,quick_strings)
File "process_scripts.py", line 19, in save_scripts
save_statement_block(file,convert_to_identifier(func[0]), 0,func[1], variable_list,variable_uses,tag_uses,quick_strings)
File "C:\----\mb_warband_module_system_1171\Module_system 1.171\process_operations.py", line 449, in save_statement_block
save_statement(ofile,opcode,no_variables,statement,variable_list,variable_uses,local_vars, local_var_uses,tag_uses,quick_strings)
File "C:\----\mb_warband_module_system_1171\Module_system 1.171\process_operations.py", line 398, in save_statement
ofile.write("%d %d "%(opcode, lenstatement))
TypeError: %d format: a number is required, not str
Exporting mission_template data...
Traceback (most recent call last):
File "process_mission_tmps.py", line 64, in <module>
save_mission_templates(variables,variable_uses,tag_uses,quick_strings)
File "process_mission_tmps.py", line 48, in save_mission_templates
save_triggers(file,convert_to_identifier(mission_template[mission_template_name_pos]), mission_template[mission_template_triggers_pos],variables,variable_uses,tag_uses,quick_strings)
File "process_mission_tmps.py", line 23, in save_triggers
save_statement_block(file, 0, 1, trigger[trigger_consequences_pos], variable_list,variable_uses,tag_uses,quick_strings)
File "C:\----\mb_warband_module_system_1171\Module_system 1.171\process_operations.py", line 449, in save_statement_block
save_statement(ofile,opcode,no_variables,statement,variable_list,variable_uses,local_vars, local_var_uses,tag_uses,quick_strings)
File "C:\----\mb_warband_module_system_1171\Module_system 1.171\process_operations.py", line 401, in save_statement
ofile.write("%d "%operand)
TypeError: %d format: a number is required, not list

Checking global variable usages...
WARNING: Global variable never used: npc_with_personality_match
WARNING: Global variable never used: g_leave_town
WARNING: Global variable never used: g_battle_simulation_cancel_for_party
WARNING: Global variable never used: g_include_diplo_explanation
WARNING: Global variable never used: debug_message_in_queue
WARNING: Global variable never used: g_attacker_drawn_weapon
WARNING: Global variable never used: g_train_peasants_against_bandits_training_succeeded
WARNING: Global variable never used: trainer_help_message
WARNING: Global variable never used: tutorial_1_finished
WARNING: Global variable never used: tutorial_2_finished
WARNING: Global variable never used: tutorial_3_finished
WARNING: Global variable never used: tutorial_4_finished
WARNING: Global variable never used: tutorial_5_finished
WARNING: Global variable never used: g_base_flag_team_1
WARNING: Global variable never used: g_base_flag_team_2
WARNING: Global variable never used: g_last_number_of_agents_around_belfry
WARNING: Global variable never used: g_multiplayer_round_max_seconds_div_2
WARNING: Global variable never used: g_multiplayer_next_team_1_faction
WARNING: Global variable never used: g_confirmation_result
WARNING: Global variable never used: g_multiplayer_respawn_start_time
WARNING: Global variable never used: romantic_attraction_seed
WARNING: Global variable never used: g_multiplayer_factions_voteable
WARNING: Global variable never used: g_multiplayer_maps_voteable
WARNING: Global variable never used: g_multiplayer_kick_voteable
WARNING: Global variable never used: g_multiplayer_ban_voteable
WARNING: Global variable never used: g_multiplayer_battle_earnings_multiplier
WARNING: Global variable never used: g_election_date
WARNING: Global variable never used: g_battle_waiting_seconds
WARNING: Global variable never used: g_death_mode_part_1_start_time
WARNING: Global variable never used: g_multiplayer_poll_end_time
WARNING: Global variable never used: g_training_ground_ranged_distance
WARNING: Global variable never used: pout_party
WARNING: Global variable never used: g_player_party_morale_modifier_leadership
WARNING: Global variable never used: g_player_party_morale_modifier_food
WARNING: Global variable never used: g_player_party_morale_modifier_debt
WARNING: Global variable never used: g_player_current_own_troop_kills
WARNING: Global variable never used: num_routed_allies
WARNING: Global variable never used: belfry_rotating_objects_begin
WARNING: Global variable never used: last_belfry_object_pos
WARNING: Global variable never used: g_minister_notification_quest
WARNING: Global variable never used: any_allies_at_the_last_battle
WARNING: Global variable never used: number_of_npc_slots
WARNING: Global variable never used: npc_grievance_string
WARNING: Global variable never used: npc_praise_not_complaint
WARNING: Global variable never used: g_custom_battle_team1_death_count
WARNING: Global variable never used: total_political_events
WARNING: Global variable never used: g_tutorial_training_ground_current_score_2
WARNING: Global variable never used: g_tutorial_training_ground_conversation_state
WARNING: Global variable never used: g_wedding_groom_troop
WARNING: Global variable never used: g_wedding_bride_troop
WARNING: Global variable never used: g_belligerent_drunk
WARNING: Global variable never used: g_hired_assassin
WARNING: Global variable never used: g_tutorial_training_ground_state
WARNING: Global variable never used: g_tutorial_training_ground_melee_trainer_attack_dir
WARNING: Global variable never used: newglob_total_prosperity_from_caravan_trade
WARNING: Global variable never used: newglob_total_prosperity_from_villageloot
WARNING: Global variable never used: newglob_total_prosperity_from_bandits
WARNING: Global variable never used: newglob_total_prosperity_losses
WARNING: Global variable never used: newglob_total_prosperity_gains
WARNING: Global variable never used: total_vassal_days_on_campaign
WARNING: Global variable never used: total_feast_changes
WARNING: Global variable never used: g_use_current_ai_object_as_s8
WARNING: Global variable never used: relative_of_merchant_is_found
WARNING: Global variable never used: merchant_sign_count
WARNING: Global variable never used: g_city_merchant_troop_id
WARNING: Global variable never used: g_city_merchant_agent_id
WARNING: Global variable never used: g_is_quick_battle
WARNING: Global variable never used: player_marshal_ai_state
WARNING: Global variable never used: player_marshal_ai_object
WARNING: Global variable never used: server_mission_timer_while_player_joined
WARNING: Global variable never used: number_of_controversial_policy_decisions
WARNING: Global variable never used: g_advantegous_faction
WARNING: Global variable never used: g_mp_coop_last_king_wave


Also, I could not find that piece of coding in module_mission_templates.py:
(ti_on_agent_spawn, 0, 0, [],
[
(store_trigger_param_1, ":agent_no"),
(agent_get_horse, ":horse", ":agent_no"),
(gt, ":horse", -1),
(call_script, "script_random_horse", ":agent_no", ":horse"),
]),
So I just added the second one you advised:
(ti_on_agent_spawn, 0, 0, [],
[
(store_trigger_param_1, ":agent_no"),
(agent_get_troop_id,":hero_check", ":agent_no"),
(neg|troop_is_hero,":hero_check"),
(agent_get_horse, ":horse", ":agent_no"),
(gt, ":horse", -1),
(call_script, "script_random_horse", ":agent_no", ":horse"),
]),
 
Upvote 0
I could not find that item_modifiers.csv so I skipped the last step, but then I get an error message when compiling module_scripts.py:
Just look in any language folder but not the english one.

Edit: You added more details after I wrote my response. You cannot simple drop the code just like that into the mission template file.
Also, I could not find that piece of coding in module_mission_templates.py:
It's not existing like that as I wrote above. Just go to module_mission_templates and adapt it to any mission template with ti_on_agent_spawn. You need to integrate that code alongside the other existing one, preventing to make duplicates of some variables. Look up for example the mission template lead_charge and look there at the existing ti_on_agent_spawn.
 
Last edited:
Upvote 0
I'm not quite sure to understand the part in module_mission_templates.py. I have found the "lead_charge" and added the code like this:
(
"lead_charge",mtf_battle_mode|mtf_synch_inventory,charge,
"You lead your men to battle.",
[
(1,mtef_defenders|mtef_team_0,0,aif_start_alarmed,12,[]),
(0,mtef_defenders|mtef_team_0,0,aif_start_alarmed,0,[]),
(4,mtef_attackers|mtef_team_1,0,aif_start_alarmed,12,[]),
(4,mtef_attackers|mtef_team_1,0,aif_start_alarmed,0,[]),
],
[
(ti_on_agent_spawn, 0, 0, [],
[
(store_trigger_param_1, ":agent_no"),
(call_script, "script_agent_reassign_team", ":agent_no"),

(assign, ":initial_courage_score", 5000),

(agent_get_troop_id, ":troop_id", ":agent_no"),
(store_character_level, ":troop_level", ":troop_id"),
(val_mul, ":troop_level", 35),
(val_add, ":initial_courage_score", ":troop_level"), #average : 20 * 35 = 700

(store_random_in_range, ":randomized_addition_courage", 0, 3000), #average : 1500
(val_add, ":initial_courage_score", ":randomized_addition_courage"),

(agent_get_party_id, ":agent_party", ":agent_no"),
(party_get_morale, ":cur_morale", ":agent_party"),

(store_sub, ":morale_effect_on_courage", ":cur_morale", 70),
(val_mul, ":morale_effect_on_courage", 30), #this can effect morale with -2100..900
(val_add, ":initial_courage_score", ":morale_effect_on_courage"),

#average = 5000 + 700 + 1500 = 7200; min : 5700, max : 8700
#morale effect = min : -2100(party morale is 0), average : 0(party morale is 70), max : 900(party morale is 100)
#min starting : 3600, max starting : 9600, average starting : 7200
(agent_set_slot, ":agent_no", slot_agent_courage_score, ":initial_courage_score"),
]),

(ti_on_agent_spawn, 0, 0, [],
[
(store_trigger_param_1, ":agent_no"),
(agent_get_troop_id,":hero_check", ":agent_no"),
(neg|troop_is_hero,":hero_check"),
(agent_get_horse, ":horse", ":agent_no"),
(gt, ":horse", -1),
(call_script, "script_random_horse", ":agent_no", ":horse"),
]),

But it still shows me the error message when compiling so I must have done it the wrong way (?)

Edit: It's a bit different this time:
Exporting scripts...
Traceback (most recent call last):
File "process_scripts.py", line 40, in <module>
save_scripts(variables,variable_uses,scripts,tag_uses,quick_strings)
File "process_scripts.py", line 19, in save_scripts
save_statement_block(file,convert_to_identifier(func[0]), 0,func[1], variable_list,variable_uses,tag_uses,quick_strings)
File "C:\----\mb_warband_module_system_1171\Module_system 1.171\process_operations.py", line 449, in save_statement_block
save_statement(ofile,opcode,no_variables,statement,variable_list,variable_uses,local_vars, local_var_uses,tag_uses,quick_strings)
File "C:\----\mb_warband_module_system_1171\Module_system 1.171\process_operations.py", line 398, in save_statement
ofile.write("%d %d "%(opcode, lenstatement))
TypeError: %d format: a number is required, not str
Exporting mission_template data...
Error: Unable to find object:script_random_horse
ERROR: Illegal Identifier:script_random_horse

Checking global variable usages...
WARNING: Global variable never used: npc_with_personality_match
WARNING: Global variable never used: g_battle_simulation_cancel_for_party
WARNING: Global variable never used: g_include_diplo_explanation
WARNING: Global variable never used: debug_message_in_queue
WARNING: Global variable never used: g_multiplayer_next_team_1_faction
WARNING: Global variable never used: g_confirmation_result
WARNING: Global variable never used: g_multiplayer_respawn_start_time
WARNING: Global variable never used: romantic_attraction_seed
WARNING: Global variable never used: g_multiplayer_factions_voteable
WARNING: Global variable never used: g_multiplayer_maps_voteable
WARNING: Global variable never used: g_multiplayer_kick_voteable
WARNING: Global variable never used: g_multiplayer_ban_voteable
WARNING: Global variable never used: g_multiplayer_player_respawn_as_bot
WARNING: Global variable never used: g_multiplayer_battle_earnings_multiplier
WARNING: Global variable never used: g_election_date
WARNING: Global variable never used: g_training_ground_training_num_gourds_to_destroy
WARNING: Global variable never used: pout_party
WARNING: Global variable never used: g_player_party_morale_modifier_leadership
WARNING: Global variable never used: g_player_party_morale_modifier_food
WARNING: Global variable never used: g_player_party_morale_modifier_debt
WARNING: Global variable never used: g_player_current_own_troop_kills
WARNING: Global variable never used: num_routed_allies
WARNING: Global variable never used: belfry_rotating_objects_begin
WARNING: Global variable never used: last_belfry_object_pos
WARNING: Global variable never used: g_minister_notification_quest
WARNING: Global variable never used: any_allies_at_the_last_battle
WARNING: Global variable never used: number_of_npc_slots
WARNING: Global variable never used: npc_grievance_string
WARNING: Global variable never used: npc_praise_not_complaint
WARNING: Global variable never used: g_custom_battle_team1_death_count
WARNING: Global variable never used: total_political_events
WARNING: Global variable never used: g_wedding_bishop_troop
WARNING: Global variable never used: newglob_total_prosperity_from_caravan_trade
WARNING: Global variable never used: newglob_total_prosperity_from_villageloot
WARNING: Global variable never used: newglob_total_prosperity_from_bandits
WARNING: Global variable never used: newglob_total_prosperity_losses
WARNING: Global variable never used: newglob_total_prosperity_gains
WARNING: Global variable never used: total_vassal_days_on_campaign
WARNING: Global variable never used: total_feast_changes
WARNING: Global variable never used: g_use_current_ai_object_as_s8
WARNING: Global variable never used: g_is_quick_battle
WARNING: Global variable never used: player_marshal_ai_state
WARNING: Global variable never used: player_marshal_ai_object
WARNING: Global variable never used: number_of_controversial_policy_decisions
WARNING: Global variable never used: g_advantegous_faction
WARNING: Global variable never used: g_ccoop_disallow_horses
WARNING: Global variable never used: g_multiplayer_ccoop_enable_count_down
WARNING: Global variable never used: g_multiplayer_ccoop_move_prison_cart
I am not quite sure about that "Illegal identifier:script_random_horse" because the random_horse script is there
 
Last edited:
Upvote 0
You cannot have two ti_on_agent parts inside the same mission template, you need to merge them such way that they still make sense. In this case it should look like this:
Code:
    (ti_on_agent_spawn, 0, 0, [],
    [
    (store_trigger_param_1, ":agent_no"),
    (try_begin),
        (call_script, "script_agent_reassign_team", ":agent_no"),
        (assign, ":initial_courage_score", 5000),
        (agent_get_troop_id, ":troop_id", ":agent_no"),
        (store_character_level, ":troop_level", ":troop_id"),
        (val_mul, ":troop_level", 35),
        (val_add, ":initial_courage_score", ":troop_level"), #average : 20 * 35 = 700

        (store_random_in_range, ":randomized_addition_courage", 0, 3000), #average : 1500
        (val_add, ":initial_courage_score", ":randomized_addition_courage"),

        (agent_get_party_id, ":agent_party", ":agent_no"),      
        (party_get_morale, ":cur_morale", ":agent_party"),

        (store_sub, ":morale_effect_on_courage", ":cur_morale", 70),
        (val_mul, ":morale_effect_on_courage", 30), #this can effect morale with -2100..900
        (val_add, ":initial_courage_score", ":morale_effect_on_courage"),

        #average = 5000 + 700 + 1500 = 7200; min : 5700, max : 8700
        #morale effect = min : -2100(party morale is 0), average : 0(party morale is 70), max : 900(party morale is 100)
        #min starting : 3600, max starting  : 9600, average starting : 7200
        (agent_set_slot, ":agent_no", slot_agent_courage_score, ":initial_courage_score"),
    (else_try),
        (agent_get_troop_id,":hero_check", ":agent_no"),
        (neg|troop_is_hero,":hero_check"),
        (agent_get_horse, ":horse", ":agent_no"),
        (gt, ":horse", -1),
        (call_script, "script_random_horse", ":agent_no", ":horse"),
    (try_end),
    ]),
I am not quite sure about that "Illegal identifier:script_random_horse" because the random_horse script is there
Where did you put the script_random_horse? I hope you just added it somewhere at the bottom of module_scripts.py
 
Last edited:
Upvote 0
Back
Top Bottom