Jump to content

Help designing mod character (Need help with programming!)


Recommended Posts

Hello fellow DST players and modders,

I've been programming for quite some time, but I find in DST it's the hardest to learn due to a couple of reasons. Mostly though is the fact that there isn't a easy to read documentation on all the methods you can use.

So onto the character, I'm looking to have a couple things on this character in each category as listed below...

Name: Gwen, the Faithful

Health: 150
Hunger: 125
Sanity: 125

Character Specialties:

Has been here before;

  • Can craft Night tools from Magic tab, using Prestihatitator.
  • Knows first science tech level by default.
  • Knows first magic tech level by default.
  • Cooks food in half the time.
  • Picks things in half the time.

Social and talkative;

  • Gains sanity when nearby one or more players.
  • Positive sanity aura for nearby players.
  • Once every 15 seconds you emote, heal 1 HP to yourself and nearby players.

Starts with some Night Tools and a Healing Staff;

  • Starts with a Night Axe.
  • Starts with a Night Pickaxe.
  • Starts with a Night Shovel.
  • Starts with a Healing Staff.

So now that I've described the specialties of the character, I'm going to go over the details of each item individually.

Item Details:

Night Tools (Axe, Pickaxe, Shovel, Hammer, Pitchfork.); [Considering adding Night Machete when tropical experience mod is enabled.]

  • Infinite durability.
  • Uses sanity instead of durability when used.
  • Sanity loss is dependent on specific tool.
  • Net sanity loss of 2 per complete action. Such as mining, chopping or digging a complete object.

Healing staff; (Healing staff will be a reskinned replica of the item from More weapons and magic mod. With upgrades!)

  • Has functions of Walking Cane.
  • Grants +2 sanity regen / minute.
  • Has ability to cast a heal spell on self or others.
  • Has ability to cast a resurrect spell on others.
  • Each use of the heal spell costs 12.5 sanity.
  • Each use of the heal spell heals 25 Health to target.
  • Each use of resurrect spell costs 50 sanity & 50% of your hunger/health.
  • Each use of resurrect spell resurrects other player with your paid stats.

 

I would be greatly appreciate if you can give any feedback on the programming of these specialties and the inherent items. :)

Also, I will note that currently the mod crashes and I have to look into the logs to determine what it says. When I do that, it will be posted here in a later comment. (Well I'm off to sleep since it's a late night!)

 

Gwen The Faithful.zip

Edited by neahxx
Updated files and mod details.
Link to comment
Share on other sites

Here's a recommendation, try putting your entire mod into a zip file instead of loading individual parts of the mod. It makes it a lot more faster to debug an entire mod than to proof read all individual parts and waste time seeing "if this is the source, no this is the source, no it has to do with one of the tex/zip files". Other than that your asking quite a bit in the specialties that's already been done before so ill link and summarize

sanity near other players:

https://forums.kleientertainment.com/forums/topic/78648-gain-sanity-near-other-players/

sanity to other players:

local function CalcSanityAura(inst)
    return TUNING.SANITYAURA_MED
end

inst:AddComponent("sanityaura")
inst.components.sanityaura.aurafn = CalcSanityAura

first tech level:

inst.components.builder.science_bonus = 1

Typical crafting formula:

local Ingredient = GLOBAL.Ingredient
local RECIPETABS = GLOBAL.RECIPETABS
Recipe = GLOBAL.Recipe
Ingredient = GLOBAL.Ingredient
TECH = GLOBAL.TECH
local TECH = GLOBAL.TECH

AddRecipe("nightaxe", { Ingredient("goldnugget",4), Ingredient("silk",2), Ingredient("boards",1) }, RECIPETABS.MAGIC, TECH.MAGIC_THREE, nil, nil, nil, nil, nil, "images/inventoryimages/nightaxe.xml")

emote every 15 seconds? well closes thing to that is this code and the link to forcing an emote:

local function healowner(inst, data)

local x,y,z = inst.Transform:GetWorldPosition()
local contacts = TheSim:FindEntities(x,y,z, 5, nil, {"player"}, nil)
local target = data and data.target
target.components.health:DoDelta(1)
inst.components.health:DoDelta(1)
end

inst.task = inst:DoPeriodicTask(15, healowner, nil, inst)

https://forums.kleientertainment.com/forums/topic/69452-force-client-to-use-an-emote/

 

Last few notes no durability is pretty easy just don't include durability code in your tools, walking cane is pretty easy to decrypt in this search path: Don't Starve Together\data\databundles\scripts.zip\scripts\prefabs\cane, sanity regen in items: inst.components.equippable.dapperness = TUNING.DAPPERNESS_MED, and cast spell I barely have any experience with so cant help there without devoting time (I have little at this point) to see how to make it work.

Edited by K1NGT1GER609
crafting formula needed some more parts
Link to comment
Share on other sites

Oops accidentally pressed report post thinking it said reply. And posting a long comment. *Wow, I'm an idiot at this time of day.*

To put it shortly though thank you for the help and I'll post any updates as well as the files in zip starting tonight.

Also, I'm borrowing the code from another mod to add magic items and other things. I'll do a further analysis of the character in the next comment or so.

Edited by neahxx
Link to comment
Share on other sites

So heres a short summary of whats wrong: the ghost zip file is named ghost_esctemplate_build instead of ghost_gwen_build, the gwen lua file has a actionhandler that's suppose to be made for the modmain, and last the cook function you made is missing some stuff that I managed to trace down the source of where it came. If you don't know what I'm talking about exactly check out the modmain and gwen lua files I left and do a comparison on whats missing.

modmain.lua

gwen.lua

Link to comment
Share on other sites

Thanks for the help, I'll work on fixing those right away. Then update when I've done so with the files.

Sorry for the delayed message, I didn't realize the notification came up on the followed content page.

Edited by neahxx
Link to comment
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
 Share

×
  • Create New...