Hello, I'm hitting a strange snag. I updated my "Assorted Crafting Things" mod, and one of the new items was an NPC spawner that summons persistent rabbits that can be captured as pets. Now, this is all fine and dandy, but upon making another pet, the new one spawns dead. http://a.pomf.se/oleywz.zip Here are the files, as made for a friend. They are a carbon copy of the one in my mod, save for filenames. What is wrong? Why do they die upon being summoned? EDIT: Also, feel free to use the assets. I made a template, so everything is ready to make. You just gotta do the art parts and naming changes. Still can't figure out why they die when spawned though.
There's an error in your lua script Code: [07:57:26.680] Error: Exception while invoking lua function 'update'. (LuaException) Error code 2, [string "/monsters/pets/groundPet.lua"]:89: attempt to index field 'behavior' (a nil value) (line 89 of groundPet.lua, you're attempting to use self.behavior which is apparently nil at some point)
Well, if you don't know just replace Code: if self.behavior.reactTo({type = "player", id = playerId, uuid = world.entityUuid(playerId)}) then by Code: if self.behavior ~= nil and self.behavior.reactTo({type = "player", id = playerId, uuid = world.entityUuid(playerId)}) then Problem (kind of) solved: your pet will survive, but if self.behavior is never set you may notice that your pet doesn't do what you want. Edit: i feel like this code is obsolete btw (not sure)
Yeah, it just turns them into persistent npcs. It's a nice thing, and I'll definitely utilize that later on, but unfortunately that's not gonna cut it for what I'm trying to do now.[DOUBLEPOST=1422602705][/DOUBLEPOST]Oh, I should probably mention that I have the original pet (bunny) and the example pet in the same folder, so they're both referencing the same files. Putting each monster in a separate folder with separate instances of the files (such as groundpet.lua) just makes both monsters die on spawning, but if they use the same files, only the bunny works. Should I change the folder layout? If so, what should I do? I've tried a few different folder layouts, but no luck.