Jump to content

Trying to make a character mod, need help.


Recommended Posts

So I'm making a character based off the ancient torch wielder. I have all the sprites and basic stats finished but I want her to be able to have clockworks be neutral to her and have her be able to make a tragic torch that scares off hallucinations and damages them when they get in it's light radius. I know this is a lot, but I would really appreciate it if somebody could help. Thank you.

face-19.png

face-2.png

face-21.png

face-22.png

face-23.png

 

face-25.png

face-29.png

face-3.png

face-30.png

face-31.png

face-32.png

foot-0.png

 

foot-3.png

foot-4.png

foot-5.png

 

hand-10.png

hand-11.png

hand-12.png

hand-13.png

hand-14.png

hand-15.png

hand-16.png

hand-17.png

hand-18.png

hand-19.png

 

 

 

 

hand-6.png

hand-7.png

hand-8.png

hand-9.png

headbase-0.png

headbase-1.png

headbase-2.png

headbase-3.png

headbase-4.png

headbase_hat-0.png

headbase_hat-1.png

headbase_hat-2.png

headbase_hat-3.png

headbase_hat-4.png

 

leg-1.png

leg-10.png

 

leg-3.png

leg-4.png

 

leg-6.png

leg-7.png

leg-8.png

leg-9.png

SWAP_ICON-0.png

tail-0.png

torso-0.png

 

 

 

 

 

 

 

 

 

 

torso_pelvis-0.png

torso_pelvis-1.png

torso_pelvis-10.png

torso_pelvis-2.png

torso_pelvis-3.png

 

torso_pelvis-5.png

 

 

 

 

avatar_ghost_wollax.png

avatar_wollax.png

self_inspect_wollax.png

wollax.png

names_wollax.png

wollax.png

Edited by Israphelite
Link to comment
Share on other sites

The sanity from raw meat being negated is pretty simple with a CustomOnEatFn that restores sanity when you eat those raw meats equivalent to what you'd normally lose.  There are more complex implmentations but a quick check to make sure your sanity isn't going to hit the zero lower limit before jumping up higher than it started removes the only edge case for strange behavior.

For the clockworks the way I'd do it is give her the ability to craft broken clockworks (relatively cheaply due to the later gear cost), which can be given gears to make them allies.  This seems a more reasonable implementation balance wise than clockworks being neutral or allies normally (you wouldn't expect maxwell's clockworks to be friendly) and is the easiest way to implement this perk.

Klei probably wouldn't want you to be using the official tragic torch skin on a custom item, but given your spriting abilities making something new with a white flame would be what I recommend.  The spell function "scaring" away the shadows/nightmares would be a little difficult to implement since they don't have a state where they flee like say, pigs or bunnies.  One option would be to simply remove() shadow and nightmare monsters nearby without having them drop nightmare fuel.  It would achieve a very similar effect in the end (maybe have it spawn an fx too when it removes them).

 

Overall though it seems a pretty reasonable thing to implement and I'd be willing to help with the first two parts.

Edited by Toros
Spelling
Link to comment
Share on other sites

28 minutes ago, Toros said:

The sanity from raw meat being negated is pretty simple with a CustomOnEatFn that restores sanity when you eat those raw meats equivalent to what you'd normally lose.  There are more complex implmentations but a quick check to make sure your sanity isn't going to hit the zero lower limit before jumping up higher than it started removes the only edge case for strange behavior.

For the clockworks the way I'd do it is give her the ability to craft broken clockworks (relatively cheaply due to the later gear cost), which can be given gears to make them allies.  This seems a more reasonable implementation balance wise than clockworks being neutral or allies normally (you wouldn't expect maxwell's clockworks to be friendly) and is the easiest way to implement this perk.

Klei probably wouldn't want you to be using the official tragic torch skin on a custom item, but given your spriting abilities making something new with a white flame would be what I recommend.  The spell function "scaring" away the shadows/nightmares would be a little difficult to implement since they don't have a state where they flee like say, pigs or bunnies.  One option would be to simply remove() shadow and nightmare monsters nearby without having them drop nightmare fuel.  It would achieve a very similar effect in the end (maybe have it spawn an fx too when it removes them).

 

