Item Drop System

  • Официальное уведомление администрации CustomGames.RU
    В связи с масштабным техническим сбоем в инфраструктуре прежнего хостинг-провайдера (Beget), работа форума CustomGames.RU была оперативно перенесена на новую серверную площадку и развёрнута из резервной копии базы данных.

    • Безопасность данных: учётные записи и данные пользователей находятся в полной безопасности. Все пароли и защищаемые параметры хранятся исключительно в криптографически зашифрованном (хэшированном) виде — никаких критических инцидентов для аккаунтов пользователей не произошло.
    • Временные технические ограничения: на этапе синхронизации файлового хранилища часть статических материалов (пользовательские аватары и архивные вложения) временно недоступна. По мере получения доступа к файловым архивам все материалы будут восстановлены в полном объёме.

den4iccc

Друзья CG
20 Сен 2014
440
1
Проект
Survival in Taiga XE
https://moddota.com/forums/discussion/257/item-drop-system
Помогите разобраться со статьёй. создал файл item_drops.kv туда закинул код файл отправил в scripts/kv/item_drops.kv всё сделал по гайду но неполучается вот код
Код:
"Drops"
{
  ////////////////////////////////
  // ItemDrops UI Configuration //
  ////////////////////////////////
  "MaxTime"    "60"
  "MaxDropsOnScreen" "3"

  "ItemQualityColors"
  {
    "artifact" "#FFA500" //Orange
    "epic"   "#8847FF" //Purple
    "rare"   "#4B69FF" //Blue
    "common"  "#00FF00" //Lime Green
    "component" "#FFFFFF" //White
    "consumable" "#FFFFFF" //White
  }

  // Don't fire the item_drop event for these
  "ExcludedQualities"
  {
    "consumable" "1"
    "component" "1"
  }

  //////////////////////////////
  // Roll Drops Configuration //
  //////////////////////////////

  //===============================================
  // Titans
  //===============================================

  "Avatar_of_Earth"
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_boots_of_agility_16"
        "2" "item_cloak_of_flames_25"
        "3" "item_gauntlets_of_might_16"
        "4" "item_orb_of_mana"
        "5" "item_life_gem"
        "6" "item_firehand_gauntlets_20"
        "7" "item_robes_of_enlightenment_16"
      }
      "Chance"  "100"
    }
  }
  "Avatar_of_Nature"
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_boots_of_agility_16"
        "2" "item_heros_blade"
        "3" "item_gauntlets_of_might_16"
        "4" "item_orb_of_mana"
        "5" "item_ring_of_spell_power"
        "6" "item_heros_hauberk"
        "7" "item_robes_of_enlightenment_16"
        "8" "item_ring_of_healing_power"
      }
      "Chance"  "100"
    }
  }
  "Avatar_of_Justice"
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_boots_of_agility_16"
        "2" "item_cloak_of_flames_25"
        "3" "item_gauntlets_of_might_16"
        "4" "item_orb_of_mana"
        "5" "item_life_gem"
        "6" "item_firehand_gauntlets_20"
        "7" "item_robes_of_enlightenment_16"
      }
      "Chance"  "100"
    }
  }
  "Avatar_of_Death"
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_tbr_ring_of_health"
        "3" "item_pendant_of_energy"
      }
      "Chance"  "100"
    }
  }
  "Avatar_of_the_Sky"
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_tbr_ring_of_health"
        "3" "item_pendant_of_energy"
      }
      "Chance"  "100"
    }
  }
  "Avatar_of_Sacrifice"
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_tbr_ring_of_health"
        "3" "item_pendant_of_energy"
      }
      "Chance"  "100"
    }
  }
  "Avatar_of_the_Sea"
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_tbr_ring_of_health"
        "3" "item_pendant_of_energy"
      }
      "Chance"  "100"
    }
  }
  "Mother_of_Earth"
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_tbr_ring_of_health"
        "3" "item_pendant_of_energy"
      }
      "Chance"  "100"
    }
  }




  //===============================================
  // Demon Area
  //===============================================

	"npc_demon_imp"   // noob tier
  { 
    "1"
    {
      "Item"   "item_potion_of_minor_healing"
      "Chance"  "10"
    }
    "2"
    {
      "Item"   "item_gold_bag_100"
      "Chance"  "10"
    }
    "3"
    {
      "ItemSets"
      {
        "1" "item_talisman_of_health"
        "2" "item_ring_of_regeneration"
        "3" "item_apprentice_robes"
        "4" "item_hard_leather_armor"
        "5" "item_ring_mail"
      }
      "Chance"  "3"
    }
  }

  "npc_demon_hound"  // noob tier
  { 
    "1"
    {
      "Item"   "item_potion_of_minor_healing"
      "Chance"  "10"
    }
    "2"
    {
      "Item"   "item_potion_of_minor_healing"
      "Chance"  "10"
    }
    "3"
    {
      "Item"   "item_gold_bag_100"
      "Chance"  "10"
    }
    "4"
    {
      "ItemSets"
      {
        "1" "item_talisman_of_health"
        "2" "item_ring_of_regeneration"
        "3" "item_apprentice_robes"
        "4" "item_hard_leather_armor"
        "5" "item_ring_mail"
      }
      "Chance"  "8"
    }
  }

  "npc_demon_fire"  // noob tier
  { 
    "1"
    {
      "Item"   "item_potion_of_minor_healing"
      "Chance"  "10"
    }
    "2"
    {
      "Item"   "item_potion_of_minor_healing"
      "Chance"  "10"
    }
    "3"
    {
      "Item"   "item_gold_bag_100"
      "Chance"  "10"
    }
    "4"
    {
      "ItemSets"
      {
        "1" "item_talisman_of_health"
        "2" "item_ring_of_regeneration"
        "3" "item_apprentice_robes"
        "4" "item_hard_leather_armor"
        "5" "item_ring_mail"
      }
      "Chance"  "5"
    }
  }

  "npc_forest_bear"  // tier 1
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_boots_of_agility_8"
        "3" "item_tbr_broadsword"
        "4" "item_tbr_circlet_of_nobility"
        "5" "item_cloak_of_flames_25"
        "6" "item_firehand_gauntlets_20"
        "7" "item_gauntlets_of_might_8"
        "8" "item_mail_shirt"
        "9" "item_pendant_of_energy" // This item doesn't exist, needs to be made
        "10" "item_ring_of_dodging"
        //"11" "item_ring_of_health" // This item doesn't exist, needs to be made
        "12" "item_ring_of_vigor"
        "13" "item_robes_of_enlightenment_8"
        "14" "item_wand_of_healing_power" 
        "15" "item_wand_of_spell_power"
      }
      "Chance"  "5" //of dropping 1 of the set
    }
    "2"
    {
      "ItemSets"
      {
        "1" "item_potion_of_lesser_healing"
        "2" "item_potion_of_lesser_mana"
      }
      "Chance"  "10" //of dropping 1 of the set
    }
  }

  "npc_nukacha"
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_tbr_ring_of_health"
        "3" "item_pendant_of_energy"
        //"4" "item_goldbag" // It spawns between 1 to 6 Gold Bags of 50 gold each
      }
      "Chance"  "100"
    }
  }

  //===============================================
  // Goblin Area
  //===============================================

  "npc_goblin"    // tier 1
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_boots_of_agility_8"
        "3" "item_tbr_broadsword"
        "4" "item_tbr_circlet_of_nobility"
        "5" "item_cloak_of_flames_25"
        "6" "item_firehand_gauntlets_20"
        "7" "item_gauntlets_of_might_8"
        "8" "item_mail_shirt"
        "9" "item_pendant_of_energy" // This item doesn't exist, needs to be made
        "10" "item_ring_of_dodging"
        //"11" "item_ring_of_health" // This item doesn't exist, needs to be made
        "12" "item_ring_of_vigor"
        "13" "item_robes_of_enlightenment_8"
        "14" "item_wand_of_healing_power" 
        "15" "item_wand_of_spell_power"
      }
      "Chance"  "5" //of dropping 1 of the set
    }
    "2"
    {
      "ItemSets"
      {
        "1" "item_potion_of_lesser_healing"
        "2" "item_potion_of_lesser_mana"
      }
      "Chance"  "10" //of dropping 1 of the set
    }
  }
    
  "npc_shaman"    // tier 1
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_boots_of_agility_8"
        "3" "item_tbr_broadsword"
        "4" "item_tbr_circlet_of_nobility"
        "5" "item_cloak_of_flames_25"
        "6" "item_firehand_gauntlets_20"
        "7" "item_gauntlets_of_might_8"
        "8" "item_mail_shirt"
        "9" "item_pendant_of_energy" // This item doesn't exist, needs to be made
        "10" "item_ring_of_dodging"
        //"11" "item_ring_of_health" // This item doesn't exist, needs to be made
        "12" "item_ring_of_vigor"
        "13" "item_robes_of_enlightenment_8"
        "14" "item_wand_of_healing_power" 
        "15" "item_wand_of_spell_power"
      }
      "Chance"  "5" //of dropping 1 of the set
    }
    "2"
    {
      "ItemSets"
      {
        "1" "item_potion_of_lesser_healing"
        "2" "item_potion_of_lesser_mana"
      }
      "Chance"  "10" //of dropping 1 of the set
    }
  }
  //===============================================
  // Black Goblin Area
  //===============================================

  "npc_black_goblin" // tier 1
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_boots_of_agility_8"
        "3" "item_tbr_broadsword"
        "4" "item_tbr_circlet_of_nobility"
        "5" "item_cloak_of_flames_25"
        "6" "item_firehand_gauntlets_20"
        "7" "item_gauntlets_of_might_8"
        "8" "item_mail_shirt"
        "9" "item_pendant_of_energy" // This item doesn't exist, needs to be made
        "10" "item_ring_of_dodging"
        //"11" "item_ring_of_health" // This item doesn't exist, needs to be made
        "12" "item_ring_of_vigor"
        "13" "item_robes_of_enlightenment_8"
        "14" "item_wand_of_healing_power" 
        "15" "item_wand_of_spell_power"
      }
      "Chance"  "5" //of dropping 1 of the set
    }
    "2"
    {
      "ItemSets"
      {
        "1" "item_potion_of_lesser_healing"
        "2" "item_potion_of_lesser_mana"
      }
      "Chance"  "10" //of dropping 1 of the set
    }
  }
    
  "npc_black_shaman" // tier 1
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_boots_of_agility_8"
        "3" "item_tbr_broadsword"
        "4" "item_tbr_circlet_of_nobility"
        "5" "item_cloak_of_flames_25"
        "6" "item_firehand_gauntlets_20"
        "7" "item_gauntlets_of_might_8"
        "8" "item_mail_shirt"
        "9" "item_pendant_of_energy" // This item doesn't exist, needs to be made
        "10" "item_ring_of_dodging"
        //"11" "item_ring_of_health" // This item doesn't exist, needs to be made
        "12" "item_ring_of_vigor"
        "13" "item_robes_of_enlightenment_8"
        "14" "item_wand_of_healing_power" 
        "15" "item_wand_of_spell_power"
      }
      "Chance"  "5" //of dropping 1 of the set
    }
    "2"
    {
      "ItemSets"
      {
        "1" "item_potion_of_lesser_healing"
        "2" "item_potion_of_lesser_mana"
      }
      "Chance"  "10" //of dropping 1 of the set
    }
  }
 
