Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function SpawnUnitKilled (event)
- local victim = EntIndexToHScript( event.entindex_killed )
- if victim:GetUnitName() == "Ancient Guardian" then
- GameRules:SetGameWinner(DOTA_TEAM_BADGUYS)
- end
- if victim:IsCreature() and victim:GetTeam() == DOTA_TEAM_BADGUYS and event.entindex_attacker ~= nil then
- remains = remains - 1
- local result={ remains = remains }
- CustomGameEventManager:Send_ServerToTeam( DOTA_TEAM_GOODGUYS, "NPC_Wave_Remains", result)
- local Drop_Info = GameRules.DropTable[victim:GetUnitName()]
- dropitem(Drop_Info, victim)
- end
- if victim:IsCreature() and victim:GetTeam() == DOTA_TEAM_NEUTRALS then
- local Drop_Info = GameRules.DropTable[victim:GetUnitName()]
- dropitem(Drop_Info, victim)
- end
- if victim:IsCreature() and victim:GetTeam() == DOTA_TEAM_BADGUYS and event.entindex_attacker ~= nil then
- remains = remains - 1
- local result={ remains = remains }
- CustomGameEventManager:Send_ServerToTeam( DOTA_TEAM_GOODGUYS, "NPC_Wave_Remains", result)
- local Drop_Info = GameRules.DropTable[victim:GetUnitName()]
- dropitem2(Drop_Info, victim)
- end
- if victim:IsCreature() and victim:GetTeam() == DOTA_TEAM_NEUTRALS then
- local Drop_Info = GameRules.DropTable[victim:GetUnitName()]
- dropitem2(Drop_Info, victim)
- end
- end
- function dropitem(Drop_Info, victim)
- if Drop_Info then
- for item_name, chance in pairs(Drop_Info) do
- if RollPercentage(chance) then
- local item = CreateItem(item_name, nil, nil)
- local pos = victim:GetAbsOrigin()
- if item_name == "item_bag_of_gold" then
- item:SetCurrentCharges(RandomInt(75,150))
- end
- local landed = pos + RandomVector(RandomFloat(-220,220))
- local drop = CreateItemOnPositionSync(pos, item)
- if victim:GetTeam() == DOTA_TEAM_BADGUYS then
- item:LaunchLoot(true, 400, 0.7, landed)
- else
- item:LaunchLoot(false, 400, 0.7, landed)
- end
- Timers:CreateTimer(15, function()
- clearitem(item)
- end)
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement