Сообщество Империал: [Modding] Отравленные оружия - Сообщество Империал

Доктор Стрэндж

[Modding] Отравленные оружия

[Modding] Отравленные оружия
Тема создана: 20 апреля 2019, 22:58 · Автор: Доктор Стрэндж
 Доктор Стрэндж
  • Imperial
Imperial
Форумчанин

Дата: 20 апреля 2019, 22:58

Imp

Оружия после удара будут периодически наносить противнику урон.
Инструкция по добавлению:

Добавляем эту строку в module_constants.py:

Цитата

slot_agent_is_poisoned = 30


Находим скрипт game_get_item_extra_text в module_scripts и добавляем следующие строки в конец скрипта:

Цитата

(else_try),
(this_or_next|eq, ":item_no", "itm_falchion"), #This is a list of weapons that should have poison effect
(eq, ":item_no", "itm_arrows"),
(try_begin),
(eq, ":extra_text_id", 0),
(set_result_string, "@Poisoned"),
(set_trigger_result, 0x3F8000),
(try_end),
]),


Следующие строки добавляем в module_mission_templates:

Цитата

poison1 = (ti_on_agent_hit, 0, 0, [], [

(store_trigger_param_1, ":victim"),
(store_trigger_param_2, ":attacker"),
(store_trigger_param, ":missile", 5),

#Here we should add weapons that were listed before. Note that weapons are added in reg0 and missiles in ":missile"
variable. It is important. Also do keep in mind that in this case, throwing weapons are treated as missiles
(this_or_next|eq, reg0, "itm_falchion"),
(eq, ":missile", "itm_arrows"),
(try_begin),
(agent_get_slot, ":is_poisoned", ":victim", slot_agent_is_poisoned),
(get_player_agent_no, ":player"),
(agent_get_horse, ":p_horse", ":player"),
(try_begin),
(eq, ":attacker", ":player"),
(neq, ":is_poisoned", 1),
(try_begin),
(neg|agent_is_human, ":victim"),
(display_message, "@You have poisoned a horse!", 0x3F8000),
(agent_set_slot, ":victim", slot_agent_is_poisoned, 1),
(else_try),
(display_message, "@You have poisoned the enemy!", 0x3F8000),
(agent_set_slot, ":victim", slot_agent_is_poisoned, 1),
(try_end),
(else_try),
(eq, ":victim", ":player"),
(neq, ":is_poisoned", 1),
(display_message, "@You are poisoned!", 0x3F8000),
(agent_set_slot, ":victim", slot_agent_is_poisoned, 1),
(else_try),
(eq, ":victim", ":p_horse"),
(neq, ":is_poisoned", 1),
(display_message, "@Your horse is poisoned!", 0x3F8000),
(agent_set_slot, ":victim", slot_agent_is_poisoned, 1),
(else_try),
(neq, ":is_poisoned", 1),
(agent_set_slot, ":victim", slot_agent_is_poisoned, 1),
(try_end),
(try_end),
])

poison2 = (1, 0, 0, [], [

(try_for_agents,":cur_agent"),
(agent_is_alive, ":cur_agent"),
(agent_get_slot, ":is_poisoned", ":cur_agent", slot_agent_is_poisoned),
(eq, ":is_poisoned", 1),
(try_begin),
(store_agent_hit_points,":agent_hp",":cur_agent", 0),
(val_sub,":agent_hp", 1),
(agent_set_hit_points,":cur_agent",":agent_hp", 0),
(le,":agent_hp", 1),
(remove_agent,":cur_agent"),
(try_end),
(try_end),
])

poison3 = (ti_on_agent_killed_or_wounded, 0, 0, [], [

(store_trigger_param_1, ":victim"),

(agent_get_troop_id, ":troop", ":victim"),
(str_store_troop_name, s33, ":troop"),
(agent_get_slot, ":is_poisoned", ":victim", slot_agent_is_poisoned),
(try_begin),
(eq, ":is_poisoned", 1),
(agent_is_human, ":victim"),
(troop_is_hero, ":troop"),
(display_message, "@{s33} fainted of poison.", 0x3F8000),
(set_trigger_result, 2),
(else_try),
(eq, ":is_poisoned", 1),
(agent_is_human, ":victim"),
(display_message, "@{s33} died of poison.", 0x3F8000),
(set_trigger_result, 1),
(else_try),
(eq, ":is_poisoned", 1),
(display_message, "@Horse died of poison.", 0x3F8000),
(set_trigger_result, 1),
(try_end),
])


Все готово для использования.
     Похожие Темы
    С[Статья] TerraModding Глава №8
    [Статья] TerraModding Глава №8
    Автор С СоциоПат
    Обновление 21 апреля 2023, 20:53
    С[Статья] TerraModding Глава №7
    [Статья] TerraModding Глава №7
    Автор С СоциоПат
    Обновление 08 апреля 2023, 10:29
    С[Статья] TerraModding Глава №6
    [Статья] TerraModding Глава №6
    Автор С СоциоПат
    Обновление 28 марта 2023, 13:19
    Воспользуйтесь одной из соц-сетей для входа
    РегистрацияВход на форум 
    «Империал» · Условия · Ответственность · Визитка · 25 апр 2024, 07:43 · Зеркала: Org, Site, Online · Счётчики