• 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.

[Spell] Adding Gold Cost to custom Spell

Status
Not open for further replies.
Level 2
Joined
Apr 14, 2012
Messages
17
I have created a custom spell to a neutral building that gives an affect to a single unit. This works fine except now I wish to add a gold cost to the spell, such as the spell "Reveal". I would prefer if this was not trigger based, but I am ok if you suggest a trigger based solution, as long as you tell me exactly what to do as I am quite new to this.
 
Level 2
Joined
Apr 14, 2012
Messages
17
Use "Charge Gold and Lumber" as the base ability.

I have tried this, and correct it dous cost the player a certain amount of resouces. But now it wont let me select a unit with the power, or apply the buff I have set it (Unholy Frenzy). Sorry if i am being a noob but i am quite new and clueless :goblin_wtf: P.S I Want this power to be cast on a different unit not the unit that has the power.
 
Last edited:
Level 2
Joined
Apr 14, 2012
Messages
17
Well it can easily be done by doing this
Events - Unit begins casting an ability
Action -
If (owner of casting unit) current gold greater than or equal to (amount)
Then do nothing
Else Make casting unit stop

hope it helps :)
I have looked all though conditions and I cant find any Gold greater tool. If I have to right it myself somehow then that is new to me and i could use some help. Please could you perhaps tell me the steps to do this or even linking a tutorial that explains this will be greatly appreciated. P.S No rush i am currently working on mob spawning so dont need an imediate response :ogre_hurrhurr:
 
Last edited:
Level 20
Joined
Jul 14, 2011
Messages
3,213
Supply Wood and Gold are Player Integers (Integers found under Player category). So Do a simple Integer Comparison, comparing Gold with the current gold the player (owner of unit) has.
 
The native native GetUnitGoldCost takes integer unitid returns integer returns the gold cost of specific unit-type, put it above the map script...

and sample:
  • Untitled Trigger 001
    • Events
      • Time - Elapsed game time is 1.00 seconds
    • Conditions
    • Actions
      • Custom script: call BJDebugMsg(I2S(GetUnitGoldCost('hpea')))
'hpea' is the peasant raw code, see it in the object editor by hitting CTRL+D...
 
Level 4
Joined
Aug 26, 2012
Messages
123
How about this?
(Like this...
  • Untitled Trigger 001
    • Events
      • -------- Check this on "Generic unit event" --------
      • Unit - A unit Starts the effect of an ability
    • Conditions
      • -------- Check this on "Ability Comparison" --------
      • (Ability being cast) Equal to (Your Ability)
    • Actions
      • -------- Check this on "If/Then/Else Multiple functions" --------
      • If (All Conditions are True) then do (Then Actions) else do (Else Actions)
        • If - Conditions
          • -------- Check this on Integer comparison -> Player Property --------
          • ((Owner of (Triggering unit)) Current gold) Greater than or equal to (gold cost)
        • Then - Actions
          • -------- Check this on "Player - Add Property" --------
          • Player - Add (negative of gold cost) to (Owner of (Triggering unit)) Current gold
        • Else - Actions
          • -------- Check this on "Unit - Issue unit With No Target" --------
          • Unit - Order (Triggering unit) to Stop
)
 
Status
Not open for further replies.
Top