土豆兄弟(Brotato) MOD制作讲解 开局基本属性修改

官方模组指南

网址链接

案例

难度 - 减10

Mod文件目录

mods-unpacked
  - 作者名-MOD名称
    - extensions
      - ......
    - mod_main.gd
    - manifest.json

例如

mods-unpacked
  - kuiwaiwai-MinusTen
    - extensions
      - singletons
        - run_data.gd
    - mod_main.gd
    - manifest.json

mod_main.gd文件

extends Node

const MOD_DIR = "kuiwaiwai-MinusTen/" # MOD目录
const LOG_NAME = "kuiwaiwai-MinusTen" # MOD名称

var dir = ""
var content_dir = ""
var content_data_dir = ""
var weapons_dir = ""
var ext_dir = ""
var trans_dir = ""

func _init(modLoader = ModLoader):
ModLoaderUtils.log_info("Init", LOG_NAME)
dir = modLoader.UNPACKED_DIR + MOD_DIR
trans_dir = dir + "translations/"
content_dir = dir + "content/"
content_data_dir = dir + "content_data/"
ext_dir = dir + "extension/"
modLoader.install_script_extension("res://mods-unpacked/kuiwaiwai-MinusTen/extensions/singletons/run_data.gd") # MOD中需要加载的文件
func _ready():
ModLoaderUtils.log_info("Done", LOG_NAME)

manifest.json文件

{
  "name": "MinusTen", # MOD名称
  "namespace": "kuiwaiwai", # 作者名称
  "version_number": "1.0.0", # MOD版本
  "description": "Make the game easier.", # MOD描述
  "website_url": "",
  "dependencies": [
  ],
  "extra": {
    "godot": {
      "incompatibilities": [ # MOD的不兼容性
      ],
      "authors": [
        "kuiwaiwai" # MOD作者
      ],
      "compatible_mod_loader_version": "3.0.0", # 适用游戏版本
      "compatible_game_version": [ "0.8.0.0" ],
      "config_defaults": {}
    }
  }

}

run_data.gd文件

extends "res://singletons/run_data.gd" # 拓展修改的是哪个游戏文件

func _ready():
init_stats()

func init_stats(all_null_values:bool = false)->Dictionary:  # 初始加载数据
# 各项开局初始属性数据↓
return {
"stat_max_hp":60 if not all_null_values else 0, # add 50
"stat_armor":5, # add 5
"stat_crit_chance":4, # add 4
"stat_luck":0, 
"stat_attack_speed":10, # add 10
"stat_elemental_damage":0, 
"stat_hp_regeneration":0, 
"stat_lifesteal":4, # add 4
"stat_melee_damage":0, 
"stat_percent_damage":5, # add 5
"stat_dodge":0, 
"stat_engineering":0, 
"stat_range":0, 
"stat_ranged_damage":0, 
"stat_speed":1, # add 1
"stat_harvesting":0, 
"xp_gain":2, # add 2
"number_of_enemies":0, 
"consumable_heal":0, 
"burning_cooldown_reduction":0, 
"burning_spread":0, 
"piercing":0, 
"piercing_damage":0, 
"pickup_range":0, 
"chance_double_gold":0, 
"bounce":0, 
"bounce_damage":0, 
"heal_when_pickup_gold":0, 
"item_box_gold":0, 
"knockback":0, 
"hp_cap":999999 if not all_null_values else 0, 
"lose_hp_per_second":0, 
"map_size":0, 
"dodge_cap":60, 
"gold_drops":100 if not all_null_values else 0, 
"enemy_health":0, 
"enemy_damage":0, 
"enemy_speed":-1, # reduce 1
"boss_strength":0, 
"explosion_size":0, 
"explosion_damage":0, 
"damage_against_bosses":0, 
"giant_crit_damage":0, 
"weapon_slot":6 if not all_null_values else 0, 
"items_price":0, 
"harvesting_growth":5 if not all_null_values else 0, 
"hit_protection":0, 
"weapons_price":0, 
}
阅读剩余
THE END