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

[Solved] Global shop - target specific unit

Status
Not open for further replies.
Level 5
Joined
Jan 23, 2020
Messages
86
I have a global range shop set up to prevent the delay in shop activation when picking a shop patron (target).

What I need is, based on the ability being cast, to target a corresponding unit.
Item Shop (open shop) should select patron unit A
Item Shop (open shop stash) should select patron unit B.

There is two threads with the answer I need here: Solution 1 Solution 2. But I am not sure how to implement the order ID that was suggested...
constant native GetIssuedOrderId takes nothing returns integer

Anyway the order to change current shop target is 852566. It was listed here under...
constant integer ORDER_neutralinteract=852566
Selecting a unit to sell to is an order with an orderid (integer) but no orderstring.

Then you just need to order the shop to do that order on the unit you want to select. GUI will not let you use the order ID so you'll need to use one of the JASS functions for orders. I believe IssueNeutralTargetOrder(), though it could also be IssueTargetOrderById().

Current triggers:

  • Shop
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Item Shop (open shop)
    • Actions
      • Set VariableSet PN = (Player number of (Owner of (Triggering unit)))
      • Selection - Select PlayerShops[PN] for (Owner of (Triggering unit))
      • Custom script: call IssueTargetOrderById(udg_PlayerShops[udg_PN], 852566, udg_Player_Builder[udg_PN])
  • Shop Stash
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Item Shop (open shop stash)
    • Actions
      • Set VariableSet PN = (Player number of (Owner of (Triggering unit)))
      • Selection - Select PlayerShops[PN] for (Owner of (Triggering unit))
      • Custom script: call IssueTargetOrderById(udg_PlayerShops[udg_PN], 852566, udg_StashUnit[udg_PN])
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,558
This is the custom script you need to use:
Lua:
IssueNeutralTargetOrderById(forWhichPlayer, neutralStructure, unitId, target)
  • Custom script: call IssueNeutralTargetOrderById(udg_Player, udg_Shop, 852566, udg_Target)
I doubt it actually needs to be a Neutral structure but that may be the case.

The Select User button MUST be visible for this to work, so your Shop can't have more than 11 items.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,558
Actually, I solved this years ago, lol: [Solved] - Hiding the "Get User" ability from Shops WHILE retaining it's functionality

Here's an old Shop system I made if you're interested. It's only been tested in Singleplayer and with Neutral shops so I can't confirm if it will work properly if these things change. Anyway, it allows you to add Categories (Optional) and Pages to your Shop. I'm not sure how it handles Stock Replenish Time so that may be an issue.
 

Attachments

  • Uncle Shop System v.1.2 (1).w3x
    87.1 KB · Views: 17
Last edited:
Status
Not open for further replies.
Top