How do I sell upgraded towers?

Posts: 84
Hi all!
My problem would be is how do i sell a tower thats been upgraded from another tower (tower 1 morphed to tower 2) for the 20% of the cost of both towers: Tower 1 = 100 minerals, upgrade to Tower 2 = 100 minerals sell tower 1= 20 minerals refund (20 % of 100), sell Tower 2 = 40 minerals refund (20% of 200).
I have the "Sell Tower" button and the trigger :

Sell Tower


Events

Unit - Any Unit uses Sell Tower at Effect4 - Channel stage (Ignore shared abilities)

Local Variables

Conditions

(Triggering ability stage) != Generic4 - Cancel

Actions

Player - Modify player (Owner of (Triggering unit)) Minerals: Add ((Minerals cost of (Unit type of (Triggering unit))) / 5)

So when i sell tower 1 its working but when i upgrade it and sell it still gives only 20 minerals back.
I saw "Onetwo" 's tutorial and he is talkin about "(none) - Repair Resource" field that for the love of my life i can't find ( yes i have all the boxes checked like Show advanced fields and stuff)

Can someone tell me how to find that or what other options i have?

Thx!
Reply Quote
Posts: 26
use the data editor i can't remember exactly where to look but i know there is a refund value in there for each unit (at least for the ability invovled in making them). also you can try looking at the bunker salvage ability as a starting point.
Reply Quote
Posts: 535
Are you sure said tower 2 has a 200 minerals cost and not 100 in the data editor?
Reply Quote
Posts: 84
It has 100. if i put 200 it would cost 300 (with the purchase o0f tower 1) then sell refound should be 60 mins.
I need the selling to acount for the total minerls needed to get tower 2 (refound should be: tower 1 cost + tower 2 cost /5 (or x 0.20 doesnt matter its the same outcome))
Edited by Bushido on 12/8/2012 11:07 AM PST
Reply Quote
Posts: 535
Doesn't some forms of morph already factor the cost difference between two units?

In other words if you put 100 min for Tower 1 then 200 min for Tower 2 then the morph make it only cost 100 min?

To give a concrete example, in the data, the command center costs 400 min, the orbital command costs 550 min yet (yes, 550) but when you morph from CC to OC, it only costs 150.

EDIT : By cost, I imply the direct cost ON the unit itself and not on the morph ability (which should be 0 cost on the morph).
Edited by Honejasi on 12/8/2012 1:51 PM PST
Reply Quote
Posts: 84
<<reply 1115220>>

I figured it out (with triggers, others told me to try with salvage but thats a lot of time to make for each unit..)

Sell Tower

Events

Unit - Any Unit uses Sell Tower at Effect4 - Channel stage (Ignore shared abilities)

Local Variables

Conditions

(Triggering ability stage) != Generic4 - Cancel

Actions

General - If (Conditions) then do (Actions) else do (Actions)

If

(Unit type of (Triggering unit)) == Tal'darim - Plasma Tower

Then

Player - Modify player (Owner of (Triggering unit)) Minerals: Add (((Minerals cost of (Unit type of (Triggering unit))) / 5) + ((Minerals cost of Tal'darim - Photon Cannon) / 5))

Else

This will take some time too, but a lot less than data.
Now I have a minor problem with the upgrade button...

This is what i did:

Duplicated Obelisk (this is the plasma tower shown in the trigger) and changed the cost to 100. This 1 will upgrade from photon cannon. The problem is that the button showes that it costs -50 minerals(i tested by setting the units cost to 0 then the button showes -150). It seems that the cost is at -150 by default for some reason. Any idea why this hapening?

Interestinly tho I use the same morph ability (I actually duplicated this for the Plasma Tower and changed the button name and such) for a pylon that upgrades from a (weaker) pylon and i have no such button problem with it...Thought this might help a bit to narrow the problem source..

have some pix at: http://www.sc2mapster.com/forums/development/data/46200-upgrade-button-problem/
Edited by Bushido on 12/10/2012 6:18 PM PST
Reply Quote
Posts: 84
UPDATE ON THE ISSUE :

Forget about my last reply. Screach that out.

So it seems my 1st trigger was right, it had no flaw in it.
It is actually the cost of Tower 2. Its needed to know how the morp ability counts:

cost of tower 2 - (minus) cost of tower 1 = (equals) cost of morph (upgrade)

In other word: if tower 1 costs 100 and want the upgrade (morph) to cost 100 than tower 2's cost has to be 200 so the equasion of morph is: 200 (tower 2) - 100 (tower 1) = 100 (cost of upgrade) this can be followed if we check out command center morph to orbital/planetary fortress, we can see that the orbital costs 550 so: 550 - 400 (CC) = 150 so the upgrade for orbital is 150.

Honejasi pointed this out earlier i just didnt understud it.

Thought I'll update this info for others that run into this problem.
Edited by Bushido on 12/10/2012 10:02 PM PST
Reply Quote

Please report any Code of Conduct violations, including:

Threats of violence. We take these seriously and will alert the proper authorities.

Posts containing personal information about other players. This includes physical addresses, e-mail addresses, phone numbers, and inappropriate photos and/or videos.

Harassing or discriminatory language. This will not be tolerated.

Forums Code of Conduct

Report Post # written by

Reason
Explain (256 characters max)

Reported!

[Close]