• 🏆 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!
  • 🏆 Hive's 6th HD Modeling Contest: Mechanical is now open! Design and model a mechanical creature, mechanized animal, a futuristic robotic being, or anything else your imagination can tinker with! 📅 Submissions close on June 30, 2024. Don't miss this opportunity to let your creativity shine! Enter now and show us your mechanical masterpiece! 🔗 Click here to enter!

Creating a "sell" or "remove" button

Status
Not open for further replies.
Level 3
Joined
Jun 19, 2017
Messages
19
Hi.
I'm on a tower defence map and I'd really like to add "sell", or at least "remove" buttons on my towers.

Is there an easy way to do this for a beginner like me, or does this require advanced knowlege?

I didn't find any topic or tutorial talking about this.
Thanks in advance!
 
Level 15
Joined
Mar 25, 2016
Messages
1,327
If you want to sell a unit, you need to know how much gold you gain for selling it.
You can:
store the gold value somewhere accessable for the trigger editor (hashtable, unit point value)
-> This requires a lot of configuration, but is fully customizeable. One tower can give 60% other one can give 40% for example.

use Transmute
-> requires a dummy caster, doable in GUI, no configuration needed. The sell price of a tower is a certain percentage of its full price, so always 50% for example.

use a native from the common.ai with jasshelper
-> requires JASS, very similar to transmute, but no dummy caster


The button itself can be realized with an ability (instant) or with training a unit for example. The advantage of training a unit is, that you have a progress bar and can cancel the sell process in case you accidently sold the tower.
 
Level 3
Joined
Jun 19, 2017
Messages
19
Thanks.

So maybe the only way for me (on my level) to perform this would be to use transmute and a dummy caster.

Creating the dummy seems not to be a problem: I understood what it is and even found a tutorial.
I also found the "Transmute" spell in the editor.
Using a "training unit" button is a great idea.

So do I understand right??
Example for the slow towers:
1/ I have to change an unused unit into a dummy, allocate him the "transmute" spell and call him "tower dummy" for example.
2/ In the object editor, I have to set "trained units" of the slow tower to "tower dummy".
3/ Customize the "train unit" button of the slow tower (icon + text).
4/ ??Tell the dummy to immediatly throw the "transmute" spell on the tower that created him?? But how?

This would mean that in the end there will be as many dummys on the map than towers that have been sold...
 
Last edited:
Level 3
Joined
Jun 19, 2017
Messages
19
It is well explained there. Great!
Will try it tomorrow evening... Time to go to bed :)

I did nod really understood the "rally point" problem that DaneTheBeast mentioned, but I will face it once it'll be here.

Cheers.
 
Last edited:
Level 8
Joined
Jan 28, 2016
Messages
486
This would mean that in the end there will be as many dummys on the map than towers that have been sold...

You could have the one dummy per player and order it to cast the Transmute ability whenever a tower is sold (that is, after the training is complete). You would still have all those trained dummy units to deal with. I'd personally move them into a corner of the map once they are trained and add an expiration timer to them to get rid of them.
 
Level 3
Joined
Jun 19, 2017
Messages
19
Had time to try out this morning.
I did it like explained in the link that UreDe4D gave me and it works perfectly.

In this trick, the dummy is removed at the same time than the tower.

Now I understand what DaneTheBeast meant:
Every tower has now a "rally flag" since they can "train units".
 
Level 3
Joined
Jun 19, 2017
Messages
19
To remove the "rally point" of the constructed towers with triggers, I did like this:
(some words are translated from french)

EVENT: (Unit - Generic unit event)
Unit - A unit finishes construction

CONDITION: (Unit - Type Comparison)
(Unit - type of (Triggering unit)) Equal to Slow tower

ACTION: (Unit - Remove Ability)
Unit - Remove Rally from (Triggering unit)

Thank you all for your help.
 
Status
Not open for further replies.
Top