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

Custom melee AI script (random)

Status
Not open for further replies.
Level 3
Joined
Oct 5, 2016
Messages
53
Hello, I am very low on scripting skills so, I have to ask for help to create a trigger script. For example, I have 6 custom races. Each race has 4 different ai scripts, that uses different heroes (12 in sum). Now,what I want to do is to manage somehow ai picking a random custom race, then picking for that race random (1-4) specific ai script. And somehow make me able to pick a custom random race. Any help is appreciated since there is no chance I'm creating this myself.
 
Level 12
Joined
Jun 15, 2016
Messages
472
You can do that in a trigger that runs when the map starts, set some selection variable to a random number from 1-6, that will choose your custom race. Then set it again to a random number from 1 to for and use the action "AI - start melee AI script for player X: YourAI.ai".
 
Level 3
Joined
Oct 5, 2016
Messages
53
You can do that in a trigger that runs when the map starts, set some selection variable to a random number from 1-6, that will choose your custom race. Then set it again to a random number from 1 to for and use the action "AI - start melee AI script for player X: YourAI.ai".

I got your idea but my editor skills are so bad, I dont have a clue how to put all this in one piece. Maybe you could make a simple example map? i desperately need it.
 
Level 12
Joined
Jun 15, 2016
Messages
472
First, you'll need one trigger in to select a race at random. Now, I each custom race has some things which need changing with triggers as the game starts, so your race selection trigger will run those triggers as necessary (for instance if the random number is 3 your selection trigger will run the high elf race trigger).


  • Race Selection
    • Events
      • Map initialization
    • Conditions
    • Actions
      • Set RandomSelection = (Random integer number between 1 and 6)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomSelection Equal to 1
        • Then - Actions
          • Trigger - Run Custom Race 1 Init <gen> (ignoring conditions)
          • Skip remaining actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomSelection Equal to 2
        • Then - Actions
          • Trigger - Run Custom Race 2 Init <gen> (ignoring conditions)
          • Skip remaining actions
        • Else - Actions
      • -------- Copy and paste while changing each time the number you compare and the following trigger you run --------


Then, as part of the race initialization trigger you will select another random number, with which you'll choose your AI in the same way. So:



  • Custom Race 1 Init
    • Events
    • Conditions
    • Actions
      • -------- Race initialization trigger stuff --------
      • Set RandomSelection = (Random integer number between 1 and 4)
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomSelection Equal to 1
        • Then - Actions
          • AI - Start melee AI script for Player 1 (Red): RaceAI1.ai
          • Skip remaining actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • RandomSelection Equal to 2
        • Then - Actions
          • AI - Start melee AI script for Player 1 (Red): RaceAI2.ai
          • Skip remaining actions
        • Else - Actions
      • -------- Copy and paste while changing each time the number you compare and the AI you apply --------


Hope this clears things up a bit.[/trigger][/hidden]
 
Level 12
Joined
Jun 15, 2016
Messages
472
That's the hard part. Creating an entirely new custom race requires a lot of tweaking around the object editor, triggering and creating spells which can be run by multiple different units, and creating a working as.

If you want, there's this tutorial in the making about custom races: [Mapping] - Custom Race Creation: Advanced Mechanics.

I suggest you keep to doing more basic stuff before trying that. I know I won't touch that subject for a while.
 
Status
Not open for further replies.
Top