Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slime Boss - Code #2176

Merged
merged 22 commits into from
May 12, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Slime spawner enitity
  • Loading branch information
TideSofDarK committed May 2, 2018
commit 747c5980a84adc0c55b441347964acc04343c09e
18 changes: 16 additions & 2 deletions game/scripts/npc/units/slime/npc_dota_boss_slime.txt
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
"DOTAUnits"
{
//=================================================================================
// Boss tier ?
// Boss tier 2
//=================================================================================
"npc_dota_boss_slime"
{
// General
//
"BaseClass" "npc_dota_creature" // Class of entity of link to.
"Model" "models/heroes/weaver/weaver.vmdl" // Model.
"vscripts" "units/slime.lua"
"vscripts" "units/ai_slime.lua"
"SoundSet" "Meepo" // Name of sound set.
"ModelScale" "1"
"Level" "30"
Expand Down Expand Up @@ -117,4 +117,18 @@
"MinimapIcon" "minimap_roshancamp"
"MinimapIconSize" "450"
}
"npc_dota_creature_slime_spawner"
{
"vscripts" "units/ai_slime_spawner.lua"

"BaseClass" "npc_dota_creature"
"Model" "models/development/invisiblebox.vmdl"
"AttackCapabilities" "DOTA_UNIT_CAP_NO_ATTACK"
"VisionDaytimeRange" "0"
"VisionNighttimeRange" "0"
"UnitRelationshipClass" "DOTA_NPC_UNIT_RELATIONSHIP_TYPE_WARD"
"MovementCapabilities" "DOTA_UNIT_CAP_MOVE_NONE"

"Ability1" "out_of_game"
}
}
14 changes: 9 additions & 5 deletions game/scripts/vscripts/abilities/slime/boss_slime_split.lua
Original file line number Diff line number Diff line change
Expand Up @@ -88,13 +88,17 @@ function modifier_boss_slime_split_passive:OnDeath(keys)
local function CreateClone(origin)
local clone = CreateUnitByName(unitName, origin, true, nil, nil, caster:GetTeamNumber())
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think you need to copy the items from the parent, so the copies have heart and the core.
also if you are in fact killing/let the original one die you have to create a spawner unit that will die only when all the splits die as well, otherwise it will not reward the core or reward the core on the first phase kill.

take a look at npc_dota_creature_temple_guardian_spawner

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fixed

clone:RemoveAbility("boss_slime_split")
for i=0,5 do
local item = caster:GetItemInSlot(i)
if item then
clone:AddItem(CreateItem(item:GetName(), clone, clone))
end
end
return clone
end

CreateClone(caster:GetAbsOrigin() + Vector(100,0,0))
CreateClone(caster:GetAbsOrigin() + Vector(-100,0,0))

caster:SetClones(CreateClone(caster:GetAbsOrigin() + Vector(100,0,0)),
CreateClone(caster:GetAbsOrigin() + Vector(-100,0,0)))
caster:AddNoDraw()
-- UTIL_Remove(caster)
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ function Spawn( entityKeyValues )
thisEntity.hJumpAbility = thisEntity:FindAbilityByName( "boss_slime_jump" )
thisEntity.hSlamAbility = thisEntity:FindAbilityByName( "boss_slime_slam" )
thisEntity.hShakeAbility = thisEntity:FindAbilityByName( "boss_slime_shake" )
-- thisEntity.hReapersRushAbility = thisEntity:FindAbilityByName( "boss_swiper_reapers_rush" )

thisEntity:SetContextThink( "SlimeBossThink", SlimeBossThink, 1 )
end
Expand Down
56 changes: 56 additions & 0 deletions game/scripts/vscripts/units/ai_slime_spawner.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
function Spawn( kv )
if not IsServer() then
return
end

if thisEntity == nil then
return
end
thisEntity.bForceKill = false
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This whitespace in this file is insane, go through and fix up the indentation. Using an editor that supports .editorconfig will help a lot.


thisEntity:SetContextThink( "SlimeSpawnerThink", SlimeSpawnerThink, 1 )
end

function SlimeSpawnerThink()
if not thisEntity.bInitialized then
thisEntity.vInitialSpawnPos = thisEntity:GetOrigin()
thisEntity.bInitialized = true
end

if thisEntity.bForceKill then
-- Triggers boss reward
local hAttackerHero = EntIndexToHScript( thisEntity.KillValues.entindex_attacker )
thisEntity:Kill(nil, hAttackerHero)
return -1
end

local function SetClones(clone1, clone2)
thisEntity.clone1 = clone1
thisEntity.clone2 = clone2
clone1:OnDeath(OnBossKill)
clone2:OnDeath(OnBossKill)
end

thisEntity.bossHandle1 = CreateUnitByName('npc_dota_boss_slime', thisEntity:GetAbsOrigin(), true, nil, nil, DOTA_TEAM_NEUTRALS)
thisEntity.bossHandle1.BossTier = thisEntity.BossTier
thisEntity.bossHandle1.SetClones = SetClones

for i = DOTA_ITEM_SLOT_1, DOTA_ITEM_SLOT_6 do
local item = thisEntity:GetItemInSlot(i)
if item ~= nil then
thisEntity.bossHandle1:AddItemByName( item:GetName() )
end
end

return -1
end

function OnBossKill(kv)
if (not IsValidEntity(thisEntity.clone1) or not thisEntity.clone1:IsAlive()) and
(not IsValidEntity(thisEntity.clone2) or not thisEntity.clone2:IsAlive()) then
-- Calling Kill or ForceKill from this handler does not work
thisEntity.KillValues = kv
thisEntity.bForceKill = true
thisEntity:SetContextThink( "SlimeSpawnerThink", SlimeSpawnerThink, 0.1 )
end
end