Sign in to follow this  
Sabeku

[Character] Lure the Lureplant

Recommended Posts

Sabeku    24

This character is a Work In Progress (WIP)!
This thread is to log the progress and problems I go through in this modding process.
 
Currently: Playable in DS, but not downloadable.
On hold for about two months. Expect continued updates mid-late March!
 
The planned mod:
ofo2iCy.png
Lure
The Lureplant, a Lureplant-Human hybrid
Motto: "Watch out, they bite!"

Health: 300
Hunger: 120
Sanity: 120

Perks:
*Nervous around fire
*Partially plantlike
*Has an eyeplant problem

 

 

Perks explained:

*Nervous around fire (Fully working!)

  • Loses a small amount of sanity from being around any type of fire.
  • Takes a lot more damage from being on fire.

*Partially plantlike (Fully working!)

  • Starts with a fleshy bulb and leafy meat.
  • Heals health / sanity when it rains.
  • Heals sanity in daylight.

*Has an eyeplant problem (In progress, after art is complete)

  • When sanity is low and Lure has been in the same place for a while, spawns eyeplants.
    > Eyeplants will 'eat' anything around it and transfer the items to Lure's inventory.
    > Speed decrease.

 

To do List:

  1. Editing Z-index (in progress)
  2. Custom speech (In progress)
  3. In-game art (Pieces that make up the mod) (In progress)
  4. Custom sounds
  5. Character art (Big portrait / Images)
  6. Perk - Has an eyeplant problem
  7. Custom Code base (able to easily add art and perks)
  8. Custom speech color
  9. Perk - Nervous around fire
  10. Perk - Partially Plantlike

Credits and helpful content

  • [Tutorial] Using Extended Sample Character Template by Dleowolf
    Used this for a huge bulk of the base character. It helped me understand lua code in a very friendly way.
  • Introduction to some Components by Mobbstar
    More help on understand how lua works. I used this one to understand burn damage, but it would be very useful in learning how to add other perks as well.
  • Don't Starve Modding Guides in Videos by Dryicefox
    I've been following Dryicefox's video's along with Dleowolf to really understand lua coding and character creation. I've yet to make a ghost or sound yet, but when I do I'll be looking here.
  • Sound Mod Tutorial by Cheerio
    Trying to add sound now, but this tutorial is outdated. This with Dyricefox's tutorial seems the most promising.
     
  • I also referenced several different threads that lead me to these other ones. I didn't save all of them, but the ones listed above were the most helpful.
  • [Custom Character] Link, The Hero! by TheDanaAddams
    This links directly to the comment I referenced to get the custom text color.

Also, when lua coding becomes a little more familiar to you, looking into the character's prefab lua files is a great way to learn and understand how different perks work.

Lure's fire damage is a reverse coding of Willow's, and the healing in the rain is a reverse of WX's code.

 

This post will be edited to updated new content and information!

 

I should mention as a disclaimer that I am not a professional modder, coder, or anything like that. Its why I'm documenting all the work I do, because I'm completely new to all of this and want others who are new to be able to follow this process with their own mod.

 

When the mod is complete, it will be uploaded like any normal character mod, but I will also release a separate one with all the files and clutter that I used to create Lure. I want to be as open source about this as possible!

 

Feel free to use this thread to ask anything about Lure and the coding that is this mod.

DO NOT use this thread to ask about your specific mod.
I don't mind helping you out if its related to any coding in Lure's mod. This is to prevent clutter in unrelated posting. You can mention me in your own thread if you'd like me to take a look at it.

Edited by Sabeku

Share this post


Link to post
Share on other sites
Aquaterion    821

I'd like to see lure's in-game art as a screenshot on the top post. It seems like a nice concept, especially the eyeplants item transfer. Will that effect normal spawning eyeplants? What happens if your inventory is full? Does Lure have any special interaction with Lureplants and naturally spawning eye plants?

Share this post


Link to post
Share on other sites
Sabeku    24

I'd like to see lure's in-game art as a screenshot on the top post. It seems like a nice concept, especially the eyeplants item transfer. Will that effect normal spawning eyeplants? What happens if your inventory is full? Does Lure have any special interaction with Lureplants and naturally spawning eye plants?

I actually don't have his in-game art drawn yet because I might have to adjust some positioning when that happens. Changing the positioning on art might become a bit of a problem; I still need to test it.

 

