AI for boss creeps?

LearningCode

New Member
Reaction score
24
Yea..
I've grown out of the Wintermaul-Terrain for my map -___-

I made my own terrain that suits this Hero Survival game I am making, lol.
I am making every round a boss round.

As in, The creeps come in groups with units supporting each other.
Like, a bunch of shackle-casters surrounded by healers and brutes is Level 1.

The problem is, I have no idea where to begin when it comes to creep AI.

I want to make it like this:
1) When creeps are spawned, order Shackle-casters to cast AerialShackles on nearest enemy unit.
2) When an enemy unit has the buff "Shackled", order all nearby brutes to attack Shackled unit.
3) When a unit is damaged, order the healers to heal damaged unit (This one is easy, auto-cast heal, lol)
4) If AerialShackles is not on cooldown for a unit and an enemy unit is attacking a healer, order the unit to cast AerialShackles on the attacking unit

It seems simple enough, but I have no idea how to do it.
Looking for guidance, lol.

(Hopefully, this will be the first and last time I ask for AI help)
 

avalya

New Member
Reaction score
37
Well,

1: Every 1 seconds of game time, pick every unit in playable map area that is that type of unit (the shackle-caster), then pick a random enemy (your friend that'd be) unit around it and order it to cast shackle.
2: A unit starts channeling an ability, if that ability is shackle then pick every nearby unit of type brute, order them to attack the targeted unit.
3: Yeah, auto-cast works just fine, remember to have it enabled (I think it is the first field in the object editor, where you can choose a spell to be auto-cast).
4: A unit is attacked, unit type of attacked unit is healer, pick every nearby friendly unit of type shackle-caster and if the target does not have the shackle buff, order it to shackle the attacker (thus multiple units won't cast shackle).
 

LearningCode

New Member
Reaction score
24
Oh..
I was thinking I'd have to use the AI-editor xD

I should have used this instead -___-
tyvm =)
 

avalya

New Member
Reaction score
37
AI pretty much only works for melee maps as far as I can recall, triggering creeps to cast spells is the best way, I've had creeps cast spells using spellbooks in the past though, but I haven't tried it in recent days, it worked fine, but triggering for specific occasions is probably the best way.
 

Nenad

~Choco Coronet~ Omnomnom
Reaction score
137
As far as i know, the only ability AI can have problems with is channel, but if it's ai then you can be a bit :rolleyes: since they actually don't have to own any abilities, like for example:

Trigger:
  • Fire Blast
    • Events
      • Unit - A unit Is attacked
    • Conditions
      • (Unit-type of (Attacking unit)) Equal to Demon Lord
    • Actions
      • Set FireblastInt = (FireblastInt + 1)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (FireblastInt Greater than or equal to 7) and ((Mana of (Attacking unit)) Greater than or equal to 180.00)
        • Then - Actions
          • Unit - Set mana of (Attacking unit) to ((Mana of (Attacking unit)) - 180.00)
          • Animation - Play Demon Lord 0011 <gen>'s Spell animation
          • Set TempPoint = (Position of (Attacking unit))
          • Set TempGroup = (Units within 600.00 of (Position of (Attacking unit)) matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of (Attacking unit))) Equal to True)))
          • For each (Integer A) from 1 to 3, do (Actions)
            • Loop - Actions
              • Set TempUnit = (Random unit from TempGroup)
              • Set TempPoint2 = (Position of TempUnit)
              • Unit - Create 1 Dummy for (Owner of (Attacking unit)) at TempPoint facing Default building facing degrees
              • Unit - Add Flame Strike to (Last created unit)
              • Unit - Add a 2.00 second Generic expiration timer to (Last created unit)
              • Unit - Order (Last created unit) to Human Blood Mage - Flame Strike TempPoint2
              • Unit Group - Remove TempUnit from TempGroup
              • Custom script: call RemoveLocation(udg_TempPoint2)
          • Set FireblastInt = 0
          • Custom script: call RemoveLocation(udg_TempPoint)
          • Custom script: call DestroyGroup(udg_TempGroup)
        • Else - Actions


It's a little spell i made, that seems to be cast at random to normal players, even reduces the mana, and the unit makes no effort at all ^^
 

Nenad

~Choco Coronet~ Omnomnom
Reaction score
137
The ability doesn't even exist, it's once every 7 attacks to make it seem random ^^ the only thing that exists is the dummy and the dummy abilities xD
 

avalya

New Member
Reaction score
37
Yeah I know, didn't see it was an attack count ability, well, you can abuse that, which is not too good. :p
 

tooltiperror

Super Moderator
Reaction score
231
Trigger:
  • Unit - A unit Is attacked


Not a reliable event.
 

avalya

New Member
Reaction score
37
Yeah, damage detection is much better, but it works for LearningCode's request there, since he only needs to see if a unit is attacked and not damaged to issue the order.
 

Nenad

~Choco Coronet~ Omnomnom
Reaction score
137
Yeah, damage detection is much better, but it works for LearningCode's request there, since he only needs to see if a unit is attacked and not damaged to issue the order.

Not necesseraly, damage detection will fire off even off spells, when he fires of his spells, hence this will fire off more times than needed, goes for everything.
Why is it unreliable? I want a detailed explanation if you please, not just It's better. ^^
 

Nenad

~Choco Coronet~ Omnomnom
Reaction score
137
What's a BJ? xD And it's no problem, it activates as it should: Randomly ^^
 

tooltiperror

Super Moderator
Reaction score
231
BJ = Blizzard JASS.

JASS:
function TriggerRegisterAnyUnitEventBJ takes trigger trig, playerunitevent whichEvent returns nothing
    local integer index

    set index = 0
    loop
        call TriggerRegisterPlayerUnitEvent(trig, Player(index), whichEvent, null)

        set index = index + 1
        exitwhen index == bj_MAX_PLAYER_SLOTS
    endloop
endfunction


If you look at this, it does a ton of things, just to add an event to a trigger. You could just use one line from there to optimize the trigger.

Actually, I stand corrected, I`m fairly certain that the event is not a BJ, that was a mistake on my part, however I`m fairly certain it calls a native, which bugs.
 

avalya

New Member
Reaction score
37
It's actually not random at all, every time you start an attack, you get an additional charge, thus it can be abused by the stop-attack bug. Damage detection system do fire off of spells, true, but if you trigger all your spell damage, and set a Boolean to false before you deal the damage and then set it back to true after, and the damage detection triggers are set to not trigger when the boolean is true, then it will only activate on attacks.
 

Nenad

~Choco Coronet~ Omnomnom
Reaction score
137
thus it can be abused by the stop-attack bug

I want to see the AI do this ^^

Anyway, i know what i made, and it was made just for the AI x)
 

avalya

New Member
Reaction score
37
Ah yeah that's true, got me there. But yeah, I thought it would be used by players as well, so meh. :)
 

Nenad

~Choco Coronet~ Omnomnom
Reaction score
137
Yep ^^

If it was a player controlled unit, using the attack function would be horrible, so you are right ^^
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      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