Последнее редактирование модератором:
Код:
"npc_ogre"     // tier 1
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_boots_of_agility_8"
        "3" "item_tbr_broadsword"
        "4" "item_tbr_circlet_of_nobility"
        "5" "item_cloak_of_flames_25"
        "6" "item_firehand_gauntlets_20"
        "7" "item_gauntlets_of_might_8"
        "8" "item_mail_shirt"
        "9" "item_pendant_of_energy" // This item doesn't exist, needs to be made
        "10" "item_ring_of_dodging"
        //"11" "item_ring_of_health" // This item doesn't exist, needs to be made
        "12" "item_ring_of_vigor"
        "13" "item_robes_of_enlightenment_8"
        "14" "item_wand_of_healing_power" 
        "15" "item_wand_of_spell_power"
      }
      "Chance"  "5" //of dropping 1 of the set
    }
    "2"
    {
      "ItemSets"
      {
        "1" "item_potion_of_lesser_healing"
        "2" "item_potion_of_lesser_mana"
      }
      "Chance"  "10" //of dropping 1 of the set
    }
  }

  "npc_rokthul"
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_boots_of_agility_8"
        "2" "item_medallion_of_stamina"
        "3" "item_pendant_of_mana"
        "4" "item_gauntlets_of_might_8"
        "5" "item_robes_of_enlightenment_8"
        "6" "item_tbr_circlet_of_nobility"
      }
      "Chance"  "100"
    }
  }
  //===============================================
  // Bandit Area
  //===============================================

  "npc_bandit"    // tier 1
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_boots_of_agility_8"
        "3" "item_tbr_broadsword"
        "4" "item_tbr_circlet_of_nobility"
        "5" "item_cloak_of_flames_25"
        "6" "item_firehand_gauntlets_20"
        "7" "item_gauntlets_of_might_8"
        "8" "item_mail_shirt"
        "9" "item_pendant_of_energy" // This item doesn't exist, needs to be made
        "10" "item_ring_of_dodging"
        //"11" "item_ring_of_health" // This item doesn't exist, needs to be made
        "12" "item_ring_of_vigor"
        "13" "item_robes_of_enlightenment_8"
        "14" "item_wand_of_healing_power" 
        "15" "item_wand_of_spell_power"
      }
      "Chance"  "5" //of dropping 1 of the set
    }
    "2"
    {
      "ItemSets"
      {
        "1" "item_potion_of_lesser_healing"
        "2" "item_potion_of_lesser_mana"
      }
      "Chance"  "10" //of dropping 1 of the set
    }
  }

  "npc_mance_swiftsword"
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_pendant_of_energy"
        "2" "item_tbr_ring_of_health"
        "3" "item_orb_of_unending_life"
        "4" "item_ring_of_vigor"
        //"5" "item_goldbag" // drops between 1 to 12 goldbags of 50 gold each
      }
      "Chance"  "100"
    }
  }
  //===============================================
  // Spider Area
  //===============================================

  "npc_forest_spider" // tier 1
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_boots_of_agility_8"
        "3" "item_tbr_broadsword"
        "4" "item_tbr_circlet_of_nobility"
        "5" "item_cloak_of_flames_25"
        "6" "item_firehand_gauntlets_20"
        "7" "item_gauntlets_of_might_8"
        "8" "item_mail_shirt"
        "9" "item_pendant_of_energy" // This item doesn't exist, needs to be made
        "10" "item_ring_of_dodging"
        //"11" "item_ring_of_health" // This item doesn't exist, needs to be made
        "12" "item_ring_of_vigor"
        "13" "item_robes_of_enlightenment_8"
        "14" "item_wand_of_healing_power" 
        "15" "item_wand_of_spell_power"
      }
      "Chance"  "5" //of dropping 1 of the set
    }
    "2"
    {
      "ItemSets"
      {
        "1" "item_potion_of_lesser_healing"
        "2" "item_potion_of_lesser_mana"
      }
      "Chance"  "10" //of dropping 1 of the set
    }
  }

  "npc_forest_lurker" // tier 2
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_boots_of_agility_8"
        "3" "item_tbr_broadsword"
        "4" "item_tbr_circlet_of_nobility"
        "5" "item_cloak_of_flames_25"
        "6" "item_firehand_gauntlets_20"
        "7" "item_gauntlets_of_might_8"
        "8" "item_mail_shirt"
        "9" "item_pendant_of_energy" // This item doesn't exist, needs to be made
        "10" "item_ring_of_dodging"
        //"11" "item_ring_of_health" // This item doesn't exist, needs to be made
        "12" "item_ring_of_vigor"
        "13" "item_robes_of_enlightenment_8"
        "14" "item_wand_of_healing_power" 
        "15" "item_wand_of_spell_power"
      }
      "Chance"  "5" //of dropping 1 of the set
    }
    "2"
    {
      "ItemSets"
      {
        "1" "item_potion_of_lesser_healing"
        "2" "item_potion_of_lesser_mana"
      }
      "Chance"  "10" //of dropping 1 of the set
    }
  }

  "npc_giant_spider" // tier 2
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_boots_of_agility_8"
        "3" "item_tbr_broadsword"
        "4" "item_tbr_circlet_of_nobility"
        "5" "item_cloak_of_flames_25"
        "6" "item_firehand_gauntlets_20"
        "7" "item_gauntlets_of_might_8"
        "8" "item_mail_shirt"
        "9" "item_pendant_of_energy" // This item doesn't exist, needs to be made
        "10" "item_ring_of_dodging"
        //"11" "item_ring_of_health" // This item doesn't exist, needs to be made
        "12" "item_ring_of_vigor"
        "13" "item_robes_of_enlightenment_8"
        "14" "item_wand_of_healing_power" 
        "15" "item_wand_of_spell_power"
      }
      "Chance"  "5" //of dropping 1 of the set
    }
    "2"
    {
      "ItemSets"
      {
        "1" "item_potion_of_lesser_healing"
        "2" "item_potion_of_lesser_mana"
      }
      "Chance"  "10" //of dropping 1 of the set
    }
  }

  "npc_forest_terror"
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_boots_of_agility_8"
        "2" "item_tbr_broadsword"
        "3" "item_mail_shirt"
        "4" "item_gauntlets_of_might_8"
        "5" "item_robes_of_enlightenment_8"
        "6" "item_wand_of_healing_power"
        "7" "item_wand_of_spell_power"
      }
      "Chance"  "100"
    }
  }
  //===============================================
  // Sea Servant Area
  //===============================================

  "npc_sea_servant_huntsman" // tier 1
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_boots_of_agility_8"
        "3" "item_tbr_broadsword"
        "4" "item_tbr_circlet_of_nobility"
        "5" "item_cloak_of_flames_25"
        "6" "item_firehand_gauntlets_20"
        "7" "item_gauntlets_of_might_8"
        "8" "item_mail_shirt"
        "9" "item_pendant_of_energy" // This item doesn't exist, needs to be made
        "10" "item_ring_of_dodging"
        //"11" "item_ring_of_health" // This item doesn't exist, needs to be made
        "12" "item_ring_of_vigor"
        "13" "item_robes_of_enlightenment_8"
        "14" "item_wand_of_healing_power" 
        "15" "item_wand_of_spell_power"
      }
      "Chance"  "5" //of dropping 1 of the set
    }
    "2"
    {
      "ItemSets"
      {
        "1" "item_potion_of_lesser_healing"
        "2" "item_potion_of_lesser_mana"
      }
      "Chance"  "10" //of dropping 1 of the set
    }
  }
  "npc_sea_servant_wavecaller"  // tier 2
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_boots_of_agility_8"
        "3" "item_tbr_broadsword"
        "4" "item_tbr_circlet_of_nobility"
        "5" "item_cloak_of_flames_25"
        "6" "item_firehand_gauntlets_20"
        "7" "item_gauntlets_of_might_8"
        "8" "item_mail_shirt"
        "9" "item_pendant_of_energy" // This item doesn't exist, needs to be made
        "10" "item_ring_of_dodging"
        //"11" "item_ring_of_health" // This item doesn't exist, needs to be made
        "12" "item_ring_of_vigor"
        "13" "item_robes_of_enlightenment_8"
        "14" "item_wand_of_healing_power" 
        "15" "item_wand_of_spell_power"
      }
      "Chance"  "5" //of dropping 1 of the set
    }
    "2"
    {
      "ItemSets"
      {
        "1" "item_potion_of_lesser_healing"
        "2" "item_potion_of_lesser_mana"
      }
      "Chance"  "10" //of dropping 1 of the set
    }
  }

  //===============================================
  // Mountain Wolf Area
  //===============================================

  "npc_mountain_wolf"
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_boots_of_agility_8"
        "3" "item_tbr_broadsword"
        "4" "item_tbr_circlet_of_nobility"
        "5" "item_cloak_of_flames_25"
        "6" "item_firehand_gauntlets_20"
        "7" "item_gauntlets_of_might_8"
        "8" "item_mail_shirt"
        "9" "item_pendant_of_energy" // This item doesn't exist, needs to be made
        "10" "item_ring_of_dodging"
        //"11" "item_ring_of_health" // This item doesn't exist, needs to be made
        "12" "item_ring_of_vigor"
        "13" "item_robes_of_enlightenment_8"
        "14" "item_wand_of_healing_power" 
        "15" "item_wand_of_spell_power"
      }
      "Chance"  "5" //of dropping 1 of the set
    }
    "2"
    {
      "ItemSets"
      {
        "1" "item_potion_of_lesser_healing"
        "2" "item_potion_of_lesser_mana"
      }
      "Chance"  "10" //of dropping 1 of the set
    }
  }

  //===============================================
  // Minotaur Area
  //===============================================

  "npc_minotaur_grunt"  // tier 1
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_boots_of_agility_8"
        "3" "item_tbr_broadsword"
        "4" "item_tbr_circlet_of_nobility"
        "5" "item_cloak_of_flames_25"
        "6" "item_firehand_gauntlets_20"
        "7" "item_gauntlets_of_might_8"
        "8" "item_mail_shirt"
        "9" "item_pendant_of_energy" // This item doesn't exist, needs to be made
        "10" "item_ring_of_dodging"
        //"11" "item_ring_of_health" // This item doesn't exist, needs to be made
        "12" "item_ring_of_vigor"
        "13" "item_robes_of_enlightenment_8"
        "14" "item_wand_of_healing_power" 
        "15" "item_wand_of_spell_power"
      }
      "Chance"  "5" //of dropping 1 of the set
    }
    "2"
    {
      "ItemSets"
      {
        "1" "item_potion_of_lesser_healing"
        "2" "item_potion_of_lesser_mana"
      }
      "Chance"  "10" //of dropping 1 of the set
    }
  }

  "npc_minotaur_warlock" // tier 2
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_boots_of_agility_8"
        "3" "item_tbr_broadsword"
        "4" "item_tbr_circlet_of_nobility"
        "5" "item_cloak_of_flames_25"
        "6" "item_firehand_gauntlets_20"
        "7" "item_gauntlets_of_might_8"
        "8" "item_mail_shirt"
        "9" "item_pendant_of_energy" // This item doesn't exist, needs to be made
        "10" "item_ring_of_dodging"
        //"11" "item_ring_of_health" // This item doesn't exist, needs to be made
        "12" "item_ring_of_vigor"
        "13" "item_robes_of_enlightenment_8"
        "14" "item_wand_of_healing_power" 
        "15" "item_wand_of_spell_power"
      }
      "Chance"  "5" //of dropping 1 of the set
    }
    "2"
    {
      "ItemSets"
      {
        "1" "item_potion_of_lesser_healing"
        "2" "item_potion_of_lesser_mana"
      }
      "Chance"  "10" //of dropping 1 of the set
    }
  }

  "npc_minotaur_beastman" // tier 2
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_boots_of_agility_8"
        "3" "item_tbr_broadsword"
        "4" "item_tbr_circlet_of_nobility"
        "5" "item_cloak_of_flames_25"
        "6" "item_firehand_gauntlets_20"
        "7" "item_gauntlets_of_might_8"
        "8" "item_mail_shirt"
        "9" "item_pendant_of_energy" // This item doesn't exist, needs to be made
        "10" "item_ring_of_dodging"
        //"11" "item_ring_of_health" // This item doesn't exist, needs to be made
        "12" "item_ring_of_vigor"
        "13" "item_robes_of_enlightenment_8"
        "14" "item_wand_of_healing_power" 
        "15" "item_wand_of_spell_power"
      }
      "Chance"  "5" //of dropping 1 of the set
    }
    "2"
    {
      "ItemSets"
      {
        "1" "item_potion_of_lesser_healing"
        "2" "item_potion_of_lesser_mana"
      }
      "Chance"  "10" //of dropping 1 of the set
    }
  }
 
