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

How to Ai buy tome?

Status
Not open for further replies.
Level 2
Joined
May 1, 2014
Messages
16
Hello,

I need help creating for my own map. I have few point to help needed. Map about me with 2 insane and opposite side enemy 9 insane. Its still melee map so computer make base. But i play only one here and taking advantage myself buying tome and items. My problem is

1) I want my to ally always build same heroes like
Undead 1.Arthas 2.Lich 3.Pitlord
Orc Far Seer, Tauren Chieftain, Beast Master
But Ai build random hero from Altar. I want Ai build my choices. And if possible each player can pick 4 heros.

2)I try to Ai buy tomes with their money. Example if Player 2 have 15k money can buy 14k tome so if computer players have more then 1k thay should spend money to buying tomes. If thay only can buy tome of knowlage also okay for me. There is another problem i recognize i dont know how to describe "give tome player 2 first hero" or "give tome player 3 Death knight". I checked posts here but cant find to answer sadly.

3)My last question about skills. I find templete like Dota huskar if life lost its giving extra damage and attack speed. Can we add if life lost giving extra str , agility, intelligence and armor with % life lost? in to map I shared?

Ps: I don't know how to copy it from the forum and transfer it to my map. I am not a native speaker of English sorry for that.

Thanks
 

Attachments

  • (12)IceCrown.w3x
    350.3 KB · Views: 4
Level 18
Joined
Mar 16, 2008
Messages
721
There may be a way to get an AI script to actually spam tomes but it's way beyond my understanding. The AI will sometimes buy items if that "init" option is part of its script. However if you really want it to spam tomes, I think the best option would be to transfer ownership to a separate computer player and then order that hero to buy tomes depending on what type of hero it is.

The trigger that will do this is:
  • Custom script: call IssueNeutralImmediateOrderById(Player(0), udg_vendor_variable, 'tdex')
so the 3 parameters in that piece of code are (owner of hero buying item, specific vendor unit, item type)

you could do something as simple as when the hero comes in range of the tome vendor and has enough money, then it fires this trigger. I think you would want to change the ownership of the hero because if you don't, the AI might spaz out and crash the game.

