[Spell] Acolyte Sacrifice that costs gold

Level 11
Joined
Nov 23, 2013
Messages
663
Hello there,

I am trying to create a system using the Acolyte Sacrifice in the Sacrificial Pit. The idea is that an existing unit goes to the building and gets transformed into another unit after a short time, just like the Acolyte.
However, I would like this transformation to cost gold, with a tooltip saying how much gold it will cost.

Problem is, Sacrifice is an ability which doesn't cost gold, and there is no gold field in the Object Editor for this ability. I tried using the Reveal ability, which is the only ability requiring gold that I could think of, but so far I have been unsuccessful.

Any idea would be greatly appreciated!
 
Level 10
Joined
Aug 29, 2012
Messages
439
Here's one way to do it:

  • Sacrifice
    • Evénements
      • Unité - A unit Initie l'effet d'une compétence
    • Conditions
      • (Ability being cast) Egal à Sacrifice (Acolyte)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • ((Owner of (Triggering unit)) Or actuel) Inférieur à 100
        • Alors - Actions
          • Unité - Order (Triggering unit) to Arrêter
        • Sinon - Actions
          • Joueur - Add -100 to (Owner of (Triggering unit)) Or actuel
Sorry, my editor is in French but you might get the idea anyway. Basically, you check how much gold the player using the ability has, and if it's under the number you want (100 in my example), the unit is forced to stop and the ability won't launch, else the player "pays" some gold and the ability fires normally.

I attached a test map if you want to copy the trigger.
 

Attachments

  • Test.w3x
    17.2 KB · Views: 26
Level 21
Joined
Nov 18, 2012
Messages
1,657
Here's one way to do it:

  • Sacrifice
    • Evénements
      • Unité - A unit Initie l'effet d'une compétence
    • Conditions
      • (Ability being cast) Egal à Sacrifice (Acolyte)
    • Actions
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • Si - Conditions
          • ((Owner of (Triggering unit)) Or actuel) Inférieur à 100
        • Alors - Actions
          • Unité - Order (Triggering unit) to Arrêter
        • Sinon - Actions
          • Joueur - Add -100 to (Owner of (Triggering unit)) Or actuel
Sorry, my editor is in French but you might get the idea anyway. Basically, you check how much gold the player using the ability has, and if it's under the number you want (100 in my example), the unit is forced to stop and the ability won't launch, else the player "pays" some gold and the ability fires normally.

I attached a test map if you want to copy the trigger.
He wants players to be able to see how much gold (or/and lumber, food) it is required in the tooltip, not by triggers.
Another ability that uses resources to cast is Destroyer Form (note that in the ability there isn't any gold costs, but if you check the standard units, from Obsidian Statue to Destroyer, Destroyer is the unit that has the resource costs required to transform.
Charge Gold and Lumber is another one.
 
Level 11
Joined
Nov 23, 2013
Messages
663
Thanks guys!

Indeed, I also needed the tooltip to say how much resources the training of the new unit would cost, therefore I needed an ability with gold cost.

Wrda, your suggestion gave me an idea, and now it's working just fine. All I had to do was to change the gold cost of Shades. If someone needs a system like mine, it's very simple, here's how to do it:
  • Give the "Sacrifice (Acolyte)" ability to the unit that needs to be transformed and the "Sacrifice (Sacrificial Pit)" to the building that trains the new unit from the old one. Change tooltips of those abilities if needed
  • Change the gold / lumber / food cost of Shades. It will change the cost of Sacrifice.
  • Then, two choices:
    • In Object Editor, change Shades' data with the data of the new unit.
    • Or use a trigger to replace the Shade with the new unit whenever a Shade is trained. If you do so, replace everything that relates to Shades, and replace them with the features of the new unit: icon, soundset, tooltip.
  • In Advanced -> Game Interface window, change "Must target a Sacrificial Pit." and "Must target an Acolyte." and "Sacrificial Pit is already sacrificing an Acolyte" with the name of the building and the new unit.
It was way easier than I thought. Thanks again :)
 
Last edited:
Top