Перейти к контенту

Уроки по модостроению


Zeka1996Korneev

Рекомендуемые сообщения

(изменено)
Автор: PrototypeGameZ
Сложность: Средне

Файлы:
config\localization (rus).ltx
scripts\ui_main_menu.script
config\ui\ui_cheat.xml
scripts\ui_cheat.script
config\text\rus\ui_cheat.xml
scripts\prototype.script


Для начала, в файле config\localization.ltx допишите в конец строки files = ... вот это - ", ui_cheat" (без кавычек)

Далее, откроем файл scripts\ui_main_menu.script, и найдем такую строчку:
if keyboard_action == ui_events.WINDOW_KEY_PRESSED then

И после неё пишем:

if dik == DIK_keys.DIK_HOME then
    if level.present() and (db.actor ~= nil) and db.actor:alive() then
        self:cheat_menu_show()
    end
end

В конец этого файла дописываем:

function main_menu:cheat_menu_show()
    if self.cheat_dlg == nil then
        self.cheat_dlg = ui_cheat.cheat()
        self.cheat_dlg.owner = self
    end
    self:GetHolder():start_stop_menu(self.cheat_dlg, true)
    self:GetHolder():start_stop_menu(self, true)
    self:Show(true)
end

Создаём файл scripts\ui_cheat.script.
Вот его содержимое:

class "cheat" (CUIScriptWnd)

function cheat:__init(owner,objid) super()
    self.owner = owner
    self:InitControls()
    self:InitCallBacks()
end

function cheat:__finalize()
end

function cheat:check_btn(id)
local number = 8
if id <= number then
return true
else
return false
end
end

function cheat:InitControls()
    self:Init(300,200,550,450)
    local xml=CScriptXmlInit()
    xml:ParseFile("ui_cheat.xml")
    xml:InitStatic("background", self)
    if self:check_btn(1) then
    self:Register(xml:Init3tButton("btn_1",self),"btn_1")
    end
    if self:check_btn(2) then
    self:Register(xml:Init3tButton("btn_2",self),"btn_2")
    end
    if self:check_btn(3) then
    self:Register(xml:Init3tButton("btn_3",self),"btn_3")
    end
    if self:check_btn(4) then
    self:Register(xml:Init3tButton("btn_4",self),"btn_4")
    end
    if self:check_btn(5) then
    self:Register(xml:Init3tButton("btn_5",self),"btn_5")
    end
    if self:check_btn(6) then
    self:Register(xml:Init3tButton("btn_6",self),"btn_6")
    end
    if self:check_btn(7) then
    self:Register(xml:Init3tButton("btn_7",self),"btn_7")
    end
    if self:check_btn(8) then
    self:Register(xml:Init3tButton("btn_8",self),"btn_8")
    end
    if self:check_btn(9) then
    self:Register(xml:Init3tButton("btn_9",self),"btn_9")
    end
    if self:check_btn(10) then
    self:Register(xml:Init3tButton("btn_10",self),"btn_10")
    end
    if self:check_btn(11) then
    self:Register(xml:Init3tButton("btn_11",self),"btn_11")
    end
    if self:check_btn(12) then
    self:Register(xml:Init3tButton("btn_12",self),"btn_12")
    end
    if self:check_btn(13) then
    self:Register(xml:Init3tButton("btn_13",self),"btn_13")
    end
    if self:check_btn(14) then
    self:Register(xml:Init3tButton("btn_14",self),"btn_14")
    end
    if self:check_btn(15) then
    self:Register(xml:Init3tButton("btn_15",self),"btn_15")
    end
    if self:check_btn(16) then
    self:Register(xml:Init3tButton("btn_16",self),"btn_16")
    end
    self:Register(xml:Init3tButton("btn_quit",self),"btn_quit")    
end

