AkaiNight Posted June 24, 2021 Share Posted June 24, 2021 (edited) I am trying to make a hud for display my characters some stats(like exp) and boss counts. And i am using this tutorial. I don't know what i did wrong but it stuck at "server is generating world" screen (it does not stop working or crush" here is the code files. The tutorial for a seperate mod but im trying to make it in a character mode i don't know what i did wrong. Any help would be great. PrefabFiles = { "esctemplate", "esctemplate_none", "rusty_armor", "stat_ui", } Assets = { Asset( "IMAGE", "images/saveslot_portraits/esctemplate.tex" ), Asset( "ATLAS", "images/saveslot_portraits/esctemplate.xml" ), Asset( "IMAGE", "images/selectscreen_portraits/esctemplate.tex" ), Asset( "ATLAS", "images/selectscreen_portraits/esctemplate.xml" ), Asset( "IMAGE", "images/selectscreen_portraits/esctemplate_silho.tex" ), Asset( "ATLAS", "images/selectscreen_portraits/esctemplate_silho.xml" ), Asset( "IMAGE", "bigportraits/esctemplate.tex" ), Asset( "ATLAS", "bigportraits/esctemplate.xml" ), Asset( "IMAGE", "images/map_icons/esctemplate.tex" ), Asset( "ATLAS", "images/map_icons/esctemplate.xml" ), Asset( "IMAGE", "images/avatars/avatar_esctemplate.tex" ), Asset( "ATLAS", "images/avatars/avatar_esctemplate.xml" ), Asset( "IMAGE", "images/avatars/avatar_ghost_esctemplate.tex" ), Asset( "ATLAS", "images/avatars/avatar_ghost_esctemplate.xml" ), Asset( "IMAGE", "images/avatars/self_inspect_esctemplate.tex" ), Asset( "ATLAS", "images/avatars/self_inspect_esctemplate.xml" ), Asset( "IMAGE", "images/names_esctemplate.tex" ), Asset( "ATLAS", "images/names_esctemplate.xml" ), Asset( "IMAGE", "images/names_gold_esctemplate.tex" ), Asset( "ATLAS", "images/names_gold_esctemplate.xml" ), } AddMinimapAtlas("images/map_icons/esctemplate.xml") local require = GLOBAL.require local STRINGS = GLOBAL.STRINGS -- The character select screen lines STRINGS.CHARACTER_TITLES.esctemplate = "The Sample Character" STRINGS.CHARACTER_NAMES.esctemplate = "Esc" STRINGS.CHARACTER_DESCRIPTIONS.esctemplate = "*Perk 1\n*Perk 2\n*Perk 3" STRINGS.CHARACTER_QUOTES.esctemplate = "\"Quote\"" STRINGS.CHARACTER_SURVIVABILITY.esctemplate = "Slim" -- Custom speech strings STRINGS.CHARACTERS.ESCTEMPLATE = require "speech_esctemplate" -- The character's name as appears in-game STRINGS.NAMES.ESCTEMPLATE = "Esc" STRINGS.SKIN_NAMES.esctemplate_none = "Esc" AddPrefabPostInit("rusty_armor", function(inst) if inst.components and inst.components.armor then inst.components.armor.TakeDamage = function () end end end) GLOBAL.STRINGS.NAMES.RUSTY_ARMOR = "Rusty Armor" STRINGS.CHARACTERS.GENERIC.DESCRIBE.RUSTY_ARMOR = "testing" -- The skins shown in the cycle view window on the character select screen. -- A good place to see what you can put in here is in skinutils.lua, in the function GetSkinModes local skin_modes = { { type = "ghost_skin", anim_bank = "ghost", idle_anim = "idle", scale = 0.75, offset = { 0, -25 } }, } -- Add mod character to mod character list. Also specify a gender. Possible genders are MALE, FEMALE, ROBOT, NEUTRAL, and PLURAL. AddModCharacter("esctemplate", "FEMALE", skin_modes) AddSimPostInıt(function() GLOBAL.TheInput:AddKeyHandler( function(key, down) if not down then return end if key == GLOBAL.KEY_T then local screen = TheFrontEnd:GetActiveScreen() if not screen or not screen.name then return true end if screen.name:find("HUD") then TheFrontEnd:PushScreen(require("screens/stat_ui")(GLOBAL.ThePlayer)) return true else if screen.name == "spawner" then screen:OnClose() end end end if GLOBAL.TheInput:IsKeyDown(GLOBAL.KEY_CTRL) then if key == GLOBAL:KEY_R then if GLOBAL.TheWorld.ismastersim then GLOBAL.c_reset() else GLOBAL.TheNey:SendRemoteExecute("c_reset()") end end end end) end) modmain local Screen = require "widgets/screen" local Widget = require "widgets/widget" local Templates = require "widgets/templates" local Text = require "widgets/text" local Spawner = Class(Screen, function(self, inst)) self.inst = inst self.tasks = [] Screen_ctor(self,"spawner") self.black = self:AddChild(Image("images/global.xml", "square.tex")) self.black:SetVRegPoint(ANCHOR_MIDDLE) self.black:SetHRegPoint(ANCHOR_MIDDLE) self.black:SetVAnchor(ANCHOR_MIDDLE) self.black:SetHAnchor(ANCHOR_MIDDLE) self.black:SetScaleMode(SCALEMODE_FILLSCREEN) self.black:SetTint(0, 0, 0, .5) end function Spawner:OnClose() for k, v in pairs(self.tasks) do if v then v:Cancel() end end local screen = TheFrontEnd:GetActiveScreen() if screen and screen.name:find("HUD") == nil then TheFrontEnd:PopScreen() end TheFrontEnd:GetSound():PlaySound("dontstarve/HUD/click_move") end function Spawner:OnControl(control, down) if Spawner_base.OnControl(self, control, down) then return true end if down and (control == CONTROL_PAUSE or control == CONTROL_CANCEL) then self:OnClose() return true end end return Spawner stat_ui.lua edit: tutorial modmain.lua esctemplate.lua stat_ui.lua Edited June 24, 2021 by AkaiNight Link to comment https://forums.kleientertainment.com/forums/topic/131130-solvedcustom-user-interface/ Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now