• 🏆 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!

A.I. GUI Ability Points

Status
Not open for further replies.
Level 7
Joined
May 21, 2009
Messages
289
Hey everyone,

I was making my own A.I. system for a Dota style map today and ran across a problem.The A.I. have been programmed to smartly attack, and attempt to run in dangerous situations. They can also randomly select a hero and the lane they will spawn at.

When fighting however, they do not use their abilities, at all. Usually the computers use their abilities "when they need them" but they just aren't using them at all.

So I attempted to create a GUI trigger that randomly distributes points to the heroes, because I think they aren't putting points into abilities. I can't seem to get it to "randomly" put points in, only select a single ability at a time to use the point with.

I would appreciate any help in trying to create this trigger. Also, if it is not possible, that would be nice to know :p

Thx
Blood
 
  • Actions
    • -------- Oh really? --------
    • Set Random_integer = (Random integer number between 1 and 3)
    • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
      • If - Conditions
        • Random_integer Equal to 1
      • Then - Actions
        • -------- So, it is random like this --------
        • Hero - Learn skill for (Triggering unit): Human Archmage - Blizzard
      • Else - Actions
        • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
          • If - Conditions
            • Random_integer Equal to 2
          • Then - Actions
            • -------- And just copy the If/Then/Else etc. --------
            • Hero - Learn skill for (Triggering unit): Human Archmage - Summon Water Elemental
          • Else - Actions
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
I did something like this in this thread which had a similar issue.

So basically, you could use a hashtable to store the ability ids (value) to a unit type id (parent key). Then when you're trying to make the AI learn the skill, use the unit type id of the hero to get a skill it can learn. The child key, aka the numbers like 0-3, can help you with randomization.
 

Vunjo

Hosted Project: SC
Level 14
Joined
Jul 1, 2010
Messages
1,340
When some systems don't work, you have to do it manually, with 9999 triggers XD
Anyway, what GhostThruster said, that is teh way to do it, the only easier way would be adding units and spells to variables. Also, why do you need random abilities? As far as I know, DotA is not using random abilities, cause it would be kinda weard, and n00bish, if a bot takes the "stun" ability at level 10....
 
Level 7
Joined
May 21, 2009
Messages
289
I did something like this in this thread which had a similar issue.

So basically, you could use a hashtable to store the ability ids (value) to a unit type id (parent key). Then when you're trying to make the AI learn the skill, use the unit type id of the hero to get a skill it can learn. The child key, aka the numbers like 0-3, can help you with randomization.

So if I duplicated that GUI and copied and pasted that JASS it would work for what I want? It seems to be a generic trigger.
 
Level 14
Joined
Nov 18, 2007
Messages
1,084
The first trigger would store the ability ids to a unit-type id.
Ignore the second trigger.

So if you stored the ability ids correctly, you should be able to make the hero learn a random skill with something like this:
  • Custom script: call SelectHeroSkill(udg_TempUnit,LoadInteger(udg_HeroAbility,GetUnitTypeId(udg_TempUnit),GetRandomInt(0,3)))
  • udg_TempUnit refers to the hero that you're trying to learn the skill for.
  • udg_HeroAbility is the hashtable that stores the information.
  • GetRandomInt(0,3) is used to make learning the skills random.
 
Level 7
Joined
May 21, 2009
Messages
289
'H000' refers to the raw id of a hero. --------
-------- The numbers (0-3) are to store the ability in a different place. (They'll also be used for looping when you learn the skills for the illusion.) --------
-------- 'A000' is an ability that a hero has. --------
Custom script: call SaveInteger(udg_HeroAbility, 'H000', 0, 'A000')
Custom script: call SaveInteger(udg_HeroAbility, 'H000', 1, 'A001')
Custom script: call SaveInteger(udg_HeroAbility, 'H000', 2, 'A002')
Custom script: call SaveInteger(udg_HeroAbility, 'H000', 3, 'A003')

So the "H000" and such is the raw data correct? (ctrl + D)? So I'm going to have more than 4 digits for custom spells and units right? Because it always makes something like L###:L###
 
Level 7
Joined
May 21, 2009
Messages
289
Actions
-------- Oh really? --------
Set Random_integer = (Random integer number between 1 and 3)
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Random_integer Equal to 1
Then - Actions
-------- So, it is random like this --------
Hero - Learn skill for (Triggering unit): Human Archmage - Blizzard
Else - Actions
If (All Conditions are True) then do (Then Actions) else do (Else Actions)
If - Conditions
Random_integer Equal to 2
Then - Actions
-------- And just copy the If/Then/Else etc. --------
Hero - Learn skill for (Triggering unit): Human Archmage - Summon Water Elemental
Else - Actions

For this - What happens if the AI has already maxed his level in that ability? Will the AI learn nothing and keep the point?
 
Status
Not open for further replies.
Top