I don't think he'll effect any other lureplants or eyeplants because in-game, when two lureplants / eyeplants are near each other, they fight and bite each other. I take it they're independent, so Lure would be the same. His dialog might reference to them as family or something?

 

If you're inventory is full, maybe they would just drop? I'll be looking into the coding for the Lazy Forger amulet, which if your inventory is full and you don't have the item, it automatically doesn't even pick it up.

I'm leaving that coding for last because it seems the most complicated. Worst case scenario, if I can't get the eyeplants to work, maybe Lure could just start out with a custom item that works like Kranpus's sack for the extra inventory.

Share this post


Link to post
Share on other sites
Aquaterion    821

Maybe make him start with a flesh bulb, so he can create a lure plant without needing to wait for 1 to spawn and that way I believe you can get leafy meat each time you kill it. (Killing other lureplants maybe either lowers sanity due to it being his own race, or highers it a bit for him being dominant). Although I heard Lure Plants are bugged atm so careful with that.

Share this post


Link to post
Share on other sites
Sabeku    24

Maybe make him start with a flesh bulb, so he can create a lure plant without needing to wait for 1 to spawn and that way I believe you can get leafy meat each time you kill it. (Killing other lureplants maybe either lowers sanity due to it being his own race, or highers it a bit for him being dominant). Although I heard Lure Plants are bugged atm so careful with that.

 

Oo, I really like that. It'll make sense with the little backstory I have for Lure. Thanks, I'll add that now!

 

I muddled through a few ideas similarly with a way to get leafy meats. One of them being after a certain amount of days, you can use a razor on Lure and get meats. (Visually I guess it would grow in his hair or something weird like that?) But I thought it was too absurd to actually make sense.

As for the sanity, hmm... I like the idea but I'd imagine the coding for that would be complicated. Definitely going to look into it!

 

Ah yes, the lureplants in DST are bugged as heck right now. I'll try to get this working in DS / ROTG first before trying to import it over. I hope using the code for the lazy forger will be better than the coding within the lureplant. :/ If not, then maybe during this time the bug will get fixed.

Share this post


Link to post
Share on other sites
Sabeku    24

Hm... Having some troubles with the "Heals sanity in daylight" part of the mod. I've tried looking into Maxwell's general sanity gain (which was oddly enough under the waxwell lua?) and it doesn't seem to be applying to Lure. I'm not sure if this has to do with a bug with WX's code that's giving Lure sanity when it rains.

Also trying to reverse Wolfgang's sanity drain during nighttime and apply it to day. Hm.

 

EDIT: Looks like it wasn't with WX's edited code (to heal health / sanity during the rain)! Combining Maxwell's general sanity gain plus Wolfgang's sanity drain at night seemed to be the key!

 

Big problem I was having is that DAPPERNESS is sanity gain at all times, while there's specific code for the sanity drain at night. Also different code (Auras) for monsters specifically.

Thank goodness its all working now, with neat coding too!

Edited by Sabeku

Share this post


Link to post
Share on other sites
Sabeku    24

Not including this in the main post because I ultimately didn't use it, but to help understand the sanity gain / drain I referenced a few topics:

The main mods I looked at to understand were:

Its important to note that I only used these as reference, along with WX and Wolfgang's codes. I didn't copy from the file or anything like that.

Also reminder that I'll be posting Lure's entire coding (with helpful notes within) as an open source project (is that the right phrasing?).
Basically I want to make it where its encouraged to change and modify my code for your own mods. Its pretty basic stuff, straight from the main characters already in-game, so I don't believe there's any harm in doing this.

Share this post


Link to post
Share on other sites
Aquaterion    821

The way that it is right now, all mods can be used as reference, even the normal game code, which is good for learning, I seen plenty of mods that have comments to help people looking through the code and explaining things.

Share this post


Link to post
Share on other sites
Sabeku    24

The way that it is right now, all mods can be used as reference, even the normal game code, which is good for learning, I seen plenty of mods that have comments to help people looking through the code and explaining things.

 

I see. I was just a little weary about using other people's code without them knowing. It sort of felt like stealing unless they otherwise said it was okay. Glad to know that's not the case. I wasn't sure what the etiquette around that was.

Share this post


