Jump to content

Add mob problem


Recommended Posts

Hello

I have problem with add mob.

I try add crabbit from Mod More Pets<3 to Shipwrecker Together mod, and i copy and edit doydoy files. When i spawn crab in game and crabbit stay is a invisible , what wrong is file?

Script:

local assets =
{
    --[[Asset("ANIM", "anim/perd_basic.zip"),
    Asset("ANIM", "anim/perd.zip"),]]
    Asset("ANIM", "anim/crabbit.zip"),
    Asset("ANIM", "anim/crabbit_build.zip"),
    
    Asset("SOUNDPACKAGE", "sound/dondoydoysons.fev"),
    Asset("SOUND", "sound/dondoydoysons_bank01.fsb"),
}

local prefabs =
{
    "drumstick",
    "crabbit",
    "crabbit_build",
}

local brain = require "brains/crabbitbrain"

--[[local loot =
{
    "drumstick",
    "drumstick",
}]]

SetSharedLootTable('dondoydoyloot', {{"drumstick", 1.0},{"drumstick", 1.0}, {"dondoydoyegg", 0.8}})

local function ShouldWake()

    return true
end

local function fn()
    local inst = CreateEntity()

    inst.entity:AddTransform()
    inst.entity:AddAnimState()
    inst.entity:AddSoundEmitter()
    inst.entity:AddDynamicShadow()
    inst.entity:AddNetwork()

    MakeCharacterPhysics(inst, 50, .5)

    inst.DynamicShadow:SetSize(1.5, .75)
    inst.Transform:SetFourFaced()

    inst.AnimState:SetBank("crabbit")
    inst.AnimState:SetBuild("crabbit_build")
    inst.AnimState:Hide("crabbit")

    inst:AddTag("character")
    inst:AddTag("berrythief")

    inst.entity:SetPristine()

    if not TheWorld.ismastersim then
        return inst
    end

    inst:AddComponent("locomotor")
    inst.components.locomotor.runspeed = 4
    inst.components.locomotor.walkspeed = 3

    inst:SetStateGraph("SGcrabbit")

    inst:AddComponent("homeseeker")
    inst:SetBrain(brain)

    inst:AddComponent("eater")
    inst.components.eater:SetDiet({ FOODTYPE.VEGGIE }, { FOODTYPE.VEGGIE })
    inst.components.eater:SetCanEatRaw()

    inst:AddComponent("sleeper")
    inst.components.sleeper:SetWakeTest(ShouldWake)

    inst:AddComponent("health")
    inst:AddComponent("combat")
    inst.components.combat.hiteffectsymbol = "pig_torso"

    inst.components.health:SetMaxHealth(TUNING.PERD_HEALTH)
    inst.components.combat:SetDefaultDamage(TUNING.PERD_DAMAGE)
    inst.components.combat:SetAttackPeriod(TUNING.PERD_ATTACK_PERIOD)

    inst:AddComponent("lootdropper")
    --inst.components.lootdropper:SetLoot(loot)
    inst.components.lootdropper:SetChanceLootTable('dondoydoyloot')

    inst:AddComponent("inventory")

    inst:AddComponent("inspectable")

    MakeHauntablePanic(inst)

    MakeMediumBurnableCharacter(inst, "pig_torso")
    MakeMediumFreezableCharacter(inst, "pig_torso")

    return inst
end

STRINGS.CRABBIT = "Crabbit"
STRINGS.NAMES.CRABBIT = "Crabbit"
STRINGS.CHARACTERS.GENERIC.DESCRIBE.CRABBIT = "Crabbit <3"

return Prefab("creature/crabbit", fn, assets, prefabs)

Link to comment
Share on other sites

    --[[Asset("ANIM", "anim/perd_basic.zip"),
    Asset("ANIM", "anim/perd.zip"),]]
    Asset("ANIM", "anim/crabbit.zip"),
    Asset("ANIM", "anim/crabbit_build.zip"),

 

Right here I think is your error. IDK what files you have crabbit called, or more importantly whether perd is something that relates to the crabbit or the doydoy. If perd files are also for the crabbit, then its the double dash at the begining there.

having those double dashes and the two [ symbols causes the computer to ignore all text within the [[ and ]] as a note. This allows the people writing the code to leave notes for themselves telling themself and others things in particular spots. If the perd_basic and perd zips are needed for your mob, your mob will probably appear invisible. I'm kinda learning the code myself, learning what the various functions the game uses do, and anim isn't my strong suit myself, but I think those double dashes and the [[ is your problem.

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