Последнее редактирование модератором:
Код:
  "npc_giant_of_the_seas" // tier 2 or 3 (its lvl 29)
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_boots_of_agility_8"
        "3" "item_tbr_broadsword"
        "4" "item_tbr_circlet_of_nobility"
        "5" "item_cloak_of_flames_25"
        "6" "item_firehand_gauntlets_20"
        "7" "item_gauntlets_of_might_8"
        "8" "item_mail_shirt"
        "9" "item_pendant_of_energy" // This item doesn't exist, needs to be made
        "10" "item_ring_of_dodging"
        //"11" "item_ring_of_health" // This item doesn't exist, needs to be made
        "12" "item_ring_of_vigor"
        "13" "item_robes_of_enlightenment_8"
        "14" "item_wand_of_healing_power" 
        "15" "item_wand_of_spell_power"
      }
      "Chance"  "5" //of dropping 1 of the set
    }
    "2"
    {
      "ItemSets"
      {
        "1" "item_potion_of_lesser_healing"
        "2" "item_potion_of_lesser_mana"
      }
      "Chance"  "10" //of dropping 1 of the set
    }
  }
  //===============================================
  // Area
  //===============================================

  "npc_bandit"
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_boots_of_agility_8"
        "3" "item_tbr_broadsword"
        "4" "item_tbr_circlet_of_nobility"
        "5" "item_cloak_of_flames_25"
        "6" "item_firehand_gauntlets_20"
        "7" "item_gauntlets_of_might_8"
        "8" "item_mail_shirt"
        "9" "item_pendant_of_energy" // This item doesn't exist, needs to be made
        "10" "item_ring_of_dodging"
        //"11" "item_ring_of_health" // This item doesn't exist, needs to be made
        "12" "item_ring_of_vigor"
        "13" "item_robes_of_enlightenment_8"
        "14" "item_wand_of_healing_power" 
        "15" "item_wand_of_spell_power"
      }
      "Chance"  "5" //of dropping 1 of the set
    }
    "2"
    {
      "ItemSets"
      {
        "1" "item_potion_of_lesser_healing"
        "2" "item_potion_of_lesser_mana"
      }
      "Chance"  "10" //of dropping 1 of the set
    }
  }

  "npc_bandit"
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_boots_of_agility_8"
        "3" "item_tbr_broadsword"
        "4" "item_tbr_circlet_of_nobility"
        "5" "item_cloak_of_flames_25"
        "6" "item_firehand_gauntlets_20"
        "7" "item_gauntlets_of_might_8"
        "8" "item_mail_shirt"
        "9" "item_pendant_of_energy" // This item doesn't exist, needs to be made
        "10" "item_ring_of_dodging"
        //"11" "item_ring_of_health" // This item doesn't exist, needs to be made
        "12" "item_ring_of_vigor"
        "13" "item_robes_of_enlightenment_8"
        "14" "item_wand_of_healing_power" 
        "15" "item_wand_of_spell_power"
      }
      "Chance"  "5" //of dropping 1 of the set
    }
    "2"
    {
      "ItemSets"
      {
        "1" "item_potion_of_lesser_healing"
        "2" "item_potion_of_lesser_mana"
      }
      "Chance"  "10" //of dropping 1 of the set
    }
  }

  "npc_bandit"
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_boots_of_agility_8"
        "3" "item_tbr_broadsword"
        "4" "item_tbr_circlet_of_nobility"
        "5" "item_cloak_of_flames_25"
        "6" "item_firehand_gauntlets_20"
        "7" "item_gauntlets_of_might_8"
        "8" "item_mail_shirt"
        "9" "item_pendant_of_energy" // This item doesn't exist, needs to be made
        "10" "item_ring_of_dodging"
        //"11" "item_ring_of_health" // This item doesn't exist, needs to be made
        "12" "item_ring_of_vigor"
        "13" "item_robes_of_enlightenment_8"
        "14" "item_wand_of_healing_power" 
        "15" "item_wand_of_spell_power"
      }
      "Chance"  "5" //of dropping 1 of the set
    }
    "2"
    {
      "ItemSets"
      {
        "1" "item_potion_of_lesser_healing"
        "2" "item_potion_of_lesser_mana"
      }
      "Chance"  "10" //of dropping 1 of the set
    }
  }

  "npc_bandit"
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_boots_of_agility_8"
        "3" "item_tbr_broadsword"
        "4" "item_tbr_circlet_of_nobility"
        "5" "item_cloak_of_flames_25"
        "6" "item_firehand_gauntlets_20"
        "7" "item_gauntlets_of_might_8"
        "8" "item_mail_shirt"
        "9" "item_pendant_of_energy" // This item doesn't exist, needs to be made
        "10" "item_ring_of_dodging"
        //"11" "item_ring_of_health" // This item doesn't exist, needs to be made
        "12" "item_ring_of_vigor"
        "13" "item_robes_of_enlightenment_8"
        "14" "item_wand_of_healing_power" 
        "15" "item_wand_of_spell_power"
      }
      "Chance"  "5" //of dropping 1 of the set
    }
    "2"
    {
      "ItemSets"
      {
        "1" "item_potion_of_lesser_healing"
        "2" "item_potion_of_lesser_mana"
      }
      "Chance"  "10" //of dropping 1 of the set
    }
  }

  "npc_bandit"
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_boots_of_agility_8"
        "3" "item_tbr_broadsword"
        "4" "item_tbr_circlet_of_nobility"
        "5" "item_cloak_of_flames_25"
        "6" "item_firehand_gauntlets_20"
        "7" "item_gauntlets_of_might_8"
        "8" "item_mail_shirt"
        "9" "item_pendant_of_energy" // This item doesn't exist, needs to be made
        "10" "item_ring_of_dodging"
        //"11" "item_ring_of_health" // This item doesn't exist, needs to be made
        "12" "item_ring_of_vigor"
        "13" "item_robes_of_enlightenment_8"
        "14" "item_wand_of_healing_power" 
        "15" "item_wand_of_spell_power"
      }
      "Chance"  "5" //of dropping 1 of the set
    }
    "2"
    {
      "ItemSets"
      {
        "1" "item_potion_of_lesser_healing"
        "2" "item_potion_of_lesser_mana"
      }
      "Chance"  "10" //of dropping 1 of the set
    }
  }

    
  
}
 