Overall though it seems a pretty reasonable thing to implement and I'd be willing to help with the first two parts.

Thanks, but I don't know how to do those things. I'd like your help though. Could you make some lines of code and then tell me where to paste them?

Link to comment
Share on other sites

52 minutes ago, Israphelite said:

Thanks, but I don't know how to do those things. I'd like your help though. Could you make some lines of code and then tell me where to paste them?

The first and simplest task is mostly just a block of code in the character lua file and a line in the master postinit function.  The line in the postinit would be:

inst.components.eater:SetOnEatFn(OnEat)

 

and the block of code that should be above it with the other functional blocks would be something like:

local function OnEat(inst, food)
--check for sanity being above 0 goes here
        if food and ((food.prefab == "meat") or (food.prefab == "plantmeat") or (food.prefab == "smallmeat") or (food.prefab == "smallmeat")) then
            inst.components.sanity:doDelta(10)
        end
    --end if you have the previous check in place
end

Link to comment
Share on other sites

Here, let me send you the files and maybe you can put the codes in and send them back? I'll credit you as a author for the mod if you can do it. Maybe add the whole "not aggroing to clockworks thing" too? I'm a big noob when it comes to coding but I can get the basics done. Sorry for the trouble. I should be able to make the torch by myself. Instead of scaring the nightmare creatures, I'll just have it do massive damage to them.

wollax.lua

wollax_none.lua

modmain.lua

Link to comment
Share on other sites

11 hours ago, Toros said:

The spell function "scaring" away the shadows/nightmares would be a little difficult to implement since they don't have a state where they flee like say, pigs or bunnies. 

Isn't this EXACTLY what was discussed here?

AddBrainPostInit("nightmarecreaturebrain",    function(self)        GLOBAL.table.insert(self.bt.root.children, 1, GLOBAL.RunAway(self.inst, "scarydoctor", 5, 8))    end)

Just replace "scarydoctor" with whatever tag you want added when you equip the new torch, and it should work... I think.

Link to comment
Share on other sites

local function REEE(inst)
    if inst.components.combat and inst.components.combat.targetfn then
        local _onstartdrying = inst.components.combat.targetfn

        local function onstartdrying(inst)
            return _onstartdrying(inst) and (((not _onstartdrying(inst):HasTag("bearded")) or nil) and _onstartdrying(inst))
        end

        inst.components.combat.targetfn= onstartdrying
    end
end    

AddPrefabPostInit("bishop", REEE)

 

This should hopefully make things neutral to things with the "bearded" tag(so change that tag to some tag your character will have), add the last line to any other prefab you want neutral to you, currently it's for the bishop, so for the rook add:

AddPrefabPostInit("rook", REEE)

Link to comment
Share on other sites

5 hours ago, spideswine said:

local function REEE(inst)
    if inst.components.combat and inst.components.combat.targetfn then
        local _onstartdrying = inst.components.combat.targetfn

        local function onstartdrying(inst)
            return _onstartdrying(inst) and (((not _onstartdrying(inst):HasTag("bearded")) or nil) and _onstartdrying(inst))
        end

        inst.components.combat.targetfn= onstartdrying
    end
end    

AddPrefabPostInit("bishop", REEE)

 

This should hopefully make things neutral to things with the "bearded" tag(so change that tag to some tag your character will have), add the last line to any other prefab you want neutral to you, currently it's for the bishop, so for the rook add:

AddPrefabPostInit("rook", REEE)

Agh, I hate to have keep asking stuff but which prefabs and stuff do I paste this in? My character's lua? A new document? The bishop's .brain? I'm so sorry. I'm a hassle.

Link to comment
Share on other sites

Good news, I got it working! Now I just need to get her to be immune to sanity loss from meat. I got some help from a friend.

 