Link to post
Share on other sites
Aquaterion    821

I see. I was just a little weary about using other people's code without them knowing. It sort of felt like stealing unless they otherwise said it was okay. Glad to know that's not the case. I wasn't sure what the etiquette around that was.

 

Well everyone has their own opinion, if you feel like you should ask, then I guess go ahead and ask. Sometimes I feel like I'm basically doing nothing except renaming things and using a different texture, to a point where I even scrapped mods due to them being to similar after looking at some reference code.

Share this post


Link to post
Share on other sites
Sabeku    24

Well everyone has their own opinion, if you feel like you should ask, then I guess go ahead and ask. Sometimes I feel like I'm basically doing nothing except renaming things and using a different texture, to a point where I even scrapped mods due to them being to similar after looking at some reference code.

 

If I was using another mod as a base, I would. But luckily, everything I'm coding I'm learning myself, so I don't have to worry about that.

 

In the end, if we want the same perk, wouldn't the code look similar regardless? I don't think there is any harm in that, as long as its not blatant stealing and calling their mod your own.

Share this post


Link to post
Share on other sites
Aquaterion    821

If I was using another mod as a base, I would. But luckily, everything I'm coding I'm learning myself, so I don't have to worry about that.

 

In the end, if we want the same perk, wouldn't the code look similar regardless? I don't think there is any harm in that, as long as its not blatant stealing and calling their mod your own.

 

What I hate mostly is when people ask here for code, and they ask for every single thing, and then they publish it, the only think they did was come up with the idea, and change some strings, other than that, they got code from people here, and usually they give no credit for the help.

Share this post


Link to post
Share on other sites
rezecib    3152

@Aquaterion, I'd personally be okay with it if they even just explicitly asked for someone to write all the code. The most annoying thing is when they give a vague description of what they want, then are like "wait, but your code doesn't do exactly this other thing that I didn't talk about before". I'd rather just have an upload of their mod with the assets, write and test all the code, and then send it back to them, instead of writing code by proxy over the forum and having them test it and give poor information about the crashes ("I tried it and it crashed. What do I need to do?").

Edited by rezecib

Share this post


Link to post
Share on other sites
Sabeku    24

@Aquaterion, I'd personally be okay with it if they even just explicitly asked for someone to write all the code. The most annoying thing is when they give a vague description of what they want, then are like "wait, but your code doesn't do exactly this other thing that I didn't talk about before". I'd rather just have an upload of their mod with the assets, write and test all the code, and then send it back to them, instead of writing code by proxy over the forum and having them test it and give poor information about the crashes ("I tried it and it crashed. What do I need to do?").

Writing all that code for someone sounds like a job in itself though. You should get paid for something so extensive! :D Although I'm not so sure about legal technicalities involving mods for a game though. I'd imagine its not available.

Either way, it's nice that you reach out to help people like that, even when its so frustrating.

Share this post


Link to post
Share on other sites
Sabeku    24

Also, a bit of an update.

Currently working on the art parts, but I had a serious problem since Lure's hair is too long to be manually adjusted down. (It clips unless I make it centered.) But when I make it centered, it's no longer aligned to the character, since the pivot it centered. The other problem is that the long hair is in front of the torso when its longer like this. Just changing the hierarchy in Spriter did nothing. In fact, and visual edits in Spriter seem useless, and when I looked up the Z-axis problem (the order that the hair is in that makes it show in front of the torso) it seems there is no way to adjust this within Spriter. Arg! (excuse the eyes, the only thing done right now is the head and hair.)

a05f98cd6ee040055ed84b726c9d234c.png

 

So, I was actually able to fix the positioning problem by opening the Spriter file in Notepad++ and manually editing the positioning of the hair / hat hair. It was about 8 lines to change, both the X and the Y for each line. (It was painful because there was so much guesswork. Change the number, open Spriter to see the change. Rinse repeat until it looks right.)

Phew.

