How to create a Spell like Berserker's Call in DotA?

Rainther

I guess I should write something of value here...
Reaction score
61
Sure, please answer my question first: Do you only have one of these heroes?
 

joohen

New Member
Reaction score
20
Yes. I had the hero which has the Taunt abitity.

EDIT: Oh, sorry my bad. I had only one hero with that ability.
 

TideOfChaos

New Member
Reaction score
25
There is no need for unit groups.
Just every 0.03 (or what have you) seconds of game time, pick every unit that has taunter buff (unit that casts gets the buff) and then pick all units in X units around them and order them to attack the taunter.
 

Rainther

I guess I should write something of value here...
Reaction score
61
You fail you answe my question. If there's only one hero of this kind with this ability it should be as simple as this:
Trigger:
  • Taunter
    • Events
      • Unit - A unit Is issued an order with no target
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • ((Triggering unit) has buff Taunted) Equal to True
    • Actions
      • Set TempGroup= (Units of type Taunter)
      • Unit - Order (Triggering unit) to Attack (Random unit from TempGroup)
      • Custom script: call DestroyGroup(udg_TempGroup)
Hope it solves the problem.

There is no need for unit groups.
Just every 0.03 (or what have you) seconds of game time, pick every unit that has taunter buff (unit that casts gets the buff) and then pick all units in X units around them and order them to attack the taunter.

I believe even if the intervall is as short as 0.03 you still have time to activate windwalk and berserk.
 

joohen

New Member
Reaction score
20
uhh... well, it ALMOST worked. It was like, my hero is hitting him, and i was trying to test whether it can run away anot but a there was a surprise for me.My warcraft epicly crash or closed without any fatal error at all. Tried twice, crash twice, what happened? :confused:
 

Kikac_NNGK

Well-Known Member
Reaction score
33
i had the same problem. Try using the action "Turn off this trigger" at the first place in actions and then put the action "Turn on this trigger" at the end of the trigger
 

Rainther

I guess I should write something of value here...
Reaction score
61
Oh yeah. Forgot about it :p thanks Kikac. The trigger gives itself an everlasting loop which I forgot about.

Use this instead:
Trigger:
  • Taunter
    • Events
      • Unit - A unit Is issued an order with no target
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • ((Triggering unit) has buff Taunted) Equal to True
    • Actions
      • Set TempGroup= (Units of type Human Footman)
      • Trigger - Turn off (This trigger)
      • Unit - Order (Triggering unit) to Attack (Random unit from TempGroup)
      • Trigger - Turn on (This trigger)
      • Custom script: call DestroyGroup(udg_TempGroup)

This makes the event to not trigger itself.
 

ShadourazeR

New Member
Reaction score
0
then order them every 0.1 seconds :rolleyes:

Don't put it 0.5 seconds, or 0.1 seconds, both of them would make units unable to attack the calling unit...

It's not exactly like dota, but its efficient to order units to attack once and then just loop an action to unselect them.
 

ShadourazeR

New Member
Reaction score
0
Oh yeah. Forgot about it :p thanks Kikac. The trigger gives itself an everlasting loop which I forgot about.

Use this instead:
Trigger:
  • Taunter
    • Events
      • Unit - A unit Is issued an order with no target
      • Unit - A unit Is issued an order targeting an object
      • Unit - A unit Is issued an order targeting a point
    • Conditions
      • ((Triggering unit) has buff Taunted) Equal to True
    • Actions
      • Set TempGroup= (Units of type Human Footman)
      • Trigger - Turn off (This trigger)
      • Unit - Order (Triggering unit) to Attack (Random unit from TempGroup)
      • Trigger - Turn on (This trigger)
      • Custom script: call DestroyGroup(udg_TempGroup)

This makes the event to not trigger itself.

Note that if it is a custom hero map, the TempGroup must be set before it, and also needs to be an array, making a Tempgroup for each player in the game, and the ability also needs to give a buff to the caster, so the trigger can recognize who is casting it and who is not.
 

Rainther

