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: 216

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.
  • Monovertex Monovertex:
    How are you all? :D
    +1
  • Ghan Ghan:
    Howdy
  • Ghan Ghan:
    Still lurking
    +3
  • The Helper The Helper:
    I am great and it is fantastic to see you my friend!
    +1
  • The Helper The Helper:
    If you are new to the site please check out the Recipe and Food Forum https://www.thehelper.net/forums/recipes-and-food.220/
  • Monovertex Monovertex:
    How come you're so into recipes lately? Never saw this much interest in this topic in the old days of TH.net
  • Monovertex Monovertex:
    Hmm, how do I change my signature?
  • tom_mai78101 tom_mai78101:
    Signatures can be edit in your account profile. As for the old stuffs, I'm thinking it's because Blizzard is now under Microsoft, and because of Microsoft Xbox going the way it is, it's dreadful.
  • The Helper The Helper:
    I am not big on the recipes I am just promoting them - I use the site as a practice place promoting stuff
    +2
  • Monovertex Monovertex:
    @tom_mai78101 I must be blind. If I go on my profile I don't see any area to edit the signature; If I go to account details (settings) I don't see any signature area either.
  • The Helper The Helper:
    You can get there if you click the bell icon (alerts) and choose preferences from the bottom, signature will be in the menu on the left there https://www.thehelper.net/account/preferences
  • The Helper The Helper:
    I think I need to split the Sci/Tech news forum into 2 one for Science and one for Tech but I am hating all the moving of posts I would have to do
  • The Helper The Helper:
    What is up Old Mountain Shadow?
  • The Helper The Helper:
    Happy Thursday!
    +1
  • Varine Varine:
    Crazy how much 3d printing has come in the last few years. Sad that it's not as easily modifiable though
  • Varine Varine:
    I bought an Ender 3 during the pandemic and tinkered with it all the time. Just bought a Sovol, not as easy. I'm trying to make it use a different nozzle because I have a fuck ton of Volcanos, and they use what is basically a modified volcano that is just a smidge longer, and almost every part on this thing needs to be redone to make it work
  • Varine Varine:
    Luckily I have a 3d printer for that, I guess. But it's ridiculous. The regular volcanos are 21mm, these Sovol versions are about 23.5mm
  • Varine Varine:
    So, 2.5mm longer. But the thing that measures the bed is about 1.5mm above the nozzle, so if I swap it with a volcano then I'm 1mm behind it. So cool, new bracket to swap that, but THEN the fan shroud to direct air at the part is ALSO going to be .5mm to low, and so I need to redo that, but by doing that it is a little bit off where it should be blowing and it's throwing it at the heating block instead of the part, and fuck man
  • Varine Varine:
    I didn't realize they designed this entire thing to NOT be modded. I would have just got a fucking Bambu if I knew that, the whole point was I could fuck with this. And no one else makes shit for Sovol so I have to go through them, and they have... interesting pricing models. So I have a new extruder altogether that I'm taking apart and going to just design a whole new one to use my nozzles. Dumb design.
  • Varine Varine:
    Can't just buy a new heatblock, you need to get a whole hotend - so block, heater cartridge, thermistor, heatbreak, and nozzle. And they put this fucking paste in there so I can't take the thermistor or cartridge out with any ease, that's 30 dollars. Or you can get the whole extrudor with the direct driver AND that heatblock for like 50, but you still can't get any of it to come apart
  • Varine Varine:
    Partsbuilt has individual parts I found but they're expensive. I think I can get bits swapped around and make this work with generic shit though

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top