Here's the changed code for his hair:

    <folder id="2" name="hair">        <file id="0" name="hair/hair-0.png" width="400" height="400" pivot_x="0.47563" pivot_y="0.551312"/>        <file id="1" name="hair/hair-1.png" width="400" height="400" pivot_x="0.397936" pivot_y="0.559752"/>        <file id="2" name="hair/hair-2.png" width="400" height="400" pivot_x="0.53563" pivot_y="0.551312"/>        <file id="3" name="hair/hair-3.png" width="400" height="400" pivot_x="0.47563" pivot_y="0.551312"/> 
    <folder id="10" name="hair_hat">        <file id="0" name="hair_hat/hair_hat-0.png" width="400" height="400" pivot_x="0.47563" pivot_y="0.551312"/>        <file id="1" name="hair_hat/hair_hat-1.png" width="400" height="400" pivot_x="0.397936" pivot_y="0.559752"/>        <file id="2" name="hair_hat/hair_hat-2.png" width="400" height="400" pivot_x="0.53563" pivot_y="0.551312"/>        <file id="3" name="hair_hat/hair_hat-3.png" width="400" height="400" pivot_x="0.47563" pivot_y="0.551312"/> 

So now that the positioning is right, I faced another problem mentioned earlier. The Z-axis (or Z-order, Hierarchy). Ugh. (The art was supposed to be the easy part...)

457f8839d42a5f5b2f40fc99861bc6ec.png

 

Like I said, Z-axis problems. That panel (which you can't edit. Even if you change it visually in Spriter it won't save when compiled) is this one:

cb4a82b6ef2c3e504d9fb0ec13708d4f.png     

Looking into the code, the Z-axis (called Z-index) is determined by a series of IDs, or the image below. But what does this mean?

8dea4d005382c91b22ba71d56c055980.png

 

Scrolling down I found the timeline number, mentioned above. (Code below)

            <timeline id="3" name="hair_hat_0_3">                <key id="0" spin="0">                    <object folder="10" file="0" x="-327.5615" y="203.449" angle="0"/>                </key>            </timeline>            <timeline id="4" name="hair_0_4">                <key id="0" spin="0">                    <object folder="2" file="0" x="-327.5615" y="203.449" angle="0"/>                </key>            </timeline>

This tells me that it looks into the object folder at the beginning of this code, the pieces inside, and takes the whole thing and assigns it an ID number. (The Hair_0_4 ID is 4. ID="4".) Alright, so if we look at the ID code, and compare it with the Z-index, we can assume the positioning in the hierarchy. Editing the ID to the correct position should be easy enough. But it's never easy.

The front-most position is actually the lowest number. Therefore, the Z index of 0 would be the top image. (which should be your face, or other top images.) So, to change one positioning, all of the other number would need to be changed, right?

Well, since Lure doesn't have a tail, but the transparent placeholders are still in there, I can theoretically use these codes to swap positioning.

 

Basically, what I'm trying to do is swap the positioning of the hair with the positioning of the tail, because the tail is transparent so it won't show if its in the front, but its behind the torso, which is where I want the hair to be.

It's certainly not the neatest way to do this, but it'll work. And a quick test (after swapping all the pieces) seems to have worked!

607b9948dae0e243ddea011d93a958f7.png

Finally!

Granted, all of these problems occurred because the hair is too long.

 

Now the plan is to clean up this code so instead of swapping parts, I can readjust their positioning. It'll be tedious, but I want a clean code.

Also planning on using the Hair Pigtails to make bangs for Lure. You'll notice that one piece of hair that's on the Head image. I want that to move and 'breathe' like the hair does. Changing the Z index like I did for the hair, I should be able to reposition the new bangs.

I'd also like to delete the unneeded pieces, such as the tail. I'd image all it would be is deleting all the lines of coding within the character Spriter file.

Phew, what a long post update! And for only 2 pieces updated. :wilson_cry:

(Lure's face is also asymmetrical, so I found a way to make two sides of the face, but I'll need double the code. Ahh... so much work, but the perfectionist in me strives to complete this!)

 

Edit: Spelling. I'll also post the topics / posts I used to understand Spriter and positioning when I get home.

Edited by Sabeku

Share this post


Link to post
Share on other sites
Deviched    10

 

 

Edit: Spelling. I'll also post the topics / posts I used to understand Spriter and positioning when I get home.

Please do! I also would like to know how to make the lively bangs.

 

Though I think you've already done the process with that post--

All you had to do was re-order the hair to a lower ID number so it can be in front of everything else?

Share this post


Link to post
Share on other sites
Sabeku    24

Please do! I also would like to know how to make the lively bangs.

 

Though I think you've already done the process with that post--