function cheat:InitCallBacks()
    if self:check_btn(1) then
    self:AddCallback("btn_1", ui_events.BUTTON_CLICKED, self.cheat_1, self)
    end
    if self:check_btn(2) then
    self:AddCallback("btn_2", ui_events.BUTTON_CLICKED, self.cheat_2, self)
    end
    if self:check_btn(3) then
    self:AddCallback("btn_3", ui_events.BUTTON_CLICKED, self.cheat_3, self)
    end
    if self:check_btn(4) then
    self:AddCallback("btn_4", ui_events.BUTTON_CLICKED, self.cheat_4, self)
    end
    if self:check_btn(5) then
    self:AddCallback("btn_5", ui_events.BUTTON_CLICKED, self.cheat_5, self)
    end
    if self:check_btn(6) then
    self:AddCallback("btn_6", ui_events.BUTTON_CLICKED, self.cheat_6, self)
    end
    if self:check_btn(7) then
    self:AddCallback("btn_7", ui_events.BUTTON_CLICKED, self.cheat_7, self)
    end
    if self:check_btn(8) then
    self:AddCallback("btn_8", ui_events.BUTTON_CLICKED, self.cheat_8, self)
    end
    if self:check_btn(9) then
    self:AddCallback("btn_a", ui_events.BUTTON_CLICKED, self.cheat_a, self)
    end
    if self:check_btn(10) then
    self:AddCallback("btn_10", ui_events.BUTTON_CLICKED, self.cheat_10, self)
    end
    if self:check_btn(11) then
    self:AddCallback("btn_11", ui_events.BUTTON_CLICKED, self.cheat_11, self)
    end
    if self:check_btn(12) then
    self:AddCallback("btn_12", ui_events.BUTTON_CLICKED, self.cheat_12, self)
    end
    if self:check_btn(13) then
    self:AddCallback("btn_13", ui_events.BUTTON_CLICKED, self.cheat_13, self)
    end
    if self:check_btn(14) then
    self:AddCallback("btn_14", ui_events.BUTTON_CLICKED, self.cheat_14, self)
    end
    if self:check_btn(15) then
    self:AddCallback("btn_15", ui_events.BUTTON_CLICKED, self.cheat_15, self)
    end
    if self:check_btn(16) then
    self:AddCallback("btn_16", ui_events.BUTTON_CLICKED, self.cheat_16, self)
    end
    self:AddCallback("btn_quit", ui_events.BUTTON_CLICKED, self.on_quit, self)
end

function cheat:OnKeyboard(dik, keyboard_action)
    CUIScriptWnd.OnKeyboard(self,dik,keyboard_action)
    if keyboard_action == ui_events.WINDOW_KEY_PRESSED then
        if dik == DIK_keys.DIK_ESCAPE then
            self:on_quit()
        end
    end
    return true
end

function cheat:on_quit()
    local console = get_console()
    self:GetHolder():start_stop_menu (self.owner, true)
    self:GetHolder():start_stop_menu (self,true)
    self.owner:Show(true)
    console:execute("main_menu off")
end

function cheat:cheat_1()
    prototype.spawn_actor("wpn_fn2000","1")
    self:on_quit()
end

function cheat:cheat_2()
    prototype.spawn_actor("ammo_5.56x45_ap","5")
    prototype.spawn_actor("ammo_5.56x45_ap","5")
    prototype.spawn_actor("ammo_5.56x45_ap","5")
    prototype.spawn_actor("ammo_5.56x45_ap","5")
    prototype.spawn_actor("ammo_5.56x45_ap","5")
    prototype.spawn_actor("ammo_m209","5")
    prototype.spawn_actor("ammo_m209","5")
    prototype.spawn_actor("ammo_m209","5")
    prototype.spawn_actor("ammo_m209","5")
    prototype.spawn_actor("ammo_m209","5")
    prototype.spawn_actor("ammo_m209","5")
    prototype.spawn_actor("ammo_m209","5")
    prototype.spawn_actor("ammo_m209","5")
    prototype.spawn_actor("ammo_m209","5")
    prototype.spawn_actor("ammo_m209","5")
    self:on_quit()
end

function cheat:cheat_3()
    prototype.spawn_actor("outfit_exo_m1","1")
    self:on_quit()
end

function cheat:cheat_4()
    prototype.spawn_actor("af_medusa","5")
    prototype.spawn_actor("af_night_star","5")
    prototype.spawn_actor("af_vyvert","5")
    prototype.spawn_actor("af_gravi","5")
    self:on_quit()
end

function cheat:cheat_5()
    local section = "bar_dolg_respawn_1"
    local pos = db.actor:position()
    local lvid = db.actor:level_vertex_id()
    local gvid = db.actor:game_vertex_id()
    local number = "10"
    local tip = "Ну, блин! Догадался нажать HOME! Тоже мне хакер... Ну чё!? Где враги?"
    local time = "15000"
    prototype.prototype_spawn(section,pos,lvid,gvid,number,tip,time)
    self:on_quit()
end

function cheat:cheat_6()
    local section = "mil_freedom_respawn_1"
    local pos = db.actor:position()
    local lvid = db.actor:level_vertex_id()
    local gvid = db.actor:game_vertex_id()
    local number = "10"
    local tip = "Ну, блин! Догадался нажать HOME! Тоже мне хакер... Ну чё!? Где враги?"
    local time = "15000"
    prototype.prototype_spawn(section,pos,lvid,gvid,number,tip,time)
    self:on_quit()