I guess I should write something of value here...
Reaction score
61
I asked him 2 times if he planned on using the hero more the once. If only used once most of the problems dissapear, however I never received an answer.
 

pneric

New Member
Reaction score
1
This thread makes me want to start a "How did they do that spell in DotA?"; just a simple thread where people can ask a skill in DotA and how it was made, fundamentals etc. I tried replicating Berserker's Call myself but was not successful until i read this thread.
 

Kuberr24

Well-Known Member
Reaction score
28
this trigger is already complex in jass, requiring hashtables (or local hande vars) to pass data effciciently without the use of global variable arrays (one for every player or unit)

Problems you'll have in GUI:
If the unit has berserk call buff, how will you know which unit it must be ordered to attack?
what if two units use berserker call at the same time?
you will order a unit group to do something every 0.05 sec. better make it perfectly leakless... (although this needs to be done in JASS too)

To make it in GUI, you'd need alot of "clunky" code. If this is some kind of rpg, where the hero is always available and only 1 player has the hero, then I'd say go for it.
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
What do you mean complex in jass. Im new to jass and ill code it easily
 

Rainther

I guess I should write something of value here...
Reaction score
61
It's more the step over to Jass that prevents people to join the Jass side. :p

People don't wanna leave the GUI side since it feels cozy and believes that joining the Jass side wouldn't give much in return, so come on over. Join the Jass side of the force! We got cookies... :D
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
Cookies it is. But who were you saying that too?
 

Kuberr24

Well-Known Member
Reaction score
28
Code it easily? Right...

JASS:
function Trig_Berserker_Call_Conditions takes nothing returns boolean
	if(not(GetSpellAbilityId()=='A0C7'))then
		return false
	endif
	return true
endfunction

function Berserker_Call_Buff takes nothing returns boolean
	return GetUnitAbilityLevel(GetTriggerUnit(),'BHwe')>0
endfunction

function Berserker_Call_Aim takes nothing returns nothing
	local unit lMy=GetUnit(H2Tx(GetTriggeringTrigger()),"Axe")
	if GetUnitState(lMy,UNIT_STATE_LIFE)>0 then
		call DisableTrigger(GetTriggeringTrigger())
		call IssueTargetOrderById(GetTriggerUnit(),OrderId("attack"),lMy)
		call EnableTrigger(GetTriggeringTrigger())
	endif
endfunction

function Berserker_Call_OrderFilter takes nothing returns boolean
	if(UnitHasBuffBJ(GetFilterUnit(),'BHwe'))then
		if((UnitHasBuffBJ(GetFilterUnit(),'B008')==false)or(UnitHasBuffBJ(GetFilterUnit(),'Bcyc')==false))then
			if IsUnitPaused(GetFilterUnit())==false then
				return true
			endif
		endif
	endif
	return false
endfunction

function Berserker_Call_Caster takes nothing returns nothing
	call IssueTargetOrderById(GetEnumUnit(),OrderId("attack"),udg_u_DTAX_temp)
endfunction

function Berserker_Call_CreepVictim takes nothing returns boolean
	return GetBooleanAnd((UnitHasBuffBJ(GetFilterUnit(),'BHwe')),GetOwningPlayer(GetFilterUnit())==udg_pA_DTAX_SEPlayers[0]or GetOwningPlayer(GetFilterUnit())==udg_pA_DTAX_SCPlayers[0])
endfunction

function Berserker_Call_CreepAttack takes nothing returns nothing
	if(GetOwningPlayer(GetEnumUnit())==udg_pA_DTAX_SEPlayers[0])then
		call UnitRemoveAbility(GetEnumUnit(),'BHwe')
		call IssuePointOrderByIdLoc(GetEnumUnit(),OrderId("attack"),GetRectCenter(gg_rct_TheFrozenThroneRect))
	endif
	if(GetOwningPlayer(GetEnumUnit())==udg_pA_DTAX_SCPlayers[0])then
		call UnitRemoveAbility(GetEnumUnit(),'BHwe')
		call IssuePointOrderByIdLoc(GetEnumUnit(),OrderId("attack"),GetRectCenter(gg_rct_TheWorldTreeRect))
	endif