All you had to do was re-order the hair to a lower ID number so it can be in front of everything else?

 

Oh my goodness, I almost forgot!

I was actually looking much earlier on how Klei made the art for the game, specially what program they used for the animations / drawing.

As for how I learned about editing Spriter in notepad++, that was from this:

I also mentioned that I found out there is no way in Spriter to change the Z order.

 

Anyway, to answer your post more directly, I would have to guess that yes, you could just edit the hair pigtails to act like the bangs with the change in the Z order, however I realized that the bangs have their own animation on them that might conflict in the compiling stage. There is also the issue with the pivots, and I haven't tested it myself but you might have to change the center pivot manually (in the code, not Spriter) for it to properly 'breathe' in the right direction.

I actually tried importing a different exported folder way back when I first started fiddling with this mod. The animation compiled weird, but the pivots seemed more normal than how the pigtails rotate (up and down breathing rather than side to side). So I would suggest making a new part entirely and changing it manually, or finding a way to adjust the pigtails themselves.

 

I don't know much about animation, or how to change it, however...

http://forums.kleientertainment.com/topic/37151-tutorial-adding-a-custom-idle-animation/

This topic is definitely worth looking into, especially since TheDanaAddams mentions in here about pivot points and bones.

 

Lastly, (gosh what a long post; I apologize) I want to mention this post as both a reference for you and myself, so I don't forget. It seems super useful, but perhaps a little dated now.

http://forums.kleientertainment.com/topic/27247-new-asset-tools-animations-textures-sounds-and-layouts/

Like I mentioned in a previous post, I want Lure to have bangs (or something like it) so I'll be working more on this in the future. :D If you try anything out, let me know how it goes, and good luck!

Share this post


Link to post
Share on other sites
Sabeku    24

Speaking about the Z order, after I compiled Lure to play in DS, the file changed a bit. It looks complicated and like this now, where it would normally be the Z order code:

70089ecf3afde9091444a94505ba3c34.png

Although it looks really complicated, the code looks like this:

<object_ref id="0" name="tail_5_71" folder="14" file="0" abs_x="-332.3115" abs_y="43.199" abs_pivot_x="0.628" abs_pivot_y="0.5" abs_angle="34.2525" abs_scale_x="1.02776" abs_scale_y="1.01232" abs_a="1" timeline="70" key="0" z_index="0"/>

At the end, we can see the original Z index number, which is what we changed in the first place. You can see that all the parts also have this Z index, over here:

c736661a74786c0bf593f5d0224ddcb6.png

Its different, and I think that this problem happened because I compiled. Assuming you just re-paste the old code, it should still work the same because they still have the index number.

Actually, looking into the code more, this might actually be from me using the DST version of the .scml. I'm not sure yet.

