Jump to content

Code Help with a New Character


booarrg

Recommended Posts

Hi folks!  I was wondering if I could get some help with a few coding issues i'm having with a character mod.

I've got the mod up and running, looks great, works without many hiccups, but there's a few extra touches i'm wanting to add and i don't quite know how to go about it.

 

First off i'm completely stumped by the code to add in a custom minimap icon.  I've copied down some code from the forums, but it only served to make my character invisible on the minimap rather than showing their pretty face to the world.

Secondly, i'm wondering if anyone can give me some advice on how to go about making a follower for this character.  Ideally, this mob would be able to do the following.
*provide a warmth/sanity boost aura when sleeping, like the pigmen.

*spook when the character stands too close

*attack nearly everything (except pigs and the player and various inanimate objects)

*follow a unique item in the player's possession and respawn on its location if dead for a certain amount of time.

I'm looking for advice on where to start, what code to look at, etc, as i've never made my own follower and all the examples i've found have crashed the game

 

Any kind of help would be fantastic!

Link to comment
Share on other sites

For Minimap:

    inst.entity:AddMiniMapEntity()
    inst.MiniMapEntity:SetIcon( "treasure_chest.png" )

 

The image name can be changed. Make sure to declare custom images as minimap icons in modmain.lua! (you can see other mods for reference)

Link to comment
Share on other sites

Just analyze the code from Chester and Pigmen! If you understand how they work, you should easily be able to code your own follower.

 

As for the Minimap issue, check this out.

 

You can find quite a lot of tutorials, guides, and samples here, including the one at the preceding link.

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