I managed to make the clockworks passive by going in the LUA file for my character and pasting 
    inst:AddTag("chess") under the master_postinit

Edited by Israphelite
Link to comment
Share on other sites

If you want your character to not take Sanity penalty from raw meat then put this inside YOURCHARACTER.lua inside the master_postinit

Spoiler

inst.components.eater.Eat_orig = inst.components.eater.Eat
function inst.components.eater:Eat(food)
	if food and food.components.edible and food.components.edible.foodtype == FOODTYPE.MEAT and self:CanEat(food) then
		if food.components.edible.sanityvalue < 0 then
			food.components.edible.sanityvalue = 0
		end
	end
	return inst.components.eater:Eat_orig(food)
end

 

 

Link to comment
Share on other sites

4 minutes ago, SuperDavid said:

If you want your character to not take Sanity penalty from raw meat then put this inside YOURCHARACTER.lua inside the master_postinit

  Hide contents


inst.components.eater.Eat_orig = inst.components.eater.Eat
function inst.components.eater:Eat(food)
	if food and food.components.edible and food.components.edible.foodtype == FOODTYPE.MEAT and self:CanEat(food) then
		if food.components.edible.sanityvalue < 0 then
			food.components.edible.sanityvalue = 0
		end
	end
	return inst.components.eater:Eat_orig(food)
end

 

 

Well this has been bothering me for a while, so I'd greatly appreciate it if you answered it, but what would happen if he placed it in common_postinit instead?

Just what exactly is the difference if you place something before

    if not TheWorld.ismastersim then
        return inst
    end

compared to after it? what happens if you place it in the wrong place?

Link to comment
Share on other sites

1 minute ago, spideswine said:

Well this has been bothering me for a while, so I'd greatly appreciate it if you answered it, but what would happen if he placed it in common_postinit instead?

Just what exactly is the difference if you place something before

    if not TheWorld.ismastersim then
        return inst
    end

compared to after it? what happens if you place it in the wrong place?

It's a bunch of stuff to do with servers & clients communicating with eachother & clients & server don't all share the same stuff for example only the server has access to components while clients don't, but I don't really know about a lot so I can't really answer your question unfortunately , sorry :wilson_smile:!

Link to comment
Share on other sites

28 minutes ago, spideswine said:

 

Just what exactly is the difference if you place something before

    if not TheWorld.ismastersim then
        return inst
    end

compared to after it? what happens if you place it in the wrong place?

All people that are client of the server will crash if the code contains things that should be server side only (usually, component).

 

Link to comment
Share on other sites

1 minute ago, Lumina said:

All people that are client of the server will crash if the code contains things that should be server side only (usually, component).

 

Ok, first of all: thanks.

Second: what If I add something like a tag(which is generally added prior to the mastersim check) only after the mastersim check, what would happen then?

Link to comment
Share on other sites

1 minute ago, spideswine said:

 

Second: what If I add something like a tag(which is generally added prior to the mastersim check) only after the mastersim check, what would happen then?

I guess (but i'm not sure) that the tag will work only for the player hosting the server (if there is one), creating bug and stuff not working properly.

Link to comment
Share on other sites

Does this apply to lichens also? Durians are pretty boring so I don't care if they take sanity away.

 

37 minutes ago, spideswine said:

Well this has been bothering me for a while, so I'd greatly appreciate it if you answered it, but what would happen if he placed it in common_postinit instead?

Just what exactly is the difference if you place something before

    if not TheWorld.ismastersim then
        return inst
    end

compared to after it? what happens if you place it in the wrong place?

 

Link to comment
Share on other sites

5 minutes ago, Lumina said:

I guess (but i'm not sure) that the tag will work only for the player hosting the server (if there is one), creating bug and stuff not working properly.

the thing is I've added tags...and components to prefabs post init(addprefabpostinit), without refering to the mastersim and they all worked out fine, both with me hosting/others hosting.

I'm just really confused about that thing at this point.

Edited by spideswine
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...