As a reference, here is the old code:

                <key id="0">                    <object_ref id="0" timeline="71" key="0" z_index="0"/>                    <object_ref id="1" timeline="83" key="0" z_index="1"/>                    <object_ref id="2" timeline="70" key="0" z_index="2"/>                    <object_ref id="3" timeline="82" key="0" z_index="3"/>                    <object_ref id="4" timeline="69" key="0" z_index="4"/>                    <object_ref id="5" timeline="81" key="0" z_index="5"/>                    <object_ref id="6" timeline="68" key="0" z_index="6"/>                    <object_ref id="7" timeline="80" key="0" z_index="7"/>                    <object_ref id="8" timeline="67" key="0" z_index="8"/>                    <object_ref id="9" timeline="79" key="0" z_index="9"/>                    <object_ref id="10" timeline="66" key="0" z_index="10"/>                    <object_ref id="11" timeline="78" key="0" z_index="11"/>                    <object_ref id="12" timeline="58" key="0" z_index="12"/>                    <object_ref id="13" timeline="62" key="0" z_index="13"/>                    <object_ref id="14" timeline="57" key="0" z_index="14"/>                    <object_ref id="15" timeline="61" key="0" z_index="15"/>                    <object_ref id="16" timeline="18" key="0" z_index="16"/>                    <object_ref id="17" timeline="37" key="0" z_index="17"/>                    <object_ref id="18" timeline="56" key="0" z_index="18"/>                    <object_ref id="19" timeline="17" key="0" z_index="19"/>                    <object_ref id="20" timeline="36" key="0" z_index="20"/>                    <object_ref id="21" timeline="55" key="0" z_index="21"/>                    <object_ref id="22" timeline="16" key="0" z_index="22"/>                    <object_ref id="23" timeline="35" key="0" z_index="23"/>                    <object_ref id="24" timeline="54" key="0" z_index="24"/>                    <object_ref id="25" timeline="15" key="0" z_index="25"/>                    <object_ref id="26" timeline="34" key="0" z_index="26"/>                    <object_ref id="27" timeline="53" key="0" z_index="27"/>                    <object_ref id="28" timeline="14" key="0" z_index="28"/>                    <object_ref id="29" timeline="33" key="0" z_index="29"/>                    <object_ref id="30" timeline="52" key="0" z_index="30"/>                    <object_ref id="31" timeline="13" key="0" z_index="31"/>                    <object_ref id="32" timeline="32" key="0" z_index="32"/>                    <object_ref id="33" timeline="51" key="0" z_index="33"/>                    <object_ref id="34" timeline="12" key="0" z_index="34"/>                    <object_ref id="35" timeline="31" key="0" z_index="35"/>                    <object_ref id="36" timeline="50" key="0" z_index="36"/>                    <object_ref id="37" timeline="49" key="0" z_index="37"/>                    <object_ref id="38" timeline="11" key="0" z_index="38"/>                    <object_ref id="39" timeline="30" key="0" z_index="39"/>                    <object_ref id="40" timeline="48" key="0" z_index="40"/>                    <object_ref id="41" timeline="47" key="0" z_index="41"/>                    <object_ref id="42" timeline="10" key="0" z_index="42"/>                    <object_ref id="43" timeline="29" key="0" z_index="43"/>                    <object_ref id="44" timeline="46" key="0" z_index="44"/>                    <object_ref id="45" timeline="65" key="0" z_index="45"/>                    <object_ref id="46" timeline="9" key="0" z_index="46"/>                    <object_ref id="47" timeline="28" key="0" z_index="47"/>                    <object_ref id="48" timeline="45" key="0" z_index="48"/>                    <object_ref id="49" timeline="27" key="0" z_index="49"/>                    <object_ref id="50" timeline="26" key="0" z_index="50"/>                    <object_ref id="51" timeline="8" key="0" z_index="51"/>                    <object_ref id="52" timeline="25" key="0" z_index="52"/>                    <object_ref id="53" timeline="44" key="0" z_index="53"/>                    <object_ref id="54" timeline="7" key="0" z_index="54"/>                    <object_ref id="55" timeline="24" key="0" z_index="55"/>                    <object_ref id="56" timeline="6" key="0" z_index="56"/>                    <object_ref id="57" timeline="5" key="0" z_index="57"/>                    <object_ref id="58" timeline="23" key="0" z_index="58"/>                    <object_ref id="59" timeline="43" key="0" z_index="59"/>                    <object_ref id="60" timeline="22" key="0" z_index="60"/>                    <object_ref id="61" timeline="63" key="0" z_index="61"/>                    <object_ref id="62" timeline="4" key="0" z_index="62"/>                    <object_ref id="63" timeline="42" key="0" z_index="63"/>                    <object_ref id="64" timeline="3" key="0" z_index="64"/>                    <object_ref id="65" timeline="41" key="0" z_index="65"/>                    <object_ref id="66" timeline="21" key="0" z_index="66"/>                    <object_ref id="67" timeline="64" key="0" z_index="67"/>                    <object_ref id="68" timeline="2" key="0" z_index="68"/>                    <object_ref id="69" timeline="40" key="0" z_index="69"/>                    <object_ref id="70" timeline="1" key="0" z_index="70"/>                    <object_ref id="71" timeline="39" key="0" z_index="71"/>                    <object_ref id="72" timeline="20" key="0" z_index="72"/>                    <object_ref id="73" timeline="19" key="0" z_index="73"/>                    <object_ref id="74" timeline="0" key="0" z_index="74"/>                    <object_ref id="75" timeline="38" key="0" z_index="75"/>                    <object_ref id="76" timeline="60" key="0" z_index="76"/>                    <object_ref id="77" timeline="59" key="0" z_index="77"/>                    <object_ref id="78" timeline="77" key="0" z_index="78"/>                    <object_ref id="79" timeline="76" key="0" z_index="79"/>                    <object_ref id="80" timeline="75" key="0" z_index="80"/>                    <object_ref id="81" timeline="74" key="0" z_index="81"/>                    <object_ref id="82" timeline="73" key="0" z_index="82"/>                    <object_ref id="83" timeline="72" key="0" z_index="83"/>                </key>

