{
"RunScript"
{
"ScriptFile" "scripts/vscripts/itemfunctions.lua"
"Function" "DropItemOnDeath"
}
}
Лови от меня подарокЯ нашёл как сделать, но когда добавляю этот код к сатанику, то ничего не происходит. Но если это "BasicClass" "datadriven" то работает.
Код:{ "RunScript" { "ScriptFile" "scripts/vscripts/itemfunctions.lua" "Function" "DropItemOnDeath" } }
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())
keys.ability gets the actual ability and then 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_dmgtest_datadriven"
{
"ID" "2100"
"AbilityBehavior" "DOTA_ABILITY_BEHAVIOR_PASSIVE"
"BaseClass" "item_datadriven"
"Model" "models/props_gameplay/divine_rapier.vmdl"
"AbilityTextureName" "rapier"
// Item Info
//---------------------------------------------------------------------------------------------------------
"ItemCost" "6200"
"ItemDroppable" "0"
"ItemSellable" "0"
"ItemKillable" "0"
"ItemQuality" "epic"
"ItemShopTags" "damage"
"ItemAliases" "rapier"
"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"
}
}
"Modifiers"
{
"modifier_rapier"
{
"Passive" "1"
"IsHidden" "1"
"Properties"
{
"MODIFIER_PROPERTY_BASEATTACK_BONUSDAMAGE" "%bonus_damage"
}
}
}
// Special
//---------------------------------------------------------------------------------------------------------
"AbilitySpecial"
{
"01"
{
"var_type" "FIELD_INTEGER"
"bonus_damage" "300"
}
}
}
function CDOTABaseAbility:ComicsVsAnimeItemDrop(caster)
local itemName = tostring(self:GetAbilityName())
if caster:IsHero() or caster:HasInventory() then
local newItem = CreateItem(itemName, nil, nil)
CreateItemOnPositionSync(caster:GetOrigin(), newItem)
caster:RemoveItem(self)
end
end