Modding Help Monster spawned from projectile dies instantly?

Discussion in 'Starbound Modding' started by I Said No, Feb 27, 2015.

  1. I Said No

    I Said No Cosmic Narwhal

    So i've been dabbling in making monsters spawn from thrown items - it all works well and good with the exception that the monster will die instantly as soon as it spawns. I'm really not sure why since there's no errors in my starbound.log.

    Here's the projectile's code:

    {
    "projectileName" : "isn_sludgegolemcore",
    "physics" : "grenadezbomb",
    "bounces" : 0,
    "level" : 3,
    "timeToLive" : 8,
    "frames" : "isn_sludgegolemcore.png",
    "emitters" : [ ],
    "animationCycle" : 0.4,
    "lightColor" : [0, 200, 200],
    "frameNumber" : 8,
    "actionOnReap": [
    {
    "action" : "spawnmonster",
    "type" : "isn_sludgegolem",
    "offset": [ 0, 0 ],
    "arguments" : { }
    }
    ],
    "power" : 0,
    "damageType" : "NoDamage",
    "damageKind" : "default",
    "damagePoly" : [ [-9, 0], [-6, -6], [0, -9], [6, -6], [9, 0], [6, 6], [0, 9], [-6, 6] ]
    }


    And the monster's code:

    {
    "type" : "isn_sludgegolem",

    "categories" : [ "isn_sludgegolem" ],
    "parts" : [ "body" ],

    "animation" : "isn_sludgegolem.animation",
    "colors" : "/monsters/colors.config",
    "reversed" : true,

    "dropPools" : [ ],

    "baseParameters" : {
    "scripts" : [
    "/monsters/ground/groundMonster.lua",
    "/scripts/stateMachine.lua",
    "/scripts/util.lua",
    "/scripts/vec2.lua",

    "/monsters/ground/approachState.lua",
    "/monsters/ground/fleeState.lua",
    "/monsters/ground/wanderState.lua",

    "/monsters/ground/skills/createGroundRangedAttack.lua"
    ],

    "baseSkills" : [ "poopBreathAttack"],
    "specialSkills" : [ ],

    "projectileSourcePosition" : [1.875, 1],

    "attackStartDistance" : 3.5,
    "attackTime" : 0.75,
    "attackCooldownTime" : 0.3,

    "aggressive" : true,
    "damageTeam" : 2,
    "territoryDistance" : 10.0,
    "territorialTargetRadius" : 20.0,
    "minimalTargetRadius" : 6.0,
    "targetSearchTime" : 0.5,
    "targetHoldTime" : 5.0,

    "closeDistance" : 1.5,

    "wanderTime" : [4.0, 6.0],
    "wanderMovementTime" : [2.0, 3.0],

    "jumpTargetDistance" : 6,
    "jumpTime" : [1.4, 2.0],

    "metaBoundBox" : [-1.625, -2.375, 1.75, 2.0],
    "scale" : 1.0,

    "movementSettings" : {
    "collisionPoly" : [ [-1.625, -2.375], [1.75, -2.375], [1.75, 2.0], [-1.625, 2.0] ],

    "mass" : 1.0,
    "walkSpeed" : 5,
    "runSpeed" : 8,
    "jumpSpeed" : 8,
    "flySpeed" : 15,
    "airFriction" : 0.25,
    "airForce" : 50.0
    },

    "bodyMaterialKind" : "organic",

    "knockoutTime" : 1,
    "knockoutEffect" : "blink",
    "deathParticles" : "deathPoof",

    "touchDamage" : {
    "poly" : [ [-1.625, -2.375], [1.75, -2.375], [1.75, 2.0], [-1.625, 2.0] ],
    "damage" : 15,

    "teamType" : "enemy",
    "damageSourceKind" : "lash",
    "statusEffects" : [ ]
    },

    "dropPools" : [ ],

    "statusSettings" : {
    "statusProperties" : {
    "targetMaterialKind" : "organic"
    },

    "appliesEnvironmentStatusEffects" : false,
    "minimumLiquidStatusEffectPercentage" : 0.1,

    "primaryScriptSources" : [
    "/stats/monster_primary.lua"
    ],
    "primaryScriptDelta" : 0,

    "stats" : {
    "maxHealth" : {
    "baseValue" : 100
    },
    "protection" : {
    "baseValue" : 1.0
    },
    "healthRegen" : {
    "baseValue" : 0.01
    }
    },

    "resources" : {
    "health" : {
    "maxStat" : "maxHealth",
    "deltaStat" : "healthRegen",
    "defaultPercentage" : 100
    }
    }
    },

    "mouthOffset" : [0, 0],
    "feetOffset" : [0, -8]
    }
    }



    It's basically the poo golem from the sewer, mostly untouched since i'll make functional/aesthetic changes to it once i've got the actual thing working. I really have no damned idea why the thing just dies instantly though!
     
    RatixFarrence likes this.
  2. I Said No

    I Said No Cosmic Narwhal

    Best Answer
    I figured it out: I didn't set a level on the thrownitem file, so the projectile was Level 0, which caused the golem to spawn at zero health and die. Good lord programming gets so tangled sometimes.
     
    The | Suit likes this.
  3. Naddox

    Naddox Cosmic Narwhal

    Im taking a look at the capturepod lua to see what they did here, when they spawn the monster, the offset is { 0, 2 }, maybe just to be sure the monster doesn't spawn inside a block?

    Have you tried spawning the monster via admin commands to see if it still dies on spawn?
     
  4. I Said No

    I Said No Cosmic Narwhal

    Just tried spawning it via console and it survived. It exhibited some odd behavior though, trying to attack me with totally ineffective projectiles when it was supposed to be friendly to players. It was also totally immortal and had an empty health bar - damaging it did absolutely nothing other than call out the damage numbers like usual. I don't think it HAD any health to drain.
    So now I gotta figure out what it's behavioral problem is in addition to why projectile spawning it is just killing it.
     
  5. I Said No

    I Said No Cosmic Narwhal

    Okay, so I put the offset to be fairly high up in the air and it's still just dying instantly. Weird. Still no errors in the log file.
     
  6. I Said No

    I Said No Cosmic Narwhal

    Ughh... I copied some of the game's assets directly over my own and just switched out the variables to try and get it to survive spawning and the damn thing STILL dies. This wouldn't be nearly as difficult without the fact that my error log isnt showing anything at all.
     
  7. eLe

    eLe Scruffy Nerf-Herder

  8. I Said No

    I Said No Cosmic Narwhal

    Best Answer
    I figured it out: I didn't set a level on the thrownitem file, so the projectile was Level 0, which caused the golem to spawn at zero health and die. Good lord programming gets so tangled sometimes.
     
    The | Suit likes this.
  9. eLe

    eLe Scruffy Nerf-Herder

    Heh yeah it does. :D
     

Share This Page