Ok devs need some help here


#1

Edited: What makes an animal want to attack me, these entities will be attacked,and defend themselves but wont attack me, also they don’t seem to help their allies much, is the sensor value to low I think? @sdee here is the mixin for the entity I want to attack:

{
   “type” : “entity”,
   “mixins” : “stonehearth:mixins:mob”,
   “components”: {
      “unit_info” : {
        “faction”: “goblin”,
        “kingdom”:“stonehearth:kingdoms:golden_conquering_arm”
      },
      “stonehearth:ai” : {
         “actions” : [
            “stonehearth:actions:combat”,
            “stonehearth:actions:combat:attack_dispatcher”,
            “stonehearth:actions:combat:attack:melee”,
            “stonehearth:actions:combat:attack:melee_adjacent”,
            “stonehearth:actions:combat:defend_dispatcher”,
            “stonehearth:actions:combat:defend:melee”,
            “stonehearth:actions:combat:idle_dispatcher”,
            “stonehearth:actions:combat:idle:ready”,
            “stonehearth:actions:combat:idle:shuffle”,
            “stonehearth:actions:combat:panic_dispatcher”,
            “stonehearth:actions:combat:panic_watcher”,
            “stonehearth:actions:combat:stop_panicking”,
            “stonehearth:actions:combat:hit_stun”,
            “stonehearth:actions:combat:find_target”,
            “stonehearth:actions:combat:create_engage_callback”,
            “stonehearth:actions:combat:get_melee_range”,
            “stonehearth:actions:combat:set_global_attack_cooldown”,
            “stonehearth:actions:combat:wait_for_global_attack_cooldown”,
            “stonehearth:actions:idle:look_around”,
            “stonehearth:actions:wander”,
            “stonehearth:actions:wander_within_leash”,
            “stonehearth:actions:wander_when_bored”,
            “stonehearth:actions:choose_point_around_leash”,
            “stonehearth:actions:set_posture”,
            “stonehearth:actions:unset_posture”
         ],
     “observers”: [
          “stonehearth:observers:ally_defense”,
          “stonehearth:observers:enemy_observer”
         ]
       },
      “stonehearth:posture”: [
         “stonehearth:combat”
      ],
      “sensor_list”: {
         “sensors”: {
            “sight”: {
               “type”: “sensor”,
               “radius”: 64
            }
         }
      },
     “entity_data” : {
      “stonehearth:combat:weapon_data” : {
         “base_damage” : 5,
         “reach” : 1.5
      },
      “stonehearth:entity_radius” : 0.75,
      “stonehearth:entity_reach” : 1.0,
      “stonehearth:combat:melee_attacks” : [
         {
            “name” : “combat_1h_forehand_spin”,
            “active_frame” : 21,
            “cooldown” : 8000,
            “priority” : 1
         }      
      ],
      “stonehearth:combat:melee_defenses” : [
         {
            “name” : “combat_1h_dodge”,
            “active_frame” : 8,
            “cooldown” : 8000,
            “priority” : 1
         }
      ]
      },
      “stonehearth:attributes”: {
         “max_health”: {
            “type” : “basic”,
            “value” : 50
         },
         “health”: {
            “type” : “variable”,
            “equation” : “max_health”
         },
         “speed” : {
            “type” : “basic”,
            “value”: 50
         },
          “calories”: {
            “type” : “basic”,
            “value” : 30
         },
         “sleepiness”: {
            “type” : “basic”,
            “value” : 0
         },
        “ferocity”: {
            “type” : “basic”,
            “value” :  100
         }
      }
   }
}


#2

I would have guessed

:confused:


#3

I talked to @Albert and it looks like hostility is determined by faction. How the person acts when they’re spawned is determined by their combat stance, which is currently via lua code:

For example, assuming that self._sv._goblin is a reference to the goblin entity, you can call:

 stonehearth.combat:set_stance(self._sv._goblin, 'defensive')

And this causes the goblin to defend himself if people attack him.
A good entrypoint for this code might be in a lua component you create and add to the goblin via a mixin. :slight_smile:


#4

Thanks @sdee and @Albert thought it might be something like that. I can live with passive until swordsmen entities for now as it better balances what I am working on but soon, very soon…


#5

Annnd @albert just reminded me that that line of code isn’t valid in the steam unstable build yet anyway! So it’s like we’re on the same page. :slight_smile: