Dota-Like Creep Pulling?

shiFt

Member
Reaction score
8
How does Dota make it so that when you attack an enemy hero the creeps move in to attack you, thus pulling the creeps, is it AI or just a simple trigger, because Id think that ordering the creep to attack the Attacking Hero would cause it to not stop attacking until the creep or the Hero dies, but this is not the case, the creep stops attacking after the Heros attack is finished attacking the other Hero, and the Attacking Hero's creeps defend him from the enemy creeps.
 

mylemonblue

You can change this now in User CP.
Reaction score
7
I think it's a value in the Gameplay Constants, the target aquisition range or somewhat. Try checking out the DoTA Template =/
 

shiFt

Member
Reaction score
8
I think its abit more advanced than that, it must be coded im sure. The template does not include this creep behavior code
 

Durandal

New Member
Reaction score
11
No actually it's very simple

Trigger:
  • Event - A unit is issued an order equal to 'Attack'
    • Condition - Attacked unit is equal to ally of [Player]


Then it just orders all nearby creeps to that belong to 'Player' to attack the attacking unit

The coding doesn't look like that, the computer I'm on doesn't have War3, so I can't give you a completely accurate coding script, once I get home I can though
 

shiFt

Member
Reaction score
8
But isnt the order 'attack' to attack the target until either the target or the ordered unit dies? would other creep threats simply override the command?
 

mylemonblue

You can change this now in User CP.
Reaction score
7
That and I have had some bad luck with sorts of command overrides like that. They will attack the target and then just stand there afterwards instead of continuing on down the lane to their target. :p
 

Durandal

New Member
Reaction score
11
Well yes it does override the command, it does that in DotA as well, if you issue an order to your hero to attack another hero within X range of those creeps, they will be ordered to attack you, but if another hero does the same thing it overrides the intial order and they'll attack that hero

same as when you retreat a certain distance, they'll have their orders overriden again, and they'll continue to attack moving
 

egomanyak

New Member
Reaction score
8
Here, maybe have some bugs i didnt checked it just writed and tryed 1 time, looked works fine, closed it
if have bugs, trigger should(must?) be like this
dont forget to change range etc.(note: i taked the damage show system from weturkiye(only Turkish))
 

Attachments

  • system.w3x
    24.9 KB · Views: 218

Sartan

New Member
Reaction score
23
here is the code that dotA are using (jass)
JASS:

// DEBUG Trigger Number : 223
function KkKk takes unit pfU returns boolean
	return GetBoolean(H2Tx(pfU),"HeroAIManager")
endfunction

function Trig_HeroAIManager_Conditions takes nothing returns boolean
	if IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO)and not IsUnitIllusion(GetTriggerUnit())then
		if not KkKk(GetTriggerUnit())then
			return true
		endif
	endif
	return false
endfunction

function KjKj takes nothing returns boolean
	if IsUnitType(GetOrderTargetUnit(),UNIT_TYPE_HERO)and not IsUnitIllusion(GetOrderTargetUnit())then
		if GetIssuedOrderId()==OrderId("attack") or GetIssuedOrderId()==OrderId("smart") then
			if IsUnitVisible(GetTriggerUnit(),GetOwningPlayer(GetOrderTargetUnit()))then
				return KFKF(GetOrderTargetUnit(),GetTriggerUnit())
			endif
		endif
	endif
	return false
endfunction

function KJKJ takes nothing returns nothing
	call KhKh(GetOrderTargetUnit(),GetTriggerUnit())
endfunction

function KiKi takes nothing returns boolean
	return KFKF(GetTriggerUnit(),GetAttacker())
endfunction

function KIKI takes nothing returns nothing
	call KhKh(GetTriggerUnit(),GetAttacker())
endfunction

function KKKK takes unit pfU returns nothing
	local group lgg
	local trigger ltt
	local timer ltm
	local string lf5=H2Tx(pfU)
	call SetBoolean(lf5,"HeroAIManager",true)
	set lgg=CreateGroup()
	call SetHandle(lf5,"Defenders",lgg)
	set ltt=CreateTrigger()
	call SetHandle(lf5,"OnAttackOrder",ltt)
	call TriggerRegisterUnitEvent(ltt,pfU,EVENT_UNIT_ISSUED_TARGET_ORDER)
	call TriggerAddCondition(ltt,Condition(function KjKj))
	call TriggerAddAction(ltt,function KJKJ)
	set ltt=CreateTrigger()
	call SetHandle(lf5,"OnAttacked",ltt)
	call TriggerRegisterUnitEvent(ltt,pfU,EVENT_UNIT_ATTACKED)
	call TriggerAddCondition(ltt,Condition(function KiKi))
	call TriggerAddAction(ltt,function KIKI)
	set ltm=CreateTimer()
	call SetHandle(H2Tx(pfU),"DefendTimer",ltm)
	call SetHandle(H2Tx(ltm),"Hero",pfU)
endfunction

function Trig_HeroAIManager_Actions takes nothing returns nothing
	call KKKK(GetTriggerUnit())
endfunction

function StartTrigger_HeroAIManager takes nothing returns nothing
	set gg_trg_HeroAIManager=CreateTrigger()
	call TriggerRegisterEnterRectSimple(gg_trg_HeroAIManager,GetWorldBounds())
	call TriggerAddCondition(gg_trg_HeroAIManager,Condition(function Trig_HeroAIManager_Conditions))
	call TriggerAddAction(gg_trg_HeroAIManager,function Trig_HeroAIManager_Actions)
endfunction

function InitTrig_HeroAIManager takes nothing returns nothing
endfunction

taken from OpenDotA Project
since i dont understand a shit about jass (well not at this level atleast^^)

this is taken from a forum post that explains how its works, although i wont be reading it^^

The hardcoded AI of all units (non-neutral) is if the unit is idle (not executing an order), it will attack the closest enemy in its acquisition range (which is not the same as vision range) and continue to attack/persuade until the enemy dies, the unit dies or it gets out of the acquisition range for some time. (There are some other conditions I will not dilate on.)
Besides that, there's hardcoded "Call for Help Range" (600), which makes an idle unit attack the enemy if an ally in the range is attacked. This by itself wouldn't make harrasing the opponent more difficult, because allied creeps are occupied fighting the enemy creeps. This is where triggers come in.

Everytime a hero (except Bloodstone dummy hero) enters the game, and the hero doesn't have "HeroAIManager" as true, then set "HeroAIManager" for "Hero" as true, create a group of units "Defenders"-"Hero" (empty), save it to the cache and create two new triggers called "OnAttackOrder" and "OnAttacked". The first one is called when "Hero" is ordered to attack (rightclick or "A") a visible enemy non-illusion hero. The second trigger ("OnAttacked") is called when "Hero" is attacked, the attacker is an enemy and the unit saved in cache as "Attacker"-"Hero" is null, dead or the attacker. Then create a new timer called "DefendTimer"-"Hero" and save it to the game cache.

"OnAttackOrder"

* call function (1) with X = the attacked hero and Y = "Hero"

"OnAttacked"

* call function (1) with X = "Hero" and Y = the attacker

(1)

* save Y as "Attacker"-X
* count all non-Balista, non-Meat Wagon units that are enemy to Y and their owning player is Player 0 (Sentinel) or Player 6 (Scourge), in 500 AoE from Y and save them to group "g"
* order all units in "g" to attack Y, add them to group "Defenders"-X and start "DefendTimer"-X with an expiry time of 2 seconds
* when the timer is up, set "Attacker"-X to null and order all units in "g" to attack ground on their next waypoint (there are 5 waypoints and they determine the pathing of creeps to the Tree/Throne, one waypoint is approximately in the middle of each line and other are by the Tree and the Throne)
* finally, empty group "Defenders"-X

To sum up:

* creep aggro lasts for 2 seconds
* the attacker gets aggro from all enemy creeps in 500 AoE from him, so you can order an attack command across the map (to a different line for example) and still get aggroed
* you get aggro even if you don't click on the enemy, but attack him by autoattack or attack ground command (this is where trigger "OnAttacked" comes in)
* trigger "OnAttacked" applies to enemy creeps and neutrals as well (can help with creep pulling)