Share this post


Link to post
Share on other sites
Sabeku    24

What coding did you use to make lure gain sanity in the sun?

 

Its actually sanity gain overall, so to counter this I made the sanity drain during the dusk and night as well.

So the first line is that daytime/overall gain, and the second two are the drain in dusk and night.

	inst.components.sanity.dapperness = TUNING.DAPPERNESS_MED	inst.components.sanity.night_drain_mult = 3	inst.components.sanity.neg_aura_mult = 3

If I didn't have the drain, he would gain sanity indefinitely.

 

Also, you can increase the sanity gain by naming it differently (although I find that DAPPERNESS_MED is a good balance). To lower it, the code MED would change. Currently the order from least to most is:

TINY, SMALL, MED, LARGE, HUGE

 

Don't forget to change the sanity drain too!

Share this post


Link to post
Share on other sites
rezecib    3152
inst.components.sanity.neg_aura_mult = 3
 neg_aura_mult is actually a multiplier for negative sanity auras, such as the ones around monsters, beardlings, evil flowers, etc. Looking at the sanity component I don't see it being used for light/phase-related sanity at all.

Share this post


Link to post
Share on other sites
Sabeku    24

 neg_aura_mult is actually a multiplier for negative sanity auras, such as the ones around monsters, beardlings, evil flowers, etc. Looking at the sanity component I don't see it being used for light/phase-related sanity at all.

 

Oh! I wasn't aware of that. So even without this string of code, he'll still lose sanity around monsters normally?

Also, if I may ask you something...

I'm trying to make it where he gains health and sanity when it rains, but it seems at dusk or night when raining, there is no sanity gain. When I try to reverse the sanity drain code, it makes him gain a ton of sanity all the time!

(Like this:)

	inst.components.sanity.night_drain_mult = -1.5

And then I would put this with the rain code (modified from WX) but it's not working the way I'd like it too. Also the sparks code is changed to raindrop. The checker for rain is renamed in the function (inst) too, so it's currently working:

--Gains health/sanity from rainlocal function dorainraindrop(inst, dt)	local mitigates_rain = false	for k,v in pairs (inst.components.inventory.equipslots) do		if v.components.dapperness then			if v.components.dapperness.mitigates_rain then				mitigates_rain = true			end		end			end	    if GetSeasonManager() and GetSeasonManager():IsRaining() and not mitigates_rain then    	inst.raindrop_time = inst.raindrop_time - dt    	if inst.raindrop_time <= 0 then    		    		inst.raindrop_time = 3+math.random()*2    		inst.components.health:DoDelta(1, false, "rain")			inst.components.sanity.dapperness = TUNING.DAPPERNESS_MED*3* GetSeasonManager():GetPrecipitationRate()	    	end    endend

I'm just not sure I'm going about this the most efficient way for day / night sanity changes, plus the issue with the rain.

I should also mention, the only coding that I have for daytime sanity gain is

	inst.components.sanity.dapperness = TUNING.DAPPERNESS_MED	inst.components.sanity.night_drain_mult = 3

with the night drain there so he doesn't gain sanity at night also. It seems like I'm coding this all sloppily but I don't know where to look besides Maxwell's coding, which isn't exactly what I need.

 

So, long post short: How do I get sanity to gain during nighttime when its raining (only), and is there an easier way to code sanity changes from night to day?

Share this post


Link to post
Share on other sites
rezecib    3152

@Sabeku, Well, SeasonManager doesn't exist in DST anymore. What you need to detect whether it's raining is TheWorld.state.israining.

 

But I think your approach is good. It's a bit difficult to get just right, I'm guessing, but it doesn't involve rewriting entire functions of the sanity component, which is nice. I think to get what you want, you probably need to just adjust the numbers for those two values, then add a custom rate fn like Willow that simply checks if it's raining, and if so, returns the extra amount of dapperness.

Share this post


Link to post
Share on other sites
Sabeku    24

