• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Need help with Computer Casting Spells

Status
Not open for further replies.
Level 7
Joined
Jul 20, 2009
Messages
295
How to make a unit to cast spells on its targets from time to time. (A spell that is not auto cast.)

e.g. Mountain King casts Storm Bolt on his targets at a random time between 8-12 seconds. (The Mountain King is owned by a computer)

Or do I have to use an auto cast spell then trigger it to whenever the unit uses this spell, to make it cast the spell I want.
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
It is called as AI Triggering
Example:
  • TAI INIT
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set AI_Location = (Position of Mountain King 0005 <gen>)
      • Set RandomTarget = (Units within 600.00 of AI_Location matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of Mountain King 0005 <gen>)) Equal to True)))
      • Unit Group - Pick every unit in (Random 1 units from RandomTarget) and do (Actions)
        • Loop - Actions
          • Unit - Order Mountain King 0005 <gen> to Human Mountain King - Storm Bolt (Picked unit)
      • Custom script: call RemoveLocation(udg_AI_Location)
      • Custom script: call DestroyGroup(udg_RandomTarget)
Test map attached.
The test map shows 1 hero (enemy unit) that will cast Storm Bolt once every 5 seconds, to random enemy unit around 600 AOE.
If you want a random-time cast, you can change the value at "Event" value over there, by going to "Math - Random Number"
 

Attachments

  • Triggered AI.w3x
    13.1 KB · Views: 77
Level 7
Joined
Jul 20, 2009
Messages
295
It is called as AI Triggering
Example:
  • TAI INIT
    • Events
      • Time - Every 5.00 seconds of game time
    • Conditions
    • Actions
      • Set AI_Location = (Position of Mountain King 0005 <gen>)
      • Set RandomTarget = (Units within 600.00 of AI_Location matching ((((Matching unit) is alive) Equal to True) and (((Matching unit) belongs to an enemy of (Owner of Mountain King 0005 <gen>)) Equal to True)))
      • Unit Group - Pick every unit in (Random 1 units from RandomTarget) and do (Actions)
        • Loop - Actions
          • Unit - Order Mountain King 0005 <gen> to Human Mountain King - Storm Bolt (Picked unit)
      • Custom script: call RemoveLocation(udg_AI_Location)
      • Custom script: call DestroyGroup(udg_RandomTarget)
Test map attached.
The test map shows 1 hero (enemy unit) that will cast Storm Bolt once every 5 seconds, to random enemy unit around 600 AOE.
If you want a random-time cast, you can change the value at "Event" value over there, by going to "Math - Random Number"

Now you see, the Mountain King will Storm Bolt a random unit which is not something I want, I want the Mountain King to do that spell to a unit that he is attacking.
E.g. Footman + Knight are attacking the Mountain King, the Mountain King attacks the Footman, while he is attacking he keeps using Storm Bolt until he dies then he starts attacking the Knight and keeps casting Storm Bolt on the Knight until the Knight dies.

Shadow Strike and Entangle are used automaticallytheres nothing you need to do.

Hmm, I'll check it out but one question, how do you know if any spell is auto casted or if it is casted under certain circumstances?
 
Level 7
Joined
Jul 20, 2009
Messages
295
Like this ?

EDIT:
CHANGE MAP

Nice, but the version i was asking for was simplified, and I need something like this: Create units, and these units will cast a spell to their targets and they are not preplaced in game.

In other words, they are multiple of units, Knight, Footman, Sorceress that attacks + casts spells to their targets and they are created through trigger, not preplaced.

Are you able to create a trigger for me to do this?
 
Level 33
Joined
Mar 27, 2008
Messages
8,035
Nice, but the version i was asking for was simplified, and I need something like this: Create units, and these units will cast a spell to their targets and they are not preplaced in game.

Are you able to create a trigger for me to do this?

This "unit" preferably called as, "dummy" ?
When the owner of the dummy attacks a unit, well, create the dummy and cast spell until the target dies, right ?

So, 2 different unit ?
1. Master / Dummy
2. Master attacks a unit
3. Creates Dummy and order Dummy to cast spell
4. Target dies = Trigger off
Is that it ?
 
Level 7
Joined
Jul 20, 2009
Messages
295
This "unit" preferably called as, "dummy" ?
When the owner of the dummy attacks a unit, well, create the dummy and cast spell until the target dies, right ?

So, 2 different unit ?
Master / Dummy
Master attacks a unit
Creates Dummy and order Dummy to cast spell
Target dies = Trigger off
Is that it ?

Kind of, I wanted it more like the unit itself casts the spells, let me explain it in more detail.

-Create 4 Footman, 2 Knight, 3 Sorceress Every 30 seconds
-All Footmen uses the ability Storm Bolt to the units they are attacking every 5-8 seconds.
-All Knights uses the ability Holy Light to their ally units every 10-12 seconds.
-All Sorceress uses the ability Entangling Roots to the units they are attacking every 5-8 seconds.
 
Status
Not open for further replies.
Top