end

function cheat:cheat_7()
    db.actor:give_money(100000)
    game_stats.money_quest_update (100000)
    self:on_quit()
end

function cheat:cheat_8()
    db.actor:restore_weapon()
    self:on_quit()
end

function cheat:cheat_a()
    self:on_quit()
end

function cheat:cheat_10()
    self:on_quit()
end

function cheat:cheat_11()
    self:on_quit()
end

function cheat:cheat_12()
    self:on_quit()
end

function cheat:cheat_13()
    self:on_quit()
end

function cheat:cheat_14()
    self:on_quit()
end

function cheat:cheat_15()
    self:on_quit()
end

function cheat:cheat_16()
    self:on_quit()
end

Создаём config\text\rus\ui_cheat.xml. Пишем:

<?xml version="1.0" encoding="windows-1251" standalone="yes"?>
<string_table>
    <string id="ui_cheat_1">
        <text>FN2000</text>
    </string>
    <string id="ui_cheat_2">
        <text>Патроны к FN2000</text>
    </string>
    <string id="ui_cheat_3">
        <text>Броня</text>
    </string>
    <string id="ui_cheat_4">
        <text>Артефакты</text>
    </string>
    <string id="ui_cheat_5">
        <text>Вызвать Долг</text>
    </string>
    <string id="ui_cheat_6">
        <text>Вызвать Свободу</text>
    </string>
    <string id="ui_cheat_7">
        <text>100000 денег</text>
    </string>
    <string id="ui_cheat_8">
        <text>Достать оружие</text>
    </string>
    <string id="ui_cheat_9">
        <text>Чит</text>
    </string>
    <string id="ui_cheat_10">
        <text>Чит</text>
    </string>
    <string id="ui_cheat_11">
        <text>Чит</text>
    </string>
    <string id="ui_cheat_12">
        <text>Чит</text>
    </string>
    <string id="ui_cheat_13">
        <text>Чит</text>
    </string>
    <string id="ui_cheat_14">
        <text>Чит</text>
    </string>
    <string id="ui_cheat_15">
        <text>Чит</text>
    </string>
    <string id="ui_cheat_16">
        <text>Чит</text>
    </string>
</string_table>

Создаём config\ui\ui_cheat.xml. Пишем:

