FleurDuSoleil3 Posted February 28, 2018 Share Posted February 28, 2018 (edited) Not sure if this is the correct place for this; however, I am making a bit of a schoolboy error and after numerous attempts to rectify it myself I am having a bit of trouble. There is a missing end function that resolves the if.GLOBAL line. I got the character to plant rabbit holes and then added in those extra two lines to make this ability unique to her. Can anyone help me out with where the missing end goes? local function rabbitHolePostInit(inst) if GLOBAL.GetPlayer().prefab == "bob" then local function CanDeploy(inst) return true end local function ondeploy(inst, pt) local rabbit = GLOBAL.SpawnPrefab("rabbithole") if rabbit then rabbit.Transform:SetPosition(pt.x, pt.y, pt.z) end end function rabbitHole(inst) inst:AddComponent("deployable") inst.components.deployable.test = function() return true end inst.components.deployable.ondeploy = ondeploy end AddPrefabPostInit("rabbit", rabbitHole) I feel so silly for not being able to work this one out myself. I am slowly improving my coding abilities but in, well, very tentative baby steps. Edited March 1, 2018 by Aquafox333 Adding solved Link to comment https://forums.kleientertainment.com/forums/topic/88145-solved-missing-end/ Share on other sites More sharing options...
Developer ImDaMisterL Posted February 28, 2018 Developer Share Posted February 28, 2018 (edited) Moved to Mods and Tools. Kleilist is for requesting assistance of coders/artists etc. to make a mod together. Hope you find someone who can help you Edited February 28, 2018 by ImDaMisterL Link to comment https://forums.kleientertainment.com/forums/topic/88145-solved-missing-end/#findComment-1009419 Share on other sites More sharing options...
ThemInspectors Posted February 28, 2018 Share Posted February 28, 2018 21 minutes ago, Aquafox333 said: local function rabbitHolePostInit(inst) if GLOBAL.GetPlayer().prefab == "bob" then local function CanDeploy(inst) return true end local function ondeploy(inst, pt) local rabbit = GLOBAL.SpawnPrefab("rabbithole") if rabbit then rabbit.Transform:SetPosition(pt.x, pt.y, pt.z) end end function rabbitHole(inst) inst:AddComponent("deployable") inst.components.deployable.test = function() return true end inst.components.deployable.ondeploy = ondeploy end AddPrefabPostInit("rabbit", rabbitHole) Hey, indentation might be something to look into, it makes your code neater. local function rabbitHolePostInit(inst) if GLOBAL.GetPlayer().prefab == "bob" then local function CanDeploy(inst) return true end local function ondeploy(inst, pt) local rabbit = GLOBAL.SpawnPrefab("rabbithole") end if rabbit then rabbit.Transform:SetPosition(pt.x, pt.y, pt.z) end end function rabbitHole(inst) inst:AddComponent("deployable") inst.components.deployable.test = function() return true end inst.components.deployable.ondeploy = ondeploy end AddPrefabPostInit("rabbit", rabbitHole) I'm not entirely sure if that's what you want, give it a spin and tell me if it works as intended Link to comment https://forums.kleientertainment.com/forums/topic/88145-solved-missing-end/#findComment-1009424 Share on other sites More sharing options...
FleurDuSoleil3 Posted February 28, 2018 Author Share Posted February 28, 2018 (edited) @ImDaMisterL Ah, collaboration. I assumed it was a request for help, period. Thank you for sorting that. @ThemInspectors Thank you for your assistance. Indentation is definitely a weak point of mine. I am actually going to polish it at the weekend if time allows. 10 hours ago, ThemInspectors said: local function rabbitHolePostInit(inst) if GLOBAL.GetPlayer().prefab == "bob" then local function CanDeploy(inst) return true end local function ondeploy(inst, pt) local rabbit = GLOBAL.SpawnPrefab("rabbithole") end if rabbit then rabbit.Transform:SetPosition(pt.x, pt.y, pt.z) end end function rabbitHole(inst) inst:AddComponent("deployable") inst.components.deployable.test = function() return true end inst.components.deployable.ondeploy = ondeploy end AddPrefabPostInit("rabbit", rabbitHole) So, the game crashed and offered me this helpful titbit. Problem is, this is how I came to learn I was missing an end in the first place. Any more suggestions? I'm greatly appreciative of your help. Also, if you do know how to fix this, could you tell me what the issue is, and how you solved it, so I don't need to ask anyone for help should this problem arise in the future? Edited February 28, 2018 by Aquafox333 Formatting Link to comment https://forums.kleientertainment.com/forums/topic/88145-solved-missing-end/#findComment-1009553 Share on other sites More sharing options...
ThemInspectors Posted February 28, 2018 Share Posted February 28, 2018 @Aquafox333 Sorry, I made an error in my code, so sorry that I missed it, it should be this local function rabbitHolePostInit(inst) if GLOBAL.GetPlayer().prefab == "bob" then local function CanDeploy(inst) return true end local function ondeploy(inst, pt) end local rabbit = GLOBAL.SpawnPrefab("rabbithole") end if rabbit then rabbit.Transform:SetPosition(pt.x, pt.y, pt.z) end end function rabbitHole(inst) inst:AddComponent("deployable") inst.components.deployable.test = function() return true end inst.components.deployable.ondeploy = ondeploy end AddPrefabPostInit("rabbit", rabbitHole) it was on the local function ondeploy(inst, pt) end there was a missing end there. Link to comment https://forums.kleientertainment.com/forums/topic/88145-solved-missing-end/#findComment-1009659 Share on other sites More sharing options...
FleurDuSoleil3 Posted March 1, 2018 Author Share Posted March 1, 2018 @ThemInspectors Thank you very much! You've helped me out a lot. The game no longer crashes! Now I can focus on the other daunting unique abilities of this character. At least this is a far more intuitive system than the one Bethesda uses for their games. Link to comment https://forums.kleientertainment.com/forums/topic/88145-solved-missing-end/#findComment-1009702 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