@rezecib, Hm... I'll keep that in mind for when I port this over to DST. I'd like to get everything working in DS and ROTG before changing the scripts for multiplayer. From what I gather though, it should be fairly simple?

 

I tried a few things involving the clock and day and night cycle, specifically from the BeefaloBrain (since they huddle at night). But when I tried to pop this code within Lure's code, nothing happened. It didn't crash the game, but just didn't work.

(This code:

local function GetWanderDistFn(inst)    if GetClock() and not GetClock():IsDay() then        return WANDER_DIST_NIGHT    else        return WANDER_DIST_DAY    endend

replacing the wander with the sanity gain / drain.)

 

Then I looked back into WX's code to figure some things out. The first part of the code I found out is for the umbrella to protect you against the rain!

This part:

	local mitigates_rain = false	for k,v in pairs (inst.components.inventory.equipslots) do		if v.components.dapperness then			if v.components.dapperness.mitigates_rain then				mitigates_rain = true			end		end			end

I didn't want this with Lure, so I cut this part out.

Moving on, I looked into the code more, and where I got the GetSeasonManager():GetPrecipitationRate() part of the mod, and traced it back to Coraline Jones from the Mystery Kids mod. (Which is good too, because I want to collect my referenced material.)

This section of their mod reminded me that the else function is what I'm looking for!

local function doraincoat(inst, dt)    if GetSeasonManager() and GetSeasonManager():IsRaining() then		inst.components.sanity.dapperness = TUNING.DAPPERNESS_MED*1.5* GetSeasonManager():GetPrecipitationRate()    else 		inst.components.sanity.dapperness = 0	end	end

Plus you adding that the sanity at night needs to return the same amount (or more, in this case). From here all I had to do was adjust the numbers, and ended up with this working code:

--Gains health/sanity from rainlocal function dorainraindrop(inst, dt)    if GetSeasonManager() and GetSeasonManager():IsRaining() then		inst.components.sanity.dapperness = TUNING.DAPPERNESS_HUGE* GetSeasonManager():GetPrecipitationRate()		inst.components.sanity.night_drain_mult = -1.5		inst.raindrop_time = inst.raindrop_time - dt         if inst.raindrop_time <= 0 then			inst.raindrop_time = 3+math.random()*2			inst.components.health:DoDelta(1, false, "rain")		end	else 		inst.components.sanity.dapperness = TUNING.DAPPERNESS_MED		inst.components.sanity.night_drain_mult = 1	endend

Thanks for the help! I'm glad its working all fine now. :grin:

(Also, sorry for kind of explaining things. I know you know how things work, but this is a backlog for me and hopefully help for anyone else reading this thread.)

Edited by Sabeku

Share this post


Link to post
Share on other sites
Sabeku    24

Updated the main post, now to talk about the woes of coding...

 

I've been messing around with the Z index because of the hair issue, but also because Lure doesn't have any sleeves. This made his upper arm appear ontop of his lower arm, which doesn't look right ingame. Now, normally I would just redo the parts so the upper arm could be where it is without changing anything, however to do it correctly so that when it bends in animation, I would have to change the Z index.

First, the problem:

b6f934e607ccfed54827ab395f29ae7c.png

The arms are placed wrong. Now to fix this, I went inside the scml file, found all the corresponding timeline id numbers associated with the arms.

99df16525a6bf5d09cd85c00e42d0df8.png

Then I made a quick text file organizing the numbers with the upper and lower arms:

4bdb64e17a10bfdb6778643e5171cf0c.png

Now the only thing left was to go back to the Z index order and change the upper and lower arm numbers.

1c4a4bdba939e0e82f1cf735efeca809.png

And it worked! Looks like I'll need to change the file of the lower arm to fit snugly on the pivot point.

 

I should also mention I tried completely deleting the tail during this time. I erased the parts from the scml and the exported folder, and the game loaded just fine. However, in game Lure was missing his hands? And his legs would disappear during certain animations or in the idle movements.

Since I haven't dealt with any animation yet, I'm assuming this is associated with that. For the meantime, I wouldn't suggest deleting any part, but replacing it with the clear template provided in the base code (from Dleowolf).

 

Onto more art assets! Next is finishing all the art and dealing with making the bangs, then learning about the animation process.

Share this post


Link to post
Share on other sites

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
Sign in to follow this