Последнее редактирование модератором:
Код addon_game_mode.lua в студию, ну или где там прописан ListenToGameEvent('entity_killed') - то и скидывай.
 
это наверно тупо что я 2 кода вставил в addon_game_mode
Код:
 require('buildinghelper')
require('good')

function Precache( context )
	--[[
		Precache things we know we'll use. Possible file types include (but not limited to):
			PrecacheResource( "model", "*.vmdl", context )
			PrecacheResource( "soundfile", "*.vsndevts", context )
			PrecacheResource( "particle", "*.vpcf", context )
			PrecacheResource( "particle_folder", "particles/folder", context )
	]]
PrecacheResource( "model", "models/props_debris/barrel002.mdl", context )
PrecacheResource( "model", "models/props_stone/stoneblock002a.mdl", context )
PrecacheUnitByNameSync("npc_dota_hero_pudge", context)
PrecacheUnitByNameSync("npc_dota_hero_omniknight", context)
PrecacheUnitByNameSync("npc_dota_hero_naga_siren", context)
PrecacheUnitByNameSync("npc_dota_hero_slardar", context)
PrecacheUnitByNameSync("npc_dota_hero_furion", context)
PrecacheUnitByNameSync("npc_dota_hero_zuus", context)
PrecacheUnitByNameSync("npc_dota_hero_Brewmaster", context)
PrecacheUnitByNameSync("npc_dota_hero_bounty_hunter", context)
PrecacheUnitByNameSync("npc_dota_hero_lion", context)
PrecacheResource( "model", "models/guildhall/guildhall.vmdl", context )
PrecacheResource( "model", "models/medievalshopb/medievalshopb.vmdl", context )			
PrecacheResource( "model", "models/medievlshopa/medievlshopa.vmdl", context )
PrecacheResource( "model", "models/shopfrontt/shopfrontt.vmdl", context )
PrecacheResource( "model", "models/towngate/towngate.vmdl", context )
PrecacheResource( "model", "models/townhouseaa/townhouseaa.vmdl", context )
PrecacheResource( "model", "models/townhouserooff/townhouserooff.vmdl", context )
PrecacheResource( "model", "models/tradershousea/tradershousea.vmdl", context )
PrecacheResource( "model", "models/tradershouseb/tradershouseb.vmdl", context )
end

