• Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.

Salvage Structure ability

Status
Not open for further replies.
Level 2
Joined
Oct 29, 2011
Messages
13
Hey, all. I've got a problem that I can't seem to find the solution for. I need an ability that will destroy the structure that used the ability, and give roughly 40% of the building's total cost (in gold and lumber) to the owner of the building.

There doesn't seem to be a trigger integer that I could use with a Dummy Ability like I'd hoped something like:

Unit-Cost of Unit in [gold/lumber].

So if anyone has any ideas, let me know.
 
Level 8
Joined
Aug 23, 2007
Messages
491
Something like this should work.

  • SalvageStructure
    • Events
      • Unit - A unit Begins casting an ability
    • Conditions
      • Or - Any (Conditions) are true
        • Conditions
          • (Unit-type of (Triggering unit)) Equal to SalvageAbility(Doesn't have to have a function, just give it a name)
    • Actions
      • Unit - Kill (Triggering unit)
      • Player - Add X to Player (Color) Current gold
      • Player - Add X to Player (Color) Current lumber
Just calculate what 40% of the gold and wood cost is then put in that amount as the X value.
 
Level 8
Joined
Jan 8, 2010
Messages
493
my eyes are got crazy from looking at the Floating text line XD
but yeah, i got what you mean.

maybe you can also simplify the variables GoldRealValue and LumberRealValue to
  • For each (Integer A) from 1 to MaxBuilding, do (Actions)
    • Loop - Actions
      • Set GoldRealValue[(Integer A)] = ((Real(GoldCost[(Integer A)])) x ValueModifier)
      • Set LumberRealValue[(Integer A)] = ((Real(LumberCost[(Integer A)])) x 0.40)
      • Set FloatingText[(Integer A)] = ((|cffffcc00+|r + (|cffffcc00 + ((String((Integer(GoldRealValue[(Integer A)])))) + |r ))) + (|cff00FF00+|r + (|cff00FF00 + ((String((Integer(LumberRealValue[(Integer A)])))) + |r))))
but meeeeh. it's just the same anyway X3
 

Dr Super Good

Spell Reviewer
Level 64
Joined
Jan 18, 2005
Messages
27,255
Or you could just upgrade to SC2 where you can get the cost of buildings via triggers and there even is salvage building functionality demonstrated without script (for the bunker).

Anyway, many people in the past created systems to automatically detect the cost of certain buildings. The best systems I think use a map save time macro to read the costs from the object editor and hard code them into some JASS script system for more efficiency. If you just want 1 building to be salvagable, it is best to hard code a script just for that building than use a whole cost detecting system.
 
Level 8
Joined
Jan 8, 2010
Messages
493
ahh, so there's already a system like that? i was thinking (well before answering KnowItAllDM's question) if there's a way to actually detect the cost of a building or unit without having to set it into variables, even if using some JASS.
 
Level 2
Joined
Oct 29, 2011
Messages
13
Thanks all for your help. I've gotten it working a different way, though. I decided to allow the unit that constructed the building to utilize a modified Pillage ability that only works on player owned units, so that they can tear down the buildings. Though the Salvage system provided by defskull might come in handy later. :)
 
Status
Not open for further replies.
Top