endfunction

function Trig_Berserker_Call_Actions takes nothing returns nothing
	local location liD=GetUnitLoc(GetTriggerUnit())
	local group lEw
	local trigger ltt=CreateTrigger()
	local unit lrs=GetSpellAbilityUnit()
	call SetHandle(H2Tx(ltt),"Axe",GetTriggerUnit())
	call TriggerRegisterAnyUnitEventBJ(ltt,EVENT_PLAYER_UNIT_ISSUED_TARGET_ORDER)
	call TriggerRegisterAnyUnitEventBJ(ltt,EVENT_PLAYER_UNIT_ISSUED_POINT_ORDER)
	call TriggerRegisterAnyUnitEventBJ(ltt,EVENT_PLAYER_UNIT_ISSUED_ORDER)
	call TriggerAddCondition(ltt,Condition(function Berserker_Call_Buff))
	call TriggerAddAction(ltt,function Berserker_Call_Aim)
	call PolledWait(.2)
	call CreateNUnitsAtLocFacingLocBJ(1,'e00E',GetOwningPlayer(GetTriggerUnit()),liD,liD)
	call RemoveLocation(liD)
	call UnitAddAbility(bj_lastCreatedUnit,'A0E1')
	call SetUnitAbilityLevelSwapped('A0E1',bj_lastCreatedUnit,GetUnitAbilityLevel(lrs,'A0C7'))
	call IssueTargetOrderById(bj_lastCreatedUnit,OrderId("innerfire"),GetTriggerUnit())
	set liD=GetUnitLoc(lrs)
	set lEw=GetUnitsInRangeOfLocMatching(550.,liD,Condition(function Berserker_Call_OrderFilter))
	set udg_u_DTAX_temp=lrs
	call ForGroupBJ(lEw,function Berserker_Call_Caster)
	call RemoveLocation(liD)
	call DestroyGroup(lEw)
	call PolledWait(1+.5*GetUnitAbilityLevel(lrs,'A0C7'))
	set lEw=GetUnitsInRectMatching(bj_mapInitialPlayableArea,Condition(function Berserker_Call_CreepVictim))
	call ForGroupBJ(lEw,function Berserker_Call_CreepAttack)
	call DestroyGroup(lEw)
	call FastFlush(H2Tx(ltt))
	call TriggerClearActions(ltt)
	call DestroyTriggerEx(ltt)
endfunction

function StartTrigger_Berserker_Call takes nothing returns nothing
	set gg_trg_Berserker_Call=CreateTrigger()
	call TriggerRegisterAnyUnitEventBJ(gg_trg_Berserker_Call,EVENT_PLAYER_UNIT_SPELL_EFFECT)
	call TriggerAddCondition(gg_trg_Berserker_Call,Condition(function Trig_Berserker_Call_Conditions))
	call TriggerAddAction(gg_trg_Berserker_Call,function Trig_Berserker_Call_Actions)
endfunction
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
Damn that code needs some remakes and i would be using structs tyvm.
 

Rainther

I guess I should write something of value here...
Reaction score
61
That's converted and only confusing. By building a trigger from stratch is the best way to make the trigger more smooth and not this confusing as mentioned.
 

Gtam

Lerning how to write and read!! Yeah.
Reaction score
164
Yes i would just use KT2 with structs to run a function and order then to attack
 

Kuberr24

Well-Known Member
Reaction score
28
I did not make it, this is copied/pasted directly from dota 6.xx open source.

dota uses local handle vars and dynamic triggers/Timers all the time.


Although it indeed lacks "a clean look" it gets the job done, for over 2 years now :)
 
General chit-chat
Help Users
  • No one is chatting at the moment.
  • 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
  • Ghan Ghan:
    Heard Houston got hit pretty bad by storms last night. Hope all is well with TH.
  • The Helper The Helper:
    Power back on finally - all is good here no damage
    +2
  • V-SNES V-SNES:
    Happy Friday!
    +1

      The Helper Discord

      Staff online

      • Ghan
        Administrator - Servers are fun

      Members online

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top