Pisces
Veteran

To learn to ropes of scripting I decided to script the tournament rules. If you've played the 1257 AD mod then it's tournament lets you keep all your equipment aside from body armour (for team colours). Now this is nice, fun and probably realistic that you'd use your own equipment, but of course it is incrediably boring as every tournament is the same, which happens to also be the same as most battles you've played, and you're likely going to win because your good with your equipment. So I decided to let you use your equipment but impose rules on tournaments (ie no horse, ranged only, no polearms, must have polearm/horse, etc.). So to test the basic principle of works, I replace the set tournament items script with this:
Obviously there should be a for loop enclosing the thing, but I decided to do the basics first as I wasn't sure of the exact commands for the enclosing for loop. Basically you are guaranteed a practice horse, as a simple test to make sure the override item is working (and it did), you are then guaranteed 1 melee weapon, 1 shield, 1 crossbow & 1 set of bolts (also worked with 1 exception to the bolts), I copied the armour script from the original script (almost worked), and if you had one of those types of equipment it would let you use that too (this is where things really broke down).
Ok, so first Halmar failed miseribly, everyone was naked, on horseback, had 1 crossbow, 1 shield (occasionally overridden with a different one), 1 practice sword (occasionally overridden) but no bolts, instead they had a second random melee weapon. I initially thought it was a total bust but then in the third round I had all my player's equipment exactly right and I came to realise, aside from the armour the script was worked perfectly but we were getting a random person's equipment, and for some reason it considered bolts to be any weapon it so desired. VERY entertaining tournament, I had no idea what side anyone was on and had no idea what type of melee weapons I'd get.
Then I went to Jekala for further testing, this time people had armour, but not the standard armour they are supposed to have, it was skins vs. mail hauberk vs. that leather armour the green team used to wear in previous versions vs. the yellow padded cloth type armour. Everyone had 1 of each type of weapon and they were replaced with their own inventory if they had them, except it wasn't their own inventory it was someone else's (blast! why did I buy that nice simitiar?). Also incrediably fun, but I think the skins might have had trouble against the mail hauberks.
Finally to Dhirim, where everyone was where the correct era of tournament armour, had weapons like Jekala, and was generally quite good, aside from the random person's equipment and while they had the right style of tournament armour, the green team had been replaced by the white team.
Clearly I am unlocking some previous settings with the armour, once thought buried only to be unlocked by the foolish patterings of a newbie scriptor. But if anyone can point to the places where the script went wrong, I might have a few typos in there too. Also, I highly recommend using this muddled code to reinvigourate your tournament playing experience.
("set_items_for_tournament",
[
(store_script_param, ":armor_item_begin", 1),
(assign, ":weapon1", itp_type_one_handed_wpn),
(assign, ":weapon2", itp_type_shield),
(assign, ":weapon3", itp_type_crossbow),
(assign, ":weapon4", itp_type_bolts),
(try_for_range, ":i_ep", 0, 32),
(mission_tpl_entry_clear_override_items, "mt_arena_melee_fight", ":i_ep"),
(store_div, ":cur_team", ":i_ep", 8 ),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", "itm_practice_horse"),
(try_begin),
(ge, ":armor_item_begin", 0),
(store_add, ":cur_armor_item", ":armor_item_begin", ":cur_team"),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":cur_armor_item"),
(try_end),
(assign, ":selected_weapon", -1),
(try_for_range, ":cur_slot", 0, 4),#equipment slots
(troop_get_inventory_slot, ":cur_item", ":i_ep", ":cur_slot"),
(ge, ":cur_item", 0),
(item_get_type, ":item_type", ":cur_item"),
(try_begin),
(eq, ":item_type", ":weapon1"),
(eq, ":selected_weapon", -1),
(assign, ":selected_weapon", ":cur_item"),
(try_end),
(try_end),
(try_begin),
(ge, ":selected_weapon", 0),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":selected_weapon"),
(else_try),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", "itm_practice_sword"),
(try_end),
(assign, ":selected_weapon", -1),
(try_for_range, ":cur_slot", 0, 4),#equipment slots
(troop_get_inventory_slot, ":cur_item", ":i_ep", ":cur_slot"),
(ge, ":cur_item", 0),
(item_get_type, ":item_type", ":cur_item"),
(try_begin),
(eq, ":item_type", ":weapon2"),
(eq, ":selected_weapon", -1),
(assign, ":selected_weapon", ":cur_item"),
(try_end),
(try_end),
(try_begin),
(ge, ":selected_weapon", 0),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":selected_weapon"),
(else_try),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", "itm_arena_shield_red"),
(try_end),
(assign, ":selected_weapon", -1),
(try_for_range, ":cur_slot", 0, 4),#equipment slots
(troop_get_inventory_slot, ":cur_item", ":i_ep", ":cur_slot"),
(ge, ":cur_item", 0),
(item_get_type, ":item_type", ":cur_item"),
(try_begin),
(eq, ":item_type", ":weapon3"),
(eq, ":selected_weapon", -1),
(assign, ":selected_weapon", ":cur_item"),
(try_end),
(try_end),
(try_begin),
(ge, ":selected_weapon", 0),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":selected_weapon"),
(else_try),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", "itm_practice_crossbow"),
(try_end),
(assign, ":selected_weapon", -1),
(try_for_range, ":cur_slot", 0, 4),#equipment slots
(troop_get_inventory_slot, ":cur_item", ":i_ep", ":cur_slot"),
(ge, ":cur_item", 0),
(item_get_type, ":item_type", ":cur_item"),
(try_begin),
(eq, ":item_type", ":weapon4"),
(eq, ":selected_weapon", -1),
(assign, ":selected_weapon", ":cur_item"),
(try_end),
(try_end),
(try_begin),
(ge, ":selected_weapon", 0),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":selected_weapon"),
(else_try),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", "itm_practice_bolts"),
(try_end),
(try_end),
]),
[
(store_script_param, ":armor_item_begin", 1),
(assign, ":weapon1", itp_type_one_handed_wpn),
(assign, ":weapon2", itp_type_shield),
(assign, ":weapon3", itp_type_crossbow),
(assign, ":weapon4", itp_type_bolts),
(try_for_range, ":i_ep", 0, 32),
(mission_tpl_entry_clear_override_items, "mt_arena_melee_fight", ":i_ep"),
(store_div, ":cur_team", ":i_ep", 8 ),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", "itm_practice_horse"),
(try_begin),
(ge, ":armor_item_begin", 0),
(store_add, ":cur_armor_item", ":armor_item_begin", ":cur_team"),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":cur_armor_item"),
(try_end),
(assign, ":selected_weapon", -1),
(try_for_range, ":cur_slot", 0, 4),#equipment slots
(troop_get_inventory_slot, ":cur_item", ":i_ep", ":cur_slot"),
(ge, ":cur_item", 0),
(item_get_type, ":item_type", ":cur_item"),
(try_begin),
(eq, ":item_type", ":weapon1"),
(eq, ":selected_weapon", -1),
(assign, ":selected_weapon", ":cur_item"),
(try_end),
(try_end),
(try_begin),
(ge, ":selected_weapon", 0),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":selected_weapon"),
(else_try),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", "itm_practice_sword"),
(try_end),
(assign, ":selected_weapon", -1),
(try_for_range, ":cur_slot", 0, 4),#equipment slots
(troop_get_inventory_slot, ":cur_item", ":i_ep", ":cur_slot"),
(ge, ":cur_item", 0),
(item_get_type, ":item_type", ":cur_item"),
(try_begin),
(eq, ":item_type", ":weapon2"),
(eq, ":selected_weapon", -1),
(assign, ":selected_weapon", ":cur_item"),
(try_end),
(try_end),
(try_begin),
(ge, ":selected_weapon", 0),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":selected_weapon"),
(else_try),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", "itm_arena_shield_red"),
(try_end),
(assign, ":selected_weapon", -1),
(try_for_range, ":cur_slot", 0, 4),#equipment slots
(troop_get_inventory_slot, ":cur_item", ":i_ep", ":cur_slot"),
(ge, ":cur_item", 0),
(item_get_type, ":item_type", ":cur_item"),
(try_begin),
(eq, ":item_type", ":weapon3"),
(eq, ":selected_weapon", -1),
(assign, ":selected_weapon", ":cur_item"),
(try_end),
(try_end),
(try_begin),
(ge, ":selected_weapon", 0),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":selected_weapon"),
(else_try),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", "itm_practice_crossbow"),
(try_end),
(assign, ":selected_weapon", -1),
(try_for_range, ":cur_slot", 0, 4),#equipment slots
(troop_get_inventory_slot, ":cur_item", ":i_ep", ":cur_slot"),
(ge, ":cur_item", 0),
(item_get_type, ":item_type", ":cur_item"),
(try_begin),
(eq, ":item_type", ":weapon4"),
(eq, ":selected_weapon", -1),
(assign, ":selected_weapon", ":cur_item"),
(try_end),
(try_end),
(try_begin),
(ge, ":selected_weapon", 0),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", ":selected_weapon"),
(else_try),
(mission_tpl_entry_add_override_item, "mt_arena_melee_fight", ":i_ep", "itm_practice_bolts"),
(try_end),
(try_end),
]),
Ok, so first Halmar failed miseribly, everyone was naked, on horseback, had 1 crossbow, 1 shield (occasionally overridden with a different one), 1 practice sword (occasionally overridden) but no bolts, instead they had a second random melee weapon. I initially thought it was a total bust but then in the third round I had all my player's equipment exactly right and I came to realise, aside from the armour the script was worked perfectly but we were getting a random person's equipment, and for some reason it considered bolts to be any weapon it so desired. VERY entertaining tournament, I had no idea what side anyone was on and had no idea what type of melee weapons I'd get.
Then I went to Jekala for further testing, this time people had armour, but not the standard armour they are supposed to have, it was skins vs. mail hauberk vs. that leather armour the green team used to wear in previous versions vs. the yellow padded cloth type armour. Everyone had 1 of each type of weapon and they were replaced with their own inventory if they had them, except it wasn't their own inventory it was someone else's (blast! why did I buy that nice simitiar?). Also incrediably fun, but I think the skins might have had trouble against the mail hauberks.
Finally to Dhirim, where everyone was where the correct era of tournament armour, had weapons like Jekala, and was generally quite good, aside from the random person's equipment and while they had the right style of tournament armour, the green team had been replaced by the white team.
Clearly I am unlocking some previous settings with the armour, once thought buried only to be unlocked by the foolish patterings of a newbie scriptor. But if anyone can point to the places where the script went wrong, I might have a few typos in there too. Also, I highly recommend using this muddled code to reinvigourate your tournament playing experience.

