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

[General] Market and Pet System Help

Status
Not open for further replies.
Level 7
Joined
Nov 6, 2019
Messages
186
First Things, I wanna add 2 Systems to a Map, 1 of them isnt as important to add, it just for fun.

1. Pet System - 100% Want
a. Cosmetic Does 0 Damage Just Follows You
b. Only Have a Pet When Holding a Pet Item, But if no pet item in inv, no pet basically.
c. This i think is possible, it spawns pet when u obtain the item, and despawns it when u drop the item, but making it follow you always and have no clip and invul, so cant die or get stuck i dunno how, Basically Locust Ability, And Follow Always.
d. Also not sure how to sort it if u go into a building Garrisoning it, then coming out, it despawns pet then respawns it when u come back out.

I think I know how to possibly do this, but expert help don’t hurt in case I don’t and do it wrong
Got Pte System Somewhat Working, but doesnt remove the pet from game if they use a goldmine.
Got it to remove entering a transport, but nt a goldmine, and dont got it to spawn back when u leave a transport

2. Market System - Not Important just wanna know if it possible and if so how.
a. Type -Market opens Market with 2 Options Buy and Sell
b. Limit to each play can have 1 item in the market.
c. They can choose how much selling it for eg. 100 Market Points
d. Buy Opens a Dialog System, showing u which each 7 play has for sale, when u click u confirm buy and it auto transfers to you Hero.
e. Sell Opens a option 1 to six to choose what slot, then u can choose the price, then shows up in buy options, Removing from your inv.
f. Now be good if was pictures showing the item, like i seen some hero menus that do.

So is Market Possible if so How, and Pet System 100% want is that possible, and How.

Been away from coding a long time so i dont remember much.
 
Last edited:

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,544
For the Pet System you can use a Periodic trigger to check the distance between a Pet and it's Owner. This way if the Pet is ever too far away it'll teleport back to you. You can also check if the Pet Owner is Hidden or not and make the Pet mimic this state.
  • Pet Loop
    • Events
      • Time - Every 1.00 seconds of game time
    • Conditions
    • Actions
      • Unit Group - Pick every unit in PetOwners and do (Actions)
        • Loop - Actions
          • Set VariableSet CV = (Custom value of (Picked unit))
          • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
            • If - Conditions
              • ((Picked unit) is hidden) Equal to True
            • Then - Actions
              • Unit - Hide Pet[CV]
            • Else - Actions
              • Unit - Unhide Pet[CV]
              • Set VariableSet PetPoint[0] = (Position of (Picked unit))
              • Set VariableSet PetPoint[1] = (Position of Pet[CV])
              • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
                • If - Conditions
                  • (Distance between PetPoint[0] and PetPoint[1]) Greater than or equal to 600.00
                • Then - Actions
                  • Unit - Move Pet[CV] instantly to PetPoint[0]
                • Else - Actions
              • Custom script: call RemoveLocation (udg_PetPoint[0])
              • Custom script: call RemoveLocation (udg_PetPoint[1])
              • Unit - Order Pet[CV] to Follow (Picked unit)
      • -------- --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • (Number of units in PetOwners) Equal to 0
        • Then - Actions
          • Trigger - Turn off (This trigger)
        • Else - Actions
This design assumes that you can only have 1 Pet active at a time and uses a Unit Indexer to link the Hero to their Pet. When a Hero acquires a Pet Item you would add them to the PetOwners unit group and remove them when they lose the item.

I recommend giving the Pets the Locust ability but if you want them to be selectable then you could do this:
  • Unit - Turn collision for (Last created unit) Off.
  • Unit - Make (Last created unit) Invulnerable
I imagine the Pet will then need to be filtered out of many triggers though.


The Market System is possible up to a certain extent using a Hashtable and Dialog menus. Or you could rely on the custom UI that was introduced in 1.31. Search for Tasyen's posts to find out how it works, he is the UI expert and has many resources you can study/use. Note that custom UI requires Jass/Lua.
 
Last edited:
Status
Not open for further replies.
Top