ListenToGameEvent('entity_killed', Dynamic_Wrap(GameMode, 'OnEntityKilled'), self)
function GameMode:OnEntityKilled( keys )
  local killedUnit = EntIndexToHScript( keys.entindex_killed )
  if killedUnit:IsCreature() then
    RollDrops(killedUnit)
  end
end

function RollDrops(unit)
  local DropInfo = GameRules.DropTable[unit:GetUnitName()]
  if DropInfo then
    for item_name,chance in pairs(DropInfo) do
      if RollPercentage(chance) then
        -- Create the item
        local item = CreateItem(item_name, nil, nil)
        local pos = unit:GetAbsOrigin() + RandomVector(200)
        item:LaunchLoot(false, RandomInt(1,200), RandomInt(300,500), pos)
      end
    end
  end
end

-- Create the game mode when we activate
function Activate()
	GameRules.AddonTemplate = CAddonTemplateGameMode()
	GameRules.AddonTemplate:InitGameMode()
end
 
Последнее редактирование модератором:
Итак.

У тебя нет тех существ, с которых ты бы дропал предмет.

Давай рассмотрим повнимательней)

Смотри npc_giant_of_the_seas - у тебя ведь нет такого, верно?

А эта таблица рассчитана на то, чтобы именно с него падал определенный шмот.

Далее уже идёт айтемсет, и предметы который у тебя тоже нет).

Для начала, чтобы взять эту систему, надо создать монстров и нужные предметы.

А потом брать, и заносить всех монстров и дроп с ними в файл с расширением .kv который и будет отвечать за дроп.

Код:
 "npc_giant_of_the_seas" // tier 2 or 3 (its lvl 29)
  { 
    "1"
    {
      "ItemSets"
      {
        "1" "item_ring_of_regeneration"
        "2" "item_boots_of_agility_8"
        "3" "item_tbr_broadsword"
        "4" "item_tbr_circlet_of_nobility"
        "5" "item_cloak_of_flames_25"
        "6" "item_firehand_gauntlets_20"
        "7" "item_gauntlets_of_might_8"
        "8" "item_mail_shirt"
        "9" "item_pendant_of_energy" // This item doesn't exist, needs to be made
        "10" "item_ring_of_dodging"
        //"11" "item_ring_of_health" // This item doesn't exist, needs to be made
        "12" "item_ring_of_vigor"
        "13" "item_robes_of_enlightenment_8"
        "14" "item_wand_of_healing_power" 
        "15" "item_wand_of_spell_power"
      }
      "Chance"  "5" //of dropping 1 of the set
    }
 
Последнее редактирование модератором:
С этим я разобрался. Но меня напрягает этот код
Код:
ListenToGameEvent('entity_killed', Dynamic_Wrap(GameMode, 'OnEntityKilled'), self)
function GameMode:OnEntityKilled( keys )
  local killedUnit = EntIndexToHScript( keys.entindex_killed )
  if killedUnit:IsCreature() then
    RollDrops(killedUnit)
  end
end
он выдаёт ошибку
+
доп к нему
Код:
function RollDrops(unit)
  local DropInfo = GameRules.DropTable[unit:GetUnitName()]
  if DropInfo then
    for item_name,chance in pairs(DropInfo) do
      if RollPercentage(chance) then
        -- Create the item
        local item = CreateItem(item_name, nil, nil)
        local pos = unit:GetAbsOrigin() + RandomVector(200)
        item:LaunchLoot(false, RandomInt(1,200), RandomInt(300,500), pos)
      end
    end
  end
end
 
У тебя в моде есть
Код:
function Activate()
	GameRules.AddonTemplate = CAddonTemplateGameMode()
	GameRules.AddonTemplate:InitGameMode()
end
Вот ты ListenToGameEvent('entity_killed', Dynamic_Wrap(GameMode, 'OnEntityKilled'), self) туда и всунь, оно по воле Божьей не заработает :)
Код:
function Activate()
	GameRules.AddonTemplate = CAddonTemplateGameMode()
	GameRules.AddonTemplate:InitGameMode()
    ListenToGameEvent('entity_killed', Dynamic_Wrap(GameMode, 'OnEntityKilled'), self)
end

function RollDrops(unit)
  local DropInfo = GameRules.DropTable[unit:GetUnitName()]
  if DropInfo then
    for item_name,chance in pairs(DropInfo) do
      if RollPercentage(chance) then
        -- Create the item
        local item = CreateItem(item_name, nil, nil)
        local pos = unit:GetAbsOrigin() + RandomVector(200)
        item:LaunchLoot(false, RandomInt(1,200), RandomInt(300,500), pos)
      end
    end
  end
end

function GameMode:OnEntityKilled( keys )
  local killedUnit = EntIndexToHScript( keys.entindex_killed )
  if killedUnit:IsCreature() then
    RollDrops(killedUnit)
  end
end
 
Ошибка при запуске карты, не запускается addon_game_mode.lua

Код:
Script Runtime Error: ...ota_addons\testfree\scripts\vscripts\addon_game_mode.lua:57: attempt to index global 'GameMode' (a nil value)
stack traceback:
 	...ota_addons\testfree\scripts\vscripts\addon_game_mode.lua:57: in main chunk
Error running script named addon_game_mode

Код:
Script Runtime Error: ...ota_addons\testfree\scripts\vscripts\addon_game_mode.lua:38: attempt to call global 'CAddonTemplateGameMode' (a nil value)
stack traceback:
 	...ota_addons\testfree\scripts\vscripts\addon_game_mode.lua:38: in function <...ota_addons\testfree\scripts\vscripts\addon_game_mode.lua:37>
 
Последнее редактирование модератором:
Код:
function Precache( context )
	--[[
		Предварительное кэширование вещи, которые мы знаем, что мы будем использовать. 
		Возможно типа файлов включают (но не ограничиваясь этим):
			PrecacheResource( "model", "*.vmdl", context )
			PrecacheResource( "soundfile", "*.vsndevts", context )
			PrecacheResource( "particle", "*.vpcf", context )
			PrecacheResource( "particle_folder", "particles/folder", context )
	]]
	
