• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

How can I make a shop sell an item to an AI unit?

Status
Not open for further replies.
Level 24
Joined
Jun 26, 2020
Messages
1,855
Hello, I was looking these threads:
And many more, but is not working:
I trying doing this:
Wurst:
print(IssueNeutralTargetOrderById(players[bot], shop, Orders.neutralinteract, h))
print(IssueNeutralImmediateOrderById(players[PLAYER_NEUTRAL_AGGRESSIVE]/*No matter what player I put*/, shop, HEALING_SALVE.getNewId()))
And prints me:
Code:
True
False
What can i do? Or I have to just emulate sell the items, because that was the other option I found.
 
Level 18
Joined
Oct 17, 2012
Messages
827
Be sure that your shop has the abilities:
  • [Apit] Shop Purchase Item
  • [Aneu] Select Hero
I use the following code to have my AI purchase items:
JASS:
call IssueTargetOrderById(shop, Orders.neutralinteract, HERO)
call IssueNeutralImmediateOrderById(GetUnitOwner(HERO), shop, item_id)
 
Level 24
Joined
Jun 26, 2020
Messages
1,855
Be sure that your shop has the abilities:
  • [Apit] Shop Purchase Item
  • [Aneu] Select Hero
I use the following code to have my AI purchase items:
JASS:
call IssueTargetOrderById(shop, Orders.neutralinteract, HERO)
call IssueNeutralImmediateOrderById(GetUnitOwner(HERO), shop, item_id)
They have
Wurst:
..setNormalAbilities(
    commaList(
        AbilityIds.neutralBuildinganyunit,
        AbilityIds.selectHero,
        AbilityIds.invulnerable,
        AbilityIds.shopSharingAlliedBldg,
        AbilityIds.shopPurchaseItem,
        'Asid', 'Asud'
    ))
 
Status
Not open for further replies.
Top