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

AI Improving Tier

Status
Not open for further replies.
Level 7
Joined
Oct 8, 2007
Messages
154
Hi, I have script which works for upgrading tier


  • bot ulepsza baze
    • Events
      • Time - Every 60.00 seconds of game time
    • Conditions
      • (Player 7 (Green) Current gold) Greater than or equal to 100
      • (Player 7 (Green) controller) Equal to Computer
    • Actions
      • Unit - Order Barracks 0001 <gen> to train/upgrade to a Upgraded Barracks
I selected Barracks 0001 from by selecting it from map, but what when bot already got "Upgraded Barracs" and I want him to order to upgrade further ?
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,190
This should be coded into the AI script, not the trigger script. The JASS AI interpreter has natives specifically aimed at doing this easily with minimal scripting effort.

If you have to use trigger script, you will have to create a much more advanced system. Firstly you will want to use a unit group to hold all Barracks type units (an equivalence class). You then pick one from the group depending on requirements (such as a random one) and then issue it the upgrade order. To resolve the correct upgrade order, you will need to use a data table to map the unit type to appropriate upgrade orders. Like I mentioned in another topic, if you are mapping a type to multiple values it become better to map a reference to the data in parallel arrays.
 
Level 7
Joined
Oct 8, 2007
Messages
154
So should it be a modification of this part of AI Script ???

JASS:
function BuildExpansion takes integer hallID, integer mineID returns nothing
    if (HallsCompleted(hallID)) then
        call SetBuildExpa( TownCount(hallID) + 1, mineID )
    endif
endfunction


Cause I'm using script generated by world editor and modified it a little bit but I don't exactly know how to make it fit my map :/
 

Dr Super Good

Spell Reviewer
Level 63
Joined
Jan 18, 2005
Messages
27,190
I think there is a tutorial on writing AI scripts for the JASS AI interpreter. Personally I have far less experience than I should on the subject with only ever making simple GUI AI.

Further more the AI system was completely changed for SC2 where strategic decisions are now run in the normal trigger engine so can be written and mixed as required. In WC3 they used the same basic interpreter but fed different native lists. Trying to run most AI natives in the standard trigger script will fatal error WC3.

This is just one of the many improvements with SC2 over WC3. There all you would need to do is in some trigger (maybe even periodic) to order the AI to build the best version of the barracks. It would then automatically resolve all requirements and seek to build them.
 
Status
Not open for further replies.
Top