Пятница, 29.03.2024, 04:42
Приветствую Вас Гость | RSS
[ Новые сообщения · Участники · Правила форума · Поиск · RSS ]
  • Страница 1 из 1
  • 1
Форум » S.T.A.L.K.E.R. Модострение » S.T.A.L.K.E.R. Shadow of Chernobyl » Делаем ремонт оружия
Делаем ремонт оружия
Vavilov8Дата: Четверг, 13.09.2012, 14:50 | Сообщение # 1
VIP
Группа: Администраторы
Сообщений: 42
Репутация: 0
Статус: Offline
Что нам понадобится: готовый новый НПС, файлы в составе:
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 пропишем нашему НПС диалог:
Code

<!---------------------------------------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:
Code

[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 сделаем ссылку на текст диалога:
Code

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, пропишем следующие:
Code

--------------------------------------------------------------------------------------------------------
--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 со следующим содержанием:
Code

<?xml version="1.0" encoding="windows-1251" ?>
<game_dialogs>

<!--********************************-->
<!-- Repair dialog start -->
<!--********************************-->
<dialog id="escape_repair">
<precondition>escape_dialog.repair_precond</precondition>
<has_info>tutorial_end</has_info>
<phrase_list>
<phrase id="0">
<text>escape_repair_0</text>
<next>1</next>
</phrase>
<phrase id="1">
<text>escape_repair_1</text>
<action>escape_dialog.repair_costs</action>
<next>2</next>
<next>3</next>
<next>4</next>
<next>5</next>
</phrase>
<phrase id="2">
<precondition>escape_dialog.check_money_s1</precondition>
<text>escape_repair_2</text>
<action>escape_dialog.repiar_weapon_s1</action>
<next>6</next>
</phrase>
<phrase id="3">
<precondition>escape_dialog.check_money_s2</precondition>
<text>escape_repair_3</text>
<action>escape_dialog.repiar_weapon_s2</action>
<next>6</next>
</phrase>
<phrase id="4">
<precondition>escape_dialog.check_money_s6</precondition>
<text>escape_repair_4</text>
<action>escape_dialog.repiar_armor_s6</action>
<next>7</next>
</phrase>
<phrase id="5">
<text>escape_repair_5</text>
</phrase>
<phrase id="6">
<text>escape_repair_6</text>
<next>8</next>
<next>10</next>
</phrase>
<phrase id="7">
<text>escape_repair_7</text>
<next>9</next>
<next>10</next>
</phrase>
<phrase id="8">
<text>escape_repair_8</text>
</phrase>
<phrase id="9">
<text>escape_repair_9</text>
</phrase>
<phrase id="10">
<precondition>escape_dialog.repair_precond</precondition>
<text>escape_repair_10</text>
<next>11</next>
</phrase>
<phrase id="11">
<text>escape_repair_11</text>
<action>escape_dialog.repair_costs</action>
<next>2</next>
<next>3</next>
<next>4</next>
<next>5</next>
</phrase>
</phrase_list>
</dialog>

</game_dialogs>  


теперь создадим файл с текстовкой которую будет видеть игрок, файл stable_repair_dialogs.xml config\text\rus:
Code

<?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>  


Всё, теперь после того как получим флешку от Шустрого и отнесём Сидоровичу, мы свободно можем чинить оружие и броню у нашего механика
то что получилось: Скачать
 
Форум » S.T.A.L.K.E.R. Модострение » S.T.A.L.K.E.R. Shadow of Chernobyl » Делаем ремонт оружия
  • Страница 1 из 1
  • 1
Поиск: