Не ищу в жизни легких путей, и в очередной раз решил сломать себе голову. Так вот, в чем вся соль...Подумал я, что надо создать в доте кастомный предмет, который будет иметь такую же функцию, как и рапира из оригинальной Доты (Чтоб предмет при смерти героя или юнита, у которого есть инвентарь - выпадал). И все было бы так круто, если бы это не работало через "одно место". А проблема как раз-таки, заключается в том, что предмет, который выпадает с этого самого юнита - не подбирается героем. Он вообще никак не выделяется, и ведет себя, как моделька.
Крч, есть вот такой код в npc_items_custom:
А это сама функция, которая за всё отвечает:
Ну и ещё забыл добавить, что если прописать этот предмет себе через команду "-item item_custom_key", то у него отсутствует картинка в инвентаре...Вообще без понятия, в чем прикол...
Так что, если у кого-нибудь есть идеи, как это довести до ума - буду признателен)
P.S:
А это тот самый ключик, который выпадает с крипа и никак не хочет подбираться...
Крч, есть вот такой код в npc_items_custom:
"item_custom_key"
{
// General
//-------------------------------------------------------------------------------------------------------------
"ID" "2213"
"AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_PASSIVE"
"BaseClass" "item_datadriven"
"Model" "models/props_debris/merchant_debris_key001.vmdl"
"AbilityTextureName" "item_custom_key"
// Item Info
//-------------------------------------------------------------------------------------------------------------
"ItemCost" "99999"
"ItemDroppable" "1"
"ItemSellable" "0"
"ItemShopTags" "consumable"
"ItemQuality" "consumable"
"ItemKillable" "0"
"ItemQuality" "epic"
"ItemShareability" "ITEM_NOT_SHAREABLE"
"ItemDeclarations" "DECLARE_PURCHASES_TO_TEAMMATES | DECLARE_PURCHASES_TO_SPECTATORS
| DECLARE_PURCHASES_IN_SPEECH"
"OnOwnerDied"
{
"RunScript"
{
"ScriptFile" "scripts/vscripts/itemfunctions.lua"
"Function" "DropItemOnDeath"
}
}
// Sound
//-------------------------------------------------------------------------------------------------------------
"UIPickupSound" "Item.PickUpGemShop"
"UIDropSound" "Item.DropGemShop"
"WorldDropSound" "Item.DropGemWorld"
// Special
//-------------------------------------------------------------------------------------------------------------
"AbilitySpecial"
{
}
}
{
// General
//-------------------------------------------------------------------------------------------------------------
"ID" "2213"
"AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_PASSIVE"
"BaseClass" "item_datadriven"
"Model" "models/props_debris/merchant_debris_key001.vmdl"
"AbilityTextureName" "item_custom_key"
// Item Info
//-------------------------------------------------------------------------------------------------------------
"ItemCost" "99999"
"ItemDroppable" "1"
"ItemSellable" "0"
"ItemShopTags" "consumable"
"ItemQuality" "consumable"
"ItemKillable" "0"
"ItemQuality" "epic"
"ItemShareability" "ITEM_NOT_SHAREABLE"
"ItemDeclarations" "DECLARE_PURCHASES_TO_TEAMMATES | DECLARE_PURCHASES_TO_SPECTATORS
| DECLARE_PURCHASES_IN_SPEECH"
"OnOwnerDied"
{
"RunScript"
{
"ScriptFile" "scripts/vscripts/itemfunctions.lua"
"Function" "DropItemOnDeath"
}
}
// Sound
//-------------------------------------------------------------------------------------------------------------
"UIPickupSound" "Item.PickUpGemShop"
"UIDropSound" "Item.DropGemShop"
"WorldDropSound" "Item.DropGemWorld"
// Special
//-------------------------------------------------------------------------------------------------------------
"AbilitySpecial"
{
}
}
А это сама функция, которая за всё отвечает:
if itemFunctions == nil then
print ( '[ItemFunctions] creating itemFunctions' )
itemFunctions = {}
itemFunctions.__index = itemFunctions
end
function itemFunctions:new()
print ( '[ItemFunctions] itemFunctions:new' )
o = o or {}
setmetatable( o, itemFunctions )
return o
end
function itemFunctions:start()
print('[ItemFunctions] itemFunctions started!')
end
function DropItemOnDeath(keys)
print( '[ItemFunctions] DropItemOnDeath Called' )
local killedUnit = EntIndexToHScript( keys.caster_entindex )
local itemName = tostring(keys.ability:GetAbilityName())
if killedUnit:IsHero() or killedUnit:HasInventory() then
for itemSlot = 0, 5, 1 do
if killedUnit ~= nil then
local Item = killedUnit:GetItemInSlot( itemSlot )
if Item ~= nil and Item:GetName() == itemName then
local newItem = CreateItem(itemName, nil, nil)
CreateItemOnPositionSync(killedUnit:GetOrigin(), newItem)
killedUnit:RemoveItem(Item)
end
end
end
end
end
print ( '[ItemFunctions] creating itemFunctions' )
itemFunctions = {}
itemFunctions.__index = itemFunctions
end
function itemFunctions:new()
print ( '[ItemFunctions] itemFunctions:new' )
o = o or {}
setmetatable( o, itemFunctions )
return o
end
function itemFunctions:start()
print('[ItemFunctions] itemFunctions started!')
end
function DropItemOnDeath(keys)
print( '[ItemFunctions] DropItemOnDeath Called' )
local killedUnit = EntIndexToHScript( keys.caster_entindex )
local itemName = tostring(keys.ability:GetAbilityName())
if killedUnit:IsHero() or killedUnit:HasInventory() then
for itemSlot = 0, 5, 1 do
if killedUnit ~= nil then
local Item = killedUnit:GetItemInSlot( itemSlot )
if Item ~= nil and Item:GetName() == itemName then
local newItem = CreateItem(itemName, nil, nil)
CreateItemOnPositionSync(killedUnit:GetOrigin(), newItem)
killedUnit:RemoveItem(Item)
end
end
end
end
end
Ну и ещё забыл добавить, что если прописать этот предмет себе через команду "-item item_custom_key", то у него отсутствует картинка в инвентаре...Вообще без понятия, в чем прикол...
Так что, если у кого-нибудь есть идеи, как это довести до ума - буду признателен)
P.S:
А это тот самый ключик, который выпадает с крипа и никак не хочет подбираться...