I hope this wasn't confusing. It is possible that I missed somthing in the code, feel free to correct me.
 

egomanyak

New Member
Reaction score
8
here is the code that dotA are using (jass)
JASS:

// DEBUG Trigger Number : 223
function KkKk takes unit pfU returns boolean
	return GetBoolean(H2Tx(pfU),"HeroAIManager")
endfunction

function Trig_HeroAIManager_Conditions takes nothing returns boolean
	if IsUnitType(GetTriggerUnit(),UNIT_TYPE_HERO)and not IsUnitIllusion(GetTriggerUnit())then
		if not KkKk(GetTriggerUnit())then
			return true
		endif
	endif
	return false
endfunction

function KjKj takes nothing returns boolean
	if IsUnitType(GetOrderTargetUnit(),UNIT_TYPE_HERO)and not IsUnitIllusion(GetOrderTargetUnit())then
		if GetIssuedOrderId()==OrderId("attack") or GetIssuedOrderId()==OrderId("smart") then
			if IsUnitVisible(GetTriggerUnit(),GetOwningPlayer(GetOrderTargetUnit()))then
				return KFKF(GetOrderTargetUnit(),GetTriggerUnit())
			endif
		endif
	endif
	return false
endfunction

function KJKJ takes nothing returns nothing
	call KhKh(GetOrderTargetUnit(),GetTriggerUnit())
endfunction

function KiKi takes nothing returns boolean
	return KFKF(GetTriggerUnit(),GetAttacker())
endfunction

function KIKI takes nothing returns nothing
	call KhKh(GetTriggerUnit(),GetAttacker())
endfunction

function KKKK takes unit pfU returns nothing
	local group lgg
	local trigger ltt
	local timer ltm
	local string lf5=H2Tx(pfU)
	call SetBoolean(lf5,"HeroAIManager",true)
	set lgg=CreateGroup()
	call SetHandle(lf5,"Defenders",lgg)
	set ltt=CreateTrigger()
	call SetHandle(lf5,"OnAttackOrder",ltt)
	call TriggerRegisterUnitEvent(ltt,pfU,EVENT_UNIT_ISSUED_TARGET_ORDER)
	call TriggerAddCondition(ltt,Condition(function KjKj))
	call TriggerAddAction(ltt,function KJKJ)
	set ltt=CreateTrigger()
	call SetHandle(lf5,"OnAttacked",ltt)
	call TriggerRegisterUnitEvent(ltt,pfU,EVENT_UNIT_ATTACKED)
	call TriggerAddCondition(ltt,Condition(function KiKi))
	call TriggerAddAction(ltt,function KIKI)
	set ltm=CreateTimer()
	call SetHandle(H2Tx(pfU),"DefendTimer",ltm)
	call SetHandle(H2Tx(ltm),"Hero",pfU)
endfunction

function Trig_HeroAIManager_Actions takes nothing returns nothing
	call KKKK(GetTriggerUnit())
endfunction

function StartTrigger_HeroAIManager takes nothing returns nothing
	set gg_trg_HeroAIManager=CreateTrigger()
	call TriggerRegisterEnterRectSimple(gg_trg_HeroAIManager,GetWorldBounds())
	call TriggerAddCondition(gg_trg_HeroAIManager,Condition(function Trig_HeroAIManager_Conditions))
	call TriggerAddAction(gg_trg_HeroAIManager,function Trig_HeroAIManager_Actions)
endfunction

function InitTrig_HeroAIManager takes nothing returns nothing
endfunction

taken from OpenDotA Project
since i dont understand a shit about jass (well not at this level atleast^^)

this is taken from a forum post that explains how its works, although i wont be reading it^^

He/She dont know how to make this in GUI, you think he can understand this and can edit to import the map ? :) and the open dota dont work for 1.24 or higher, and there have return codes so it wont work =)
 

shiFt

Member
Reaction score
8
this is awesome accurate info, could somebody make this into a working system maybe using vJass? Id like to use this in my map +rep for finding the resource and +rep for the system attempt ego :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Staff online

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top