HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Tower defense ability: Sell Tower

01-19-2004, 02:58 PM#1
Darky28
Hi
Lots of people use different ways on how to refund the cost of sold towers.
I did a pretty neat version which can actually get the gold and lumber cost value of any building:
(works for multiplayer)
http://www.wc3sear.ch/?p=Spells&ID=34

For those who are interrested, heres a quick explanation how it works.
As soon as a building hits the "sell tower" button a trigger starts which creates a human farm. The human farm gets the ability "sell units" and then i add the unittype of the tower (casting unit) to the farm. The farm can now sell the tower. Now you give 50000 gold and lumber to the player who belongs the tower and it gives the farm the command to sell a tower to the player. You store the number of gold of the player into the flying height of the farm and the lumber of the player in the custom value flag.
A second trigger now looks if a unit of type "farm" solds a unit. As soon as a unit is sold you can now check the old gold and lumber value versus the new ones and know exactly how much gold the building had cost.
All you need to do is restore the previous gold and lumber state from the player and refund a percentage of the gold/lumber. Finally remove the sold and selling unit from game.

Have fun Darky27
01-19-2004, 10:23 PM#2
Grater
Hmmm the problem with this method is it doesn't account for upgrade cost. Another method which also doesn't account for upgrades is 100% Pillage on a builder that can only target friendly buildings.
01-19-2004, 11:22 PM#3
TitanRevamped
u dont need upgradable towers in td....... do like wintermaul. single towers, no upgrades
01-19-2004, 11:53 PM#4
Lil Blue Smurf
What do you mean you don't need upgradable towers? There are TD's based on upgrading towers, like tech td. Anyways, this can still work if you upgrade to a fake unit and replace the fake with one with appropriate stats, which can be a pain too for lots of towers. Really this is only good if you do towers that cost lumber and aren't upgradable, which most td's don't do. If it is just gold, just give the unit the same point value as gold cost, then give number of points (or %) to a player gold when it is sold, much easier, and less trigger work.
02-07-2004, 07:42 AM#5
GaDDeN
I use a changed unsummon building ability... works fine (which takes away 99999 hp/sec instead of 50, so you cant notice its unsummon)
02-15-2004, 08:27 PM#6
Lost_ally
Forgive me if Im being noobish, but I think its actually pretty easy to do.

Make sure all your towers have a point value. I made my sell give back 70% of orginal cost, so what you do for that is tkae the original gold cost, multiply it by .7 (If I remember it correctly), and input the new point value. Now, take an ability that creates a unit, remove all costs and give it a training time of how long you want it to take to sell the tower.

Let towers train the Sell 'unit', and then there is a very simple trigger to do.

Unit - A unit Finishes training a unit

(Unit-type of (Trained unit)) Equal to Sell

Unit - Remove (Trained unit) from the game
Player - Add (Point-value of (Triggering unit)) to (Triggering player) Current gold
Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\Other\Awaken\Awaken.mdl
Unit - Kill (Triggering unit)
Special Effect - Create a special effect attached to the overhead of (Triggering unit) using Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl

If the tower costs lumber (which there are usually only 1 or two of in a TD), do something like add an else clause that checks for unit type, then adds 1 lumber if it matches.

EDIT: This is not Lost_Ally, this is LordRayne, his triggerer.
02-15-2004, 09:01 PM#7
Darky28
@Lost_ally

Actually it is nuubish yes ;-)
Thats what all do right now... using point value and training a unit.

Thats why all Tower defense Towers have that Gay Rally Point Flag and double the work to set the cost for the tower into the gold field AND point value.

Isnt it much more elegant if you really know the goldprice of a unit without having to worry about point values? ^^
02-16-2004, 02:41 AM#8
Lost_ally
*laughs his butt off*

Figures. Man, am I silly. XD

Though...I mean...is it really all that bad to set the point values?

Okay. I mean, if you have an existing TD, and you ADD sell, its a pain in the ass. (I know this.) But while you're creating the towers, setting a point value is a minor detail.

...Must we invent a complicated system? I mean quite honestly if you think about it, you guys are working hard to find a way that...really, as far as I can TELL...isn't worth the effort, in the long run.

Occam's Razor sort of thing.

You're making uncomplication complicated.
02-16-2004, 05:41 AM#9
Darky28
@Lost_ally

Why complicated?
I did the trigger in 10 minutes and it saved me hours of point value settings.
Beside the trigger just needs to be "Copy & Pasted" into your map and works perfectly.

So what is so comcplicated?