- Joined
- Sep 20, 2015
- Messages
- 385
hello. How can i make an item have requisite to be purchased? I want to create a group of item that can't be purchased unless the hero has a X level and some specific ability.
thank you
thank you
Hey hey
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 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:
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!"
- Who is the purchasing unit?
- What other items does that unit have?
- What level is that unit?
- What is the item being purchased?
This all runs instantly upon purchase event.
hope that helps.