• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

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,928
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 19
Joined
Oct 17, 2012
Messages
860
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,928
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