PrecacheResource( "model", "models/props_debris/barrel002.mdl", context )
PrecacheResource( "model", "models/props_stone/stoneblock002a.mdl", context )
PrecacheUnitByNameSync("npc_dota_hero_pudge", context)
PrecacheUnitByNameSync("npc_dota_hero_omniknight", context)
PrecacheUnitByNameSync("npc_dota_hero_naga_siren", context)
PrecacheUnitByNameSync("npc_dota_hero_slardar", context)
PrecacheUnitByNameSync("npc_dota_hero_furion", context)
PrecacheUnitByNameSync("npc_dota_hero_zuus", context)
PrecacheUnitByNameSync("npc_dota_hero_Brewmaster", context)
PrecacheUnitByNameSync("npc_dota_hero_bounty_hunter", context)
PrecacheUnitByNameSync("npc_dota_hero_lion", context)
PrecacheResource( "model", "models/guildhall/guildhall.vmdl", context )
PrecacheResource( "model", "models/medievalshopb/medievalshopb.vmdl", context )			
PrecacheResource( "model", "models/medievlshopa/medievlshopa.vmdl", context )
PrecacheResource( "model", "models/shopfrontt/shopfrontt.vmdl", context )
PrecacheResource( "model", "models/towngate/towngate.vmdl", context )
PrecacheResource( "model", "models/townhouseaa/townhouseaa.vmdl", context )
PrecacheResource( "model", "models/townhouserooff/townhouserooff.vmdl", context )
PrecacheResource( "model", "models/tradershousea/tradershousea.vmdl", context )
PrecacheResource( "model", "models/tradershouseb/tradershouseb.vmdl", context )
 -- Sounds can precached here like anything else
PrecacheResource("soundfile", "soundevents/game_sounds_custom.vsndevts", context)
PrecacheResource("soundfile", "sounds/heartbeat.vsnd_c", context)
end

function Activate()
	GameRules.AddonTemplate = CAddonTemplateGameMode()
	GameRules.AddonTemplate:InitGameMode()
    ListenToGameEvent('entity_killed', Dynamic_Wrap(GameMode, 'OnEntityKilled'), self)
end

function RollDrops(unit)
  local DropInfo = GameRules.DropTable[unit:GetUnitName()]
  if DropInfo then
    for item_name,chance in pairs(DropInfo) do
      if RollPercentage(chance) then
        -- Create the item
        local item = CreateItem(item_name, nil, nil)
        local pos = unit:GetAbsOrigin() + RandomVector(200)
        item:LaunchLoot(false, RandomInt(1,200), RandomInt(300,500), pos)
      end
    end
  end
end

function GameMode:OnEntityKilled( keys )
  local killedUnit = EntIndexToHScript( keys.entindex_killed )
  if killedUnit:IsCreature() then
    RollDrops(killedUnit)
  end
end
 
Последнее редактирование модератором:
Ну ты мутишь конечно.. :) Пробуй.
Код:
require('buildinghelper')
require('good')

if GameMode == nil then
	GameMode = class({})
end

function Precache( context )
	--[[
		Precache things we know we'll use. Possible file types include (but not limited to):
			PrecacheResource( "model", "*.vmdl", context )
			PrecacheResource( "soundfile", "*.vsndevts", context )
			PrecacheResource( "particle", "*.vpcf", context )
			PrecacheResource( "particle_folder", "particles/folder", context )
	]]
PrecacheResource( "model", "models/props_debris/barrel002.mdl", context )
PrecacheResource( "model", "models/props_stone/stoneblock002a.mdl", context )
PrecacheUnitByNameSync("npc_dota_hero_pudge", context)
PrecacheUnitByNameSync("npc_dota_hero_omniknight", context)
PrecacheUnitByNameSync("npc_dota_hero_naga_siren", context)
PrecacheUnitByNameSync("npc_dota_hero_slardar", context)
PrecacheUnitByNameSync("npc_dota_hero_furion", context)
PrecacheUnitByNameSync("npc_dota_hero_zuus", context)
PrecacheUnitByNameSync("npc_dota_hero_Brewmaster", context)
PrecacheUnitByNameSync("npc_dota_hero_bounty_hunter", context)
PrecacheUnitByNameSync("npc_dota_hero_lion", context)
PrecacheResource( "model", "models/guildhall/guildhall.vmdl", context )
PrecacheResource( "model", "models/medievalshopb/medievalshopb.vmdl", context )			
PrecacheResource( "model", "models/medievlshopa/medievlshopa.vmdl", context )
PrecacheResource( "model", "models/shopfrontt/shopfrontt.vmdl", context )
PrecacheResource( "model", "models/towngate/towngate.vmdl", context )
PrecacheResource( "model", "models/townhouseaa/townhouseaa.vmdl", context )
PrecacheResource( "model", "models/townhouserooff/townhouserooff.vmdl", context )
PrecacheResource( "model", "models/tradershousea/tradershousea.vmdl", context )
PrecacheResource( "model", "models/tradershouseb/tradershouseb.vmdl", context )
end

function Activate()
	GameRules.GameMode = GameMode()
	GameRules.GameMode:InitGameMode()
    ListenToGameEvent('entity_killed', Dynamic_Wrap(GameMode, 'OnEntityKilled'), self)
end

function GameMode:OnEntityKilled( keys )
  local killedUnit = EntIndexToHScript( keys.entindex_killed )
  if killedUnit:IsCreature() then
    RollDrops(killedUnit)
  end
end

function RollDrops(unit)
  local DropInfo = GameRules.DropTable[unit:GetUnitName()]
  if DropInfo then
    for item_name,chance in pairs(DropInfo) do
      if RollPercentage(chance) then
        -- Create the item
        local item = CreateItem(item_name, nil, nil)
        local pos = unit:GetAbsOrigin() + RandomVector(200)
        item:LaunchLoot(false, RandomInt(1,200), RandomInt(300,500), pos)
      end
    end
  end
end
 
Последнее редактирование модератором:
Это я тоже делал, только вот так
Код:
require('buildinghelper')
require('good')

if CAddonTemplateGameMode == nil then
	CAddonTemplateGameMode = class({})
end

