• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

[Solved] Question regarding using a button to spawn units

Status
Not open for further replies.
Level 1
Joined
Oct 26, 2023
Messages
3
Hello guys, I have a question regarding a small map I’m making and I was hoping someone with more experience could point me I the right way.

So, my objective is to have a building that when owned by the player would allow him to spawn a wave of ai controlled troops by pressing a button in the UI from anywhere in the map as long has the building is alive and owned by the player. I guess this is similar to the “call to arms” ability only that instead of calling nearby peasants, it would spawn ai controlled units and make them attack a point.

I think I have the spawning/attacking units part nailed down, the part which I’m not so sure is how to make a button for the player to press. Right now, I’m using the building like a shop which sells a dummy item that’s immediately used after being bought. This comes with some draw backs like being able to see the treasure 3d model for a split second under the unit that bought the item or needing to have a unit close to building to actually buy the item. Has anyone done something similar before? Should I use an ability instead of an item?
 
Level 30
Joined
Aug 29, 2012
Messages
1,383
Unless you want to use charges, it would be just easier to use a dummy ability instead

Alternatively, change the item's model to ".mdl" or just about any made up name the game won't recognize and it will be completely invisible ingame. You can also put an invisible dummy unit with an inventory next to the shop so that there's always a client nearby
 

Uncle

Warcraft Moderator
Level 73
Joined
Aug 10, 2018
Messages
7,869
There's an ability called Charge Gold and Lumber that allows you to put a Gold/Lumber cost on the ability if that interests you.

But you should rarely need to rely on Units/Items to do something that they're not designed to do.
 
Level 1
Joined
Oct 26, 2023
Messages
3
There's an ability called Charge Gold and Lumber that allows you to put a Gold/Lumber cost on the ability if that interests you.

But you should rarely need to rely on Units/Items to do something that they're not designed to do.
Thank you for your answer, this might also be useful.
 
Status
Not open for further replies.
Top