Better MS Scripting Reference: header_operations expanded

Users who are viewing this thread

Undocumented Warband operations

store_main_party_wounded = 2176 # (store_main_party_wounded,<destination>),

lhs operation

Code:
case store_main_party_wounded:
        {
            int wounded = 0;
            mbParty *mainParty = g_game->getMainParty();


            for (int i = 0; i < mainParty->m_numStacks; ++i)
            {
                mbPartyStack *stack = mainParty->getStack(i);


                if (!stack->isPrisoner())
                {
                    mbTroop *troop = g_game->getTroop(stack->m_troopNo);


                    wounded += troop->isHero() ? (int)ceilf(((float)troop->getMaxHitPoints() - troop->m_hitPoints) * 0.15f) : stack->m_numWounded;
                }
            }
            returnValue(localVariables, wounded);
        }


str_store_agent_face_keys = 2749 # (str_store_agent_face_keys, <string_no>, <agent_id>),

Code:
case str_store_agent_face_keys:
        if (mbCheckRegister(intValues[0]) && mbCheckAgent(intValues[1]))
        {
            mbAgent *agent = g_mission->getAgent(intValues[1]);
            mbTroop *troop = agent->getTroop();


            g_faceGenerator.load(agent->m_skinNo, agent->m_dna, troop->m_faceKeys1, troop->m_faceKeys2);
            mbFaceKeys facekeys;
            g_faceGenerator.fillKeys(facekeys);
            g_basicGame.m_stringRegisters[intValues[0]] = facekeys.toString();
        }

Their practical application is unclear, which is probably why they are not in the documentation.
 
cur_item_add_mesh has an optional fourth parameter color

(cur_item_add_mesh, <mesh_name_string>, [<lod_begin>], [<lod_end>], [<color>]),
 
Undocumented Warband operations

store_main_party_wounded = 2176 # (store_main_party_wounded,<destination>),

lhs operation

Code:
case store_main_party_wounded:
        {
            int wounded = 0;
            mbParty *mainParty = g_game->getMainParty();


            for (int i = 0; i < mainParty->m_numStacks; ++i)
            {
                mbPartyStack *stack = mainParty->getStack(i);


                if (!stack->isPrisoner())
                {
                    mbTroop *troop = g_game->getTroop(stack->m_troopNo);


                    wounded += troop->isHero() ? (int)ceilf(((float)troop->getMaxHitPoints() - troop->m_hitPoints) * 0.15f) : stack->m_numWounded;
                }
            }
            returnValue(localVariables, wounded);
        }


str_store_agent_face_keys = 2749 # (str_store_agent_face_keys, <string_no>, <agent_id>),

Code:
case str_store_agent_face_keys:
        if (mbCheckRegister(intValues[0]) && mbCheckAgent(intValues[1]))
        {
            mbAgent *agent = g_mission->getAgent(intValues[1]);
            mbTroop *troop = agent->getTroop();


            g_faceGenerator.load(agent->m_skinNo, agent->m_dna, troop->m_faceKeys1, troop->m_faceKeys2);
            mbFaceKeys facekeys;
            g_faceGenerator.fillKeys(facekeys);
            g_basicGame.m_stringRegisters[intValues[0]] = facekeys.toString();
        }

Their practical application is unclear, which is probably why they are not in the documentation.
I am currently updating the GitLab again. Are you sure about store_main_party_wounded? It would share the same OP Code as store_proficiency_level which made me wonder (in both cases 2176).

To add to that a question: daniel99 is asking here about an operation named set_ally_collision_threshold. Is that a WSE operation since I can also not find its OP Code.
set_ally_collision_threshold = 3602 #(set_ally_collision_threshold, <low_boundary>, <high_boundary>), #Changes the animation progress boundaries (in percents) that determine if attacks on allies will collide (default: 45% <= x <= 60%)

Trying to set allied collision to be the same as enemies. Is (default: 45% <= x <= 60%) the default for allies or enemies? If it's for allies, what would I need to change to make it match that of an enemy?
 
I have updated the GitLab

New operations:
- str_store_agent_face_keys
- store_main_party_wounded

New parameter at operation:
- cur_item_add_mesh