function Precache( context )
	--[[
		Precache things we know we'll use. Possible file types include (but not limited to):
			PrecacheResource( "model", "*.vmdl", context )
			PrecacheResource( "soundfile", "*.vsndevts", context )
			PrecacheResource( "particle", "*.vpcf", context )
			PrecacheResource( "particle_folder", "particles/folder", context )
	]]
PrecacheResource( "model", "models/props_debris/barrel002.mdl", context )
PrecacheResource( "model", "models/props_stone/stoneblock002a.mdl", context )
PrecacheUnitByNameSync("npc_dota_hero_pudge", context)
PrecacheUnitByNameSync("npc_dota_hero_omniknight", context)
PrecacheUnitByNameSync("npc_dota_hero_naga_siren", context)
PrecacheUnitByNameSync("npc_dota_hero_slardar", context)
PrecacheUnitByNameSync("npc_dota_hero_furion", context)
PrecacheUnitByNameSync("npc_dota_hero_zuus", context)
PrecacheUnitByNameSync("npc_dota_hero_Brewmaster", context)
PrecacheUnitByNameSync("npc_dota_hero_bounty_hunter", context)
PrecacheUnitByNameSync("npc_dota_hero_lion", context)
PrecacheResource( "model", "models/guildhall/guildhall.vmdl", context )
PrecacheResource( "model", "models/medievalshopb/medievalshopb.vmdl", context )			
PrecacheResource( "model", "models/medievlshopa/medievlshopa.vmdl", context )
PrecacheResource( "model", "models/shopfrontt/shopfrontt.vmdl", context )
PrecacheResource( "model", "models/towngate/towngate.vmdl", context )
PrecacheResource( "model", "models/townhouseaa/townhouseaa.vmdl", context )
PrecacheResource( "model", "models/townhouserooff/townhouserooff.vmdl", context )
PrecacheResource( "model", "models/tradershousea/tradershousea.vmdl", context )
PrecacheResource( "model", "models/tradershouseb/tradershouseb.vmdl", context )
end

function Activate()
	GameRules.GameMode = GameMode()
	GameRules.GameMode:InitGameMode()
    ListenToGameEvent('entity_killed', Dynamic_Wrap(GameMode, 'OnEntityKilled'), self)
end

function GameMode:OnEntityKilled( keys )
  local killedUnit = EntIndexToHScript( keys.entindex_killed )
  if killedUnit:IsCreature() then
    RollDrops(killedUnit)
  end
end

function RollDrops(unit)
  local DropInfo = GameRules.DropTable[unit:GetUnitName()]
  if DropInfo then
    for item_name,chance in pairs(DropInfo) do
      if RollPercentage(chance) then
        -- Create the item
        local item = CreateItem(item_name, nil, nil)
        local pos = unit:GetAbsOrigin() + RandomVector(200)
        item:LaunchLoot(false, RandomInt(1,200), RandomInt(300,500), pos)
      end
    end
  end
end
 
Последнее редактирование модератором:
den4iccc,вставь просто это все в гейм мод и убери пока
require('buildinghelper')
require('good')
 
Код:
if GameMode == nil then
	GameMode = class({})
end

function Precache( context )
	--[[
		Precache things we know we'll use. Possible file types include (but not limited to):
			PrecacheResource( "model", "*.vmdl", context )
			PrecacheResource( "soundfile", "*.vsndevts", context )
			PrecacheResource( "particle", "*.vpcf", context )
			PrecacheResource( "particle_folder", "particles/folder", context )
	]]
PrecacheResource( "model", "models/props_debris/barrel002.mdl", context )
PrecacheResource( "model", "models/props_stone/stoneblock002a.mdl", context )
PrecacheUnitByNameSync("npc_dota_hero_pudge", context)
PrecacheUnitByNameSync("npc_dota_hero_omniknight", context)
PrecacheUnitByNameSync("npc_dota_hero_naga_siren", context)
PrecacheUnitByNameSync("npc_dota_hero_slardar", context)
PrecacheUnitByNameSync("npc_dota_hero_furion", context)
PrecacheUnitByNameSync("npc_dota_hero_zuus", context)
PrecacheUnitByNameSync("npc_dota_hero_Brewmaster", context)
PrecacheUnitByNameSync("npc_dota_hero_bounty_hunter", context)
PrecacheUnitByNameSync("npc_dota_hero_lion", context)
PrecacheResource( "model", "models/guildhall/guildhall.vmdl", context )
PrecacheResource( "model", "models/medievalshopb/medievalshopb.vmdl", context )			
PrecacheResource( "model", "models/medievlshopa/medievlshopa.vmdl", context )
PrecacheResource( "model", "models/shopfrontt/shopfrontt.vmdl", context )
PrecacheResource( "model", "models/towngate/towngate.vmdl", context )
PrecacheResource( "model", "models/townhouseaa/townhouseaa.vmdl", context )
PrecacheResource( "model", "models/townhouserooff/townhouserooff.vmdl", context )
PrecacheResource( "model", "models/tradershousea/tradershousea.vmdl", context )
PrecacheResource( "model", "models/tradershouseb/tradershouseb.vmdl", context )
end

function Activate()
	GameRules.GameMode = GameMode()
	GameRules.GameMode:InitGameMode()
    ListenToGameEvent('entity_killed', Dynamic_Wrap(GameMode, 'OnEntityKilled'), self)
end

function GameMode:OnEntityKilled( keys )
  local killedUnit = EntIndexToHScript( keys.entindex_killed )
  if killedUnit:IsCreature() then
    RollDrops(killedUnit)
  end
end

function RollDrops(unit)
  local DropInfo = GameRules.DropTable[unit:GetUnitName()]
  if DropInfo then
    for item_name,chance in pairs(DropInfo) do
      if RollPercentage(chance) then
        -- Create the item
        local item = CreateItem(item_name, nil, nil)
        local pos = unit:GetAbsOrigin() + RandomVector(200)
        item:LaunchLoot(false, RandomInt(1,200), RandomInt(300,500), pos)
      end
    end
  end
end

Код:
Script Runtime Error: ...ota_addons\testfree\scripts\vscripts\addon_game_mode.lua:40: attempt to call method 'InitGameMode' (a nil value)
 stack traceback:
 	...ota_addons\testfree\scripts\vscripts\addon_game_mode.lua:40: in function <...ota_addons\testfree\scripts\vscripts\addon_game_mode.lua:38>

У меня сейчас мозг вскипит.
 
Последнее редактирование модератором:
почему он не читает "InitGameMode" ?
 
Последнее редактирование модератором:
den4iccc, блин, да что за бред вообще ? Оно и так должно работать
 
Реклама: