Jump to content

Recommended Posts

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.

@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)end

Although 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	end

3) 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 by rezecib

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.

@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

Wow ok let me study this simple code block. Questions below.

 

local OldSetGhostMode = inst.SetGhostMode

This "OldSetGhostMode" is just a name right? I can name it anything else I want?

So this line sets a local variable to the "SetGhostMode" function

Q01: 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 then

Q04. 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 = 12

Q06: How about walkspeed, or does ghost not have walkspeed?

 

Thanks!

Wow ok let me study this simple code block. Questions below.

 

local OldSetGhostMode = inst.SetGhostMode

This "OldSetGhostMode" is just a name right? I can name it anything else I want?

So this line sets a local variable to the "SetGhostMode" function

Q01: 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 then

Q04. 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 = 12

Q06: 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.

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...