|
Опытный игрок
Регистрация: 19.08.2007
Сообщений: 1,050
Репутация: 145
|
Родолжем нашее так сказать обучение, как уже хочет публика, требуется новый НПС и ещё что бы был ремонтником, на счёт нового НПС можно посмотреть здесь, а по возможности ремонта сейчас раскажем....
кто сделал ф-ию ремонта, мне не известно(кто знает, пусть напишет), но она мелькала и продолжает мелькать в большинстве глобальных модов...
что нам понадобится: готовый новый НПС, файлы в составе:
Цитата:
all.spawn в gamedata/spawns
character_desc_escape.xml в gamedata/config/gameplay
npc_profile.xml в gamedata/config/gameplay
|
а также файлы оригиналы:
Цитата:
\config:
localization.ltx
system.ltx
\script
escape_dialog. script
|
и создать новые:
Цитата:
dialogs_repair.xml
stable_repair_dialogs.xml
|
теперь всё по порядку:
сперва отредактируем имеющиеся файлы, тоесть те, которые не требуется создавать:
в character_desc_escape.xml пропишем нашему НПС диалог:
Цитата:
<!---------------------------------------esc_mehanik----------------------------------------------------->
<specific_character id="mehanik" team_default = "1">
<name>mehanik</name>
<icon>ui_npc_u_green_stalker_5</icon>
<bio>esc_stalker_novice_bio</bio>
<class>mehanik</class>
<community>stalker</community> <terrain_sect>stalker_terrain</terrain_sect>
<rank>350</rank>
<reputation>10</reputation>
<money min="200" max="600" infinitive="0"/>
<snd_config>characters_voice\human_01\newbie\</snd_config>
<crouch_type>-1</crouch_type>
<visual>actors\soldier\soldier_bandana_6</visual>
<supplies>
[spawn] \n
wpn_pm \n
ammo_9x18_fmj = 1 \n
wpn_bm16 \n
ammo_12x70_buck \n
device_torch \n
#include "gameplay\character_items.xml" \n
#include "gameplay\character_food.xml"
</supplies>
#include "gameplay\character_criticals_3.xml"
<start_dialog>hello_dialog</start_dialog>
<actor_dialog>escape_repair</actor_dialog>
</specific_character>
|
в system.ltx сделаем ссылку на нашь repaid_dialog:
Цитата:
[dialogs]
files = dialogs_test, dialogs, dialogs_escape, dialogs_garbage, dialogs_agroprom, dialogs_deadcity, dialogs_darkvalley, dialogs_pripyat, dialogs_bar, dialogs_yantar, dialogs_military, dialogs_labx18, dialogs_radar, dialogs_aes, dialogs_repair
|
в localization.ltx сделаем ссылку на текст диалога:
Цитата:
|
files = ui_st_pda, ui_st_mm_mp, ui_st_inventory, string_table_tutorial, string_table_general, string_table_includes, stable_dialog_manager, stable_dialog_manager_uni, stable_task_manager, stable_treasure_manager, string_table_level_tips, string_table_items, string_table_ui, string_table_enc_zone, string_table_outfit, stable_dialogs, stable_dialogs_escape, stable_dialogs_garbage, stable_dialogs_agroprom, stable_dialogs_deadcity, stable_dialogs_darkvalley, stable_dialogs_pripyat, stable_dialogs_labx18, stable_dialogs_bar, stable_dialogs_military, stable_dialogs_yantar, stable_dialogs_radar, stable_dialogs_aes, mp_st_speechmenu, ui_st_keybinding, ui_mp_teamdesc, ui_st_mm, stable_stories, ui_st_mapdesc, string_table_enc_social, string_table_enc_mutants, string_table_enc_weapons, string_table_enc_equipment, ui_st_mp, ui_st_other, stable_game_credits, stable_repair_dialogs
|
теперь добавим саму функцию ремонта, для этого в файле escape_dialog. script, пропишем следующие:
Скрытый текст:
Цитата:
--------------------------------------------------------------------------------------------------------
--Repair
--------------------------------------------------------------------------------------------------------
local weapon_profit_margin = 1.3
local armor_profit_margin = 1.2
function repair_precond(npc, actor)
local item_in_slot_1 = db.actor:item_in_slot(1)
local item_in_slot_2 = db.actor:item_in_slot(2)
local item_in_slot_6 = db.actor:item_in_slot(6)
if item_in_slot_1 ~= nil and 1 > item_in_slot_1:condition() + 0.01 then return true
elseif item_in_slot_2 ~= nil and 1 > item_in_slot_2:condition() + 0.01 then return true
elseif item_in_slot_6 ~= nil and 1 > item_in_slot_6:condition() + 0.01 then return true
else return false
end
end
function check_money_s1(npc, actor)
local item_in_slot = db.actor:item_in_slot(1)
if item_in_slot ~= nil then
local item_repair_cost = math.floor( (1-item_in_slot:condition()) * item_in_slot:cost() * weapon_profit_margin )
if item_repair_cost > 0 and db.actor:money() >= item_repair_cost and 1 > item_in_slot:condition() then
return true
end
end
return false
end
function check_money_s2(npc, actor)
local item_in_slot = db.actor:item_in_slot(2)
if item_in_slot ~= nil then
local item_repair_cost = math.floor( (1-item_in_slot:condition()) * item_in_slot:cost() * weapon_profit_margin )
if item_repair_cost > 0 and db.actor:money() >= item_repair_cost and 1 > item_in_slot:condition() then
return true
end
end
return false
end
function check_money_s6(npc, actor)
local item_in_slot = db.actor:item_in_slot(6)
if item_in_slot ~= nil then
local item_repair_cost = math.floor( (1-item_in_slot:condition()) * item_in_slot:cost() * armor_profit_margin )
if item_repair_cost > 0 and db.actor:money() >= item_repair_cost and 1 > item_in_slot:condition() then
return true
end
end
return false
end
function repiar_weapon_s1(npc, actor)
local item_in_slot = db.actor:item_in_slot(1)
if item_in_slot ~= nil then
local item_repair_cost = math.floor( (1-item_in_slot:condition()) * item_in_slot:cost() * weapon_profit_margin )
item_in_slot:set_condition(1)
dialogs.relocate_money(actor, item_repair_cost, "out")
end
end
function repiar_weapon_s2(npc, actor)
local item_in_slot = db.actor:item_in_slot(2)
if item_in_slot ~= nil then
local item_repair_cost = math.floor( (1-item_in_slot:condition()) * item_in_slot:cost() * weapon_profit_margin )
item_in_slot:set_condition(1)
dialogs.relocate_money(actor, item_repair_cost, "out")
end
end
function repiar_armor_s6(npc, actor)
local item_in_slot = db.actor:item_in_slot(6)
if item_in_slot ~= nil then
local item_repair_cost = math.floor( (1-item_in_slot:condition()) * item_in_slot:cost() * armor_profit_margin )
item_in_slot:set_condition(1)
dialogs.relocate_money(actor, item_repair_cost, "out")
end
end
function repair_costs(first_speaker, second_speaker)
local task_texture, task_rect = get_texture_info("ui_iconsTotal_lost_money")
local item_name_and_price = ""
local item_repair_cost = 0
if db.actor ~= nil then
local item_in_slot_1 = db.actor:item_in_slot(1)
local item_in_slot_2 = db.actor:item_in_slot(2)
local item_in_slot_6 = db.actor:item_in_slot(6)
if item_in_slot_1 ~= nil then
item_repair_cost = math.floor( (1-item_in_slot_1:condition()) * item_in_slot_1:cost() * weapon_profit_margin )
if item_repair_cost > 0 then
item_name_and_price = game.translate_string("list_repair_0").." %c[255,238,155,23]"..item_repair_cost.."Ru%c[default]"
db.actor:give_talk_message(item_name_and_price, task_texture, task_rect, "iconed_trade_info")
end
end
if item_in_slot_2 ~= nil then
item_repair_cost = math.floor( (1-item_in_slot_2:condition()) * item_in_slot_2:cost() * weapon_profit_margin )
if item_repair_cost > 0 then
item_name_and_price = game.translate_string("list_repair_1").." %c[255,238,155,23]"..item_repair_cost.."Ru%c[default]"
db.actor:give_talk_message(item_name_and_price, task_texture, task_rect, "iconed_trade_info")
end
end
if item_in_slot_6 ~= nil then
item_repair_cost = math.floor( (1-item_in_slot_6:condition()) * item_in_slot_6:cost() * armor_profit_margin )
if item_repair_cost > 0 then
item_name_and_price = game.translate_string("list_repair_2").." %c[255,238,155,23]"..item_repair_cost.."Ru%c[default]"
db.actor:give_talk_message(item_name_and_price, task_texture, task_rect, "iconed_trade_info")
end
end
end
end
|
теперь создадим файл dialogs_repair.xml в config\gamepay со следующим содержанием:
теперь создадим файл с текстовкой которую будет видеть игрок, файл stable_repair_dialogs.xml config\text\rus:
Скрытый текст:
Цитата:
<?xml version="1.0" encoding="windows-1251" ?>
<string_table>
<string id="list_repair_0">
<text>Стоимость починки оружия в первом слоте:</text>
</string>
<string id="list_repair_1">
<text>Стоимость починки оружия во втором слоте:</text>
</string>
<string id="list_repair_2">
<text>Стоимость починки брони:</text>
</string>
<!--********************************-->
<!-- Repair dialog start -->
<!--********************************-->
<string id="escape_repair_0">
<text>Слыш, да ты никак стволы чинишь... и бронежилеты?</text>
</string>
<string id="escape_repair_1">
<text>А... это ты о той штуке, что в тисках? Да, хороший ствол будет. Правда дорогущий. Так что тебе надо отремонтировать? Предупреждаю - это не дешевая работа, чем больше износ тем дороже. Итак?\n \nСписок возможных починок:</text>
</string>
<string id="escape_repair_2">
<text>Отремонтируй первый ствол.</text>
</string>
<string id="escape_repair_3">
<text>Отремонтируй второй ствол.</text>
</string>
<string id="escape_repair_4">
<text>Отремонтируй броньку.</text>
</string>
<string id="escape_repair_5">
<text>Черт, с деньгами напряг. Зайду позже.</text>
</string>
<string id="escape_repair_6">
<text>Щас... всё мигом сделаю...\n \nГотово, забирай!</text>
</string>
<string id="escape_repair_7">
<text>Да... Меченый, здорово тябя потрепало. Так... где то у меня были броньпластины... ага вот они... вот так... угу... уф.\n \nПолучай, как новенький!</text>
</string>
<string id="escape_repair_8">
<text>Хм. Отличная работа. Слушай, а где ты так навострился? Молчишь? Ну и ладно.</text>
</string>
<string id="escape_repair_9">
<text>Мастерская работа, не зря такие деньги берешь.</text>
</string>
<string id="escape_repair_10">
<text>Можеш ещё кое-что поченить?</text>
</string>
<string id="escape_repair_11">
<text>Ну давай, сделаю.\n \nСписок возможных починок:</text>
</string>
</string_table>
|
всё, теперь после того как получим флешку от Шустрого и отнесём Сидоровичу, мы свободно можем чинить оружие и броню у нашего механика
то что получилось: Скачать
__________________
"Чем больше нас, тем меньше их..."
Последний раз редактировалось Jesh; 05.06.2009 в 14:06.
|