Jump to content

Wicked the Theif (need a little coding advice!)


Kafaid

Recommended Posts

Hello!  I wanted to try to make my own custom character, which was going pretty great yesterday but somehow I broke it today when I was trying to rename her from Nimble to Wicked.  (In the code I used nim -> wik )

 

Edit: it is fixed now!  She works again :grin:  Now I will slowly work on the features I wanted to add.  Hopefully It will not heck up again.

 

You can test out this mod here: :grin:

 

tumblr_nljij242Gi1qa4dnro1_1280.png

 

If someone could give me some pointers that would be really appreciated ; u ;

 

(Also when she was working, her sprite seemed to be glitching a little?  Her head for when she wears a hat ended up showing up on top of her normal head.)

post-620726-0-42884300-1426905170_thumb.

 

Her intended traits:

-runs fast (or faster when there is gold/gold tools/gems in her inventory?)

-hits hard

-low sanity (but gold gives her sanity boost)

-picky eater (like wickerbottom)
- Refusal to eat anything not a dish from crockpot
- Possible custom items
- No sanity drop when digging graves
- Pigs see her as a monster

 

 

Link to comment
Share on other sites

This is a good general guide for character making, and a lot more up-to-date than the other "artist's guide" I assume you used.

http://forums.kleientertainment.com/topic/46849-tutorial-using-extended-sample-character-template/

 

 

If your mod's started crashing due to you changing the name, most likely it's just that you didn't change the name everywhere in the files. 

 

Also, there's a handy little log.txt thing in your files somewhere that will usually have a bit telling you what you've borked up that caused the crash.

 

Also also, the "hat" head should just be the normal head sprite with the bits that will be covered by hats erased, instead of a completely seperate drawing. 

 

Also also also, just a little general character-making tip, try to make her have some big (for lack of a better word) gimmick that'll set her apart from other characters folks have made. Like... I dunno, she crafts rocks and gold into gems, or makes nifty gem weapons, or eats gems to turn into the mighty Gemzilla. There aren't really any limits to what you can do, so get creative with it.

Link to comment
Share on other sites

@Patriarachnid  Thanks for the advice!  That new tutorial is much easier to follow and easier to edit lmao.  It's working again but now I have to update all the sprite art. 

 

@weirdobob If I name the workshop file "WickedTheThief" will the code still work?  I don't really care if other people have already used the name as long as it doesn't affect the code lol; 

Link to comment
Share on other sites

@Kafaid,

 

Select some text in a person's post for the little popup that allows you to mention them to appear.  That way they get notifications when you respond to them.

 

Anyhoo--  the workshop name doesn't matter at all.  You'll want to give it a unique name though.  You'll also probably want to make sure that the code internally refers to wicked as something other than what the other mod's character uses.  It appears that the other mod's character is internally called 'wik', so you should be safe.

Link to comment
Share on other sites

@Corrosive  Oh thanks!  I didn't realize I had to do that lol.  (used to another forum where you just use the @)

 

I might change the name back to Nimble again but it just depends how tired I am when I'm done updating the sprite lol.

I finally got the character to work again and don't want to break it the same way as last time.  > . >

 

 

@seronis, I wasn't sure how much people cared about it, (or against it I guess lol?). I just wanted to make a character that was consistent-ish with the style of the core game.  The name was actually different before I realized all the names started with Ws.

 

Link to comment
Share on other sites

Also I've been having issues trying to figure out how to set it so she can only eat crock pot foods. 

 

these are the only pre-determined fuctions I can find, and non of them are exclusively crockpot.  Is there an easy way to define my own?  I'm not really sure what Eater:OnRemoveFromEntity() does and what parameters are necessary.

function Eater:SetVegetarian()
self.foodprefs = { FOODTYPE.VEGGIE }
end

function Eater:SetCarnivore()
self.foodprefs = { FOODTYPE.MEAT }
end

function Eater:SetInsectivore()
self.foodprefs = { FOODTYPE.INSECT }
end

function Eater:SetBird()
self.foodprefs = { FOODTYPE.SEEDS }
end

function Eater:SetSmallBird()
self.foodprefs = { FOODGROUP.BERRIES_AND_SEEDS }
end

function Eater:SetBeaver()
self.foodprefs = { FOODTYPE.WOOD }
end

function Eater:SetElemental()
self.foodprefs = { FOODTYPE.ELEMENTAL }
end

 

 

Link to comment
Share on other sites

Also I've been having issues trying to figure out how to set it so she can only eat crock pot foods. 

 

these are the only pre-determined fuctions I can find, and non of them are exclusively crockpot.  Is there an easy way to define my own?  I'm not really sure what Eater:OnRemoveFromEntity() does and what parameters are necessary.

function Eater:SetVegetarian()

self.foodprefs = { FOODTYPE.VEGGIE }

end

function Eater:SetCarnivore()

self.foodprefs = { FOODTYPE.MEAT }

end

function Eater:SetInsectivore()

self.foodprefs = { FOODTYPE.INSECT }

end

function Eater:SetBird()

self.foodprefs = { FOODTYPE.SEEDS }

end

function Eater:SetSmallBird()

self.foodprefs = { FOODGROUP.BERRIES_AND_SEEDS }

end

function Eater:SetBeaver()

self.foodprefs = { FOODTYPE.WOOD }

end

function Eater:SetElemental()

self.foodprefs = { FOODTYPE.ELEMENTAL }

end

 

You should set a caneattest to somehow limit the choice of food to what you want. Foodprefs aren't suitable for this kind of limitation.

 

sample

local function CanEat(inst, food)

--test for whether it's prepared food

[...]

end

 

local function fn() --or 'local fn = function()', it doesn't matter

[...]

    inst.components.eater.caneattest = CanEat

 

    return inst

end

 

EDIT: In the test function, you'd have to use an if-block like so:

if [is_prepared_dish] then

    return true

end

return false --can't return when the function already returned true

Link to comment
Share on other sites

@Kafaid,

 

Just to tack on to what Mobbstar said...

 

Foods cooked in a crockpot generally all share the same base initialization function, which is located in preparedfoods.lua.  You'll notice that it adds the tag "preparedfood" to every instance.

 

Your caneattest function can be very simple:

local function caneattestfn(inst)    return inst:HasTag("preparedfood")end

You can modify it however you want, if you want to be more specific.  The function needs to return the value true when the character is able to eat the instance of food passed to it, and false when not.

 

 

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...