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

Item need requisite to be purchased

Status
Not open for further replies.
Level 12
Joined
May 22, 2015
Messages
1,051
Have a check when they get the item. If they buy an item, it is one of these special items, and they are not of the correct level / don't have the ability, remove the item from the game and refund the money to the player.
 
Level 12
Joined
May 22, 2015
Messages
1,051
This will get a little more tricky then.

Is this from a shop that all players can buy from?

Anyway, my idea is this:
Use a dummy building for the shop. It doesn't do anything (except maybe select a unit to pretend to be a shop). When a player clicks this building, a new unit is selected (a building with no model so you cannot see it). The building that gets selected will be owned by the player who clicked on the dummy building. There will be one building per player.

The building that the player then selects will have dummy abilities that are locked (requires technology like an upgrade). Use dummy units as the required technology like:
Level X
Special Ability Name

It will appear on those abilities like:
Requires:
- Level X
- Special Ability Name

when the player gets to the level, you spawn the "Level X" unit for that player (a dummy unit with no model). When they learn the proper ability, you do the same for the "Special Ability Name" unit. When they have both, replace the player fake shop with a real shop that sells the items.

The item tooltips should match the dummy abilities' tooltips.

It's a lot of set up, but I think it will look nice in the end.
 
Level 9
Joined
Sep 20, 2015
Messages
385
This will get a little more tricky then.

Is this from a shop that all players can buy from?

Anyway, my idea is this:
Use a dummy building for the shop. It doesn't do anything (except maybe select a unit to pretend to be a shop). When a player clicks this building, a new unit is selected (a building with no model so you cannot see it). The building that gets selected will be owned by the player who clicked on the dummy building. There will be one building per player.

The building that the player then selects will have dummy abilities that are locked (requires technology like an upgrade). Use dummy units as the required technology like:
Level X
Special Ability Name

It will appear on those abilities like:
Requires:
- Level X
- Special Ability Name

when the player gets to the level, you spawn the "Level X" unit for that player (a dummy unit with no model). When they learn the proper ability, you do the same for the "Special Ability Name" unit. When they have both, replace the player fake shop with a real shop that sells the items.

The item tooltips should match the dummy abilities' tooltips.

It's a lot of set up, but I think it will look nice in the end.

Thank you, i'm going to try that way
 
This will get a little more tricky then.

Is this from a shop that all players can buy from?

Anyway, my idea is this:
Use a dummy building for the shop. It doesn't do anything (except maybe select a unit to pretend to be a shop). When a player clicks this building, a new unit is selected (a building with no model so you cannot see it). The building that gets selected will be owned by the player who clicked on the dummy building. There will be one building per player.

The building that the player then selects will have dummy abilities that are locked (requires technology like an upgrade). Use dummy units as the required technology like:
Level X
Special Ability Name

It will appear on those abilities like:
Requires:
- Level X
- Special Ability Name

when the player gets to the level, you spawn the "Level X" unit for that player (a dummy unit with no model). When they learn the proper ability, you do the same for the "Special Ability Name" unit. When they have both, replace the player fake shop with a real shop that sells the items.

The item tooltips should match the dummy abilities' tooltips.

It's a lot of set up, but I think it will look nice in the end.

This is a good idea and looks like it will work. Might be a bit tricky to code though.

I created an item class/refund system. It will refund the gold/lumber for a purchased item instantly and remove it if a condition is not met. So for example. A unit purchases Orb. If hero level is less than level 5, refund. A game message will display saying what ever you want. Here it might say, "Only level 5 heroes can purchase this Orb." I like SAUS's idea because it shows the disabled icon and "requirements." My system will let you write those requirements in the tooltip, but they will not appear disabled. Anyway, here it is.

Item refund system.w3x

SAUS, do you have a demo of this system you are talking about or is there one in the spells section? Because it would be pretty useful.


Initialize:
There is a dummy shop and a dummy buyer.

Event:
Everytime a unit buys an item, a trigger creates a duplicate item for the shop and orders the dummy buyer to buy it.
Now we get the item cost by checking the dummy buyer's gold. His "player starts with 10,000. What is left is the subtracted.
The difference is the cost of the item.

Checking:
Now it is just a simple set of if/then conditions.

The event will be a unit sells an item (shop).
Now we check for whatever conditions we want.
Examples:
  • Who is the purchasing unit?
  • What other items does that unit have?
  • What level is that unit?
  • What is the item being purchased?
If it's not what we want then we remove the item and return the cost and give the error message "no soup for you!"
This all runs instantly upon purchase event.

hope that helps.
 
Level 9
Joined
Sep 20, 2015
Messages
385
This is a good idea and looks like it will work. Might be a bit tricky to code though.

I created an item class/refund system. It will refund the gold/lumber for a purchased item instantly and remove it if a condition is not met. So for example. A unit purchases Orb. If hero level is less than level 5, refund. A game message will display saying what ever you want. Here it might say, "Only level 5 heroes can purchase this Orb." I like SAUS's idea because it shows the disabled icon and "requirements." My system will let you write those requirements in the tooltip, but they will not appear disabled. Anyway, here it is.

Item refund system.w3x

SAUS, do you have a demo of this system you are talking about or is there one in the spells section? Because it would be pretty useful.


Initialize:
There is a dummy shop and a dummy buyer.

Event:
Everytime a unit buys an item, a trigger creates a duplicate item for the shop and orders the dummy buyer to buy it.
Now we get the item cost by checking the dummy buyer's gold. His "player starts with 10,000. What is left is the subtracted.
The difference is the cost of the item.

Checking:
Now it is just a simple set of if/then conditions.

The event will be a unit sells an item (shop).
Now we check for whatever conditions we want.
Examples:
  • Who is the purchasing unit?
  • What other items does that unit have?
  • What level is that unit?
  • What is the item being purchased?
If it's not what we want then we remove the item and return the cost and give the error message "no soup for you!"
This all runs instantly upon purchase event.

hope that helps.

Thank you for the system map. The SAUS method is more complicated but it looks how i wanted, the icon for the item is unclickable, yours is more simple and need less time to be done(since u attached a map :D). I will try both and see
 
Level 12
Joined
May 22, 2015
Messages
1,051
It was just something I thought of. I don't know if such a system exists, but I have definitely not built such a system. Good luck with it! I'll be glad to help further if there are problems.
 
Status
Not open for further replies.
Top