The trigger that I made for my map orders the unit to run to the vendor and also sell items, and upgrade items in scheme specific to my map, pick up any other items that heroes dropped near the vendor, and if any gold remains it will buy tomes depending on the hero's unit type. I don't intend to overwhelm you but here's that trigger:
  • AI Red Enchant pt1
    • Events
      • Unit - A unit enters Red king Stay in <gen>
    • Conditions
      • (Entering unit) Equal to Red_Prince
      • fifteen_min Equal to True
      • (Player 1 (Red) Current gold) Greater than 10000
      • (Owner of Red_Prince) Not equal to Neutral Passive
      • ((Strength of Red_Prince (Include bonuses)) + ((Agility of Red_Prince (Include bonuses)) + (Intelligence of Red_Prince (Include bonuses)))) Less than 750
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Player 1 (Red) Current gold) Greater than 20000
              • (Item: (Item carried by Red_Prince in slot 1)'s Integer Field: Level ('ilev')) Equal to 6
              • (Item: (Item carried by Red_Prince in slot 2)'s Integer Field: Level ('ilev')) Equal to 6
              • (Item: (Item carried by Red_Prince in slot 3)'s Integer Field: Level ('ilev')) Equal to 6
              • (Item: (Item carried by Red_Prince in slot 4)'s Integer Field: Level ('ilev')) Equal to 6
              • (Item: (Item carried by Red_Prince in slot 5)'s Integer Field: Level ('ilev')) Equal to 6
              • (Item: (Item carried by Red_Prince in slot 6)'s Integer Field: Level ('ilev')) Equal to 6
              • (Item: (Item carried by Red_Prince in slot 1)'s Integer Field: Level ('ilev')) Equal to 7
              • (Item: (Item carried by Red_Prince in slot 2)'s Integer Field: Level ('ilev')) Equal to 7
              • (Item: (Item carried by Red_Prince in slot 3)'s Integer Field: Level ('ilev')) Equal to 7
              • (Item: (Item carried by Red_Prince in slot 4)'s Integer Field: Level ('ilev')) Equal to 7
              • (Item: (Item carried by Red_Prince in slot 5)'s Integer Field: Level ('ilev')) Equal to 7
              • (Item: (Item carried by Red_Prince in slot 6)'s Integer Field: Level ('ilev')) Equal to 7
        • Then - Actions
          • Countdown Timer - Start ench_timer[1] as a One-shot timer that will expire in 90.00 seconds
          • Trigger - Turn off AI Red Receive Gold <gen>
          • Unit - Change ownership of Red_Prince to Player 13 (Maroon) and Retain color
          • Unit - Order Red_Prince to Move To King_Vendor_Red
        • Else - Actions
  • AI Red Enchant pt2
    • Events
      • Unit - A unit enters Red Ftn <gen>
    • Conditions
      • (Entering unit) Equal to Red_Prince
      • (Owner of (Entering unit)) Equal to Player 13 (Maroon)
    • Actions
      • -------- ------------------------ --------
      • -------- PAWN ITEMS BELOW ILV 5 --------
      • -------- ------------------------ --------
      • For each (Integer integer_A_red_prince) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • (Item: (Item carried by Red_Prince in slot integer_A_red_prince)'s Integer Field: Level ('ilev')) Less than 5
            • Then - Actions
              • Set VariableSet pawn_item_red = (Item carried by Red_Prince in slot integer_A_red_prince)
              • Custom script: call UnitDropItemTarget(udg_Red_Prince, udg_pawn_item_red, udg_king_library[1])
              • Wait 1.00 seconds
              • Set VariableSet pawn_item_red = No item
            • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Red Ftn <gen> contains Red_King) Equal to True
        • Then - Actions
          • Unit - Change ownership of Red_King to Player 1 (Red) and Retain color
          • Trigger - Turn on AI Red Receive Gold <gen>
          • Skip remaining actions
        • Else - Actions
      • -------- ------------------------ --------
      • -------- ORBS and SHARDS --------
      • -------- ------------------------ --------
      • For each (Integer integer_A_red_prince) from 1 to 6, do (Actions)
        • Loop - Actions
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • Or - Any (Conditions) are true
                • Conditions
                  • And - All (Conditions) are true
                    • Conditions
                      • (Item-type of (Item carried by Red_Prince in slot integer_A_red_prince)) Equal to Artifact Shard
                      • (artifact_red is owned) Equal to True
                  • (Item-type of (Item carried by Red_Prince in slot integer_A_red_prince)) Equal to Royal Orb of Fire
                  • (Item-type of (Item carried by Red_Prince in slot integer_A_red_prince)) Equal to Royal Orb of Water
                  • (Item-type of (Item carried by Red_Prince in slot integer_A_red_prince)) Equal to Royal Orb of Wind
                  • (Item-type of (Item carried by Red_Prince in slot integer_A_red_prince)) Equal to Royal Orb of Ice
            • Then - Actions
              • Hero - Drop (Item carried by Red_Prince in slot integer_A_red_prince) from Red_Prince.
            • Else - Actions
      • -------- ------------------------ --------
      • -------- UNCOMMONS --------
      • -------- ------------------------ --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Item: (Item carried by Red_Prince in slot 1)'s Integer Field: Level ('ilev')) Equal to 6
              • (Item: (Item carried by Red_Prince in slot 2)'s Integer Field: Level ('ilev')) Equal to 6
              • (Item: (Item carried by Red_Prince in slot 3)'s Integer Field: Level ('ilev')) Equal to 6
              • (Item: (Item carried by Red_Prince in slot 4)'s Integer Field: Level ('ilev')) Equal to 6
              • (Item: (Item carried by Red_Prince in slot 5)'s Integer Field: Level ('ilev')) Equal to 6
              • (Item: (Item carried by Red_Prince in slot 6)'s Integer Field: Level ('ilev')) Equal to 6
        • Then - Actions
          • For each (Integer integer_A_red_prince) from 1 to 6, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item: (Item carried by Red_Prince in slot integer_A_red_prince)'s Integer Field: Level ('ilev')) Not equal to 6
                • Then - Actions
                  • Set VariableSet dropped_items_red_prince[integer_A_red_prince] = (Item carried by Red_Prince in slot integer_A_red_prince)
                  • Unit - Order Red_Prince to drop dropped_items_red_prince[integer_A_red_prince] at King_Vendor_Red
                  • Wait 0.50 seconds
                • Else - Actions
          • For each (Integer integer_A_red_prince) from 1 to 6, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item: (Item carried by Red_Prince in slot integer_A_red_prince)'s Integer Field: Level ('ilev')) Equal to 6
                  • (Player 1 (Red) Current gold) Greater than 1250
                • Then - Actions
                  • Player - Add 1250 to Player 13 (Maroon).Current gold
                  • Player - Add -1250 to Player 1 (Red).Current gold
                  • Wait 1.00 seconds
                  • Custom script: call IssueNeutralImmediateOrderById(Player(12), udg_king_library[1], 'I015')
                  • Wait 2.00 seconds
                • Else - Actions
          • For each (Integer integer_A_red_prince) from 1 to 6, do (Actions)
            • Loop - Actions
              • Hero - Give dropped_items_red_prince[integer_A_red_prince] to Red_Prince
          • For each (Integer integer_A_red_prince) from 1 to 6, do (Actions)
            • Loop - Actions
              • Set VariableSet dropped_items_red_prince[integer_A_red_prince] = No item
          • Wait 1.00 seconds
        • Else - Actions
      • -------- ------------------------ --------
      • -------- ------RARES------ --------
      • -------- ------------------------ --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • Or - Any (Conditions) are true
            • Conditions
              • (Item: (Item carried by Red_Prince in slot 1)'s Integer Field: Level ('ilev')) Equal to 7
              • (Item: (Item carried by Red_Prince in slot 2)'s Integer Field: Level ('ilev')) Equal to 7
              • (Item: (Item carried by Red_Prince in slot 3)'s Integer Field: Level ('ilev')) Equal to 7
              • (Item: (Item carried by Red_Prince in slot 4)'s Integer Field: Level ('ilev')) Equal to 7
              • (Item: (Item carried by Red_Prince in slot 5)'s Integer Field: Level ('ilev')) Equal to 7
              • (Item: (Item carried by Red_Prince in slot 6)'s Integer Field: Level ('ilev')) Equal to 7
        • Then - Actions
          • For each (Integer integer_A_red_prince) from 1 to 6, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item: (Item carried by Red_Prince in slot integer_A_red_prince)'s Integer Field: Level ('ilev')) Not equal to 7
                • Then - Actions
                  • Set VariableSet dropped_items_red_prince[integer_A_red_prince] = (Item carried by Red_Prince in slot (Integer A))
                  • Unit - Order Red_Prince to drop dropped_items_red_prince[integer_A_red_prince] at King_Vendor_Red
                  • Wait 0.50 seconds
                • Else - Actions
          • For each (Integer integer_A_red_prince) from 1 to 6, do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item: (Item carried by Red_Prince in slot integer_A_red_prince)'s Integer Field: Level ('ilev')) Equal to 7
                  • (Player 1 (Red) Current gold) Greater than 2750
                • Then - Actions
                  • Player - Add 2750 to Player 13 (Maroon).Current gold
                  • Player - Add -2750 to Player 1 (Red).Current gold
                  • Wait 1.00 seconds
                  • Custom script: call IssueNeutralImmediateOrderById(Player(12), udg_king_library[1], 'I007')
                  • Wait 2.00 seconds
                • Else - Actions
          • For each (Integer integer_A_red_prince) from 1 to 6, do (Actions)
            • Loop - Actions
              • Hero - Give dropped_items_red_prince[integer_A_red_prince] to Red_Prince
          • For each (Integer integer_A_red_prince) from 1 to 6, do (Actions)
            • Loop - Actions
              • Set VariableSet dropped_items_red_prince[integer_A_red_prince] = No item
          • Wait 1.00 seconds
        • Else - Actions
      • -------- ------------------------ --------
      • -------- PICK UP EPICS --------
      • -------- ------------------------ --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of items carried by Red_Prince) Less than 6
        • Then - Actions
          • Item - Pick every item in Red Ftn <gen> and do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Item-type of (Picked item)) Not equal to Page of Royal Literature
                  • Or - Any (Conditions) are true
                    • Conditions
                      • (Item: (Picked item)'s Integer Field: Level ('ilev')) Equal to 6
                      • (Item: (Picked item)'s Integer Field: Level ('ilev')) Equal to 7
                      • (Item: (Picked item)'s Integer Field: Level ('ilev')) Equal to 8
                • Then - Actions
                  • Hero - Give (Picked item) to Red_Prince
                • Else - Actions
        • Else - Actions
      • -------- ------------------------ --------
      • -------- ------TOMES------ --------
      • -------- ------------------------ --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of Red_Prince) Equal to Royal Paladin
        • Then - Actions
          • For each (Integer integer_A_red_prince) from 1 to ((Player 1 (Red) Current gold) / 9000), do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Player 1 (Red) Current gold) Greater than 4500
                • Then - Actions
                  • Player - Add 4500 to Player 13 (Maroon).Current gold
                  • Player - Add -4500 to Player 1 (Red).Current gold
                  • Wait 1.00 seconds
                  • Custom script: call IssueNeutralImmediateOrderById(Player(12), udg_king_library[1], 'tstr')
                  • Wait 1.00 seconds
                • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of Red_Prince) Equal to Royal Mage
        • Then - Actions
          • For each (Integer integer_A_red_prince) from 1 to ((Player 1 (Red) Current gold) / 9000), do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Player 1 (Red) Current gold) Greater than 4500
                • Then - Actions
                  • Player - Add 4500 to Player 13 (Maroon).Current gold
                  • Player - Add -4500 to Player 1 (Red).Current gold
                  • Wait 1.00 seconds
                  • Custom script: call IssueNeutralImmediateOrderById(Player(12), udg_king_library[1], 'tint')
                  • Wait 1.00 seconds
                • Else - Actions
        • Else - Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Unit-type of Red_Prince) Equal to Royal Warrior
        • Then - Actions
          • For each (Integer integer_A_red_prince) from 1 to ((Player 1 (Red) Current gold) / 9000), do (Actions)
            • Loop - Actions
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Player 1 (Red) Current gold) Greater than 4500
                • Then - Actions
                  • Player - Add 4500 to Player 13 (Maroon).Current gold
                  • Player - Add -4500 to Player 1 (Red).Current gold
                  • Wait 1.00 seconds
                  • Custom script: call IssueNeutralImmediateOrderById(Player(12), udg_king_library[1], 'tdex')
                  • Wait 1.00 seconds
                • Else - Actions
        • Else - Actions
      • Countdown Timer - Pause ench_timer[1]
      • Unit - Change ownership of Red_Prince to Player 1 (Red) and Retain color
      • Trigger - Turn on AI Red Receive Gold <gen>
 
Level 2
Joined
May 1, 2014
Messages
16
Hello

i am sorry asking to this but how can i copy paste your gui to my map?
in site i search word with "copy paste" but cant show proper result.
 
Level 18
Joined
Mar 16, 2008
Messages
721
copying from the forums won't work because it's just text. you could download my map and copy this trigger but i'd suggest just recreating the trigger for your map, it probably won't need to be this complicated. i posted this as more of an example. make sense?

This is not a setting you can just add to the AI script to make it buy tomes in a smart way. this is more of a manual trigger workaround.

figure out how you want to implement this type of trigger. like do you want this to fire each time the hero comes within range of the tome vendor?
 
Last edited:
Status
Not open for further replies.
Top