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

Making a Reward Chest

Status
Not open for further replies.
Level 23
Joined
Oct 12, 2008
Messages
1,783
Im trying to make a 'Treasure Chest'
  • It is given to a specific player (only they can loot it)
  • It contains random items

This can be done very easily via. 'Marketplace' mechanics, however the problem is how make it usable ONLY by the player who owns it (ie. not Neutral).
  • Changing the target of Shop abilities does not seem to help
  • Using the 'Items Created' field of racial shops does not allow random items to be added

Alternatively, if there is a better way to create this Treasure Chest effect, Id love to know as well.
 
Level 21
Joined
Dec 4, 2007
Messages
1,480
What if you just remove and reset the items when non-owners interact?
Also de-select the shop and display a msg like "this is not your treasure chest".
Hm it's quite a wonky solution.

More time intensive would be to have a unit with abilities which are synced to the according items.
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
I'm not sure if this is exactly what you want -

create a stationary unit with an inventory (you can copy from the things rexxar can store items in in the campaign), and just use triggers to randomly generate items in them every so often.
 

Chaosy

Tutorial Reviewer
Level 40
Joined
Jun 9, 2011
Messages
13,183
My first thought/idea:

1. create a unit
2. set unit model to a chest model
3. add locust to the unit
4. Use triggers to check for chest units under current mouse location and spawn items if they exist for the triggering player

I am rusty so my memory of what you could do with the mouse natives might be incorrect.
edit: on second thought, mouse natives probably gets you screen coords not ingame coords.
 
Level 21
Joined
Mar 29, 2020
Messages
1,237
My first thought/idea:

1. create a unit
2. set unit model to a chest model
3. add locust to the unit
4. Use triggers to check for chest units under current mouse location and spawn items if they exist for the triggering player

I am rusty so my memory of what you could do with the mouse natives might be incorrect.
edit: on second thought, mouse natives probably gets you screen coords not ingame coords.
having this trigger by hovering the mouse over the chest would give the player items even if his hero is all the way across the map. and that sounds highly abuseable. no?
 
Level 23
Joined
Oct 12, 2008
Messages
1,783
Firstly, thank you everyone for the answers.

I forgot to mention how the chest is intented to work exactly.
- It doesnt just open and spit out a random item, instead you are given a selection of a few items and are allowed to pick one.
Hence the reason I wanted to use the 'default' shop interface, also makes it easy to despawn the shop (ie.the chest) when an item is picked.
- Ideally, Id like a solution that works in old wc3 versions as well, hence nothing that is based on custom UI elements.
create a stationary unit with an inventory (you can copy from the things rexxar can store items in in the campaign), and just use triggers to randomly generate items in them every so often.
Intresting solution, though I need it to be able to handle powerups as well.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,569
Firstly, thank you everyone for the answers.

I forgot to mention how the chest is intented to work exactly.
- It doesnt just open and spit out a random item, instead you are given a selection of a few items and are allowed to pick one.
Hence the reason I wanted to use the 'default' shop interface, also makes it easy to despawn the shop (ie.the chest) when an item is picked.
- Ideally, Id like a solution that works in old wc3 versions as well, hence nothing that is based on custom UI elements.

Intresting solution, though I need it to be able to handle powerups as well.
You can use Abilities to mimic Items. If the Chest casts one of said abilities you can create the associated item and give it to the player's hero. Then remove the chest. This would allow you to use all 12 button slots instead of 6 inventory slots.
 
Level 23
Joined
Oct 12, 2008
Messages
1,783
You can use Abilities to mimic Items. If the Chest casts one of said abilities you can create the associated item and give it to the player's hero. Then remove the chest. This would allow you to use all 12 button slots instead of 6 inventory slots.
Ive considered this, though it is object editor intensive.
Will definitely use it as a backup solution if I cant find a more straightforward one.
 

Uncle

Warcraft Moderator
Level 64
Joined
Aug 10, 2018
Messages
6,569
Ive considered this, though it is object editor intensive.
Will definitely use it as a backup solution if I cant find a more straightforward one.
I don't think you can avoid the Object Editor with these older systems.

That being said, if you want less intensive you can use the Item method that was suggested and make your Powerups have an alternate version that can be drag and dropped into the player's inventory. Once acquired, the Item is removed and the associated Powerup is given to the hero. This way you'll only need to create a new Item for each powerup. Keep in mind that you'll probably have to catch when the Item is dropped on the ground instead of given to the hero. But the solution to that should be fairly easy if each player controls a single Hero that is tracked with a Unit variable.

A unit loses an item -> Unit == Chest -> If Item-type == Powerup then Remove item being manipulated and Create powerup for Hero[Player number]
 
Last edited:
Level 23
Joined
Oct 12, 2008
Messages
1,783
That being said, if you want less intensive you can use the Item method that was suggested and make your Power-Ups have an alternate version that can be drag and dropped into the player's inventory.
This hybrid system is probably the best. Realistically I only have 3-4 powerups, so it shouldnt to be too bad.
Thanks, and cheers everyone!
 
Status
Not open for further replies.
Top