I'm going to assume you know your way around the editor so I don't need to go into detail on how to create new buttons/units/etc. So the first part is going to very simple.
Part 1:
Duplicate, edit or use the ability Salvage Bunker.
(I personally duplicated it and renamed it to Sell Tower and said in the tooltip the tower would refund 75%)
Add the Salvage Bunker/Sell Tower button to the command card of your tower (All the towers of course).
You do not need to edit the rewards, cast or whatever of the ability as it will not have time to finish. Though if you want, edit it to your liking but make sure to add a "wait" trigger that corresponds with the cast on the ability (though 0.1 seconds earlier as we want to destroy the tower so the 100 minerals return for a normal bunker does not go into effect).
Now that we got that set up its time for the actual trigger
Part 2:
Create a new trigger anywhere you want with the following details.
Now all you have to do is go back to the data editor and edit the (None) - Repair Resource field to whatever you want the tower to sell for.
I personally made all the towers sell for about 75% as that is what my sell tooltip said.
Working on it.
Just got most bugs and kinks fixed, now I have to buckle down and create all the waves and towers and upgrades.
I have 40 waves and 12 towers with an upgrade on each planned. Just need to work out all their stats.
Thanks, this works quite well. I have a problem when trying to sell upgraded towers though :( I upgrade the tower using a morph ability, so the unit changes from Tower Level 1 to Tower Level 2. I set the repair resource to include the upgrades (set to 10 for tower level 1, 20 for tower level 2), but the function that returns the mineral cost returns 0 and no money is refunded... Do you have this problem too?
No. Perhaps you did something wrong or forgot to save. However when my map is released you can check it for reference.
Almost done now. Takes some time as I'm very busy with school atm.
Btw, If you are, like me, too lazy or to scared of inconsitencies, you can also take this one. You won't have to manually calculate the 75% but just have to put the build cost in the repair cost. btw why can't we just get the build cost directly :( that sucks.
anyways:
Modify player (Triggering player) Minerals: Add (Integer((*(Real((Minerals Cost of (Unit type of(Triggering unit))))), 0.75))))
Basically converting the cost to a real, multiplying by 0.75 and converting to an integer to add it to the minerals
Thanks, this works quite well. I have a problem when trying to sell upgraded towers though :( I upgrade the tower using a morph ability, so the unit changes from Tower Level 1 to Tower Level 2. I set the repair resource to include the upgrades (set to 10 for tower level 1, 20 for tower level 2), but the function that returns the mineral cost returns 0 and no money is refunded... Do you have this problem too?
I am having this issue only with some buildings. I have all of the resource values in place. Some morphed buildings return the correct amount, and some return 0. I can't figure out why, as there are very few differences between each of my morphs.
Modify player (Triggering player) Minerals: Add
(Integer((*(Real((Minerals Cost of (Unit type of(Triggering unit))))),
0.75))))
Okay so i have the ability/buttons for selling and the whole trigger from the 1st post on this thread set up EXCEPT in the trigger I'm confused for the Action: "Modify player 1 Minerals: Add HERE.
(Integer((*(Real((Minerals Cost of (Unit type of(Triggering unit))))), 0.75)))) - would this be a custom script or do i need to make variables or what?
(Minerals cost of (Unit type of (Triggering unit))) - is what the OP says, but i dont know how to add this either.
I am having this issue only with some buildings. I have all of the resource values in place. Some morphed buildings return the correct amount, and some return 0. I can't figure out why, as there are very few differences between each of my morphs.
From my experiences the Unit Cost function appears to be extremely buggy.
Just fyi using local varibles here would probley work a lot better. so for example a local varible called tmpTower would be = to the triggering unit. This is handy and genrealy avoids timing issues when mutliple triggers are fired, next we could also do all the math in a local varible before we acutally modfiy the players minerals.
So for example tmpRefund = (Integer((*(Real((Minerals Cost of (Unit type of(tmpTower))))), 0.75))))
Then all that needs to be modifed is all instances for Triggering unit to tmpTower and of course the minerals would look more like this:
Modify player (Owner of Unit (tmpUnit)) Minerals: Add (tmpRefund)
should work well and possibly get rid of any issues you may be having. Sorry if its not clear enough i'm tired heh so i'm running on SC2 editor fumes lol Hope it helps.
I ended up just hard coding in an array of building costs. When a player sells a building, it gets the unit type and finds the cost in the array. Works beautifully.
Nothing wrong with that, i've acutally found recently you can do something pretty much the same in the data editor with a single ability and an effect set with multiple effects for each tower type having a modify unit cost fraction refund...hard to exaplin but it works really exactly the same only diffrence is its done through the data edtior.
Modify player (Triggering player) Minerals: Add
(Integer((*(Real((Minerals Cost of (Unit type of(Triggering unit))))),
0.75))))
Okay so i have the ability/buttons for selling and the whole trigger
from the 1st post on this thread set up EXCEPT in the trigger I'm
confused for the Action: "Modify player 1 Minerals: Add HERE.
(Integer((*(Real((Minerals Cost of (Unit type of(Triggering unit))))),
0.75)))) - would this be a custom script or do i need to make variables
or what?
(Minerals cost of (Unit type of (Triggering unit))) - is what the OP
says, but i dont know how to add this either.
EDIT: nevermind, i figured out how to set up (Minerals cost of (Unit type of (Triggering unit))). However this gives back 100% and i'd only like to give back 75%. How do i do this?
I'm going to assume you know your way around the editor so I don't need to go into detail on how to create new buttons/units/etc. So the first part is going to very simple.
Part 1:
Duplicate, edit or use the ability Salvage Bunker. (I personally duplicated it and renamed it to Sell Tower and said in the tooltip the tower would refund 75%) Add the Salvage Bunker/Sell Tower button to the command card of your tower (All the towers of course). You do not need to edit the rewards, cast or whatever of the ability as it will not have time to finish. Though if you want, edit it to your liking but make sure to add a "wait" trigger that corresponds with the cast on the ability (though 0.1 seconds earlier as we want to destroy the tower so the 100 minerals return for a normal bunker does not go into effect).
Now that we got that set up its time for the actual trigger
Part 2:
Create a new trigger anywhere you want with the following details.
Part 3:
Now all you have to do is go back to the data editor and edit the (None) - Repair Resource field to whatever you want the tower to sell for. I personally made all the towers sell for about 75% as that is what my sell tooltip said.
Nice,
Could you give us a sample map using that system?
Working on it. Just got most bugs and kinks fixed, now I have to buckle down and create all the waves and towers and upgrades. I have 40 waves and 12 towers with an upgrade on each planned. Just need to work out all their stats.
Thanks, this works quite well. I have a problem when trying to sell upgraded towers though :( I upgrade the tower using a morph ability, so the unit changes from Tower Level 1 to Tower Level 2. I set the repair resource to include the upgrades (set to 10 for tower level 1, 20 for tower level 2), but the function that returns the mineral cost returns 0 and no money is refunded... Do you have this problem too?
No. Perhaps you did something wrong or forgot to save. However when my map is released you can check it for reference. Almost done now. Takes some time as I'm very busy with school atm.
@Shakeslol: Go
Btw, If you are, like me, too lazy or to scared of inconsitencies, you can also take this one. You won't have to manually calculate the 75% but just have to put the build cost in the repair cost. btw why can't we just get the build cost directly :( that sucks.
anyways:
Modify player (Triggering player) Minerals: Add (Integer((*(Real((Minerals Cost of (Unit type of(Triggering unit))))), 0.75))))
Basically converting the cost to a real, multiplying by 0.75 and converting to an integer to add it to the minerals
Thanks, that didnt occur to me. Just learning the editor and thought I would share what I found. Good work amighandhi :)
I am having this issue only with some buildings. I have all of the resource values in place. Some morphed buildings return the correct amount, and some return 0. I can't figure out why, as there are very few differences between each of my morphs.
Okay so i have the ability/buttons for selling and the whole trigger from the 1st post on this thread set up EXCEPT in the trigger I'm confused for the Action: "Modify player 1 Minerals: Add HERE.
(Integer((*(Real((Minerals Cost of (Unit type of(Triggering unit))))), 0.75)))) - would this be a custom script or do i need to make variables or what?
(Minerals cost of (Unit type of (Triggering unit))) - is what the OP says, but i dont know how to add this either.
From my experiences the Unit Cost function appears to be extremely buggy.
@RileyStarcraft: Go
Just fyi using local varibles here would probley work a lot better. so for example a local varible called tmpTower would be = to the triggering unit. This is handy and genrealy avoids timing issues when mutliple triggers are fired, next we could also do all the math in a local varible before we acutally modfiy the players minerals.
So for example tmpRefund = (Integer((*(Real((Minerals Cost of (Unit type of(tmpTower))))), 0.75))))
Then all that needs to be modifed is all instances for Triggering unit to tmpTower and of course the minerals would look more like this:
Modify player (Owner of Unit (tmpUnit)) Minerals: Add (tmpRefund)
should work well and possibly get rid of any issues you may be having. Sorry if its not clear enough i'm tired heh so i'm running on SC2 editor fumes lol Hope it helps.
@Quickshot14: Go
I ended up just hard coding in an array of building costs. When a player sells a building, it gets the unit type and finds the cost in the array. Works beautifully.
@RainGame: Go
Nothing wrong with that, i've acutally found recently you can do something pretty much the same in the data editor with a single ability and an effect set with multiple effects for each tower type having a modify unit cost fraction refund...hard to exaplin but it works really exactly the same only diffrence is its done through the data edtior.
EDIT: nevermind, i figured out how to set up (Minerals cost of (Unit type of (Triggering unit))). However this gives back 100% and i'd only like to give back 75%. How do i do this?
2nd EDIT: Nevermind, i found a work-around