Jump to content

Making your own critter [NEED HELP PLEASE]


Recommended Posts

Since there's no replies yet I'll add my awful attempt at coding that I'm having problems with.

I'm no coder at all, I simply use other mods as a base and change things until they work, so with that being said here's the mod I used as a base: https://steamcommunity.com/sharedfiles/filedetails/?id=932975687

and here's my awful attempt at changing the code:

Artemis.zip

My problem that I can't get by right now is with the artemis.lua; I load up the game and start a sever and it pops up with an error saying: '(' expected near return so I go back to the code and try putting one of those in (though I don't understand where it wants it) and I try loading the game up again, then I get a different error that says unexpected symbol near '<eof>' so I try changing things again and I end up getting a different error unexpected symbol near local then it's just back to the first one if I change it, so I'm lost on how to fix it. 

I tried looking around the forums for help on making critters, but there wasn't really anything that I could find, and whenever I try to use the game's scripts (that are moved into a rar/zip now, idk when that happened I haven't played in months) it always makes my game crash to desktop, then I have to get a new data folder from my sister just to be able to play the game again. :/

Link to comment
Share on other sites

First of all remove all characters after the MakeDonPetBuild() - no need for spaces, or enters.

Also you should add code inside this function to actual return a diet to the pet "local function standard_diet(prefab) " 

and also close it with an end before the last return, and it should work fine

Link to comment
Share on other sites

I didn't really understand what you wanted me to do, and I switched somethings around before I noticed your reply (like changing the SG into the kittykit's SG since I wanted him to behave like one of those) and now I'm getting a different error:

Quote

[00:00:41]: [string "scripts/mainfunctions.lua"]:146: Error loading file prefabs/artemis
[string "../mods/Artemis/scripts/prefabs/artemis.lua"]:327: '<name>' expected near '{'
LUA ERROR stack traceback:
        =[C] in function 'assert'
        scripts/mainfunctions.lua(146,1)
        =(tail call) ?
        =[C] in function 'xpcall'
        scripts/mods.lua(158,1)
        scripts/mods.lua(598,1) in function 'RegisterPrefabs'
        scripts/gamelogic.lua(263,1) in function 'LoadAssets'
        scripts/gamelogic.lua(847,1) in function 'cb'
        scripts/saveindex.lua(285,1)
        =[C] in function 'GetPersistentString'
        scripts/saveindex.lua(267,1) in function 'GetSaveDataFile'
    ...
        =[C] in function 'GetPersistentString'
        scripts/saveindex.lua(250,1) in function 'Load'
        scripts/gamelogic.lua(1039,1) in function 'callback'
        scripts/playerprofile.lua(977,1) in function 'Set'
        scripts/playerprofile.lua(838,1)
        =[C] in function 'GetPersistentString'
        scripts/playerprofile.lua(836,1) in function 'Load'
        scripts/gamelogic.lua(1038,1) in main chunk
        =[C] in function 'require'
        scripts/mainfunctions.lua(873,1)   

Here's my latest file:

Artemis.zip

I'm sorry, I really don't understand coding at all orz Thank you for taking the time to reply though ^^

Link to comment
Share on other sites

So, I'll try to be clearer, in the mod you used as base, it has the function "standard_diet" that returns a diet object and is called initializing the prefab.

It was like this on your file

function standard_diet()

return  MakeDonPet("petdonartemis", artemisname, 4, ("walkbounce2"), 1, standard_diet, false, artemisanimzip, artemisconfiganim, artemisanims, {favoritefood="seeds"}),
       MakeDonPetBuilder("petdonartemis")

you see its starting the function "standard_diet" but has no code inside, you could copy this function, so it will return a diet of the pet. If you open the mod you used as base it will have some code between this 2 lines, that should be in your code too.

I'm not home right now, so I can't open the mod you used to check the code and solve it for you, if you still dont get what need to be doing, and you can wait some time, I can fix this for you.

Link to comment
Share on other sites

So, first of all, you added a lot of calls to functions that does'nt exists, so it was throwing errors.

I removed all, and made it work, but, still you didn't declare the sounds of the pet, and yet you were passing the variable that didnt exists, so I removed, but it is soundless as it is now.
Anyway, here is the source of the working one, couldn't test all functions, but it loads without crashing.
Artemis.zip

 

Not sure if it will do everything that you need it to do, but I think it's a start.

Link to comment
Share on other sites

23 hours ago, caioketo said:

Anyway, here is the source of the working one, couldn't test all functions, but it loads without crashing.

Artemis.zip

Thank you! It's finally getting through the load screen ^^

I'm still having a few problems though, would you be able to help me with them?

It works and I can load into the game, but my critter isn't showing up in the crafting tab, so I tried just spawning him on my own to see if that would work and it did.. but he's completely invisible. lol I've made characters before, but I'm just having so many problems with this mod - I tried getting him to show up by recreating the anim zips again, but I guess there's something wrong with the code still..

I looked through everything but nothing stood out to me orz I don't know what's wrong this time

Link to comment
Share on other sites

If its not showing up, probbly the build/bank is incorrect, I'm not really sure since I never changed animations before.

Also, make sure that the animations inside the zip matches the animations you are calling:

local artemisanims = 
{
	idle = "idle", --parado
	hungry = "hit", --fome
	eat = "eat", --comer
	sleep_pre = "sleep_pre", --dormir
	sleep_pst = "sleep_pst", --dormir
	sleep_loop = "sleep_loop", --dormir
	walk_pre = "walk_pre", --andar
	walk_pst = "walk_pst", --andar
	walk_loop = "walk_loop", --andar
	
	emote_pet = "hit", --carinho
	emote_nuzzle = "eat", --carinho 2
	emote_playful = "hit", --brincar
}

There must have "idle", "hit", "eat", etc..

Also you have an "if" before creating recipes, maybe that is not working properly, try removing it to see if it appears on the craft tab.

Link to comment
Share on other sites

I removed the "if" just like you said, but my game just crashed to desktop so I looked around that code a bit more and realized a mistake that I never fixed (I had the code as "petdon" still instead of just artemis.. orz) so now he's showing up in the craft tab, but.. now there's another weird problem lol

Instead of showing the image I made for the craft tab the game is just randomly selecting different items as the preview image.. Like I'll click the critters tab and at first it was a spider egg, and now it's a raincoat ._. idk why that is (and also I tried recreating the anim and build all over again using the kittykit as a base and still Artemis is invisible.)

artemis.thumb.png.e07bfa1c3286e6612d1aaa6a4373423b.png

Link to comment
Share on other sites

A bit of a late reply, but this happened to me as well and the problem was that the atlas (.xml) and image (.tex) asset declarations to the prefab, e.g.:

Asset("ATLAS", "images/inventoryimages/my_pet.xml"), 
Asset("IMAGE", "images/inventoryimages/my_pet.tex"), 

Of course, these files need to be there in your project folder as well, and you need to pass them as arguments in AddRecipe:

AddRecipe(
    "my_pet_builder",    -- Prefab name of the BUILDER (assuming you're basing off of prefabs/critters.lua in the vanilla game), not the pet, otherwise it won't follow you
    {Ingredient("coontail", 1),      Ingredient("fishsticks", 1)},    -- Example ingredients (Kittykit's)
    RECIPETABS.ORPHANAGE, -- Tab
    TECH.ORPHANAGE_ONE, -- Level
    nil, -- Placer
    nil, -- Min spacing
    true, -- No unlock
    nil, -- Num to give
    nil, -- Builder tag
    "images/inventoryimages/my_pet.xml", -- Atlas
    "my_pet.tex") -- Texture (note: no images/inventoryimages/ prefix)

 

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