xzanakub Posted October 4, 2024 Share Posted October 4, 2024 I'm not very good at English. I used GPT to help translate all of this. I want to make it so that when I press the 'X' key, the character repI'm not very good at English. I used GPT to help translate all of this.orts its status, and when I press 'F10', the character resets its level. modmain modmain.lua character cac.lua level system caclucklevel.lua Link to comment https://forums.kleientertainment.com/forums/topic/160068-the-character-mod-works-fine-when-the-world-has-no-caves-but-doesnt-work-properly-if-the-world-has-caves/ Share on other sites More sharing options...
xzanakub Posted October 4, 2024 Author Share Posted October 4, 2024 modmain.lua Spoiler GLOBAL.TheInput:AddKeyDownHandler(GLOBAL.KEY_F10, function() if GLOBAL.ThePlayer and GLOBAL.ThePlayer.prefab == "cac" then GLOBAL.ThePlayer:PushEvent("reset_status") end end) GLOBAL.TheInput:AddKeyDownHandler(GLOBAL.KEY_X, function() print("on key x:>") if GLOBAL.ThePlayer and GLOBAL.ThePlayer.prefab == "cac" then GLOBAL.ThePlayer:PushEvent("show_status") end end) character prefabs Spoiler local function ShowStatus(inst) print("Status of character:>") inst.components.caclucklevel:CheckLevel() end local function ResetCac(inst) print("reset level:>") inst.components.caclucklevel:ResetLevel() end local master_postinit = function(inst) -- -- กด f11 รีเซ็ตสถานะ inst:ListenForEvent("reset_status", ResetCac) -- -- กด x ดูสถานะตัวละคร inst:ListenForEvent("show_status", ShowStatus) end Link to comment https://forums.kleientertainment.com/forums/topic/160068-the-character-mod-works-fine-when-the-world-has-no-caves-but-doesnt-work-properly-if-the-world-has-caves/#findComment-1751771 Share on other sites More sharing options...
Baguettes Posted October 5, 2024 Share Posted October 5, 2024 อ่า เพิ่งเจอคนไทยบนฟอรั่มครั้งแรก... สวัสดีฮะ ยินดีต้อนรับ ขอตัวม็อดเต็มๆ ได้มั้ยฮะ เดี๋ยวถ้าผมว่างอะ ผมจะลองดูว่าทำไมมันกดแล้วไม่มีอะไรเกิดขึ้น เพราะเอาจริงๆ ดูจากโค้ดเผินๆ แล้วมันไม่ควรมีอะไรผิดไป... ถ้าไม่ว่าอะไร แอดดิสได้ครับ (แอด ilaskus น่าจะเจอ ไม่ก็ถ้าอยู่ใน Klei Discord ก็ @ ผมได้ ชื่อเดียวกัน) 1 Link to comment https://forums.kleientertainment.com/forums/topic/160068-the-character-mod-works-fine-when-the-world-has-no-caves-but-doesnt-work-properly-if-the-world-has-caves/#findComment-1751861 Share on other sites More sharing options...
xzanakub Posted October 5, 2024 Author Share Posted October 5, 2024 I've fixed it now, thank you Baguettes! modmain.lua Spoiler local function OnF10Pressed(player, ...) if player and player.prefab == "cac" then player:PushEvent("reset_status") end end local function OnXPressed(player, ...) if player and player.prefab == "cac" then player:PushEvent("show_status") end end AddModRPCHandler("cacluckmod", "reset_status", OnF10Pressed) AddModRPCHandler("cacluckmod", "show_status", OnXPressed) GLOBAL.TheInput:AddKeyDownHandler(GLOBAL.KEY_F10, function() SendModRPCToServer(GetModRPC("cacluckmod", "reset_status")) end) GLOBAL.TheInput:AddKeyDownHandler(GLOBAL.KEY_X, function() SendModRPCToServer(GetModRPC("cacluckmod", "show_status")) end) Link to comment https://forums.kleientertainment.com/forums/topic/160068-the-character-mod-works-fine-when-the-world-has-no-caves-but-doesnt-work-properly-if-the-world-has-caves/#findComment-1751901 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