Improved descriptions at:
- val_clamp
- store_script_param_X
- options_set_battle_size
- party_set_icon
- party_set_banner_icon
- party_set_extra_icon
- party_quick_attach_to_current_battle
- troop_loot_troop
- set_merchandise_modifier_quality
- cur_item_set_material
- cur_item_add_mesh
- init_position
- in_meta_mission
- set_party_battle_mode
- add_missile
- agent_set_max_hit_points

New defined operations for easier usage at code:
- faction_slot_lt
- party_is_dead
- party_template_slot_lt
- party_slot_lt
- troop_slot_lt
- quest_slot_lt
- item_slot_lt
- num_active_teams_gt
- main_hero_alive
- scene_slot_lt
- agent_is_down
- agent_is_horse
- agent_is_enemy
- agent_is_attacker
- team_slot_lt
- agent_slot_lt

Little corrections and added remark at Z24 (MULTIPLAYER AND NETWORKING)

@Vetrogor , I integrated all informations of mbcommands wiki up to your latest change at 4th of April. See commit for the exact changes. mbcommands got also added to the initial post of Lav.

@K700 , do you think that there are now all available operations listed? I made a short list with 42 lone wolf numbers of which the number neighbours before and after are used OP Codes while they are not. They seemed to be potential candidates for existing but not listed operations. Not sure if you have an easier way to see all available operations, I have no deep software knowledge here.
2, 38, 43, 59, 74, 76, 109, 428, 469, 474, 706, 989, 1061, 1099, 1306, 1504, 1514, 1524, 1624, 1659, 1664, 1668, 1821, 1824, 1839, 1888, 1979, 2005, 2007, 2054, 2059, 2074, 2118, 2132, 2166, 2174, 2253, 2256, 2260, 2331, 2354, 2378
 
I found out that this operation is not indicated in the documentation yet

can fail
is_cheat_mode_enabled = 53 # (is_cheat_mode_enabled),
 
@K700 , could you shortly verify if the operation presentation_is_active is a WSE operation or a Native one? I just noticed that I have that operation mentioned in a comment while it is not mentioned with an own OP code and I didn't see any Module System with that operation. I would assume that it's a WSE operation, just to make things sure. Thanks!

I carried over that description of Lav who took it probably out of here:
Code:
player_is_busy_with_menus                    =  438  # (player_is_busy_with_menus, <player_id>),
this one is used when a player presses a hotkey like TAB or ESC to check if he doesn't have any kind of presentation open, however, it works strangely and is almost always acompannied by some sort of (neg|presentation_is_active, "prst"), in native


Edit: Sorry, my misstake. The operation is called is_presentation_active and I simply missed that somehow, a simply spelling misstake by the others here.
 
Last edited:
I have updated the GitLab

New operation:
- is_cheat_mode_enabled

New defined operations for easier usage at code:
- store_random_parties_in_range as alternative for store01_random_parties_in_range

Improved descriptions at:
- key_is_down
- key_clicked
- game_key_is_down
- game_key_clicked
- troop_raise_proficiency
- question_box
- set_rain
- agent_stop_sound
- agent_set_position
- agent_get_action_dir
- agent_start_running_away
- agent_set_kick_allowed
- player_is_busy_with_menus
- player_get/set_score
- player_get/set_kill_count
- player_get/set_death_count
- player_get_ping
- player_get/set_is_muted
- player_get_gender
- player_save_picked_up_items_for_next_spawn
- team_get/set_bot_kill_count
- team_get/set_bot_death_count
- team_get_kill_count
- team_get/set_score
- team_set/get_faction
- server_get/set_combat_speed
- server_get/set_friendly_fire
- server_get/set_control_block_dir
- server_set_password
- server_get/set_add_to_game_servers_list
- server_get/set_ghost_mode
- server_set_name
- server_get/set_max_num_players
- server_set_welcome_message
- server_get/set_melee_friendly_fire
- server_get/set_friendly_fire_damage_self_ratio
- server_get/set_friendly_fire_damage_friend_ratio
- server_get/set_anti_cheat

Listed up all remaining issues with varying degree of difficulty/accompanying informations, up for tests/research
Little corrections and new placement of troop_set_face_key_from_current_profile

@Vetrogor , I integrated all informations of mbcommands wiki up to today, 11th of May. See commit for the exact changes. I did not integrate some syntax stuff which you have implemented. I am not sure yet if I find it useful there or not (I have it on the list for the Modding Guide though).
 
Back
Top Bottom