HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

75% Gold from unit

05-22-2004, 02:55 PM#1
Nash
im making td and i need sell abillity (i made sell on unit) and i stucked because i dont know how to get 75% gold from unit 100% cost, can someone tell me what function i have to use?

i have something like this
05-22-2004, 03:08 PM#2
PatruX
Well, First set the Point value to 75% of the unit's original value in the unit editor.
The give point value to the player that is being sold.

- Sorry but I can't explain more than so right now. -
05-22-2004, 03:15 PM#3
Vexorian
Go to wc3sear.ch and search for a spell called Sell Tower made by Darky
05-22-2004, 03:19 PM#4
Nash
thx Lord Vexorian! :D
05-22-2004, 07:55 PM#5
Nash
wtf? not working! i CnPed all and set 50% to 75% :/ but when im clicking on Sell icon - tower is not selling
05-22-2004, 10:17 PM#6
Milkman
OR, set the point value to usual value and then return 75% of it, so then wc3 can do the math for you ^^.

Have a look at this piece of code, it's how i solved it one of my maps:

Code:
Events:
Unit - A unit Finishes training a unit

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

Actions:
Player - Add (((Point-value of (Triggering unit)) / 10) x 7) to (Owner of (Triggering unit)) Current gold
Game - Display to (Triggering player), at offset (0.00, 0.00) for 30.00 seconds the text: ((You have sold your tower for:  + (String((((Point-value of (Triggering unit)) / 10) x 7)))) +  gold)
Unit - Remove (Trained unit) from the game
Unit - Explode (Triggering unit)


Then you just add some flashy special effect. Also, you must create a unit and name it i.e. Sell and make it cost nothing and so on.

- MilkmaN

EDIT: I forgot to explain, first you divide the value by 10 and then multiply it with 7 so that u get 70% back. Works fine for me ^^
05-22-2004, 10:40 PM#7
Nash
thanks man!! :D
edit: i have prob with that:
Code:
Game - Display to (Triggering player), at offset (0.00, 0.00) for 30.00 seconds the text: ((You have sold your tower for:  + (String((((Point-value of (Triggering unit)) / 10) x 7)))) +  gold) 

i cant do: Game - Display to (Triggering player), at offset (0.00, 0.00), where is that function?
05-22-2004, 10:55 PM#8
Vexorian
That's actually a bad solution, and you can't expect it to magically work, you have to change the rawcode in the trigger to match the one in yours
05-22-2004, 11:24 PM#9
Nash
i have better way to get 50% from unit 100% cost:
Code:
-Events
Unit - a unit begins casting an ability
-Conditoions
(ability being cast) equal to Sell Tower
-Actions
Unit - set the custom value of (castiong unit) to ((integer((max life of (casting unit)))) / 2)
Player - add (custom value of (casting unit)) to (owner of (casting unit)) current Gold
Unit - remove (casting unit) from the game


but.... 100% = max unit hp
for example: tower cost - 40 gold, tower must have 40 hp
05-22-2004, 11:46 PM#10
imgonnabackstab
Quote:
Originally Posted by Nash
im making td and i need sell abillity (i made sell on unit) and i stucked because i dont know how to get 75% gold from unit 100% cost, can someone tell me what function i have to use?

i have something like this

Yea that guy is right...tahts what i do
05-23-2004, 11:18 AM#11
Milkman
Lord Vexorian, you cant say it's stupid. There's nothing advanced in it and to modify it to match you map should take a maximum of 30 seconds. I admit that the /10 x 7 solution isn't very refined but it works. Just one Trigger, short. I really don't see your point.
05-23-2004, 09:27 PM#12
Vexorian
It is not just one trigger it is a point value modiffication for each unit type, which will take extra space, and time use, it is even going to rectrict you from using point values in other stuff, and why the hell to do that if there is already a direct way to get the gold of a unit?
05-23-2004, 10:53 PM#13
Silversuns
I don't know if its a good idea, but you can try it with variable if you don't like other way to sell. You set all tower with a variable and other variable to set the gold it will give back.

Variables :
Tower(Array), Units Type
TowerValue(Array), Integer
TempTower, Units

you will need a loop, and it will look like this.

-Events
Unit - a unit begins casting an ability
-Conditoions
(ability being cast) equal to Sell Tower
-Actions
Set TempTower = units being cast ability (or something like this)
For Loop Integer 1 to x (number total of all your setted tower)
-If
Tower(Array) equal TempTower(Array)
-Then
-(player) Add property TowerValue(Array) to triggered player.
-destroy casting tower.
-Else (Nothing)

It's something like this, I didnt said the exacte word I just say what i remember. Tell me if you think its a good issue or idea?
05-24-2004, 07:23 PM#14
Milkman
Vex, i stand corrected. Still, how do you get the amount of gold that a unit COSTS to build, tell me. And the Point Value modification is in the Unit Editor.