모드를 만들어 보자
모드를 만들려면 다음과 같은 사이트를 참조하자
https://noita.fandom.com/wiki/Modding
Modding
This page is written for aspiring modders. For installing mods, see the page How to install mods. For info about some specific existing Mods, see the Noita-mods wiki. Modding Noita is quite straightforward and fun, but can still hide many implementation de
noita.fandom.com
절차나 내용을 간략히 보자
윈도우의 경우 data_wak_unpack.bat 를 통해 노이타의 리소스 파일을 볼 수 있다. 여기서 보이는 노이타에서 돌아가는 코드일 뿐이지 실제로 게임에 쓰이는 파일들이 아니다. 이 내용들은 나중에 참조할 때 쓰인다.
이후 읽으라는 것을 읽으면 된다.
내가 만들고 싶은 모드는 인벤토리를 늘리는 모드다.
창작마당을 검색해보니 인벤토리를 늘리는 퍽 추가는 있다.
어디서나 와드 편집을 들고 시작하는 모드는 있으니 이 모드를 개조해서 처음부터 인벤토리를 늘리는 퍽을 들고 시작해보자.
-- 와 lua는 있지도 않네
dofile( "data/scripts/lib/utilities.lua" )
dofile( "data/scripts/perks/perk_list.lua" )
function OnPlayerSpawned( player_entity )
if tonumber(StatsGetValue("playtime")) > 1 then
return
end
local perk_id = "EDIT_WANDS_EVERYWHERE"
local perk_data = get_perk_with_id(perk_list, perk_id)
GameAddFlagRun( get_perk_picked_flag_name(perk_id) )
if perk_data.game_effect ~= nil then
local e = GetGameEffectLoadTo( player_entity, perk_data.game_effect, true )
if e ~= nil then
ComponentSetValue( e, "frames", "-1" )
end
end
if perk_data.func ~= nil then
perk_data.func( nil, player_entity, nil )
end
local ui = EntityCreateNew( "" )
EntityAddComponent( ui, "UIIconComponent",
{
name = perk_data.ui_name,
description = perk_data.ui_description,
icon_sprite_file = perk_data.ui_icon
})
EntityAddChild( player_entity, ui )
end
ModLuaFileAppend( "data/scripts/perks/perk_list.lua", "mods/edit_wands_always/files/remover.lua" )
p대충 플레이어가 스폰될 때 능력을 얻고 목록에서 지우나보다.
나중에 보니 사이트에 더 간편해보이는 예시가 있었다.
https://noita.fandom.com/wiki/Modding:_Making_a_custom_perk
Modding: Making a custom perk
Making a new perk is relatively simple, assuming you have gone through the Modding: Basics and have a mod directory set up. Add a new file to your mod (eg. files/perk_list.lua), where you define all your custom perks by appending to the perk_list table pro
noita.fandom.com
대충 느낌을 알았으니 perk_id를 우리가 원하는 MORE_INVENTORY_SLOTS 로 수정해서 돌리면 된다. 뒤에 목록 지우는 것도 경로까지 수정해서 같이 맞춰주면 잘 돌아간다.
-----------------------------------------------------
한번 바꾼김에 답답하던 능력 뽑기도 리롤 가격을 낮춰 수정해 보고자 했다.
.bat 으로 얻은 자료 중 data/scripts/perks/~ 에 있는 파일을 수정하면 될 줄 알았는데 거기는 바꿔도 적용이 안됐다.
설명을 보면 모드에 data 아래 넣은 것은 override 한다고 하니 게임 기본을 건드려면 원하는 부분을 수정해 모드 폴더의 data에 경로에 맞게 넣고 모드를 적용하면 된다.
perk_reroll_init.lua 을 수정해 reroll의 기본 가격을 10원으로 했다.
local entity_id = GetUpdatedEntityID()
local itemcost_comp = EntityGetFirstComponent( entity_id, "ItemCostComponent" )
local costsprite_comp = EntityGetComponent( entity_id, "SpriteComponent", "shop_cost" )
local perk_reroll_count = tonumber( GlobalsGetValue( "TEMPLE_PERK_REROLL_COUNT", "0" ) )
-- local cost = 200 * math.pow( 2, perk_reroll_count )
local cost = 10 * math.pow( 2, perk_reroll_count )
if ( costsprite_comp ~= nil ) then
local comp = costsprite_comp[1]
local offsetx = 6
local text = tostring(cost)
text = "TEST"
if ( text ~= nil ) then
local textwidth = 0
for i=1,#text do
local l = string.sub( text, i, i )
if ( l ~= "1" ) then
textwidth = textwidth + 6
else
textwidth = textwidth + 3
end
end
offsetx = textwidth * 0.5 - 0.5
ComponentSetValue2( comp, "offset_x", offsetx )
end
end
ComponentSetValue( itemcost_comp, "cost", tostring(cost))
-- ComponentSetMetaCustom( ingestion_component, "ingestible_materials", values)
perk.lua 를 바꿔 한번 reroll해도 가격이 오르지 않게 수정했다.
~
~
~
~
~
-- first remove all the perks that are visible and count how many and where they are
function perk_reroll_perks( entity_item )
local perk_spawn_pos = {}
local perk_count = 0
-- remove all perk items (also this one!) ----------------------------
local all_perks = EntityGetWithTag( "perk" )
local x, y
if ( #all_perks > 0 ) then
for i,entity_perk in ipairs(all_perks) do
if entity_perk ~= nil then
perk_count = perk_count + 1
x, y = EntityGetTransform( entity_perk )
table.insert( perk_spawn_pos, { x, y } )
EntityKill( entity_perk )
end
end
end
local perk_reroll_count = tonumber( GlobalsGetValue( "TEMPLE_PERK_REROLL_COUNT", "0" ) )
-- perk_reroll_count = perk_reroll_count + 1
perk_reroll_count = perk_reroll_count
GlobalsSetValue( "TEMPLE_PERK_REROLL_COUNT", tostring( perk_reroll_count ) )
local count = perk_count
local width = 60
local item_width = width / count
local perks = perk_get_spawn_order()
for i,v in ipairs(perk_spawn_pos) do
x = v[1]
y = v[2]
local next_perk_index = tonumber( GlobalsGetValue( "TEMPLE_REROLL_PERK_INDEX", tostring(#perks) ) )
local perk_id = perks[next_perk_index]
while( perk_id == nil or perk_id == "" ) do
-- if we over flow
perks[next_perk_index] = "LEGGY_FEET"
next_perk_index = next_perk_index - 1
if next_perk_index <= 0 then
next_perk_index = #perks
end
perk_id = perks[next_perk_index]
end
next_perk_index = next_perk_index - 1
if next_perk_index <= 0 then
next_perk_index = #perks
end
GlobalsSetValue( "TEMPLE_REROLL_PERK_INDEX", tostring(next_perk_index) )
GameAddFlagRun( get_perk_flag_name(perk_id) )
perk_spawn( x, y, perk_id )
end
end
~
~
~
~
~