Salvage Skill help

makakai

New Member
Reaction score
1
How would I go about making a salvage skill to give you back half the resources of the build cost by using a skill on it? (targeting it)

ie Guard tower costs 20 lumber so when you use salvage on it it gives you 10 lumber back and destroys the tower

Any help is much appreciated :)
 

sentrywiz

New Member
Reaction score
25
Here is how I made it. You obviously need a spell that requires no target, means you can cast it when you click the button and to know how much lumber you want each tower to give.

Here is how I made it:

I made my spell off warstomp, but you might wanna choose other because of the terrain deformation warstomp does. I just chose it to make this trigger.

Trigger:
  • Tower Selling
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sell Tower
      • (Unit-type of (Casting unit)) Equal to Some Tower
    • Actions
      • Unit Group - Pick every unit in (Units of type Some Tower) and do (Actions)
        • Loop - Actions
          • Unit - Set the custom value of (Picked unit) to 20
          • Player - Add ((Custom value of (Picked unit)) / 2) to Player 2 (Blue) Current lumber
          • Game - Display to (All players) for 5.00 seconds the text: (String((Player 2 (Blue) Current lumber)))
          • Special Effect - Create a special effect attached to the origin of (Triggering unit) using Abilities\Spells\Human\Thunderclap\ThunderClapCaster.mdl
          • Special Effect - Destroy (Last created special effect)
          • Unit - Kill (Picked unit)



I used custom value. I just put the full amount of lumber I would pay for a tower of that sort and then used custom value I paid divided by two and it gives me half that amount when I sell the tower.


Also you will want one spell for every tower you make. When you want to use the spell for different towers, just put other tower in:

Trigger:
  • (Unit-type of (Casting unit)) Equal to Some Tower
 

makakai

New Member
Reaction score
1
Works well but was hoping that i could use it on other buildings and get half that amount rather than always 10 (half 20)
I suppose i could make multiple of this trigger and just manually set the amount for each building but it is kinda annoying :p
 

Accname

2D-Graphics enthusiast
Reaction score
1,462
i would say you should set the amount of lumber you want to get back when selling a structure as its point value in the editor. (there is a field called point value, the standard is 100 for every unit)
and create a simple trigger like this:
Trigger:
  • Sell
    • Events
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • (Ability being cast) Equal to Sell
    • Actions
      • Player - Add (Point value of (Target unit of ability being cast)) to (Owner of (Triggering Unit)) Current lumber
      • Unit - Kill (Target unit of ability being cast)
 

makakai

New Member
Reaction score
1
Thanks heaps :) quick reply too XD

Very simple solution Thanks :) one thing i had to add was
Trigger:
  • (Owner of (Triggering unit)) Equal to (Owner of (Target unit of ability being cast))


But you didn't know i wanted that so thanks :D
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top