SenL Posted January 20, 2015 Share Posted January 20, 2015 I have so many questions. Could you answer some of below questions?You could also point me to a mod and I'll study it.Thanks! 01)Duration-based usable inventory item. Ie: I want to make a regen potion that does:10 hp instantly and then 1 hp per "tick" for 20 ticks Optional: stackable to 20 but once drank, the remaining in the stack cannot be used until x time has passed 02)Super-fast ghost walk and run speed. Ie: When I'm a ghost (in endless mode for example), I hate the slow speed back to the resurrection portal. How do I make my custom character super-fast (as ghost only)? 03)Sample working custom helm or armor mod with spriter and png files? 04)Non-symmetric character mod. This may be hard to do at my knowledge level. Let's say I want a character where the right arm (not left and not both) have a small shield or spiked gloves. How would one do such? 05)Bigger chest or storage building.In DS (not yet ported to DST) there is a mod called "Storm Cellar". This has 80+ slots for storage. Awesome. How to do this in DST? Thanks again. Link to comment https://forums.kleientertainment.com/forums/topic/49462-new-at-modding-so-many-questions/ Share on other sites More sharing options...
rezecib Posted January 21, 2015 Share Posted January 21, 2015 (edited) @SenL, 1) Just use the petals prefab or something, replace the art, remove perishable, set the healing to zero, change the foodtype, and then after the edible component add this:inst.components.edible.oneaten = function(inst, eater) local ticks = 20 local per = eater:DoPeriodicTask(0.1, --the time between ticks in seconds function() ticks = ticks - 1 if ticks > 0 then eater.components.health:DoDelta(1) else per:Cancel() end end)endAlthough as I was writing it, I realized I'm not sure you can cancel a task from within it like that. But try it and see xD. Getting the timeout part to work would be a bit trickier, but I think you'd probably want to make your own foodtype for it, then have the it remove the FOODTYPE_eater tag from the eater, then use a DoTaskInTime to add it back. 2) In the master_postinit: (this is to make the real speed change)inst:ListenForEvent("ms_becameghost", function() inst.components.locomotor.runspeed = 12end)In the common_postinit: (this is to fix action prediction) local OldSetGhostMode = inst.SetGhostMode inst.SetGhostMode = function(inst, isghost) OldSetGhostMode(inst, isghost) if inst.components.locomotor then inst.components.locomotor.runspeed = 12 end end3) There are many working mods on the workshop. As for Spriter, you'll have to get it from someone else. 4) I would not recommend doing this. Most character mods use the existing character animations, getting something like this to work would mean doing all of those animations yourself, I think. 5) I think tetrified has been working on something like this, but right now you can't really do it in a nice compatible way, so that's probably why Storm Cellar hasn't been ported. Edited January 21, 2015 by rezecib Link to comment https://forums.kleientertainment.com/forums/topic/49462-new-at-modding-so-many-questions/#findComment-604244 Share on other sites More sharing options...
Ryuushu Posted January 21, 2015 Share Posted January 21, 2015 04)Non-symmetric character mod. This may be hard to do at my knowledge level. Let's say I want a character where the right arm (not left and not both) have a small shield or spiked gloves. How would one do such?Check out http://forums.kleientertainment.com/topic/48557-asymmetcrical-character-design/. It hasn't been fully tested, and I'm sure it requires some fixes here and there, but it should get you started. Link to comment https://forums.kleientertainment.com/forums/topic/49462-new-at-modding-so-many-questions/#findComment-604276 Share on other sites More sharing options...
SenL Posted January 21, 2015 Author Share Posted January 21, 2015 @rezecibThanks a lot!02) you said"In the master_postinit: (this is to make the real speed change)"but there there is no code Btw. How do you do "spoiler" stuff in this forum? @RyuushuWow it's quite involved Thanks. Link to comment https://forums.kleientertainment.com/forums/topic/49462-new-at-modding-so-many-questions/#findComment-604296 Share on other sites More sharing options...
rezecib Posted January 21, 2015 Share Posted January 21, 2015 @SenL, Sorry, fixed it. The forum eats code blocks that are a long single line because it shows the scroll bar over the single line -_-. Spoilers are done like this:(spoiler)Spoilers!(/spoiler) But you use [] instead of () Link to comment https://forums.kleientertainment.com/forums/topic/49462-new-at-modding-so-many-questions/#findComment-604309 Share on other sites More sharing options...
SenL Posted January 21, 2015 Author Share Posted January 21, 2015 02)Works! Thanks rezecib! Link to comment https://forums.kleientertainment.com/forums/topic/49462-new-at-modding-so-many-questions/#findComment-604328 Share on other sites More sharing options...
SenL Posted January 21, 2015 Author Share Posted January 21, 2015 Hm, I started a new world and I'm fast (speed 12) even when alive.Something's amiss... Link to comment https://forums.kleientertainment.com/forums/topic/49462-new-at-modding-so-many-questions/#findComment-604598 Share on other sites More sharing options...
rezecib Posted January 21, 2015 Share Posted January 21, 2015 @SenL, Oops, change this part:local OldSetGhostMode = inst.SetGhostModeinst.SetGhostMode = function(inst, isghost) OldSetGhostMode(inst, isghost) if isghost and inst.components.locomotor then inst.components.locomotor.runspeed = 12 endend Link to comment https://forums.kleientertainment.com/forums/topic/49462-new-at-modding-so-many-questions/#findComment-604609 Share on other sites More sharing options...
SenL Posted January 22, 2015 Author Share Posted January 22, 2015 Wow ok let me study this simple code block. Questions below. local OldSetGhostMode = inst.SetGhostModeThis "OldSetGhostMode" is just a name right? I can name it anything else I want?So this line sets a local variable to the "SetGhostMode" functionQ01: How do you know the name of this function?Q02: What is "inst"? inst.SetGhostMode = function(inst, isghost)This overwrites/overloads SetGhostMode function with a "on-the-fly" function. Am I saying that right?Q03: How do you know that it takes two parameters and that they are "inst" and "isghost"? OldSetGhostMode(inst, isghost)This calls the "old" SetGhostMode function if isghost and inst.components.locomotor thenQ04. IsGhost is a boolean. It checks if player is a ghost. Right?Q05: Why do we have to check inst.components.locomotor? inst.components.locomotor.runspeed = 12Q06: How about walkspeed, or does ghost not have walkspeed? Thanks! Link to comment https://forums.kleientertainment.com/forums/topic/49462-new-at-modding-so-many-questions/#findComment-604701 Share on other sites More sharing options...
Kzisor Posted January 22, 2015 Share Posted January 22, 2015 Wow ok let me study this simple code block. Questions below. local OldSetGhostMode = inst.SetGhostModeThis "OldSetGhostMode" is just a name right? I can name it anything else I want?So this line sets a local variable to the "SetGhostMode" functionQ01: How do you know the name of this function?Q02: What is "inst"? inst.SetGhostMode = function(inst, isghost)This overwrites/overloads SetGhostMode function with a "on-the-fly" function. Am I saying that right?Q03: How do you know that it takes two parameters and that they are "inst" and "isghost"? OldSetGhostMode(inst, isghost)This calls the "old" SetGhostMode function if isghost and inst.components.locomotor thenQ04. IsGhost is a boolean. It checks if player is a ghost. Right?Q05: Why do we have to check inst.components.locomotor? inst.components.locomotor.runspeed = 12Q06: How about walkspeed, or does ghost not have walkspeed? Thanks! Q1 and Q3: rezecib and a lot of other modders look through the Lua files supplied in the original game directory to get the function names and parameters needed for them. Q2: inst is short for instance. It's a basic representation of a class. This class will vary depending on what exactly you are doing. Q4: Correct, although incorrect at the same time. Any variable in lua can contain any type of data. Q5: You always want to determine whether a component exists before trying to change it as to prevent errors. Q6: No clue, will let others answer it because I haven't created a custom character as of yet. Link to comment https://forums.kleientertainment.com/forums/topic/49462-new-at-modding-so-many-questions/#findComment-604716 Share on other sites More sharing options...
rezecib Posted January 22, 2015 Share Posted January 22, 2015 Q05: Why do we have to check inst.components.locomotor? Everything Kzisor said, but the specific reason for checking this is because clients with action prediction off do not have the locomotor component. As for walkspeed... you could set that too, but I'm not sure it actually does anything for players. I might be wrong about that, though. Link to comment https://forums.kleientertainment.com/forums/topic/49462-new-at-modding-so-many-questions/#findComment-604726 Share on other sites More sharing options...
Kzisor Posted January 22, 2015 Share Posted January 22, 2015 SenL, after looking at the files some more I've discovered that there is a cooldown component already add to the game for abigails flower. You could use that for the optional part of the original question #1. Link to comment https://forums.kleientertainment.com/forums/topic/49462-new-at-modding-so-many-questions/#findComment-604764 Share on other sites More sharing options...
SenL Posted January 22, 2015 Author Share Posted January 22, 2015 Hm ok I'll take a look. Thanks! Link to comment https://forums.kleientertainment.com/forums/topic/49462-new-at-modding-so-many-questions/#findComment-604830 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