<?xml version="1.0" encoding="windows-1251" ?>
<cheat>    
    <background x="-70" y="100" width="574" height="232" stretch="0">
        <texture x="450" y="792" width="574" height="232">ui\ui_hud</texture>
    </background>
    
    <btn_1 x="-52" y="172" width="117" height="29">
        <texture_e>ui_button_ordinary_e</texture_e>
        <texture_t>ui_button_ordinary_t</texture_t>
        <texture_h>ui_button_ordinary_h</texture_h>
        <text>ui_cheat_1</text>
    </btn_1>

    <btn_2 x="78" y="172" width="117" height="29">
        <texture_e>ui_button_ordinary_e</texture_e>
        <texture_t>ui_button_ordinary_t</texture_t>
        <texture_h>ui_button_ordinary_h</texture_h>
        <text>ui_cheat_2</text>
    </btn_2>

    <btn_3 x="-52" y="204" width="117" height="29">
        <texture_e>ui_button_ordinary_e</texture_e>
        <texture_t>ui_button_ordinary_t</texture_t>
        <texture_h>ui_button_ordinary_h</texture_h>
        <text>ui_cheat_3</text>
    </btn_3>

    <btn_4 x="78" y="204" width="117" height="29">
        <texture_e>ui_button_ordinary_e</texture_e>
        <texture_t>ui_button_ordinary_t</texture_t>
        <texture_h>ui_button_ordinary_h</texture_h>
        <text>ui_cheat_4</text>
    </btn_4>

    <btn_5 x="-52" y="236" width="117" height="29">
        <texture_e>ui_button_ordinary_e</texture_e>
        <texture_t>ui_button_ordinary_t</texture_t>
        <texture_h>ui_button_ordinary_h</texture_h>
        <text>ui_cheat_5</text>
    </btn_5>

    <btn_6 x="78" y="236" width="117" height="29">
        <texture_e>ui_button_ordinary_e</texture_e>
        <texture_t>ui_button_ordinary_t</texture_t>
        <texture_h>ui_button_ordinary_h</texture_h>
        <text>ui_cheat_6</text>
    </btn_6>

    <btn_7 x="-52" y="268" width="117" height="29">
        <texture_e>ui_button_ordinary_e</texture_e>
        <texture_t>ui_button_ordinary_t</texture_t>
        <texture_h>ui_button_ordinary_h</texture_h>
        <text>ui_cheat_7</text>
    </btn_7>

    <btn_8 x="78" y="268" width="117" height="29">
        <texture_e>ui_button_ordinary_e</texture_e>
        <texture_t>ui_button_ordinary_t</texture_t>
        <texture_h>ui_button_ordinary_h</texture_h>
        <text>ui_cheat_8</text>
    </btn_8>

    <btn_9 x="215" y="172" width="117" height="29">
        <texture_e>ui_button_ordinary_e</texture_e>
        <texture_t>ui_button_ordinary_t</texture_t>
        <texture_h>ui_button_ordinary_h</texture_h>
        <text>ui_cheat_9</text>
    </btn_9>

    <btn_10 x="345" y="172" width="117" height="29">
        <texture_e>ui_button_ordinary_e</texture_e>
        <texture_t>ui_button_ordinary_t</texture_t>
        <texture_h>ui_button_ordinary_h</texture_h>
        <text>ui_cheat_10</text>
    </btn_10>

    <btn_11 x="215" y="204" width="117" height="29">
        <texture_e>ui_button_ordinary_e</texture_e>
        <texture_t>ui_button_ordinary_t</texture_t>
        <texture_h>ui_button_ordinary_h</texture_h>
        <text>ui_cheat_11</text>
    </btn_11>

    <btn_12 x="345" y="204" width="117" height="29">
        <texture_e>ui_button_ordinary_e</texture_e>
        <texture_t>ui_button_ordinary_t</texture_t>
        <texture_h>ui_button_ordinary_h</texture_h>
        <text>ui_cheat_12</text>
    </btn_12>

    <btn_13 x="215" y="236" width="117" height="29">
        <texture_e>ui_button_ordinary_e</texture_e>
        <texture_t>ui_button_ordinary_t</texture_t>
        <texture_h>ui_button_ordinary_h</texture_h>
        <text>ui_cheat_13</text>
    </btn_13>

    <btn_14 x="345" y="236" width="117" height="29">
        <texture_e>ui_button_ordinary_e</texture_e>
        <texture_t>ui_button_ordinary_t</texture_t>
        <texture_h>ui_button_ordinary_h</texture_h>
        <text>ui_cheat_14</text>
    </btn_14>

    <btn_15 x="215" y="268" width="117" height="29">
        <texture_e>ui_button_ordinary_e</texture_e>
        <texture_t>ui_button_ordinary_t</texture_t>
        <texture_h>ui_button_ordinary_h</texture_h>
        <text>ui_cheat_15</text>
    </btn_15>

    <btn_16 x="345" y="268" width="117" height="29">
        <texture_e>ui_button_ordinary_e</texture_e>
        <texture_t>ui_button_ordinary_t</texture_t>
        <texture_h>ui_button_ordinary_h</texture_h>
        <text>ui_cheat_16</text>
    </btn_16>

    <btn_quit x="368" y="114" width="117" height="29">
        <texture_e>ui_button_ordinary_e</texture_e>
        <texture_t>ui_button_ordinary_t</texture_t>
        <texture_h>ui_button_ordinary_h</texture_h>
        <text>Выход</text>
    </btn_quit>
</cheat>

Создаём scripts\prototype.script. Пишем:

function prototype_spawn(section,pos,lvid,gvid,number,tip,time)
local i = "0"
local temp = "1"
local step = "1"
if not number then
number = "1"
end
for i = temp, number, step do
alife():create(section,pos,lvid,gvid)
end
if (tip ~= nil and time ~= nil) then
news_manager.send_tip(db.actor, tip, nil, nil, time)
end
end

function spawn_actor(section,number,tip,time)
local i = "0"
local temp = "1"
local step = "1"
if not number then
number = "1"
end
for i = temp, number, step do
alife():create(section,db.actor():position(), db.actor:level_vertex_id(), db.actor:game_vertex_id(), db.actor:id())
end
if (tip ~= nil and time ~= nil) then
news_manager.send_tip(db.actor, tip, nil, nil, time)
end
end

Всё. Заходим в игру, нажимаем HOME, пользуемся. В меню еще предусмотрено 8 кнопок, кому надо, сам поймёт как их настроить.
Если чё-то не работает, обращайтесь.
(Тестировалось на Исполнителе Желаний)

 

Изменено пользователем World_Stalker
  • Согласен 1

Поделиться этим сообщением


Ссылка на сообщение
  • Недавно просматривали   0 пользователей

    Ни один зарегистрированный пользователь не просматривает эту страницу.

AMK-Team.ru

×
×
  • Создать...