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?
Why not just give each unit the salvage ability. Just scale it for each one
ex:
salvage for tower 1
cost - .2 min
salvage for tower 2
cost -.4 min
Yes it takes longer but data doesn't have a limit while triggers do (256 or something like that)
but if you still want to do it with triggers
create a switch with a different return for each tower
Ex
switch
if tower 1
Player - Modify player (Owner of (Triggering unit)) Minerals: Add ((Minerals cost of (Unit type of (Triggering unit))) / 5)
if tower 2
Player - Modify player (Owner of (Triggering unit)) Minerals: Add ((Minerals cost of (Unit type of (Triggering unit))) / 5)
Player - Modify player (Owner of (Triggering unit)) Minerals: Add ((Minerals cost of tower 1)) / 5)
So I followed Willuwontu's advice (trigger part is eazier imo):
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 works as it should. 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 -50 as seen in the pic below) I changed the morph ability's thec cost to 100 otheerwise it wont even show the cost on the button. Any idea why this hapening?
Check the cost of the new unit. Also check the cost of the ability to use you probably have one of them set to -150
Btw switch is easier to work with
General - switch (actions) depending on ((Unit Type of (triggering unit))
-cases
--if 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))
Also just for you to note in the future of you tower upgrades there is a limit to how many abilities they can have linked to them (if they morph they get the abilities of the unit they morph into linked to them all the way down the morph line).
The best way to get around that is to create a dummy morph ability and have a trigger replace the unit when it happens
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!
Why not just give each unit the salvage ability. Just scale it for each one
ex:
salvage for tower 1
cost - .2 min
salvage for tower 2
cost -.4 min
Yes it takes longer but data doesn't have a limit while triggers do (256 or something like that)
but if you still want to do it with triggers
create a switch with a different return for each tower
Ex
switch
if tower 1
Player - Modify player (Owner of (Triggering unit)) Minerals: Add ((Minerals cost of (Unit type of (Triggering unit))) / 5)
if tower 2
Player - Modify player (Owner of (Triggering unit)) Minerals: Add ((Minerals cost of (Unit type of (Triggering unit))) / 5)
Player - Modify player (Owner of (Triggering unit)) Minerals: Add ((Minerals cost of tower 1)) / 5)
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)
@ElBushido: Go
the easiest way is fix the cost of the towers accordingly and give them salvage.
@zakariahliklikleh: Go
So I followed Willuwontu's advice (trigger part is eazier imo):
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 works as it should. 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 -50 as seen in the pic below) I changed the morph ability's thec cost to 100 otheerwise it wont even show the cost on the button. Any idea why this hapening?
Check the cost of the new unit. Also check the cost of the ability to use you probably have one of them set to -150
Btw switch is easier to work with
General - switch (actions) depending on ((Unit Type of (triggering unit))
-cases
--if 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))
Also just for you to note in the future of you tower upgrades there is a limit to how many abilities they can have linked to them (if they morph they get the abilities of the unit they morph into linked to them all the way down the morph line).
The best way to get around that is to create a dummy morph ability and have a trigger replace the unit when it happens
Still alive and kicking, just busy.
My guide to the trigger editor (still a work in progress)